Skip to content

Fix publication queue listing nothing; drop All tab - #407

Merged
neuromechanist merged 3 commits into
stagingfrom
fix/admin-publication-queue-shape
Oct 1, 2026
Merged

neuromechanist merged 3 commits into
stagingfrom
fix/admin-publication-queue-shape

Conversation

@neuromechanist

@neuromechanist neuromechanist commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor

Problem

/admin/publication-requests listed nothing. nm000290 was requested at 12:46 UTC on 2026-10-01 and published at 13:50 UTC, and it appeared under no filter, "All" included.

The data was never missing: production GET /admin/publish/requests returns it as id 835, status: "published". The page could not read it. It was written against the owner-side PublicationStatus object (request.status.status, request.status.dataset_id, plus a dataset_name and an owner_email the route never sends), but the list route returns the raw publication_requests row joined to the requester, with status as a plain string. Rendering the first row threw Cannot use 'in' operator to search for 'requested_at' in published, so the list never completed. The unit tests passed because they built their responses from the same wrong shape.

Changes

  • PublicationRequest now matches the real row (dataset_id, status, requested_by_username, requested_by_email, approved_at, denied_at, denied_reason, block_reason, current_step, last_error). deriveAdminBadgeState takes a structural type so it accepts both shapes.

  • The "All" tab is gone. Tabs are Pending, Published, Denied, Blocked, each with a count. Pending is the default.

    • Pending is requested plus approving. With no "All", an approving request (a run in flight or stopped partway) would otherwise match no tab.
    • Each dataset appears once, under its latest request. Production has 29 datasets with an older denied request next to a later published one, which a per-status list would show under Denied.
    • ?status=all and the old ?status=requested land on Pending.
  • The dataset id is the row heading, since the route sends no dataset name. Rows show requester username and email, relative times with the exact UTC instant in the tooltip, and the denial reason, block reason, or last orchestrator error where it applies.

  • block_reason is read only on blocked rows. Production keeps a stale one on published and denied rows.

  • parseBackendTimestamp pins SQLite datetime('now') values to UTC. new Date("2026-10-01 12:46:50") reads local time, so ages were off by the viewer's offset.

  • The web Approve button is withheld behind WEB_PUBLISH_APPROVE_ENABLED (off). Fixing the list makes the button reachable for the first time, and one click would half-publish a real dataset: approval runs S3 Object Lock in batches of 100 objects that the caller must keep requesting (the CLI loops; this page sent one request), so a dataset over 100 files would stop at approving after its DOI is published. Pending rows show nemar admin publish approve <id> instead (--resume for an approving row). Deny is unchanged. The button returns when approval runs as a backend job that an executor drives to completion (website#200).

Testing

  • bun run typecheck (0 errors), bun run lint, bun run test (2730 passed), bun run build
  • New tests run on test/fixtures/admin-publish-requests.json: real rows from a production response, with requester identity and prescreen tokens scrubbed. Time-zone tests also run under America/Los_Angeles and Asia/Tokyo.
  • Rendered the page in dev against the full production list (822 rows): Pending 2, Published 780, Denied 2, Blocked 0; nm000290 is the first Published row; no dataset is listed twice. The same render threw before this change.
  • Not checked on a deployed build. The dev render used a local stand-in serving the captured production response and the dev admin session.

Not changed

  • Approve and deny (the client functions) still declare a { status: PublicationStatus } return type the backend does not send. The page ignores the return value, so nothing breaks today.
  • Failed approve and deny actions show Approve failed: <status text>. The backend sends { error: "<sentence>" }, which readError files under code, so the specific reason (for example "CI check failed: BIDS validation is failing") is dropped.
  • The Published tab renders all 780 cards on one page.
  • Dataset names are not shown. A name would need dataset_name added to the list route in nemar-cli.

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.
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Oct 1, 2026 •

Copy link
Copy Markdown

Deploying nemar-website with  Cloudflare Pages  Cloudflare Pages

Latest commit: 71d2c29
Status: ✅  Deploy successful!
Preview URL: https://acbbe8a2.nemar-website.pages.dev
Branch Preview URL: https://fix-admin-publication-queue.nemar-website.pages.dev

View logs

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).
@neuromechanist
neuromechanist merged commit 4a559b9 into staging Oct 1, 2026
5 checks passed
@neuromechanist
neuromechanist deleted the fix/admin-publication-queue-shape branch October 1, 2026 21:50
neuromechanist added a commit that referenced this pull request Oct 1, 2026
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.
neuromechanist added a commit that referenced this pull request Oct 5, 2026
Cuts [Unreleased] into 0.2.28 (2026-10-05). Adds the missing entries
for #407 (queue lists nothing), #408 (web approval by dispatch) and #409
(50-row pages), and moves #422's Fixed entry, which had landed under
0.2.27, into 0.2.28.
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