Repository navigation
Start web approval through a backend dispatch - #408
Merged
Merged
Conversation
The backend stores datetime('now'), UTC with no zone marker, which
new Date() reads as local time. Tested in UTC, Pacific, and Tokyo.
The page read a nested status object the backend list route never sends, so rendering the first row threw and no request showed, including nm000290. Read the flat row the route returns instead. Tabs are now Pending (requested + approving), Published, Denied, Blocked, each with a count and one row per dataset (latest request). Old ?status=all and ?status=requested links land on Pending. Tested: unit tests on a scrubbed production response, typecheck, lint, build, and the page rendered against the full production list.
Approval is not one request: after the DOI is published, S3 Object Lock runs in batches the caller must keep requesting. The CLI loops; this page sent one request, so a dataset over 100 files would stop at approving, public but unlocked and unannounced. Gate the button behind WEB_PUBLISH_APPROVE_ENABLED (off) and show the CLI command, with --resume for an approving request. Deny is unchanged. Tested: unit test for the command, typecheck, lint, and the page rendered in dev (no Approve button or dialog, Deny and hint present).
The page no longer drives approval. Approve asks the backend to start it (POST /admin/publish/:id/approve-dispatch), which hands the run to a GitHub Action, and the page watches status and current_step. Rows show Approve, Queued or Running, and Resume or Retry when a run stalls, from the backend's own approval_in_flight; a backend without it falls back to the CLI hint. The page refreshes while a run is live. Also shows the backend's real error sentence instead of the HTTP status text, and types the deny response as the backend sends it. Tested: unit tests on real-row variants, typecheck, lint, build, and the page clicked through in dev against a local dispatch stand-in.
A site deployed ahead of its backend would tell admins approval keeps going if they close the page, while the rows fall back to the CLI. Detect dispatch support from the rows (approval_in_flight present) and use it for the lede and the dialogs too. Tested: unit tests, lint, typecheck, and the page rendered against the current production response (no buttons, CLI hints, old lede).
Deploying nemar-website with
|
| Latest commit: |
3b7f75f
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://85fc5fca.nemar-website.pages.dev |
| Branch Preview URL: | https://feature-web-approve-dispatch.nemar-website.pages.dev |
Retrying a request that never started now asks for the typed PUBLISH confirmation like the first approval, since nothing has run. A failed run shows its error and the CLI command instead of claiming progress. Cancelling a dialog no longer stops the auto-refresh; the refresh can be paused and waits for open dialogs and error messages. A failed start offers a refresh link. Anonymous releases are tagged and get their own confirmation. What each row shows now comes from a tested rowView. Also: CLI command only for well-formed dataset ids, queued state for a resume dispatch, time elements, username fallback, comment fixes. Tested: unit tests (2762), typecheck, lint, and the page in a browser against a local stand-in: states, dialogs, Cancel then refresh.
Open PR #396 already adds ADR 0021. Also correct two claims the review found overstated: the page reads approval_in_flight, and its copy names GitHub Actions.
Running and stalled rows link to the approval workflow's runs, since the backend cannot see a failure inside the workflow. Friendly messages for dispatch_unconfirmed, dispatch_unconfigured and origin_not_allowed. Tested: unit tests, typecheck, lint.
The backend now holds a failed run in flight for a short grace because the CLI retries a failed step itself. The row no longer claims the run has stopped during that window; the ADR matches. Tested: unit tests, typecheck, lint.
Staging squash-merged #407, whose original commits this branch still carries. Take this branch's side of the overlapping files; it is a superset of what the squash contains.
This was referenced Oct 1, 2026
neuromechanist
added a commit
that referenced
this pull request
Oct 5, 2026
5 of 10 tasks
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.
Reviewed by an independent agent; its findings are fixed here (see the commits).
Stacked on #407 (base is that branch until #407 merges, then retarget to
staging).Problem
The web Approve button cannot finish a real dataset (see #407 and the finding on #200). Approval is not one request: after the irreversible DOI publish, S3 Object Lock runs in batches of 100 objects that the caller must keep requesting. The CLI loops; the page sent one request. The loop stays in the caller because running it in a Cloudflare Worker would cost too much.
Change
The page no longer drives approval. The backend route is the contract and executors are pluggable; for now a web click is executed by a GitHub Action in
nemarDatasets/.github, and the CLI path is unchanged (ADR 0022).POST /admin/publish/:id/approve-dispatch, which answers 202. The page then only watches the request's ownstatusandcurrent_step.approval_in_flight, so the page holds no timing constant: Approve (ready), Queued or Running with the current step (no buttons, page refreshes every 20 s while a row runs), and Resume or Retry when a run stalls. The CLI command stays on a stalled row as a fallback.approval_in_flightcannot dispatch, so the page falls back to the CLI hint and drops the "keeps going if you close this page" promise. A site deployed ahead of its backend degrades instead of showing a button that answers 404.approvePublicationRequestand its two-minute deadline are removed (website#200: "drops back to a normal deadline"). Dispatch has a 15 s deadline.rowView(the review found the decision logic untested). Retrying a request that never started opens the same typed-PUBLISH dialog as the first approval, because nothing has run; the lighter Resume dialog is only for a request that already has steps done. A failed run shows its error and the CLI command instead of "it keeps going", even while the backend still holds its lease.{ error }, whichreadErrorfiles undercode. The deny response is typed as the backend sends it.Deploy order
Do not promote the site before the first two.
dev.mainbefore the backend dispatches in production. A dispatch with no workflow does nothing, so the page would say "queued" forever.WEB_PUBLISH_APPROVE_ENABLEDis the kill switch.Testing
bun run typecheck(0 errors),bun run lint,bun run test(2762 passed),bun run buildtest/fixtures/admin-publish-requests.json): phase for every status and for a backend without the dispatch fields, dispatch client, error text, deadlinesapprove-dispatch, and the row then reads "Approval queued" with no buttons. Running, stalled (Resume plus the CLI fallback) and ready rows all render. Against today's production response (no dispatch fields) there are no buttons and the CLI hints show.devand the workflow merged, then one approval ofnm099999on test.nemar.org.Not changed
nemar admin publish approveexits 0 when an approval fails (found while reviewing the workflow), so nothing should rely on its exit code. The workflow reads the final status back instead.