Repository navigation
Phase B3: admin quality API (#2324) - #2386
Merged
neuromechanist merged 8 commits intoNov 26, 2026
Merged
neuromechanist merged 8 commits into
neuromechanist merged 8 commits into
Conversation
📦 Package PreviewYour package is ready to test! bun install -g nemar-cli@PR2386Version: 🤖 Updated on each push. |
neuromechanist
merged commit Nov 26, 2026
2266dc8
into
feature/issue-2324-epic-pipeline-progress
47 of 53 checks passed
This was referenced Nov 26, 2026
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.
Phase B3 of #2324 (ADR 0137 decision 7): the admin quality API. Refs #2384.
What changed
GET /admin/compute/pipeline/runs/:stamp/quality(routes/admin/compute-pipeline.ts,services/quality-admin.ts), behind the admin router's authentication, admin and cookie-origin middleware. Every answer, refusals included, isCache-Control: no-store.RUN_QUALITY_SQL, by index) reads the stamp, its derivative row, the skip log's word and whether the row is the current public derivative (B1'sCURRENT_PUBLIC_DERIVATIVE_SQL).COMPUTE_RUN_QUALITY_STATES:run_in_progress(adispatchedstamp),run_not_succeeded,not_keyed(withskip),awaiting_derivative,failed,expired,copying,canary,current,superseded,not_current. A canary past its date isexpiredbefore the sync marks it (the missing-canary case), and no state is a 500. The answer also carries retention,stored_at,expires_at,superseded_at,failureandserving_index, anddataset_public: whether the dataset passesQUALITY_DATASET_GATE_SQLnow. Acurrentrow is the row public pages read only while the dataset is public; W9 needs this.not_keyedwithduplicate_keymeans an earlier run with the same inputs holds the derivative.next_after, from the recordings table stored under the derivative's key. The table is read only when the files stand (stored, not past date). The read is bounded atTABLE_READ_MAX_BYTES, the bound reconciliation uses; a larger body is never read. The table is parsed byparseRecordingsTable, and the sorted list is kept in the edge cache under the derivative key. A later page costs one D1 statement and one cache match, with no store read. The cache is consulted only after D1 says the files stand. A succeeded path the quality route would refuse, and every repeat of a duplicate path, is left out and counted asunlisted. An oversize table's body is cancelled, not read.aftermust be a recording path: the quality route'srelativeLocationpattern and a recording name. Anything else, a repeated key or an unknown key isinvalid_query, and the cursor is never echoed. A well-formed cursor the list does not hold pages from where it would sort.shared/contract/compute-admin.ts. The lists are literals for the website's drift tests, and the contract test covers them. The website drift tests pinCOMPUTE_RUN_QUALITY_STATES, so W9 must take the newrun_in_progressword.nemar admin compute pipeline quality <stamp-id> [--after <path>] [--json], plusgetComputeRunQualityinsrc/lib/api/compute.ts.No migration. None of B2b's files (dispatch, launch spec, derivative keying) are touched.
Tests
backend/test/quality-admin-route.test.ts(26 tests) runs on the real admin router, real migrations, real hashed API keys and Miniflare R2. It covers:dataset_public: each term of the gate turns it false and a missing dataset row is false. The concealed case also clearsfirst_published_at, because a trigger forbids a published anonymous dataset; the anonymity term itself is covered by B2's gate tests;test/admin-compute-pipeline-cli.test.ts: three new CLI tests run against the real routes. An empty or overlong cursor (overQUALITY_RECORDING_PATH_MAX) is never sent.bun run typecheckpasses.bun run lintpasses, and Biome is clean on the changed files. Targeted root suites pass:compute-admin-contract,admin-route-inventory,api-export-surfaceandadmin-compute-pipeline-cli, 149 tests. Targeted backend suites pass:quality-admin-route,quality-route,quality-documents,compute-pipeline-grid,oidc-token-allowlist,admin-nonadmin-sweepandadmin-origin-guard, 150 tests. The fullbun testwas not run (epic gate).Mutation run (28 of 28 killed)
Notes for review
/__quality-admin-cache/key, never an answer. ADR 0137's "administrator responses are not cached" holds: every answer isno-store.duplicate_keystamp answersnot_keyedand does not point at the first stamp's derivative, because the statement cannot recompute the key.Next: B3b
Lead ruling: a separate phase after this PR merges, covering only the admin half of #2384. It must meet the reviewer's security points (a) to (f), as relayed by the lead:
(a) a strict
restpattern and pinned GET in W9's proxy, (b) the admin role checked on the caller's own credential, (c) stored and in-date rows only, (d) no write to B2's edge cache (pinned by a mutation), (e) B2's record and file checks kept, and (f) no anonymous-deposit leak.Agentic AI tools were used.