Skip to content

Sync: BioPortal v6.8.0 release #18

Draft
alexskr wants to merge 240 commits into
ontoportal:masterfrom
ncbo:master
Draft

Sync: BioPortal v6.8.0 release #18
alexskr wants to merge 240 commits into
ontoportal:masterfrom
ncbo:master

Conversation

@alexskr

@alexskr alexskr commented Nov 21, 2025

Copy link
Copy Markdown
Contributor

alexskr and others added 30 commits August 19, 2025 13:45
Feature: Ontology Admin Endpoints for Logs and Submission Management
…ests

Replace non-idiomatic assertions with Minitest equivalents:
- assert(x == y) -> assert_equal
- .eql?() -> assert_equal
- assert !x.empty? -> assert_operator x.length, :>, 0
- submissions.all? -> submissions.each for better error messages

Extract repeated contact validation into helper method to reduce duplication.

Fix intermittent test failures by sorting array keys before comparison to handle non-deterministic ordering.
refs #197
- Replace class variables (@@) with class instance variables using accessors
- Add attr_accessor definitions for shared test state
- Modernize assertions to Minitest style (assert_equal, assert_includes, assert_nil)
- Improve code formatting and readability
…dition

- Replace random .sample(3) with deterministic .first(3)
- Use dynamic assertion for keep_ids count instead of hardcoded value
- Capture process_id before use for clarity
- Simplify polling loop condition to check only for 'done' or 'errors'
- Clean up assertion message formatting for consistency
…n/deletion

- Replace `assert 201, ...` with `assert_equal 201, ...` to properly compare response status.
- Add GET checks after slice creation to confirm the new slice exists.
- Remove redundant manual reset of LinkedData.settings.enable_security.
- Update DELETE test to expect 204 (No Content) instead of 201.
- Add GET checks after deletion to verify the slice was actually removed.
- Add explicit flunk when status_payload contains 'errors'
  to prevent false positives from incomplete or invalid responses
- Ensure test fails immediately on backend error instead of silently skipping assertions
Restore LinkedData.settings.enable_slices to its original value after tests.
…com:ncbo/ontologies_api into refactor/tests-stability-and-minitest-style
… user helpers

This change refactors `TestOntologySubmissionsController` to eliminate
suite-level globals and class-variable state in favor of per-test setup
and shared helpers:

- Replace `before_suite` + `@@acronym`/`@@name`/`@@file_params` with
  per-test `setup` that generates a unique ontology acronym and creates
  an ontology administered by a shared test user.
- Introduce a suite-local `USERNAME = "test_user"` and use
  `ensure_user(USERNAME)` to guarantee the user exists without races.
- Normalize assertion style:
  - Use `assert_equal(expected, actual, message)` with parentheses
  - Remove `msg=` pseudo-named args
  - Add `.sort` where appropriate when comparing unordered keys
- Replace direct references to `@@acronym`/`@@name` with instance vars
  (`@acronym`, `@name`).

New helper methods (in the base test class) used by this suite:
- `create_user(username, email:, password:)` — always creates a user
- `ensure_user(username, email:, password:)` — idempotently finds or creates
- `delete_user(username)` — removes a user if present

Notes:
- `delete_ontologies_and_submissions` now runs in `setup` to guarantee
  a clean slate per test. `after_all` also cleans up the shared user via
  `delete_user(USERNAME)`. If the extra cleanup proves redundant, we can
  drop `before_all`/`after_all` and keep only the per-test cleanup.
…st-style

Refactor/tests stability and minitest style
mdorf and others added 27 commits May 26, 2026 18:03
Develop -> Master merge, release v7.3.1
Apply boost=sum(ontologyRank,1) on all three edismax paths via the
common parameter section. Multiplier is (1 + rank), bounded in [1, 2];
unranked ontologies are unaffected. Rank now participates in Solr
scoring before pagination, addressing #230.

Bump goo, ncbo_cron, and ontologies_linked_data gem pins to the
matching fix/incorrect-search-result-ranking branches. The new boost
references the ontologyRank Solr field which is only declared in the
ontologies_linked_data branch's schema.

The post-hoc Ruby tiebreaker remains in place for this commit and
will be removed in the next.
Solr is now the single source of result ordering via the boost added
in the previous commit. The in-page Ruby tiebreaker is redundant and
would mask any Solr-side scoring regression.

The doc[:ontology_rank] attachment and Ontology.rank fetch upstream
become unused; cleaned up in the next commit.
The post-hoc Ruby sort was the sole consumer of these. The line-293
skip-list entry (filter_attrs_by_language) was a defensive exclusion
to prevent ontology_rank from being treated as a language-suffixed
attribute during response serialization, also dead now.
Seeds four ontologies with synthetic BioPortal ranks (1.0, 0.7, 0.4,
0.1) into a clean Solr index, queries /search?q=melanoma, and
asserts the returned acronyms come back in descending rank order.
With Solr's boost=sum(ontologyRank,1) participating before
pagination, the ordering reflects ontology rank from the very first
page returned by Solr.

Adds two minimal OWL fixtures (search_rank_melanoma_upper.owl with
"Melanoma", search_rank_melanoma_lower.owl with "melanoma") that
exercise the string_ci prefLabelExact field type and guarantee a
case-insensitive match for the lowercase query.
The previous test method bundled two distinct invariants: the Phase 1
schema fix (string_ci prefLabelExact / synonymExact for case-insensitive
exact match) and the Phase 2 mechanism (Solr-side boost producing
rank-ordered results before pagination). Splitting them gives more
diagnostic information when something regresses and makes each test's
intent explicit.

- test_schema_uses_case_insensitive_string_ci_exact_fields seeds only
  RANKHIGH (one ontology with mixed-case "Melanoma" prefLabel) and
  asserts the schema field types plus a lowercase prefLabelExact match.
- test_search_rank_orders_results_via_solr_side_boost seeds all four
  ranked ontologies and asserts pagesize=3 returns the three highest
  ranks in order, with RANKLOW counted in totalCount but excluded from
  page 1.

Shared setup is factored into a private with_ranked_melanoma_ontologies
helper. Each test method now has a docstring explaining the mechanism
it exercises (Phase 1 vs Phase 2) and the coverage gap the existing
fixtures don't address (the original #230 cross-Solr-page failure mode
would need 50+ matching docs to reproduce).

Both tests verified against the live setup; original combined test's
asserted behavior is preserved.
…ch-result-ranking

# Conflicts:
#	Gemfile.lock
The prefLabelExact/synonymExact fields now use the string_ci_exact
field type (case-insensitive exact match + binary scoring via
omitTermFreqAndPositions). The schema assertions still expected the
old string_ci literal, failing CI on develop after the type change
merged. Case-insensitivity is preserved, so the functional check is
unchanged.
Fix: malformed Solr query in Annotator (#233)
Fix: restore production access log output
@alexskr alexskr marked this pull request as draft June 18, 2026 16:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants