Repository navigation
Closed
5 / 55 of 5 issues completedClosed
Robustness: post-publish artifact cascade (archive/zarr/records) is fragile and non-self-healing#736
5 / 55 of 5 issues completed
Copy link
Labels
bugSomething isn't working
Description
Incident: nm000111 publish produced an incomplete archive, no Zarr, no records.json
Approving the long-blocked nm000111 (ISRUC-Sleep) on 2026-06-10 minted the version DOI (v1.0.1) but the downstream serving artifacts silently did not materialize: the archive zip is incomplete, no Zarr store exists, and records.json is absent. This is a robustness post-mortem plus the fixes to make the post-publish cascade self-healing.
What actually happened (timeline, 2026-06-10)
16:22:43run-version-doisucceeded -> mintedv1.0.1.16:23:26run-generate-archiveFAILED: all 126 annexed EDF blobs returnedHTTP 403fromnemar.s3.us-east-2.amazonaws.com/nm000111/objects/.... Log:126 annexed files were not found in S3; archive is incomplete/Archive complete: 0 annexed + 639 regular + 126 skipped/Uploaded to s3://nemar/nm000111/archives/v1.0.1.zip/exit code 1.- The exact blob that 403'd during the job now returns
HTTP 200anonymously. The data was never missing; the dataset's S3 prefix was still private (deny-list carve-out not yet propagated) at the moment the archive job read it.
Root causes
- Archive reads blobs anonymously + public-flip race (primary).
run-generate-archive.ymlstreams annexed blobs via unauthenticatedhttps.getagainst the public S3 URL, even though the job already hasAWS_ACCESS_KEY_ID/SECRETin its env (used only for the multipart upload). The orchestrator flips S3 public (s3_public_read, step 4) before the tag push that fires the archive (create_tag, step 9), but S3 bucket-policy propagation lags, so the blob GETs 403'd. Reading with signed requests would have been immune. - Sticky partial archive. The incomplete zip is uploaded to the canonical key even on failure, and the
head-objectskip-if-exists idempotency guard then makes every re-dispatch a no-op. A broken archive is self-perpetuating; onlyforce=trueclears it. - No auto-retry.
/webhooks/archive-readyrecordsstatus=failedin D1, but nothing re-dispatches. Terminal until a human notices. - Zarr not generated. Autodispatch is off (Hallu cron owns conversion);
nm000111is not converted (zarr index 404). Same public-timing fragility applies if/when it reads blobs during a private window. - records.json never wired.
generate-records.yml's S3 upload + callback are a documented TODO skeleton and the orchestrator never dispatchesgenerate-records. Sorecords.json404s for ALL datasets, not just this one. (summary.jsonis also absent for this version.)
Robustness fixes
- A. Signed S3 reads in
run-generate-archive.yml(and audit the Zarr converter for the same). Use the creds already in env; removes the public-access dependency entirely, works for private datasets too. Highest leverage. - B. Flip public early + gate on propagation. Move the deny-list removal as early as possible in the publish cascade, then poll a known blob's anonymous HEAD until 200 (bounded) before advancing. Belt-and-suspenders with A.
- C. Never leave a partial archive at the canonical key. Stream to a temp/staging key; promote (server-side copy) to
archives/v<X>.ziponly whenskipped == 0; delete the temp on failure. Makes re-dispatch self-healing withoutforce=true. - D. Auto-retry failed archive/zarr. On
archive-ready/zarr-readystatus=failed, re-dispatch with capped backoff, or a sweep that re-dispatches failed/missing artifacts. - E. Finish records.json wiring. Enable the upload + callback in
generate-records.yml, add arecords-readywebhook handler, and dispatchgenerate-recordsfrom the orchestrator (or the version-doi workflow, like archive).
Immediate remediation (nm000111)
- Force-rebuild archive (
run-generate-archive.ymlforce=true; blobs public now). - Trigger Zarr conversion.
- records.json pending fix E.
Repos touched: nemarOrg/nemar-cli (orchestrator order, retry sweep, webhook handlers) and nemarDatasets/.github (archive signed reads, partial-key promotion, zarr audit, records wiring).
Sub-issues
Collapse Sub-issuesSub-issues
Loading 5 sub-issues
Metadata
Metadata
Assignees
Labels
bugSomething isn't working
Activity
neuromechanist commentedon Jun 11, 2026
Recovery + two refinements after live testing
Archive: recovered and root cause confirmed. Re-dispatched
run-generate-archive.ymlwithforce=true(to bypass the sticky partial-zip guard) now that the dataset is public. It succeeded and rebuilt a completev1.0.1.zip. This confirms root cause #1: the only thing that changed is the blobs are now publicly readable; with signed reads the original run would have succeeded regardless of visibility timing.Refinement to fix A: no new credential needed (do NOT push the Hallu key). The Zarr workflow already configures the same org secret
AWS_ACCESS_KEY_ID/AWS_SECRET_ACCESS_KEYand reads blobs with authenticatedaws s3 cp(scripts/zarr/generate_zarr.pyline 20: "authenticatedaws s3 cp(works for [private datasets])"), and it has many successful runs. So the CI key already holdss3:GetObjecton theobjects/prefix. Fix A is purely: switchrun-generate-archive.yml'sstream-archive.jsfrom anonymoushttps.get(<public S3 URL>)to a signed read (SDKGetObjectCommand/aws s3 cp) using the creds it already configures for the multipart upload. No secret rotation, no Hallu key.New finding (separate bug): the Zarr converter cannot handle mixed-sampling-rate EDF. A forced Zarr re-run on the now-public dataset still failed, but for an unrelated reason: all 126 EDFs error with
Length of values (N) does not match length of index (16*N). ISRUC-Sleep is polysomnography with heterogeneous per-channel rates (EEG/EOG/EMG ~200 Hz, respiratory/SpO2 ~12.5 Hz; 200/12.5 = 16). The converter builds a single time index at the max rate and the slow channels' value arrays don't align. This is a converter robustness gap ingenerate_zarr.py, independent of the publish cascade — track as its own fix (call it F).Updated fix list: A (signed reads), B (flip public early + propagation gate), C (no sticky partial), D (auto-retry/visibility), E (records.json wiring), F (Zarr converter: support mixed-rate EDF).
neuromechanist commentedon Jun 11, 2026
Split out fix F (Zarr mixed-rate EDF/BDF) to #737 — handled separately (likely a biosigIO issue). This epic is scoped to A–E.
neuromechanist commentedon Jun 11, 2026
Follow-up surfaced in Phase 2 review (deferred, not blocking): if a runner is killed mid-stream before CompleteMultipartUpload, the archive streaming script may leave an incomplete multipart upload that delete-on-failure (
aws s3 rm) won't clean. Pre-existing, narrow. Options: (a) catch SIGTERM/SIGINT in stream-archive.js and AbortMultipartUpload; (b) ensure an S3 lifecycle rule reaps incomplete MPUs on the nemar bucket. Low priority.Merge pull request #746 from nemarOrg/feature/issue-736-epic-publish-…
neuromechanist commentedon Jun 11, 2026
Epic finalized to dev (prod held)
All 5 phases merged + cross-phase reviewed. PR #746 (epic -> dev) merged (merge commit cab2395, regular merge preserving the phase commits).
Dev finalization verified:
nemar-api-dev.sccn-org.workers.dev/webhooks/records-readyreturns 401 (auth required) = route exists.Status by surface:
Held per maintainer: dev -> main (prod deploy + prod-D1 migrations + release tag). Will ship on your go.
Keeping this issue open until prod ships. #737 (Zarr mixed-rate EDF/BDF) tracked separately.
archive: reset retry_count on skipped (cross-epic #736/#749) (#767)
Merge pull request #766 from nemarOrg/dev
neuromechanist commentedon Jun 17, 2026
Shipped to prod as part of the v0.8.53 release (2026-06-16). D/B/E (archive auto-retry, early S3-public flip + propagation gate, records-ready webhook) rode along on the dev->main release of epic #749 and deployed + verified green; the #736<->#749 archive seam (retry_count reset on skip) was fixed in #767.