Repository navigation
Epic review fixes 1: recovery, cancels, excess - #2099
Merged
neuromechanist merged 12 commits intoNov 7, 2026
Merged
neuromechanist merged 12 commits into
neuromechanist merged 12 commits into
Conversation
A refusal no longer writes cancel_requested_at or cancel_reason (partner_refused_at is its clock), so a person's, an administrator's or an account-end cancel recorded after it survives a recovery or a re-binding; recovery and verification re-check the person's standing in their own statements, the request path sends no blind cancel and a blind cancel is stamped before it is sent (partner_cancel_sent_at) which forbids a recovery, a report that triggers a recovery is answered verified, and the failed-read counters reset at every binding. Tests: compute-partner-recovery (mutation-checked).
The provisional settlement only caps the person at the hold for a job with a Slurm id; the observer's final figure writes the partner's excess, and a job with no Slurm id keeps the provisional excess. The excess entry is gated on the person's charge being exactly the hold. Tests: compute-partner-final (mutation-checked).
allowedSchedulerArgs refuses any gpu, gres or tres token in any case, -G, and abbreviations of --gpus, --gres and --tres, with a test of near neighbors that stay allowed. The count in partner_reservations_open names only what the switch freezes (unbound reservations). Tests: compute-partner-allowed-args, compute-partner-switch (mutation-checked).
The suspend and revoke consequences and results now say an unreported partner reservation is left to expire, and the mismatch flag meaning covers partner refusals and capped excess. Changed keys: compute_admin.dialog.consequence.suspend, .revoke; compute_admin.result.suspended, .revoked; compute_admin.flag.meaning.mismatch. Parity with the website copy is a follow-up (already red on this branch).
ADR 0118 items 34 to 40 (a refusal records no cancel intent, recovery conditions, the counters, who writes the excess) and the implementation notes. Documentation only.
📦 Package PreviewYour package is ready to test! bun install -g nemar-cli@PR2099Version: 🤖 Updated on each push. |
VERIFIED_SQL needs no cancel recorded; verifyBoundJob refuses a matching job with a cancel recorded (or an ended person) as hold_ended, and the caller cancels it at Tapis so it stops and the partner pays. Tests: compute-partner-recovery, including the person-cancel and suspend/re-grant cases and races on the verifying statement's own cancel and standing terms (mutation-checked).
The readable cancel path stamps partner_cancel_sent_at before it is sent, as the blind one does, and sends nothing if a recovery committed first. Test: compute-partner-recovery (mutation-checked).
The provisional excess statement requires no Slurm id in the statement itself, so a commit built from a stale record cannot write an excess the final settlement could never correct. Test: compute-partner-final with a concurrent commit injected after the cap is decided (mutation-checked).
A partner job with a Slurm id capped at its hold is marked (flag_overrun, partner_flag capped_provisional) with one audit row and no ledger entry; the final settlement clears or replaces the word; the status view counts capped jobs whose final is a week overdue (partner_capped_no_final). Tests: compute-partner-final, compute-status-route (mutation-checked).
A write that drops the partner block, or changes its execution system or listed scheduler options, while bound pending or unverifiable jobs wait is refused with the bound count named apart from the open count, unless forced. Tests: compute-partner-switch (mutation-checked).
schedulerOptionNamesGpus looks at the option name only, so values such as --account=progress are allowed while gpu, gres, tres names, -G and abbreviations stay refused; the schema's doc comment is back above the schema; the policy set help and ADR 0118 items 41 to 44 say which scheduler options an owner must never list. Tests: compute-partner-allowed-args (mutation-checked).
cancel_requested reads true in the person's and the administrator's job view while a refused partner job (partner_refused_at set) has not ended, as it did before a refusal stopped recording a cancel intent; stale comments about a refusal's cancel intent are corrected; the vacuous adoption-reset test is replaced by one that isolates BIND_ADOPT_SQL's reset. Tests: compute-partner-recovery (mutation-checked).
neuromechanist
merged commit Nov 7, 2026
3ba3347
into
feature/issue-2021-epic-compute-users
53 of 57 checks passed
2 tasks
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.
Fixes from the epic-level review (Opus, whole branch) of phase D4's second-round code. Targets the epic branch; not merged.
Findings and the tests that kill them
unverifiablerefusal threw away a later cancel or account endpartner_refused_atis its clock); recovery needs no cancel recorded;UNBINDno longer touches the cancel columns, so a re-bind is refused after a person's cancel; recovery and verification re-check the person isactiveand not deleted in their own statementscompute-partner-recovery: person cancel, cascade of a suspended, a revoked and a deleted account after the refusal; revoked without a cascade; UNBIND then cancel then re-bind; verify-timehold_endedcompute-partner-recovery(200 verified; with a cancel recorded still 409)BIND_REPORT_SQL,BIND_ADOPT_SQL,UNBIND_SQLand the reaper's withdrawalcompute-partner-recovery(the probe, and one test per statement)partner_cancel_sent_at) by a conditional UPDATE before it is sent; recovery needs the stamp NULL; the request path sends no blind cancelcompute-partner-recovery(race injected between the read of the row and the cancel; stamp kept after a failed cancel; request path sends none)compute-partner-final(both paths, the budget counted once, the repair path)compute-partner-finalallowedSchedulerArgsguardgpu/gres/trestokens in any case,-G, abbreviations of--gpus/--gres/--tres; near neighbors stay allowedcompute-partner-allowed-argscompute-partner-unverifiableopencountcompute-partner-switchaccount-copy-parityis red on this branch already (the website copy follows)Kept as the review asked: the report route's refusal of a recovered job is no longer a refusal; the failure of a blind cancel keeps its stamp because every failure of a mutating Tapis call has an unknown outcome (a consequence: a refusal whose blind cancel already failed is not recovered later; it is ended).
Copy keys changed (for the website transcription PR)
All in
shared/contract/account-copy.ts; values only, no key added or removed:compute_admin.dialog.consequence.suspendcompute_admin.dialog.consequence.revokecompute_admin.result.suspendedcompute_admin.result.revokedcompute_admin.flag.meaning.mismatchFiled, not changed
The ORCID rule split (the profile-gap matrix versus the compute request) is ADR 0045's: see #2098.
Notes
partner_refused_at,partner_cancel_sent_at); it has not been released.Mutation results
25 distinct mutants across the new guards. 7 survived the first pass because the fixtures did not isolate the guard (the recovery guards were hidden by the blind-cancel stamp, the counter resets only showed where a verification also resets them, the stamp check, the
hold_endedword, the verify-time standing check); each got a test and is killed. One survives by design: the>= 3bound of the abbreviation check (only the bare string--differs, which is not a scheduler option and not a GPU one).Tests run (targeted, by file; the full suite is not run)
Backend: compute-partner-{credentials,holds,report,release,unverifiable,final,logs,files,scheduler,allowed-args,switch,move-charge,migration,recovery}, compute-hold-reaper, -ledger-budget, -records, -observer, -sweep, -status-route, -policy-routes, -route-inventory, -source-scan, cron-sweep-wiring, oidc-token-allowlist, compute-lifecycle, -lifecycle-money, -e2e, -jobs, -read-jobs, -access-cascade, -job-callbacks. Root: compute-partner-e2e.integration, admin-compute-move-charge-cli, admin-compute-cli, api-export-surface, ci-tier-routing, compute-admin-contract, contract-schemas.
bun run lint, bothtsc,bun run migrations:d1-checkclean.Delta review fixes (second commit series on this branch)
pendingjob the person cancelled was verified and chargedVERIFIED_SQLneeds no cancel recorded; a matching job with a cancel recorded is refused ashold_ended, cancelled at Tapis so it stops, and the partner payscompute-partner-recovery: person cancel while pending; suspend then re-grant before the tick; the report that finds a cancel; races on the statement's own cancel and standing termsflag_overrun,capped_provisional) with one audit row and no ledger entry; the final clears or replaces the word; status countpartner_capped_no_final(a week after the end)compute-partner-final,compute-status-routecompute-partner-final(concurrent commit injected withraceAfterRead)pending/unverifiablejobs wait is refused, withopenandboundnamed apartcompute-partner-switchpartner_cancel_sent_atfirstcompute-partner-recoveryVERIFIED_SQLcompute-partner-recovery--account=progressis fine);--partition-like options are documented as never to be listed (ADR item 41,policy sethelp); the schema's JSDoc is above the schemacompute-partner-allowed-argscancel_requestedfor a refused jobcompute-partner-recoveryBIND_ADOPT_SQL's resetcompute-partner-recoveryNew status key (open record, no contract change):
attention.partner_capped_no_final. New flag word and audit actions:capped_provisional,compute.partner.provisional_capped. Tightened policy validation could make a stored policy unreadable; no stored policy lists any scheduler option today.Owner check before epic to dev
Migration 0134 is edited in place.
bunx cfman wrangler --account sccn d1 migrations list nemar-db-dev --remote --env dev -c backend/wrangler-sccn.tomllists0134_compute_partner.sqlunder "Migrations to be applied", so it is not applied on the development database (checked now). The production database was NOT checked: the owner should run the same command for it before the epic branch merges to dev; if 0134 were applied anywhere, the two newest columns need a new migration instead.Mutations of this series: 32 mutants run, 31 killed (two survived the first pass and got tests). One survives, by design: the
settled_final_at IS NULLterm of the overdue-count statement, which is redundant because the final settlement clears or replaces the flag word the statement also requires.