Skip to content

records.json serving (epic #615): data plane route - #707

Merged
neuromechanist merged 2 commits into
devfrom
feature/issue-615-epic-records-json
Jun 5, 2026
Merged

neuromechanist merged 2 commits into
devfrom
feature/issue-615-epic-records-json

Conversation

@neuromechanist

Copy link
Copy Markdown
Contributor

Summary

Brings the nemar-cli side of the records.json epic (#615) to dev: the data plane route GET /<id>/<version>/records.json (+ loadRecords/versionArtifactKey in s3.ts), serving the per-version S3 snapshot.

The records EMITTER, Tier-2 duration fill, and raw-manifest bytes_url all live in nemarDatasets/.github (P1 #32, P3 #34, P5 #35, all merged to .github main); this PR is the nemar-cli serving half (P2 #706).

Phases (epic #615)

  • P1 Tier-1 git-walk emitter — .github#32 (merged)
  • P2 data.nemar.org route + S3 snapshot — this PR (Phase 2: serve GET /<id>/<version>/records.json (#615) #706 squashed onto the epic branch) + .github#33 (S3 upload)
  • P3 Tier-2 duration via biosigIO full read — .github#34 (merged)
  • P5 bytes_url in raw S3 manifest — .github#35 (merged)
  • P4 biosigIO importers (CTF .ds/KIT) — deferred, upstream neuromechanist/biosigio (graceful null until then)
  • P6 backfill — deferred, post-deploy ops

Part of epic #615 (kept open: P4 upstream + P6 backfill remain). Merging to dev deploys the route to the dev environment; dev->main is the prod gate per the release flow.

Test plan

  • Each phase individually reviewed (2-agent /review-pr) + CI green
  • data-route unit suite green on the route; emit/patch/manifest tests green in .github
  • Post-deploy E2E: emit+upload a records.json for nm099999, curl data.nemar.org/nm099999//records.json

* 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.
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).
@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@PR707

Version: 0.8.48-PR707.8418aca
Commit: 8418aca


🤖 Updated on each push.

@neuromechanist
neuromechanist merged commit 57bb970 into dev Jun 5, 2026
10 checks passed
@neuromechanist
neuromechanist deleted the feature/issue-615-epic-records-json branch June 5, 2026 16:50

This branch was previously deployed

1 inactive deployment
npm — 8418aca5 Deployed Jun 5, 2026 by neuromechanist via publish #1319
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