feat(artifacts): add slim field-projected search-index artifact#1975
Conversation
Adds a token-stripped projection of search.json as search-index.json and the /api/v1/search-index route. The slim index carries the same document count and IDs as the full index but omits per-document token blobs, making it significantly lighter for browser typeahead and listing use-cases. - New schema: SearchIndexArtifact / SearchIndexDocument (api-components.schema.json, 08-evidence-search-sources.schema.json, public-artifacts.schema.json) - src/artifact-storage.mjs: R2-only tier entry for search-index.json - src/contracts.mjs: artifact + /api/v1/search-index route registration - scripts/build-artifacts.mjs: buildSlimSearchIndex writes search-index.json alongside search.json (not replacing it) - scripts/validate-api.mjs: live-API check for the new route - tests/artifacts.test.mjs: lock-step consistency assertions (count, IDs, no token blobs, field-for-field equality minus tokens) - tests/api-coverage.test.mjs: slim route serve + field-projection tests - Regenerated OpenAPI, types, api-index, and contracts Co-authored-by: Cursor <cursoragent@cursor.com>
|
Superagent didn't find any vulnerabilities or security issues in this PR. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1975 +/- ##
=======================================
Coverage 93.23% 93.23%
=======================================
Files 48 48
Lines 7626 7626
Branches 2804 2804
=======================================
Hits 7110 7110
Misses 90 90
Partials 426 426
🚀 New features to boost your workflow:
|
Co-authored-by: Cursor <cursoragent@cursor.com>
|
Hi, @JSONbored |
40c8968 to
eaaef10
Compare
JSONbored
left a comment
There was a problem hiding this comment.
Merging. I closed #1889 for bundling the scripts/lib.mjs Windows path fix alongside this — I asked you to split them. This is the correctly split version: no lib.mjs changes in the diff, just the slim search-index artifact. Removes the per-document tokens blobs (~1.1 MB saved) that typeahead and list rendering never use. All generated artifacts regen'd, client bumped 0.9.0 → 0.10.0. Green CI.
Summary
Adds
search-index.json— a token-stripped projection ofsearch.json— andthe corresponding
/api/v1/search-indexroute. The slim index carries the samedocument count and IDs as the full index but omits per-document token blobs,
making it significantly lighter for browser typeahead and listing use-cases.
Served from R2 only (never committed as a static artifact).
What Changed
schemas/api-components.schema.json+schemas/components/08-evidence-search-sources.schema.json+schemas/public-artifacts.schema.json: newSearchIndexArtifact/SearchIndexDocumentschemassrc/artifact-storage.mjs: R2-only tier entry forsearch-index.jsonsrc/contracts.mjs: artifact and/api/v1/search-indexroute registrationscripts/build-artifacts.mjs:buildSlimSearchIndexwritessearch-index.jsonalongside (not instead of)
search.jsonscripts/validate-api.mjs: live-API check for the new routetests/artifacts.test.mjs: lock-step consistency assertions — same count, sameIDs, no token blobs, field-for-field equality minus
tokenstests/api-coverage.test.mjs: slim route serve test + field-projection testgenerated/+public/metagraph/: regenerated OpenAPI, types, api-index, andcontracts via
npm run buildon currentmainpackages/client/package.json+package-lock.json: version bumped0.7.0→0.8.0(new route added to the published contract)docs/backend-artifact-contracts.md: contract documentation updateRegistry Safety
validator-local state.
npm run buildon currentmain.Validation
git diff --checknpm run build(all steps green)npm run validatenpm run validate:schemasnpm run validate:apinpm run validate:openapinpm run scan:public-safety