Skip to content

feat: add stable same-origin bytes_url to manifest.json (#615) - #700

Merged
neuromechanist merged 2 commits into
devfrom
feat/manifest-bytes-url
Jun 5, 2026
Merged

neuromechanist merged 2 commits into
devfrom
feat/manifest-bytes-url

Conversation

@neuromechanist

Copy link
Copy Markdown
Contributor

Part of #615. Adds an additive bytes_url to every manifest.json entry — a durable, same-origin contract URL for the bytes that, unlike url (a 1h-presigned S3 GET for annex files), never expires.

  • annex -> the per-file data-plane route <origin>/<id>/<v>/<path> (302s to freshly-presigned bytes)
  • git -> the same raw.githubusercontent.com URL as url

buildBytesUrl is a pure helper that rebuilds the public path from <id>/<v>/<path> (not the Worker's internal /data-prefixed URL), so it's correct across data.nemar.org and api.nemar.org/data. Presign-independent, so it's set even when a row's url build fails. Decision vs Bruno's raw-S3 example: same-origin keeps nemar-py's assert_within honest, and his example URL was wrong anyway (omits the /objects/ prefix) — see the #615 reply.

Tested: 4 buildBytesUrl unit tests; 142 data-route unit tests pass; tsc --noEmit clean.

Follow-ups (separate): mirror bytes_url into the raw S3 version/v<X>.json via emit_manifest.py; the records.json route + emitter; 302-route recordAccess metering.

Adds an additive bytes_url to every manifest.json entry: a durable, same-origin contract URL for the bytes that (unlike the 1h-presigned url) never expires. annex -> the per-file data-plane route <origin>/<id>/<v>/<path> (302s to re-presigned bytes); git -> the same raw.githubusercontent URL as url.

Pure helper buildBytesUrl rebuilds the public path from <id>/<v>/<path> (not the Worker's internal /data-prefixed URL), so it stays correct across data.nemar.org and api.nemar.org/data. Presign-independent, so it is set even when a row's url build fails.

Tested: 4 buildBytesUrl unit tests; 142 data-route unit tests pass; tsc clean.
@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@PR700

Version: 0.8.47-PR700.6a16f97
Commit: 6a16f97


🤖 Updated on each push.

Review finding (#700): the handler derived the base from new URL(reqUrl).origin, dropping the /data mount prefix, so bytes_url 404'd on api.nemar.org and *.workers.dev (correct only on data.nemar.org, which serves the data plane at root via the index.ts host fork).

Extract dataPlaneBaseUrl(reqUrl): bare origin on data.nemar.org, origin + /data elsewhere — mirroring the exact host condition in index.ts. buildBytesUrl now takes that base. Add dataPlaneBaseUrl unit tests for all three host shapes; fix the misleading workers.dev buildBytesUrl test to assert the /data-prefixed URL.

Tested: 145 data-route unit tests pass; tsc clean.

This branch was previously deployed

1 inactive deployment
npm — 6a16f973 Deployed Jun 5, 2026 by neuromechanist via publish #1310
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