Skip to content

Epic review fixes 1: recovery, cancels, excess - #2099

Merged
neuromechanist merged 12 commits into
feature/issue-2021-epic-compute-usersfrom
feature/issue-2021-epic-fixes-1
Nov 7, 2026
Merged

neuromechanist merged 12 commits into
feature/issue-2021-epic-compute-usersfrom
feature/issue-2021-epic-fixes-1

Conversation

@neuromechanist

@neuromechanist neuromechanist commented Nov 7, 2026 •

Copy link
Copy Markdown
Contributor

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

Finding Fix Test (file: what)
C1 critical: recovering an unverifiable refusal threw away a later cancel or account end a refusal records NO cancel intent (partner_refused_at is its clock); recovery needs no cancel recorded; UNBIND no longer touches the cancel columns, so a re-bind is refused after a person's cancel; recovery and verification re-check the person is active and not deleted in their own statements compute-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-time hold_ended
I1: a report that triggers the recovery answered the stale 409 re-read after carrying the refusal out, continue on the verified path compute-partner-recovery (200 verified; with a cancel recorded still 409)
M1: failed-read counters carried over between bindings reset in BIND_REPORT_SQL, BIND_ADOPT_SQL, UNBIND_SQL and the reaper's withdrawal compute-partner-recovery (the probe, and one test per statement)
M2: recovery races a blind cancel the blind cancel is stamped (partner_cancel_sent_at) by a conditional UPDATE before it is sent; recovery needs the stamp NULL; the request path sends no blind cancel compute-partner-recovery (race injected between the read of the row and the cancel; stamp kept after a failed cancel; request path sends none)
M3: the provisional excess could never be corrected option (a): a job with a Slurm id has its excess written only by the observer's final figure; the provisional settlement only caps the person; a job with no Slurm id keeps the provisional excess (ADR 0118 item 38) compute-partner-final (both paths, the budget counted once, the repair path)
minor: excess gate gated on the person's charge on the hold's pool being exactly the hold compute-partner-final
minor: allowedSchedulerArgs guard refuses gpu/gres/tres tokens in any case, -G, abbreviations of --gpus/--gres/--tres; near neighbors stay allowed compute-partner-allowed-args
minor: RECOVER erased flags it keeps them, as the verifying statement does compute-partner-unverifiable
minor: open count counts only unbound reservations (what the switch freezes) compute-partner-switch
minor: copy see below account-copy-parity is 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.suspend
  • compute_admin.dialog.consequence.revoke
  • compute_admin.result.suspended
  • compute_admin.result.revoked
  • compute_admin.flag.meaning.mismatch

Filed, not changed

The ORCID rule split (the profile-gap matrix versus the compute request) is ADR 0045's: see #2098.

Notes

  • Migration 0134 is edited in place again (two columns: partner_refused_at, partner_cancel_sent_at); it has not been released.
  • ADR 0118 items 34 to 40 and the implementation notes are updated; the ADR 0119 words are unchanged.
  • I2 (release order) is not touched.
  • The commit "Keep a later cancel through a refusal" holds C1, I1, M1 and M2 together because they edit the same statements and share one test file.

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_ended word, the verify-time standing check); each got a test and is killed. One survives by design: the >= 3 bound 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, both tsc, bun run migrations:d1-check clean.

Delta review fixes (second commit series on this branch)

Item Fix Test (file: what)
M-a: a pending job the person cancelled was verified and charged VERIFIED_SQL needs no cancel recorded; a matching job with a cancel recorded is refused as hold_ended, cancelled at Tapis so it stops, and the partner pays compute-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 terms
M-b: a Slurm-id job whose final never comes was capped silently the provisional cap marks the job (flag_overrun, capped_provisional) with one audit row and no ledger entry; the final clears or replaces the word; status count partner_capped_no_final (a week after the end) compute-partner-final, compute-status-route
1 enforce M3 in SQL the provisional excess statement requires no Slurm id in the statement compute-partner-final (concurrent commit injected with raceAfterRead)
2 pin change under bound jobs a write that drops the block or changes the execution system or listed options while bound pending/unverifiable jobs wait is refused, with open and bound named apart compute-partner-switch
3 stamp every cancel of an unverifiable row the readable cancel path stamps partner_cancel_sent_at first compute-partner-recovery
4 standing term of VERIFIED_SQL tested with a hook on the account read compute-partner-recovery
5, 6 option-name check; schema doc comment only the option NAME is judged (--account=progress is fine); --partition-like options are documented as never to be listed (ADR item 41, policy set help); the schema's JSDoc is above the schema compute-partner-allowed-args
7 stale comments corrected n/a
8 cancel_requested for a refused job true until the job ends, in the person's and the administrator's view compute-partner-recovery
9 vacuous test replaced by one that isolates BIND_ADOPT_SQL's reset compute-partner-recovery

New 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.toml lists 0134_compute_partner.sql under "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 NULL term of the overdue-count statement, which is redundant because the final settlement clears or replaces the flag word the statement also requires.

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.
@github-actions

github-actions Bot commented Nov 7, 2026 •

Copy link
Copy Markdown

📦 Package Preview

Your package is ready to test!

bun install -g nemar-cli@PR2099

Version: 0.10.28-PR2099.e3d8f40
Commit: e3d8f40


🤖 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
neuromechanist merged commit 3ba3347 into feature/issue-2021-epic-compute-users Nov 7, 2026
53 of 57 checks passed
@neuromechanist
neuromechanist deleted the feature/issue-2021-epic-fixes-1 branch November 7, 2026 20:01

This branch was previously deployed

1 inactive deployment
npm — e3d8f405 Deployed Nov 7, 2026 by neuromechanist via publish #4338
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