Repository navigation
Define a stable public search response contract - #153
Merged
Merged
Conversation
jdaigneau5
approved these changes
Sep 10, 2026
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.
Summary
Define an API-owned response contract for
POST /searchand add non-fatal warnings for requested CVE IDs from years before CVE Records exist.Why These Changes Were Needed
Decouple the API from OpenSearch responses
The previous success payload returned OpenSearch response and hit objects directly. That exposed implementation details such as index names, shard metadata, scores, hit wrappers, and backend timing while requiring clients to understand OpenSearch-specific structures.
The new response contains, in order:
apiVersionstatuswarningspaginationrecordsComplete CVE Records are returned directly in
records. Search-backend timing remains available to internal telemetry but is no longer included in the public response.Primary files:
controllers/searchController.jsutils/searchResponseBuilder.jsroutes/swagger.jsapi-docs/openapi.jsonMake bounded semantic totals explicit
Semantic post-filter searches inspect at most 10,000 candidates. When that ceiling is reached, the response now sets
pagination.totalIsExacttofalseand places aSEMANTIC_CANDIDATE_LIMIT_REACHEDwarning before the records. Direct searches and semantic searches below the ceiling report exact totals.Primary files:
controllers/searchController.jsutils/searchResponseBuilder.jsREADME.mdroutes/swagger.jsRemove backend-specific public errors
Search dependency failures now return the platform-neutral
SEARCH_UNAVAILABLEerror instead of naming OpenSearch in the public error code and message.Primary files:
controllers/searchController.jsutils/errors.jsroutes/index.jsExplain pre-1999 CVE ID results without rejecting mixed requests
CVE Records do not exist for years before 1999. These syntactically valid IDs continue to produce zero matches rather than an HTTP error. A successful response now includes
CVE_IDS_NOT_RETURNEDwith the affected IDs. When a request contains both pre-1999 and supported-year IDs, matching supported-year records are still returned.Primary files:
utils/searchResponseBuilder.jscontrollers/searchController.jsutils/constants.jsroutes/swagger.jsREADME.md