Repository navigation
fix: auto-clear stale publish-request blocks (#428) - #801
Merged
Merged
Conversation
A publish request blocked while BIDS validation CI was pending/running never re-checked itself when CI later passed, so requests sat in 'blocked' indefinitely (13 stuck for weeks, cleared by hand). - publication-sweep.ts: pure evaluateBlockedBidsValidation() + a daily cron sweep that re-reads the latest bids-validation.yml run for each blocked request and transitions it (green -> requested, failing -> bids_validation_failed). Reuses getWorkflowRuns so the cron and the interactive readiness check can't disagree. - index.ts: wire the sweep into scheduledCleanup (step 5) + audit log. - CLI publish status: surface the block_reason message, CI link, and next-step hint instead of a bare 'Status: blocked'. Real-time webhook re-eval is a follow-up (needs the GitHub App to also deliver workflow_run events); the cron sweep resolves the stuck rows without that infra change. Closes #428
📦 Package PreviewYour package is ready to test! bun install -g nemar-cli@PR801Version: 🤖 Updated on each push. |
Contributor
Author
PR review (pr-review-toolkit, Sonnet) — code-reviewer + silent-failure-hunterAll findings addressed in
Not changed (self-downgraded by the reviewer): the Clean items confirmed: SQL Re-verified: 6 tests pass, |
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.
Problem
nemar dataset publish requestblocks a request when BIDS validation CI is pending/running (block_reason='bids_validation_pending' | 'bids_validation_in_progress'). That block was one-shot: nothing re-evaluated the request when CI later went green, so requests sat inblockedforever. 13 of bruaristimunha's requests were stuck for weeks and had to be cleared by hand.Fix (cron sweep + CLI hint)
backend/src/services/publication-sweep.ts(new):evaluateBlockedBidsValidation()— pure decision: no runs → keep; latestsuccess→ unblock; latestfailure→ re-block asbids_validation_failed;null/cancelled/skipped → keep.sweepBlockedBidsValidationRequests()— finds everyblockedrequest with abids_validation_*reason, re-reads the latestbids-validation.ymlrun viagetWorkflowRuns(same call the publish-request path uses), and transitions it. Never throws; per-row failures are counted and skipped. Updates are guarded onstatus='blocked'so a concurrent re-request can't be clobbered.backend/src/index.ts— wired intoscheduledCleanup(daily 3 AM cron) as step 5, with a tally in the audit log + summary line.dataset publish status— now surfaces theblock_reasonmessage, the CI link, and a next-step hint instead of a bareStatus: blocked(the issue's "side note"). Addedci_urltoPublishStatusResponse.Design notes
nemar admin publish list); the move is logged.workflow_run.completedwebhook for near-real-time clearing. That needs the nemar-publish-bot GitHub App to also subscribe toworkflow_runevents (infra/config outside this repo), so it's not in this PR. The cron sweep already resolves the stuck-row problem on its own (it's the "defense in depth" item the issue lists); the webhook would only reduce latency from ~1 day to minutes.Tests
test/publication-sweep.unit.test.tspins the decision matrix (all conclusion states) and that the swept block-reason set matches what the readiness check can produce. 6 pass;tsc --noEmit0;biome check src/clean.Closes #428