Repository navigation
Add openapi_version and backend to /status output - #392
Merged
Merged
Conversation
Closes #377. Surface the app's OpenAPI info.version and a backend key (currently always "redis") at the top of /status. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Group the frontend (server/normalizer) tests under tests/frontend/, leaving the loader tests at tests/ for a future tests/loader/ move. Relative imports (..helpers) and resources paths (parent.parent) updated for the new depth; shared helpers/, resources/, and conftest.py stay at tests/. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The /status output now surfaces the app version as "version" (e.g. "v2.4.1") rather than a separate "openapi_version" key. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
… CI --ignore pytestmark = pytest.mark.skip travels with the file, so it survives moves (e.g. tests/ -> tests/frontend/) instead of relying on the workflow to keep --ignore paths in sync.
gaurav
added a commit
to NCATSTranslator/NameResolution
that referenced
this pull request
Nov 10, 2026
… stats under `solr` (#304) This PR adds `backend` and an API `version` to `/status`, matching NodeNorm's `/status` (NCATSTranslator/NodeNormalization#392). Until now, nothing machine-readable said whether a NameRes `/status` came from this Solr implementation or from the Elasticsearch-backed one at [biothings/NameResolutionAPI](https://github.com/biothings/NameResolutionAPI). The two differed only by a word of prose in `message`. That gap is what stopped TranslatorSRI/babel-validation from pinning a NameRes target to its expected backend. **Breaking change:** everything `/status` reads from Solr now sits in a `solr` object rather than at the top level. That covers `startTime`, `numDocs`, `maxDoc`, `deletedDocs`, `segmentCount`, `lastModified` and `size`, plus the Solr index version, which was the top-level `version` and is now `solr.version`. The freed top-level `version` is the API version. Closes #296. ## The calls worth overruling - **A `solr` object, not a renamed `index_version`.** The API version needed the top-level `version`, so the Solr index version had to move. Renaming it in place would have fixed only that one key. With a `solr` object, consumers adjust once, the key is named after `backend`'s value, and backend detail can't collide with the service's own keys again. It is also the layout the `improve-performance` branch already uses (deployed as `release-v1.5.2-with-metrics`). That branch's JVM, OS and cache stats can therefore land in the same object without a second break. babel-validation's `trim_status()` already reads `raw["solr"]` first. - **`solr.version` keeps Solr's own name** for the index version counter, as on `improve-performance`, rather than `solr.index_version`. - **`solr.core`** is new: the name of the core actually reported on. Because of the single-core fallback, it is not always `SOLR_CORE`. Older cloud-mode backups call it `name_lookup_shard1_replica_n1`. - **`version` comes from `get_app_info()`, not `app.openapi_schema`.** NodeNorm reads the latter, but here it is `None` until the first request to `/openapi.json` (#294), so a fresh process would report `"unknown"`. - **Both branches report `backend` and `version`.** The error branch (`Expected core not found.`) is what a mis-pointed deployment returns, which is exactly when a caller needs to know which NameRes it reached. The shared keys are built once as `common` and spread into each return, so the two can't drift. The error branch has no `solr` object. ## What's here | key | value | |---|---| | `backend` | always `"solr"`; the ES NameRes reports `"elasticsearch"` | | `version` | the OpenAPI `info.version` verbatim (`"1.7.0"`) | | `solr` | `core`, `startTime`, `numDocs`, `maxDoc`, `deletedDocs`, `version`, `segmentCount`, `lastModified`, `size` | `nameres_version` (`"v1.7.0"`) is unchanged. [API.md](https://github.com/NCATSTranslator/NameResolution/blob/639a7a2/documentation/API.md#status) documents the new shape, with an example. A [CLAUDE.md gotcha](https://github.com/NCATSTranslator/NameResolution/blob/639a7a2/CLAUDE.md#gotchas) records why Solr fields must not go back to the top level. `tests/test_status.py` checks `version` against `/openapi.json`'s `info.version` rather than a literal, so the two are tested to be identical. It also asserts that none of the old top-level Solr keys remain, so a partial revert fails. ## What it deliberately does not do It doesn't fetch any more from Solr. JVM, OS and cache stats need extra Solr calls and a `?full=true` switch; that is `improve-performance`'s work, and this PR only gives it a place to land. ## Verification `python -m pytest tests/` passes in full (50-odd tests) on 639a7a2 against a local Solr 9.10 with the 89-document test index. I also checked three mocked Solr responses by hand: - two cores: the error branch, with `backend` and `version` and no `solr` object - a single `name_lookup_shard1_replica_n1` core: `solr.core` names it - a sparse, still-initializing core: blank counts, not a 500 ## Before merging - `api/resources/openapi.yml` is still at `1.7.0`, and API.md dates the move to v1.8.0. Bump it when the release is cut. - Follow-up in TranslatorSRI/babel-validation, not blocking this PR: its comment "under solr before v1.7, at the top level from v1.7 on" goes stale. It could also start reading NameRes's top-level `version`, now that it is a release rather than the index counter. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #377.
What
Add two values to the top of the
/statusoutput:openapi_version— the app's OpenAPIinfo.version(currently2.4.1), fromapp.openapi_schema["info"]["version"]backend— currently always"redis"; a hook for reporting other backends laterTests
tests/frontend/test_status.pymocks the 7 Redis dbs and asserts both new keys.tests/frontend/(a follow-up can move the loader tests intotests/loader/). Sharedhelpers/,resources/, andconftest.pystay attests/.🤖 Generated with Claude Code