Repository navigation
feat: add stable same-origin bytes_url to manifest.json (#615) - #700
Merged
Merged
Conversation
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.
📦 Package PreviewYour package is ready to test! bun install -g nemar-cli@PR700Version: 🤖 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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of #615. Adds an additive
bytes_urlto everymanifest.jsonentry — a durable, same-origin contract URL for the bytes that, unlikeurl(a 1h-presigned S3 GET for annex files), never expires.<origin>/<id>/<v>/<path>(302s to freshly-presigned bytes)raw.githubusercontent.comURL asurlbuildBytesUrlis a pure helper that rebuilds the public path from<id>/<v>/<path>(not the Worker's internal/data-prefixed URL), so it's correct acrossdata.nemar.organdapi.nemar.org/data. Presign-independent, so it's set even when a row'surlbuild fails. Decision vs Bruno's raw-S3 example: same-origin keeps nemar-py'sassert_withinhonest, and his example URL was wrong anyway (omits the/objects/prefix) — see the #615 reply.Tested: 4
buildBytesUrlunit tests; 142 data-route unit tests pass;tsc --noEmitclean.Follow-ups (separate): mirror
bytes_urlinto the raw S3version/v<X>.jsonviaemit_manifest.py; therecords.jsonroute + emitter; 302-routerecordAccessmetering.