Repository navigation
Epic #559: Centralize manifest generation (PR-1 of #557 + #556 + #558) - #563
Merged
Merged
Conversation
…+ part of #558) PR-1 Stream A of epic #559. Adds scripts/emit_manifest.py (git-tree walk, no GitHub API), .github/workflows/generate-manifest.yml (repository_dispatch + workflow_dispatch), and helper scripts. Replaces in-worker manifest generation. Emits both manifest.json (existing shape) and summary.json (new compact artifact per #558). 25 real-git tests pass. Closes part of #556 + #558.
PR-1 Stream C of epic #559. Adds loadSummary helper, GET /:datasetId/:version/summary.json route (static passthrough, s-maxage=86400), and scripts/backfill-summaries.sh for the 5 recovered datasets. Includes 403-throws fix (silent-credentials-drift) and 500-on-S3-error fix from review round. 3 unit tests + real-S3 conditional test pass. Companion: nemarOrg/website#29. Closes part of #558.
PR-1 Stream B of epic #559. Adds triggerManifestGeneration dispatch (targeting nemarOrg/nemar-cli central repo), POST /webhooks/manifest-ready callback (HMAC-validated, S3 HEAD-checked, dataset_versions insert + nemar-sync deferred until callback), POST /webhooks/manifest-failed callback, migration 0025 (manifest_jobs), and feature flag MANIFEST_VIA_CENTRAL_WORKFLOW (default false). Includes review-round fixes: 403→throw, crypto-error→500, nemar-sync moved to manifest-ready, 500-on-insert-fail, skipCanary wired, validateManifestCallbackBody + isCentralManifestWorkflowEnabled unit tests, supersession warn, dead fallback removed. canary_skipped field handoff from Stream A accepted. 108 manifest+sync tests pass. Closes part of #557.
Contributor
Author
Cross-phase review (epic leader)Three reviewers ran (code-reviewer, pr-test-analyzer, silent-failure-hunter) AGAINST THE INTEGRATED DIFF. Per-phase reviews of #560/#561/#562 already addressed; this surfaces issues only visible across phase boundaries. Critical — wire drift (block merge to dev)
Critical — before flipping
|
Contributor
Author
Cross-phase findings: resolutionsAll 9 in-scope items addressed on this branch. Items 10-12 deferred to follow-up issues as planned.
Verification
Out of scope (deferred to follow-up issues, per plan)
Feature flag stays default |
This was referenced May 19, 2026
Closed
This branch had an error being 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.
Summary
Epic #559 — PR-1 of the 4-PR phasing in #557. Bundles the algorithmic fix from #556 and the new
summary.jsonartifact from #558 into a single integration intodev. Three sub-PRs landed onto the epic branch in parallel:scripts/emit_manifest.py(git-tree walk, zero GitHub API calls) +.github/workflows/generate-manifest.yml(centralrepository_dispatch). 25 real-git tests pass.loadSummaryhelper +GET /:datasetId/:version/summary.jsonroute (static passthrough,s-maxage=86400) +scripts/backfill-summaries.shfor the 5 recovered datasets.triggerManifestGeneration()+POST /webhooks/manifest-readyHMAC-validated callback +POST /webhooks/manifest-failed+ migration 0025 (manifest_jobs) + feature flagMANIFEST_VIA_CENTRAL_WORKFLOW(defaultfalse— oldgenerateManifest()path stays active as fallback). 108 manifest+sync tests pass.Design contract pinned in
.context/epic_central_manifest_state.md. Each sub-PR was reviewed (code-reviewer, pr-test-analyzer, silent-failure-hunter) and all findings addressed.What this fixes (today's failure mode)
backend/src/services/manifest.ts:generateManifest()makes one GitHub REST API call per annex-pointer-candidate blob. For a typical BIDS-EEG dataset (on005261, 14,536 candidate files) that single publish exhausts 116% of thenemarDatasetsGH App installation hourly quota. Worker logs from the doctor-framework (#555) recovery run on 2026-05-18:Replaces the API-per-pointer algorithm with a
git ls-tree -r v<X> + git cat-file blob <sha>walk on a managed GitHub-Actions runner (Python, ~ 2 min for the largest dataset). Zero GitHub API calls during manifest generation.What this adds (companion: nemarOrg/website#29)
A compact
summary.jsonsibling artifact alongsidemanifest.json. The website's detail page only needs paths + readme + totals; today it pulls a 10+MBmanifest.jsonwith presigned URLs per file on every request. The new summary is path-only, typically 50-200 KB regardless of dataset size, statically cacheable for 24 hours.Ops sequence (BLOCKS
MANIFEST_VIA_CENTRAL_WORKFLOW=truerollout)Required secrets on
nemarOrg/nemar-cli:NEMAR_APP_ID(already onnemarDatasetsvia Epic Epic: migrate GITHUB_ADMIN_PAT to a GitHub App installation token #432 — mirror to nemarOrg)NEMAR_APP_PRIVATE_KEY(same)AWS_ACCESS_KEY_IDAWS_SECRET_ACCESS_KEYMANIFEST_CALLBACK_SECRETRequired Workers secret (prod + dev SCCN):
MANIFEST_CALLBACK_SECRET(same value as above)Required D1 migration application after merge:
npx cfman wrangler --account neuromechanist d1 migrations apply nemar-db -c backend/wrangler.toml(prod + dev)npx cfman wrangler --account sccn d1 migrations apply nemar-db -c backend/wrangler-sccn.toml(prod + dev)Rollout: flip
MANIFEST_VIA_CENTRAL_WORKFLOW=trueon SCCN dev first, run a real publish onnm099999, observe a week of clean runs, then flip prod.Test plan
scripts/test_emit_manifest.pypass (Stream A)test/data-summary-route.test.ts+ conditional real-S3test/s3-summary.test.tspass (Stream C)--dry-runprintsDry-run would fire (5):(verified live)nemar admin e2e-test --verboseon SCCN dev withMANIFEST_VIA_CENTRAL_WORKFLOW=trueonce secrets are in (BLOCKING)gh workflow run generate-manifest.yml -f dataset_id=nm099999 -f version=1.0.0 ...on this repo once secrets are inhttps://data.nemar.org/nm099999/1.0.0/summary.jsonreturns 200 with documented shapehttps://data.nemar.org/nm099999/1.0.0/manifest.jsonstill returns existing per-file presigned-URL shape (back-compat unchanged)scripts/backfill-summaries.sh(post-merge)/review-prcleanOut of scope (later sub-issues of #557, opened after this lands)
manifest_jobstable, compare for a weekpublish-version-doi.yml/generate-archive.yml; removegenerateManifest()worker fallbackgenerate-archiveto the same central patternCloses #559. Partially closes #556, #557, #558 (the remaining work for #557 is tracked in PR-2/PR-3/PR-4 follow-ups).