Skip to content

Epic #736: self-healing post-publish artifact cascade (archive/zarr/records) - #746

Merged
neuromechanist merged 4 commits into
devfrom
feature/issue-736-epic-publish-robustness
Jun 11, 2026
Merged

neuromechanist merged 4 commits into
devfrom
feature/issue-736-epic-publish-robustness

Conversation

@neuromechanist

Copy link
Copy Markdown
Contributor

Summary

Epic #736 — make the post-publish artifact cascade (archive / zarr / records) self-healing, after the nm000111 incident where an approval minted the DOI but produced an incomplete archive, no Zarr, and no records.json.

Root cause: run-generate-archive.yml read S3 blobs over anonymous HTTP and raced the publish-time public-flip propagation, 403'ing every blob into a hollow zip; the partial then stuck at the canonical key; nothing retried; and records.json was never dispatched at all.

Phases (A & C already live on nemarDatasets/.github; D, B, E in this PR)

Split out: #737 (Zarr mixed-rate EDF/BDF, likely biosigIO) — handled separately, not in this epic.

Closes #736

Migrations (apply on deploy)

  • 0040 archive_retry_count, 0041 records_status / records_checked_at. Apply to dev D1 on this merge; prod D1 at dev -> main.

Test plan

  • Each phase: real-SQLite/real-XML unit tests (no mocks) + Sonnet /review-pr (all findings addressed). D: 12 tests; B: 4 tests; E: 4 tests. tsc + Biome clean.
  • A & C verified live this session: nm000111 archive rebuilt 126 annexed + 0 skipped; induced-failure partial deleted.
  • Live archive-retry / propagation-gate / records-ready exercise on this dev deploy.

🤖 Generated with Claude Code

* Add bounded auto-retry for failed archives

* Address review: waitUntil dispatch, sweep note
* Flip S3 public early + propagation gate

* Move s3_public_read block before repo_public
* Add records-ready webhook + records_status column

* Clarify reserved 'pending' records_status in migration
@neuromechanist

Copy link
Copy Markdown
Contributor Author

Cross-phase Sonnet /review-pr (epic->dev) — caught two real inter-phase issues that the per-phase reviews couldn't see, both now fixed:

  • Issue 1 (Important): retry-count ordering. Phase D's review moved the archive dispatch into waitUntil, but the count increment stayed in the synchronous UPDATE — so a deferred dispatch that throws (GitHub 422/rate-limit) would consume a retry slot without ever dispatching, inconsistent with archiveRetrySweep (which increments only after a successful dispatch). Fixed: the synchronous UPDATE now writes only archive_status='failed' + archive_checked_at; archive_retry_count is incremented inside the waitUntil closure, after a successful triggerArchiveGeneration. A failed dispatch no longer burns a slot.
  • Issue 2 (Important): propagation-gate latency. Phase B's gate ran inline in the publish request (~10s of bounded poll on top of ci_check/enrichment/etc.), risking the 30s Worker wall-clock limit. Fixed: the gate now runs via c.executionCtx.waitUntil, so its poll overlaps the subsequent publish steps instead of adding serial latency. It's observability-only and non-fatal, so fire-and-forget is correct.

Migrations 0040+0041 apply cleanly in order; webhooks.ts/index.ts/admin.ts compose coherently; shared columns + naming consistent (per the reviewer). 16 tests pass, tsc + Biome clean.

@github-actions

Copy link
Copy Markdown

📦 Package Preview

Your package is ready to test!

bun install -g nemar-cli@PR746

Version: 0.8.53-PR746.ca6dd10
Commit: ca6dd10


🤖 Updated on each push.

@neuromechanist
neuromechanist merged commit cab2395 into dev Jun 11, 2026
10 checks passed
@neuromechanist
neuromechanist deleted the feature/issue-736-epic-publish-robustness branch June 11, 2026 22:27

This branch was previously deployed

1 inactive deployment
npm — ca6dd108 Deployed Jun 11, 2026 by neuromechanist via publish #1392
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