Repository navigation
B5: automatic deny (off, shadow, on) and ready-to-approve mail - #2387
Merged
neuromechanist merged 12 commits intoNov 26, 2026
Merged
neuromechanist merged 12 commits into
neuromechanist merged 12 commits into
Conversation
📦 Package PreviewYour package is ready to test! bun install -g nemar-cli@PR2387Version: 🤖 Updated on each push. |
Contributor
Author
|
Merge gate (lead): head e82c272. Every remote check passes after one rerun of unit-pure shards 2 and 5, which failed on the repull CLI flake (#2377). Review: round 1 panel (code+tests; errors+comments+types) found no path that denies wrongly; 3 important findings (a silent denial-mail failure, confirming runs that did not record confirm_failed, the recipient rule) and 6 more fixed; round 2 delta review resolved all nine items, and its 3 suggestions are fixed in e82c272. The switch PUBLICATION_AUTO_DENY_MODE stays absent (off) and is the owner's; auto-deny-switch-flag.test.ts guards it. |
neuromechanist
merged commit Nov 26, 2026
b781c19
into
feature/issue-2182-epic-pq-decide
50 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.
Part of #2369
Part of #2182
Card B5 of the publication-queue plan: a confirmed review
faildenies a publication request as nemarAdmin (modeon), or records "would deny" (modeshadow), exactly under ADR 0139; the depositor gets a transparent mail; a pass with a clear gate mails the administrators "Ready to approve".What changed
publication_reviewsgainsconfirm_of,auto_deny_stateandauto_deny_at, anddenial_mail_state(sent,failed,fenced) withdenial_mail_attempts. The states:none;would_deny(shadow);denied;capped(past the daily cap, "recommended: deny");not_eligible(the request changed: approval, withdrawal, re-screen, newer request, two earlier automatic denials);disagreed;confirm_failed(the confirming run errored, its dispatch failed or was declined, or the watchdog expired it);no_service_account(nemarAdmin missing, nothing denied);restored(an administrator restored it; that commit is never denied automatically again, and its cap place stays counted); its UNIQUE key becomes a partial unique index over first runs, with a second partial index for one confirming row per first run (rebuild, every row kept).publication_requests.auto_denied(0/1).publication_auto_deny_digestsfor the once-a-day digest claim. Replayed through local D1 (bun run migrations:d1-check,--localonly), and both upserts on the partial indexes checked there.POST /admin/publish/:id/denymoved verbatim toservices/publication-deny.ts(denyPublicationRequest); the route calls it with no extras and keeps its single.run()write, so its answers and its race tests are unchanged. The automatic denial calls the same function with extra guard terms,auto_denied = 1, and the cap claim, the audit row and the claim's take-back in the same batch.shared/publication-auto-deny.ts): one pure function, with the card's conditions;license_lineage_unconfirmed, every screen reason, every infrastructure outcome andsource_license_conflictare never eligible.confirm: { model: claude-sonnet-5-5, effort: max }, only for a confirming row), and the review script calls that model at max (streamed, 64k budget, 12-minute deadline). No change tonemarDatasets/.github. The Worker stores a confirming row's report only on that model and effort, and the confirmation needs the same input digest and prompt version. Confirming runs are left out of the depositor's tally and held by the platform cap.PUBLICATION_AUTO_DENY_MODE(off/shadow/on, anything elseoff, re-read when acting) andPUBLICATION_AUTO_DENY_DAILY_CAP(default 25), both absent fromwrangler-sccn.toml(newauto-deny-switch-flag.test.ts). The cap is one conditional statement, claimed before a deny or would-deny. A lost race (approval in flight, blocked, moved) takes the claim back and recordsnot_eligible.datasets.owner_user_id(maintain) anddataset_collaborators(write, no role column), so that is the requester plus the owner. It goes through the delivery fence, and what became of it is recorded on the review; the daily tick retries a failed mail once, and the digest lists "Denial mail not delivered" with dataset and request. The mail is built from the copy table, the closed codes and both review records (B4'sreproducibilityLines), never from model text. The administrators' mail adds the state's line ("Automated review disagreed", "Recommended: deny", "Would deny"). A pass with gateclearis headed "Ready to approve" and lists the gate, the minimums, the lineage outcome, the four answers and the approve command; gateacknowledgesays "Review passed; the identifier screen still needs an acknowledgment" and quotes the screen's status line. A daily digest of denied, would-deny, capped, disagreed, confirm-failed and service-account-missing rows, production-only, throughgetAdminEmailsForCategory, on the 03:00 tick. It counts first, lists at most 500 and says how many more wait (its window ends at the last row listed), and releases its day claim if anything after the claim throws.POST /admin/publish/:id/restore(admin or owner, audit rowpublication_restore) andnemar admin dataset publish restore <id>.Tests
New:
test/publication-auto-deny.unit.test.ts,backend/test/publication-auto-deny.test.ts,backend/test/auto-deny-switch-flag.test.ts,test/admin-publish-restore-cli.test.ts, and an end-to-end case intest/publication-review-e2e.test.tsthat runs the real workflow steps and job script twice (first run, then confirming run on Sonnet at max, same digest) to a denial. Existing mail tests now expect the pass headline. Ten mutations (anonymous check, widened finding codes, widened mode, shadow denying, cap widened, status guard, earlier-denials check, digest equality, model check, restore's newer-request rule) each turn a named test red.Deviations
denied_reasonholds reason codes (question_failed,steering_attempt), per ADR 0139 decision 2 and so a later review is shown them (previousDenialReasonsOf); the finding codes are in the audit row and the mail.nemar admin dataset publish restore(the card'sadmin repo publishdoes not exist since Epic: admin command tree grouped by object #2307).nemar admin dataset publish license-lineagefor the sources: a stored review keeps the outcome, not the source records.shared/openapi.jsondocuments only the public catalog, so it has no admin route to add.