Skip to content

Sync: BioPortal v6.8.0 release #18

Open
alexskr wants to merge 186 commits into
ontoportal:masterfrom
ncbo:master
Open

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

Conversation

@alexskr
Copy link
Copy Markdown
Contributor

@alexskr alexskr commented Nov 21, 2025

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
alexskr and others added 30 commits April 22, 2026 21:55
The previous "No metadata for \`X\` — not a LinkedData model class"
leaked the Ruby gem name and used "model class", terms API users don't
encounter elsewhere. The BioPortal /documentation page uses "media
type" for exactly these /metadata/:X URIs (they surface as JSON-LD
@type / @context identifiers in responses, documented under "Media
Types and Hypermedia Links"), so match that vocabulary and point the
user at a concrete working example.

Also route the response through the repo's `error` helper so the 404
comes back as the standard `{ errors: [...], status: 404 }` shape
through LinkedData's content-negotiating serializer, matching every
other error response in the codebase (no more one-off `halt 404,
"string"`).

Strengthen the regression test to assert the new phrasing appears in
the body, not just the status code.
- Extend `test_metadata_route_renders_for_model_class` to loop over
  `Ontology`, `Metrics`, `Class` — covers plain top-level lookup
  (`Ontology`), singularization (`Metrics` → `Metric`), and a second
  plain case with a distinctive name (`Class`). All three hit the same
  `resolve_model_class` top-level branch, but `Ontology` was the one
  case we previously had no explicit coverage for.

- Rename `test_metadata_route_returns_404_for_non_class_names` →
  `test_metadata_route_returns_404_for_bogus_names` and trim its list
  to `DefinitelyNotAModel`, `nonexistent_thing`, `xyzqux123` —
  guaranteed-nonexistent identifiers that will stay 404 regardless of
  future features.

  The previous list (`created`, `body`, `prefixIRI`, `name`,
  `omvacronym`) was misleading: those *are* attribute URIs the API
  emits in JSON-LD @context, currently 404'd as a stop-gap but tracked
  in ncbo/bioportal-project#388 for actual attribute-documentation
  rendering. Leaving them asserted as 404 would turn into a false
  regression signal when #388 lands.
…ssue-212

fix: /documentation NameError from sinatra-contrib 4.2.1 namespace bug
Develop -> Master merge, release v7.1.0
Drops the `if page?` guard so /users unconditionally returns a Page
object. Adds a deterministic default sort (username asc) so paged
responses are stable for clients walking nextPage links.

Addresses production timeouts on /users?include=all. Pairs with
ncbo/ontologies_linked_data#286 (idempotent User#admin?, drop inverse
attrs from auth load) and the corresponding ontologies_api_ruby_client
auto-paginate change. Tests updated for the paged response shape and
cover ?pagesize and ?include=all combinations.
Commit 388d1bd ("converted acronyms filter from Boolean to Term syntax")
replaced get_quoted_field_query_param at the start of filter_query
construction in BOTH search_helper.rb (line 160) and
properties_search_helper.rb (line 48). The new term-syntax function
correctly early-returns "" for an empty acronyms list (an empty
terms-query would itself be malformed), but the rest of filter_query
construction in both helpers implicitly relied on the prior function's
vacuous `submissionAcronym:""` placeholder always producing a non-empty
starting clause.

When acronyms filtered to empty (e.g. ontology_types restriction matches
nothing, or the requesting user has no access to any of the requested
ontologies), filter_query was "" and the subsequent `<< " AND <clause>"`
appends produced a stray-AND fq that Solr rejected with 400 (surfaced
as 500 by the API), breaking both /search and /property_search for any
call whose acronyms resolved empty.

Fix: when filter_query is empty after the acronyms step, use Solr's
match-all literal `*:*`. AND'ing further clauses onto `*:*` narrows
correctly, producing well-formed queries semantically equivalent to the
constraints that follow. Also more correct than the pre-388d1bd
behavior, which always silently added `submissionAcronym:""` (matching
zero docs) when acronyms was empty — search-without-acronyms now
actually returns matches.

The third in-tree call site (search_helper.rb:181 — valueset_root_ids)
is unaffected: it's already guarded by `unless valueset_root_ids.empty?`
on the line above, so the function input is guaranteed non-empty.

Adds regression tests for both endpoints exercising the empty-acronyms
path via ontology_types=NONEXISTENT.
Fix: always paginate GET /users; /search 500 on empty acronym filter
Develop to Master merge,  Release v7.2.0
Fix: trailing-slash 301 redirects downgrading https to http (#217)
Develop to Master merge,  Release 7.2.1
…derror

Fix: annotator 500s - too many boolean clauses (#221) and missing prefLabel (#222)
Develop to Master merge, Release 7.2.2
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