Skip to content

Phase 2: serve GET /<id>/<version>/records.json (#615) - #706

Merged
neuromechanist merged 2 commits into
feature/issue-615-epic-records-jsonfrom
feature/issue-701-phase2-records-route
Jun 5, 2026
Merged

neuromechanist merged 2 commits into
feature/issue-615-epic-records-jsonfrom
feature/issue-701-phase2-records-route

Conversation

@neuromechanist

Copy link
Copy Markdown
Contributor

Summary

Closes the serving loop for records.json (epic #615 P2). The Tier-1 emitter (.github#32) produces records.json but nothing served it; this adds the route, mirroring the summary.json sibling (#559).

  • data.ts recordsJsonHandler + route — serves the S3 <id>/version/v<X>-records.json snapshot verbatim, s-maxage=86400; missing -> 404 no-store; S3 error -> uncached 500. Registered before the /:id/:version(/*) catch-alls.
  • s3.ts — shared loadVersionJson + loadRecords (behaviour-identical for summary) + pure exported versionArtifactKey.

Coupled follow-up (separate PR to .github main, under #701): un-gate generate-records.yml S3 upload. Committed .nemar/records.json is a deferred dedicated change.

Closes #701
Part of epic #615

Test plan

  • data-records-route.test.ts (no mocks): registration + ordering + invalid-id 404 + passthrough check + versionArtifactKey — 7 pass
  • summary + manifest-coverage still green; 145 data-route tests pass; tsc + biome clean
  • E2E post-deploy: emit+upload records.json for nm099999, curl returns array with s-maxage=86400

Adds the records.json serving route, mirroring the summary.json sibling (#559). New recordsJsonHandler in data.ts serves the S3 <id>/version/v<X>-records.json snapshot verbatim with s-maxage=86400; missing -> 404 no-store (no negative caching, so a freshly-published snapshot appears next request); S3 error -> uncached 500.

s3.ts: factor loadSummary's fetch/fallback into a shared loadVersionJson + add loadRecords (behaviour-identical for summary); extract a pure, exported versionArtifactKey for the S3 key contract.

Route registered right after summary.json, before the /:id/:version(/*) catch-alls. Tests (no mocks): route registration + ordering + invalid-id 404 + static-passthrough source check + versionArtifactKey unit cases.

Closes #701. Part of epic #615.
Addresses PR #706 review (both reviewers): (1) the 500 branches in records + summary handlers now set Cache-Control: no-store, matching the comment's stated intent (a transient S3 failure must not be CDN-pinned); (2) headVersionArtifact uses the shared versionArtifactKey and its suffix type widens to include '-records', so the key formula has a single authority and a future records-ready HEAD check type-checks.
@github-actions

github-actions Bot commented Jun 5, 2026

Copy link
Copy Markdown

📦 Package Preview

Your package is ready to test!

bun install -g nemar-cli@PR706

Version: 0.8.48-PR706.e537242
Commit: e537242


🤖 Updated on each push.

@neuromechanist
neuromechanist merged commit 8d2aeb5 into feature/issue-615-epic-records-json Jun 5, 2026
1 check passed
@neuromechanist
neuromechanist deleted the feature/issue-701-phase2-records-route branch June 5, 2026 09:44
neuromechanist added a commit that referenced this pull request Jun 5, 2026
* Phase 2: serve GET /<id>/<version>/records.json (#615) (#706)

* feat: serve GET /<id>/<version>/records.json (#615)

Adds the records.json serving route, mirroring the summary.json sibling (#559). New recordsJsonHandler in data.ts serves the S3 <id>/version/v<X>-records.json snapshot verbatim with s-maxage=86400; missing -> 404 no-store (no negative caching, so a freshly-published snapshot appears next request); S3 error -> uncached 500.

s3.ts: factor loadSummary's fetch/fallback into a shared loadVersionJson + add loadRecords (behaviour-identical for summary); extract a pure, exported versionArtifactKey for the S3 key contract.

Route registered right after summary.json, before the /:id/:version(/*) catch-alls. Tests (no mocks): route registration + ordering + invalid-id 404 + static-passthrough source check + versionArtifactKey unit cases.

Closes #701. Part of epic #615.

* review: no-store on 500 + headVersionArtifact reuses versionArtifactKey

Addresses PR #706 review (both reviewers): (1) the 500 branches in records + summary handlers now set Cache-Control: no-store, matching the comment's stated intent (a transient S3 failure must not be CDN-pinned); (2) headVersionArtifact uses the shared versionArtifactKey and its suffix type widens to include '-records', so the key formula has a single authority and a future records-ready HEAD check type-checks.

* refactor: make bytes_url host-invariant (canonical data.nemar.org)

Cross-phase review (epic #615 finalization) found the served manifest's bytes_url was request-relative (api.nemar.org/data/... off the canonical host) while the raw S3 manifest (emit_manifest.py) hardcodes data.nemar.org -- they disagreed off data.nemar.org. bytes_url is a stable, storable contract URL, so it must be host-invariant: hardcode the canonical data.nemar.org for annex files and drop the request-relative dataPlaneBaseUrl entirely (buildBytesUrl no longer takes a base or the request URL; manifestJsonHandler drops the reqUrl param). data.nemar.org is the public host, reachable from anywhere, so the URL resolves regardless of how the manifest was fetched; this now matches the raw S3 manifest in lockstep. Tests updated (dataPlaneBaseUrl tests removed; host-invariance asserted).

This branch was previously deployed

1 inactive deployment
npm — e5372421 Deployed Jun 5, 2026 by neuromechanist via publish #1317
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.

1 participant