Skip to content

feat(artifacts): add slim field-projected search-index artifact#1975

Merged
JSONbored merged 11 commits into
JSONbored:mainfrom
andriypolanski:feat/search-index-artifact
Jun 26, 2026
Merged

feat(artifacts): add slim field-projected search-index artifact#1975
JSONbored merged 11 commits into
JSONbored:mainfrom
andriypolanski:feat/search-index-artifact

Conversation

@andriypolanski

@andriypolanski andriypolanski commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds search-index.json — a token-stripped projection of search.json — and
the corresponding /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.
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: new SearchIndexArtifact /
    SearchIndexDocument schemas
  • src/artifact-storage.mjs: R2-only tier entry for search-index.json
  • src/contracts.mjs: artifact and /api/v1/search-index route registration
  • scripts/build-artifacts.mjs: buildSlimSearchIndex writes search-index.json
    alongside (not instead of) search.json
  • scripts/validate-api.mjs: live-API check for the new route
  • tests/artifacts.test.mjs: lock-step consistency assertions — same count, same
    IDs, no token blobs, field-for-field equality minus tokens
  • tests/api-coverage.test.mjs: slim route serve test + field-projection test
  • generated/ + public/metagraph/: regenerated OpenAPI, types, api-index, and
    contracts via npm run build on current main
  • packages/client/package.json + package-lock.json: version bumped
    0.7.00.8.0 (new route added to the published contract)
  • docs/backend-artifact-contracts.md: contract documentation update

Registry Safety

  • No secrets, PATs, wallet data, private dashboards, private URLs, or
    validator-local state.
  • Generated artifacts were produced by npm run build on current main.
  • R2-only/high-churn detail artifacts are not committed.
  • Public API/OpenAPI/schema changes are intentional and documented.

Validation

  • git diff --check
  • npm run build (all steps green)
  • npm run validate
  • npm run validate:schemas
  • npm run validate:api
  • npm run validate:openapi
  • npm run scan:public-safety

andriypolanski and others added 2 commits June 25, 2026 22:47
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-security

Copy link
Copy Markdown

Superagent didn't find any vulnerabilities or security issues in this PR.

@codecov

codecov Bot commented Jun 26, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.23%. Comparing base (2bcd5c1) to head (4464ab3).

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           
Files with missing lines Coverage Δ
src/artifact-storage.mjs 100.00% <ø> (ø)
src/contracts.mjs 94.31% <ø> (ø)
🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Co-authored-by: Cursor <cursoragent@cursor.com>
@JSONbored JSONbored added the gittensor:feature Feature / enhancement label Jun 26, 2026
@andriypolanski

Copy link
Copy Markdown
Contributor Author

Hi, @JSONbored
I’m trying to fix a CI error that occurred during testing, but I haven’t been able to resolve it yet. Could you please help me take a look?

@andriypolanski andriypolanski force-pushed the feat/search-index-artifact branch from 40c8968 to eaaef10 Compare June 26, 2026 21:02

@JSONbored JSONbored left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@JSONbored JSONbored moved this from Todo to In Progress in Metagraphed - Blocksploratory v1 Jun 26, 2026
@JSONbored JSONbored merged commit 1985e0f into JSONbored:main Jun 26, 2026
4 checks passed
@github-project-automation github-project-automation Bot moved this from In Progress to Done in Metagraphed - Blocksploratory v1 Jun 26, 2026
@github-actions github-actions Bot mentioned this pull request Jun 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gittensor:feature Feature / enhancement

Projects

Status: Todo

Development

Successfully merging this pull request may close these issues.

2 participants