Repository navigation
feat(campaign): the ceiling verbs — a target system's or the global ceiling changed live, audited, from the API or the governor (R3-S9, #318) - #581
Conversation
…eiling changed live, audited, from the API or the governor (R3-S9, #318) Campaign R3.2 part b and admin-contract R4.5 (slice R4-S6). - GoldpathCampaignAdminService: GetCeilingsAsync, ThrottleCeilingAsync and GetCeilingAuditAsync, with GoldpathCampaignCeilingInfo and GoldpathCampaignCeilingPatch (the RFC's API block, additions only). - Four routes under the campaign mount: GET /ceilings, POST /ceilings/global/throttle, POST /ceilings/target-systems/{name}/throttle, GET /ceilings/audit. Viewer reads, operator changes (R4.1); the route freeze gains the four lines. - A change is an update guarded on the value read (re-read on a lost race), or an insert carrying the code seed before the leader seeds the row; it is audited with CampaignId = Guid.Empty, action "ceiling", actor, old -> new. - Refused in words: a cleared target system, an undeclared name (the declared ones named), a value below 1, a patch naming both or neither. - The governor shows the target-system ceiling that binds a campaign and edits it; runbook item 15. - S-FLEET-03 extended on RabbitMQ + PostgreSQL (CampaignCeilingVerbTests). Closes #318 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018AFdNb6HPHypNiQbkaNAxH
| var detail = $"{subject}: MaxTps {DescribeTps(before)} -> {DescribeTps(target)}"; | ||
| await AuditAsync(db, Guid.Empty, "ceiling", who, Bound(detail, 1024), ct); | ||
| _logger.LogInformation("Campaign ceiling {Kind} '{Name}': {Before} -> {After} by {Actor}.", | ||
| kind, name, DescribeTps(before), DescribeTps(target), who); |
|
CI on
Generated by Claude Code |
Verifier verdict (run 2026-11-14)Verdict: changes requested. 1 MAJOR, 2 MINOR, 3 NIT. The core of the slice is sound. The verbs, refusals, authZ split, routes and pacer binding all reproduce, and every plant I ran goes red. One documented behaviour is untrue, though: "setting the code value back hands the row back to code" fails as soon as code changed while the row was moved.
Steps 1–6
Deep review
Edge-case probes (mine, throwaway, nothing pushed)
Findings
NITs (optional)
What I could not run
Generated by Claude Code |
…me is refused at declaration, the verb fact waits on samples (R3-S9, #318) Verifier findings on 2026-11-14: - MAJOR 1: setting a ceiling to the current code value now resets the row's seed to that value as well, so MaxTps == SeedMaxTps and the next release is followed even when code changed while the operator held the row. The guarded update also compares the seed it read. SettingTheCodeValueBack_AfterCodeMoved_HandsTheRowBackToCode (target system and global) and step 6 of CampaignCeilingProof (PostgreSQL and Oracle) are red without it. - MINOR 1: AddTargetSystem refuses a name containing '/', because ASP.NET Core leaves %2F encoded in a route value and the name could be listed but never changed. A name the console escapes otherwise ('çekirdek İ a%b') is proven to reach the verb over HTTP. - MINOR 2: CampaignCeilingVerbTests keeps its fixed windows as minimums and then waits until enough releases were sampled, rather than failing its sample-count guards when the slices start late under load. - NIT 2: the ceiling audit row is stamped with the instant the change applied (the row's UpdatedAt). Runbook item 15, the preview.10 upgrade guide and the CHANGELOG entry say the same. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018AFdNbaFtJ7VPJp83KV9Jh
|
Addressed verifier findings: MAJOR 1 (hand-back after code moved), MINOR 1 (a What changed
Evidence
Pre-PR self-check (the whole PR as it now stands)
Not run here: the console smoke and axe. No UI file changed. Generated by Claude Code |
Verifier verdict (run 2026-11-14, daytime)Head verified: Verdict: changes requested. 0 BLOCKER, 1 MAJOR, 0 MINOR, 2 NIT. The morning's findings are fixed and each one's red proof reproduces:
Mutation-testing the new seed rule found a sibling defect, though, and this one silently reverts an operator's value within one leader slice, with no deploy at all. Finding1. MAJOR: an operator value that equals the row's stale seed reads as "never moved", so the leader's next slice overwrites it with the code value.
NITs (optional)
Steps 1–6
Deep review (delta)
Edge-case probes (throwaway facts and mutants, removed;
|
| # | Probe | Result |
|---|---|---|
| P1 | 200 → op 100 → release 300 → op 200 → reconcile the same release | FAIL: the row becomes 300 by system (finding 1). Green with seed = code. |
| P2 | Global off by code → op 700 → op clear → release seeds 500 | ✓ (null,null), then (500,500) |
| P3 | Declared ., .. and a?b#c, POSTed through the route with Uri.EscapeDataString |
a?b#c ✓ 200. . and .. 404 (NIT 1) |
| M2 | && c.SeedMaxTps == readSeed removed |
survives, 71/71 (NIT 2) |
| M5 | seed = code unconditionally |
survives, 542/542; it is the fix for finding 1 |
Not run: a full mutation-gate.sh Goldpath.Campaign run, and the console smoke. No UI file changed in the delta.
Labels: changes-requested stays. Not agent-verified. Tier C: the owner merges after the fix.
Generated by Claude Code
… the seed, so an operator value equal to a stale seed is not reverted (R3-S9, #318) Verifier findings on 2026-11-14 (daytime): - MAJOR 1: the verb kept the stale seed for any value other than code, so an operator value that happened to equal it (200 -> 100, release 300, operator sets 200) read as "never moved" and the leader's next slice of the same release replaced it with 300 by "system". The seed is now always the code value the verb ran against, as the insert path records it: the code value hands the row back, any other value stays moved. AnOperatorValueEqualToTheStaleSeed_StaysMoved_... (target system and global) is red on the previous rule; CampaignCeilingProof step 5 now expects (25, 400) on PostgreSQL and Oracle and is red on it. The seed half of the update's guard is dropped: the seed it read plays no part in what it writes, and the leader's follow always moves MaxTps. - NIT 1: AddTargetSystem refuses a name made only of dots ('.', '..'), which the request path normalises away. Runbook item 15, the preview.10 upgrade guide and the CHANGELOG say the same. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018AFdNbvMcH62PfA1a9ugqU
|
Addressed verifier findings: MAJOR 1 (an operator value equal to the stale seed reverted by the leader), NIT 1 ( What changed
Evidence
ReproducePre-PR self-check (this delta)
Not run here: the console smoke and axe (no UI file changed), and a full Generated by Claude Code |
Verifier verdict (run 2026-11-16)Head verified: Verdict: verified. 0 BLOCKER, 0 MAJOR, 0 MINOR, 0 NIT. The 2026-11-14 daytime findings are fixed, and each red proof reproduces:
The earlier rounds' findings remain fixed: the hand-back after code moved, the Steps 1–6
Deep review (the delta, with the whole verb re-read)
Edge-case probes (throwaway facts, removed; nothing pushed)
Not run: a full Labels: Owner: safe to merge. Summary: operators can now change a target system's ceiling, or the global one, live from the admin API or the console governor, and every change is audited. The operator's value stands across deploys until they set it back to the code value, which hands it back to code. Generated by Claude Code |
What and why
This is Campaign R3-S9 (#318), which is also admin-contract R4-S6 (R4.5). R3-S8 (#290) made target-system ceilings rows the pacer reads every tick, but only a database edit could change one. This PR adds the audited verb an operator uses during an incident, the four routes R4.5 writes, the governor screen that shows and edits the ceiling binding a campaign, a runbook item, and S-FLEET-03 extended on a real broker.
GetCeilingsAsync: the global row (*), then every declared target system by name. Each carries its livemaxTps(the pacer's reading: an unseeded row or a NULL target row reads as code, below zero reads as 0),codeMaxTps, the types it binds, andupdatedAt/updatedBy. A row left by a system no longer declared is not listed.ThrottleCeilingAsync(kind, name, patch, actor, ct):GoldpathCampaignAuditrow:CampaignId = Guid.Empty, actionceiling, the actor (bounded to 256), detailtarget system 'x': MaxTps 200/s -> 100/s.GetCeilingAuditAsync(take): ceiling rows only, newest first (ties broken by id).*.GET /ceilings,POST /ceilings/global/throttle,POST /ceilings/target-systems/{name}/throttle,GET /ceilings/audit?take=. They sit in the campaign group, so the all-tenants filter and R4.1's split apply unchanged. An undeclared name answers400, not404.RouteContractTestsgains the four lines, and the contract inventory gains two rows./ceilingsshows "not available from this server", never a number.AddTargetSystem("device-core", 50)and aconfig-pushtype naming it.A note on the issue's "red on
main(two type buckets sum above the system's rate)". #290 has since landed the shared bucket onmain, so onmainthe new integration test is red only because the verb does not exist. The two-buckets world is planted below as fault P2 instead, and it goes red.Reproduce
I ran every plant (U1–U3, P1, P2, C1) and saw each go red as described. With the code restored, everything is green. (The console smoke here ran with
PLAYWRIGHT_BROWSERS_PATHpointed at the sandbox's preinstalled Chromium 1243, because the pinned Playwright 1.64.1 asks for build 1248. That is an environment detail; no repo change.)Acceptance criteria (#318), with evidence
Admin service:
GetCeilingsAsync(kind, name, live and code values, bound types, updated at/by),ThrottleCeilingAsync(kind, name, patch, actor, ct),GetCeilingAuditAsync, following R3.2's block, additions only.PublicAPI.Unshipped.txtcarries exactly the RFC's lines plus the members the two records synthesize. Proof:R3TargetSystemTests(TheCeilingsList_…,Throttling…_AuditsOldToNew,TheGlobalCeiling_IsSetAndSwitchedOff, …).The routes follow admin-contract R4 (the four proposed);
RouteContractTestsupdated in the same PR. Mapped as R4.5 writes them. Proof:RouteContractTests, plusTheCeilingRoutes_BindTheNameAndTheBody_AndAnUndeclaredNameAnswers400over TestServer.Every change writes a
GoldpathCampaignAuditrow withCampaignId = Guid.Empty, actionceiling, the actor and old → new. Proof: the unit facts, plus the PostgreSQL/Oracle scenario step 5 andCampaignCeilingVerbTestson a real broker.Clearing only on the global row; a target system without a ceiling is refused with teaching text. Proof:
ATargetSystemIsNeverCleared_AndTheRefusalSaysToSetAHighNumber, and the HTTP fact (400).The console governor shows the ceiling that binds a campaign and edits it; the vitest floor and axe hold. Proof:
CampaignPanel.test.tsx(5 new facts) andadminClient.test.ts;pnpm test339 green with coverage at 98.11 / 91.18 / 97.73 / 99.07 against the 97/85/75/97 floors; the console smoke'scampaign R3.2: …journey and the…target-system ceiling has no serious accessibility violationaxe scan, both green (52/52).A runbook item covers changing a target-system ceiling during an incident.
ops/runbooks.mditem 15.Proof, S-FLEET-03 extended on Testcontainers RabbitMQ + PostgreSQL, strict ceiling:
Green 4 of 4 runs; red with P1 and P2.
CampaignCeilingVerbTests.A viewer reads
/ceilingsand is refused the verb (R4.5's own proof).AdminReadRoleSurfaceTestsenumerates every campaign route, so the four new ones are covered: the viewer reads/ceilingsand/ceilings/auditwith 200, and both POSTs answer the worded 403 envelope. Green 4/4.Pre-PR self-check
[Unreleased];docs/rfc/README.mdindex row (landed: R3-S8, R3-S9, R3-S10; not yet: Campaign R3-S11 (R3.6b): S-OPS-03 on a real broker, the suspended view in the console, R3 closed #319);ga-gate-status.mdG10a row (S-FLEET-03 extended). Nothing was edited ingoldpath-ga-readiness.md;stryker/README.md(the scoped run).///block and its declaration (re-read every hunk).Dictionaryorder.{ maxTps?, clearMaxTps? }, both optional and refused when both or neither is named;takedefaults to 100, clamped byAdminPaging.Category=Benchand runs in thequartz-process-globalscollection likeCampaignR1Tests.OpsRead/Opssplit and the all-tenants filter (AdminReadRoleSurfaceTests). Input is bounded: the name appears in a refusal truncated to 128 (WithNoSystemDeclared_…AHugeNameIsBoundedInIt, a 5,000-char name), and the actor is truncated to the 256 columns (ALongActor_IsBoundedToTheColumns). EF parameterizes everything; no raw SQL. No new dependency. The logs carry the actor principal, as every campaign verb's log already does, and no secrets.ArgumentNullException), null/empty/case-variant name, 0/−1, both/neither, NULL target row, negative row (reads 0, as the pacer binds it), a system literally named*, global off → on (the NULL guard, on SQLite, PostgreSQL and Oracle), and tr-TR (names are ordinal; the engine's existing tr-TR fact covers the declaration).AChangeThatLandsBetweenTheReadAndTheUpdate_…), every update raced (AVerbThatLosesEveryRace_…: 8 attempts, nothing applied, no audit row), the leader winning the insert (AnInsertThatMeetsTheLeadersRow_…), and an insert refused for another reason (AnInsertRefusedForAnotherReason_…: it surfaces after one re-read).take-clamped.stryker/README.md.Gates run
./scripts/docs-freshness.sh,ledger-check.sh(no authenticated gh here, so it skipped honestly),schema-honesty.sh,skills-parity.sh,template-pins.sh: all exit 0.dotnet build Goldpath.sln -c Release: 0 warnings, 0 errors.dotnet format whitespace --verify-no-changesis clean on the touched projects.Goldpath.Campaign.Tests: 535/535.CampaignCeilingVerbTests,CampaignCeilingProof,CampaignCeilingOracleProof(Oracle Free 23.26 slim, re-run on the committed head),CampaignR1Tests(its tick-window helper is nowinternal staticand shared) andAdminReadRoleSurfaceTests: all green.tsc --noEmitclean,pnpm test339 green with the floors held,scripts/console-smoke.sh52 passed.What I could not verify
mutation-gate.sh Goldpath.Campaignrun. Diff mode took ~114 minutes for R3-S8, so I ran the span-scoped run above instead, and the package table row is unchanged.GoldpathCampaignAdminService.cs,CampaignPanel.tsxandRouteContractTests.cs. This branch is cut frommain@58589e1without it. Whichever of the two lands second merges the other in; the overlaps are additive (new methods, new routes, new panel sections).Closes #318
Generated by Claude Code