Skip to content

Phase 4: publisher canary for git:-keyed manifest entries (#503) - #518

Merged
neuromechanist merged 1 commit into
feature/issue-514-epic-website-followupsfrom
feature/issue-503-phase4-git-canary
May 16, 2026
Merged

neuromechanist merged 1 commit into
feature/issue-514-epic-website-followupsfrom
feature/issue-503-phase4-git-canary

Conversation

@neuromechanist

Copy link
Copy Markdown
Contributor

Closes #503. Phase 4 of epic #514.

Summary

Option 1 from the issue: publisher canary on git:-keyed manifest entries.

After generateManifest builds the file map (backend/src/services/manifest.ts), verifyGitBackedFiles HEAD-checks a small sample of the git:-keyed URLs against https://raw.githubusercontent.com/nemarDatasets/<repo>/<tag>/<bidsPath>. If any return non-200 after one retry, it throws GitBackedFileMissingError. All four existing generateManifest callers already wrap the call in try/catch and surface the error message, so a broken manifest never reaches S3.

Sampling strategy

Cap the Worker subrequest cost at 5 HEADs in the happy path:

  • dataset_description.json is always included when present (the canonical BIDS root file the website hits first)
  • Up to 4 additional git: paths in deterministic sorted order

A single 2-second retry per failing canary absorbs raw.githubusercontent.com CDN propagation lag after a fresh tag push. Real missing-blob failures stay failed across both attempts.

selectGitBackedCanaries(files, maxAdditional) is exported and unit-pinned (8 tests) so the sampling matrix is legible and refactor-safe.

Failure modes this catches

  • Recovery scripts that insert a dataset_versions row without minting the corresponding tag → canary 404s on the missing tag.
  • Force-pushed retags where the manifested blob no longer exists at that ref → canary 404s on the missing blob.
  • Publication-workflow bug that writes the D1 row before the GitHub repo is flipped public → canary 404s with "repo is private" semantics.

In all three cases, the publish workflow fails LOUDLY with a clear error message instead of silently writing a manifest that 302→404s for every end user.

Test plan

  • bun test test/manifest.test.ts → 26 pass / 0 fail
  • Backend tsc --noEmit passes
  • After deploy: tag a test dataset where the tag was deleted from GitHub; confirm the next publish attempt throws GitBackedFileMissingError with the failing path + HTTP status.
  • After deploy: confirm a healthy publish (live nm dataset) writes the manifest in the normal flow and logs [manifest] git-backed canary OK ....

Acceptance from the issue

  • Documented, tested behavior for the "git: blob refers to a non-existent ref" case (not a silent 302→404)
  • No change to the public /manifest.json contract for healthy datasets
  • Operator-visible signal: console.log on success, console.error + thrown GitBackedFileMissingError on failure (with full failure summary in the message)

This is the final phase of epic #514. Next: open epic→dev PR with /review-pr (sonnet).

Option 1 from the issue. After generateManifest builds the file map, HEAD-check a small sample of the git:-keyed URLs on raw.githubusercontent.com pinned to the version tag. If any return non-200, throw GitBackedFileMissingError so the publication workflow fails LOUDLY instead of writing a manifest that would later 302->404 on data.nemar.org.

Sampling: dataset_description.json (always when present) + up to 4 additional git: paths in deterministic sorted order. Caps the Worker subrequest cost at 5 HEADs in the happy path. A single 2-second retry per failing canary absorbs raw.githubusercontent.com CDN propagation lag after a fresh tag push; real missing-blob failures stay failed across both attempts.

selectGitBackedCanaries is exported and pinned by unit tests so the sampling matrix is legible.
@github-actions

Copy link
Copy Markdown

📦 Package Preview

Your package is ready to test!

bun install -g nemar-cli@PR518

Version: 0.8.18-PR518.bc5bfe8
Commit: bc5bfe8


🤖 Updated on each push.

@neuromechanist
neuromechanist merged commit 60e0a8a into feature/issue-514-epic-website-followups May 16, 2026
1 check passed
@neuromechanist
neuromechanist deleted the feature/issue-503-phase4-git-canary branch May 18, 2026 11:10

This branch was previously deployed

1 inactive deployment
npm — bc5bfe86 Deployed May 16, 2026 by neuromechanist via publish #933
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