carlos / platform Public

console tests: split the two slowest so the gate can deal them

They set the CI gate's floor: TestClaimConsoleMutationInvariant (127 s)
and TestDemoClaimUXHeadless (104 s). Neither is clock-bound in a way a
fake clock would fix honestly, so they are split instead; no assertion
changes.

- TestDemoClaimUXHeadless drove 21 scenes in one Chromium; "motion" and
  "fast" took 80 of its 106 s, replaying the claim's real timing (the
  page's 3 s status poll, 650 ms a stage) at two widths, two themes and
  both motion settings. It is now seven top-level tests: the 19 quick
  scenes, fast at 390 and 1280, and motion at each width and theme. The
  browser scripts take optional Widths/Themes to narrow those variants.
  Longest locally: 26.6 s.
- TestClaimConsoleMutationInvariant's probes are their own top-level
  test, TestClaimConsoleMutationInvariantProbes; nothing they find feeds
  the doors' writer check and claimProbeCensus stays in the main test.
- claimCaseParallelism is half the cores, between 8 and 32. Cases sleep
  in quiesce windows (8 at once kept one core busy: 115 s CPU in 106 s),
  so CI's 64 cores run 32; docs-t1 and laptops keep 8.
- test-weights.tsv carries estimates for the new tests until measured.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
claude agent, operated by paul@keymail.dev pushed by paul@keymail.dev d890613a13ab0dfc9edd14bb5529bc87b93ed09c parent a5225f7
5 files changed, +96 −19
  • .amadan/test-weights.tsv +9 −2
  • internal/console/claim_invariant_test.go +24 −9
  • internal/console/demo_claim_ux_test.go +56 −3
  • internal/console/testdata/demo_claim_browser.mjs +3 −3
  • internal/console/testdata/demo_claim_motion.mjs +4 −2
diff --git a/.amadan/test-weights.tsv b/.amadan/test-weights.tsv
index 5965a2528..96baad69e 100644
--- a/.amadan/test-weights.tsv
+++ b/.amadan/test-weights.tsv
@@ -561,19 +561,26 @@ github.com/carlosframework/platform/internal/activator TestAlwaysOnWorkerIgnores
github.com/carlosframework/platform/internal/activator TestHALostLeaseAnswersImmediately 0.25
github.com/carlosframework/platform/internal/activator TestMoveLossFirstInEveryPhase 0.25
github.com/carlosframework/platform/internal/activator TestRootfsHealthBoundIs120Seconds 0.25
-github.com/carlosframework/platform/internal/console TestClaimConsoleMutationInvariant 127.44
-github.com/carlosframework/platform/internal/console TestDemoClaimUXHeadless 103.93
github.com/carlosframework/platform/internal/console TestALapsedWriterCannotOverwriteTheNextWritersRevoke 60.41
github.com/carlosframework/platform/internal/console TestDemoClaimSelectStepUpHeadless 52.24
github.com/carlosframework/platform/internal/console TestRestoreProvenanceSimulation 48.77
github.com/carlosframework/platform/internal/console TestDemoClaimKeptHeadless 42.93
github.com/carlosframework/platform/internal/console TestDemoProtectionsSourceToLimitAndTakedown 42.37
+github.com/carlosframework/platform/internal/console TestClaimConsoleMutationInvariant 40.00
+github.com/carlosframework/platform/internal/console TestClaimConsoleMutationInvariantProbes 40.00
github.com/carlosframework/platform/internal/console TestPolicyWriterLeaseIsOneConsolePerBucket 30.37
+github.com/carlosframework/platform/internal/console TestDemoClaimUXHeadless 26.00
github.com/carlosframework/platform/internal/console TestHACreateCapacityDoors 22.29
github.com/carlosframework/platform/internal/console TestPerfWriteRoutesMeetTheBudget 21.13
github.com/carlosframework/platform/internal/console TestDemoOfflineRetirementHTTP 20.99
github.com/carlosframework/platform/internal/console TestG3StatusReadersRetainUncertainRows 16.13
+github.com/carlosframework/platform/internal/console TestDemoClaimUXHeadlessFast390 16.00
+github.com/carlosframework/platform/internal/console TestDemoClaimUXHeadlessFast1280 16.00
github.com/carlosframework/platform/internal/console TestClaimConsoleMutationInvariantWitnesses 15.01
+github.com/carlosframework/platform/internal/console TestDemoClaimUXHeadlessMotion390Light 15.00
+github.com/carlosframework/platform/internal/console TestDemoClaimUXHeadlessMotion390Dark 15.00
+github.com/carlosframework/platform/internal/console TestDemoClaimUXHeadlessMotion1280Light 15.00
+github.com/carlosframework/platform/internal/console TestDemoClaimUXHeadlessMotion1280Dark 15.00
github.com/carlosframework/platform/internal/console TestRestoreProofPrecedence 12.93
github.com/carlosframework/platform/internal/console TestRestoreProof 11.70
github.com/carlosframework/platform/internal/console TestHACreateCapacityNamedPools 11.37
diff --git a/internal/console/claim_invariant_test.go b/internal/console/claim_invariant_test.go
index 9d00e43f9..d866cdf26 100644
--- a/internal/console/claim_invariant_test.go
+++ b/internal/console/claim_invariant_test.go
@@ -50,6 +50,7 @@ import (
"html"
"net/http"
"reflect"
+ "runtime"
"slices"
"sort"
"strings"
@@ -235,7 +236,12 @@ var claimCoordinators = map[string]string{
// behind by waiting for quiet windows (quiesce). Too many at once starve the
// CPU, and a handler goroutine that misses its window is measured with the
// wrong request; the bound keeps that contention down.
-const claimCaseParallelism = 8
+//
+// The bound is half the cores, between 8 and 32. A case spends most of its
+// time asleep in those windows: 8 at once kept about one core busy
+// (2026-11-10: 115 s of CPU in 106 s). So CI's 64 cores run 32 at once,
+// while a laptop or a shared dev box keeps the 8 this always was.
+var claimCaseParallelism = max(8, min(32, runtime.GOMAXPROCS(0)/2))
// claimParallelCases counts the claim cases running under t.Parallel. A
// fixture that swaps process-wide state (a package variable, the log
@@ -385,14 +391,7 @@ func TestClaimConsoleMutationInvariant(t *testing.T) {
// (claim_invariant_wakereset_test.go).
runClaimLifecycleVariants(t)
- // Reads and nonApp entries are probed with their own valid request on
- // their own console (claim_invariant_probes_test.go): a request the
- // handler turned away is not coverage, and a mutator proves its effect
- // from the world. They run in parallel too, after every door, except the
- // probes marked serial (claimProbe.serial), which run alone first.
- t.Run("probes", func(t *testing.T) {
- runClaimProbes(t, claimFixtures, claimProbes, claimCaseParallelism)
- })
+ // The probes run in TestClaimConsoleMutationInvariantProbes, below.
var unreached []string
for w := range inventory {
@@ -411,6 +410,22 @@ func TestClaimConsoleMutationInvariant(t *testing.T) {
}
}
+// TestClaimConsoleMutationInvariantProbes probes reads and nonApp entries,
+// each with its own valid request on its own console
+// (claim_invariant_probes_test.go): a request the handler turned away is not
+// coverage, and a mutator proves its effect from the world. They run in
+// parallel, except the probes marked serial (claimProbe.serial), which run
+// alone first.
+//
+// They are their own top-level test, not a step of
+// TestClaimConsoleMutationInvariant, so the CI gate can deal them to another
+// shard: the two took about a minute each. Nothing a probe finds feeds the
+// doors' writer check, and claimProbeCensus, which pairs every probe with
+// its fixture, still runs in TestClaimConsoleMutationInvariant.
+func TestClaimConsoleMutationInvariantProbes(t *testing.T) {
+ runClaimProbes(t, claimFixtures, claimProbes, claimCaseParallelism)
+}
+
// claimFixtureCensus compares the registered entries with the fixture table,
// exactly, and checks each fixture is one kind with its reason or door.
func claimFixtureCensus(entries []claimEntry, fixtures map[string]claimFixture) []string {
diff --git a/internal/console/demo_claim_ux_test.go b/internal/console/demo_claim_ux_test.go
index 4973fd63d..d161b94b2 100644
--- a/internal/console/demo_claim_ux_test.go
+++ b/internal/console/demo_claim_ux_test.go
@@ -109,7 +109,56 @@ func TestDemoClaimUXRetryRemainsClosed(t *testing.T) {
}
}
+// demoClaimUXScenes are the headless claim UX scenes, in the order one browser
+// runs them.
+var demoClaimUXScenes = []string{"email", "code", "one", "many", "no-accounts", "new-account", "missing", "missing-link", "disabled", "copying", "starting", "unknown", "stopping", "aborted", "done", "fast", "motion", "expired", "kept", "taken-down", "invalid"}
+
+// The headless claim UX is split across top-level tests so the CI gate can
+// deal them to different shards. The "fast" and "motion" scenes replay the
+// claim's real timing (the page's 3 s status poll, 650 ms a stage) at two
+// widths, two themes and both motion settings, and took 80 s of the 106 s
+// one browser run needed. Each test below runs its own browser over its own
+// fixtures; between them they run every scene and every variant once.
+
func TestDemoClaimUXHeadless(t *testing.T) {
+ var quick []string
+ for _, name := range demoClaimUXScenes {
+ if name != "fast" && name != "motion" {
+ quick = append(quick, name)
+ }
+ }
+ runDemoClaimUXHeadless(t, quick, nil, nil)
+}
+
+func TestDemoClaimUXHeadlessFast390(t *testing.T) {
+ runDemoClaimUXHeadless(t, []string{"fast"}, []int{390}, nil)
+}
+
+func TestDemoClaimUXHeadlessFast1280(t *testing.T) {
+ runDemoClaimUXHeadless(t, []string{"fast"}, []int{1280}, nil)
+}
+
+func TestDemoClaimUXHeadlessMotion390Light(t *testing.T) {
+ runDemoClaimUXHeadless(t, []string{"motion"}, []int{390}, []string{"light"})
+}
+
+func TestDemoClaimUXHeadlessMotion390Dark(t *testing.T) {
+ runDemoClaimUXHeadless(t, []string{"motion"}, []int{390}, []string{"dark"})
+}
+
+func TestDemoClaimUXHeadlessMotion1280Light(t *testing.T) {
+ runDemoClaimUXHeadless(t, []string{"motion"}, []int{1280}, []string{"light"})
+}
+
+func TestDemoClaimUXHeadlessMotion1280Dark(t *testing.T) {
+ runDemoClaimUXHeadless(t, []string{"motion"}, []int{1280}, []string{"dark"})
+}
+
+// runDemoClaimUXHeadless drives the named scenes in one headless Chromium.
+// widths and themes, when set, narrow the fast and motion scenes' variants
+// (testdata/demo_claim_browser.mjs); nil means all of them.
+func runDemoClaimUXHeadless(t *testing.T, names []string, widths []int, themes []string) {
+ t.Helper()
chromium, err := exec.LookPath("chromium")
if err != nil {
t.Skip("no Chromium")
@@ -118,9 +167,13 @@ func TestDemoClaimUXHeadless(t *testing.T) {
if err != nil {
t.Skip("no node")
}
- type scene struct{ Name, URL, Cookie, Session, State, Text string }
+ type scene struct {
+ Name, URL, Cookie, Session, State, Text string
+ Widths []int `json:",omitempty"`
+ Themes []string `json:",omitempty"`
+ }
var scenes []scene
- for _, name := range []string{"email", "code", "one", "many", "no-accounts", "new-account", "missing", "missing-link", "disabled", "copying", "starting", "unknown", "stopping", "aborted", "done", "fast", "motion", "expired", "kept", "taken-down", "invalid"} {
+ for _, name := range names {
s, _, b := claimSigninFixture(t)
s.consoleMail = &fakeConsoleMail{ready: true}
state := "proof"
@@ -221,7 +274,7 @@ func TestDemoClaimUXHeadless(t *testing.T) {
}))
t.Cleanup(ts.Close)
s.cfg.Origin = ts.URL
- scenes = append(scenes, scene{name, ts.URL + "/demo/claim" + suffix, b.cookie, b.session, state, message})
+ scenes = append(scenes, scene{name, ts.URL + "/demo/claim" + suffix, b.cookie, b.session, state, message, widths, themes})
}
encoded, err := json.Marshal(scenes)
if err != nil {
diff --git a/internal/console/testdata/demo_claim_browser.mjs b/internal/console/testdata/demo_claim_browser.mjs
index 14657805c..9a6d43ca4 100644
--- a/internal/console/testdata/demo_claim_browser.mjs
+++ b/internal/console/testdata/demo_claim_browser.mjs
@@ -139,8 +139,8 @@ async function runUX(scenes) {
await until('document.readyState === "complete" && !!document.getElementById("claim")');
assert.equal(await evaluate('document.getElementById("claim").dataset.state'),scene.State,scene.Name);
if (scene.Name === 'motion') {
- await checkClaimMotion(call, evaluate, until, screenshots, scene.URL);
- process.stdout.write('live progress: centred rings/dots/ticks, spin, flowing path, calm breathe, zero CSP violations; 390/1280 light/dark passed\n');
+ await checkClaimMotion(call, evaluate, until, screenshots, scene.URL, scene);
+ process.stdout.write('live progress: centred rings/dots/ticks, spin, flowing path, calm breathe, zero CSP violations; '+(scene.Widths ?? [390,1280]).join('/')+' '+(scene.Themes ?? ['light','dark']).join('/')+' passed\n');
continue;
}
if (scene.Text) {
@@ -205,7 +205,7 @@ async function runUX(scenes) {
}
async function liveMotion(scene) {
- for (const width of [390,1280]) for (const theme of ['light','dark']) for (const motion of ['no-preference','reduce']) {
+ for (const width of scene.Widths ?? [390,1280]) for (const theme of scene.Themes ?? ['light','dark']) for (const motion of ['no-preference','reduce']) {
await call('Emulation.setDeviceMetricsOverride',{width,height:900,deviceScaleFactor:1,mobile:false});
await call('Emulation.setEmulatedMedia',{features:[{name:'prefers-color-scheme',value:theme},{name:'prefers-reduced-motion',value:motion}]});
await call('Page.navigate',{url:scene.URL+'?replay=1'});
diff --git a/internal/console/testdata/demo_claim_motion.mjs b/internal/console/testdata/demo_claim_motion.mjs
index 13785b3f5..a38924cfd 100644
--- a/internal/console/testdata/demo_claim_motion.mjs
+++ b/internal/console/testdata/demo_claim_motion.mjs
@@ -45,14 +45,16 @@ const motionState = `(() => {
};
})()`;
-export async function checkClaimMotion(call, evaluate, until, screenshots, url) {
+// only.Widths and only.Themes narrow the run to some of the variants, so the
+// Go side can split them across tests; absent, every variant runs.
+export async function checkClaimMotion(call, evaluate, until, screenshots, url, only = {}) {
// Change the fixture's operation, then let the real status endpoint and page
// script advance the UI. Never manufacture the state attributes in the test.
const phase = async value => {
const response = await fetch(new URL('/__test_claim_phase?phase='+value, url), {method:'POST'});
assert.equal(response.status, 204);
};
- for (const width of [390,1280]) for (const theme of ['light','dark']) for (const motion of ['no-preference','reduce']) {
+ for (const width of only.Widths ?? [390,1280]) for (const theme of only.Themes ?? ['light','dark']) for (const motion of ['no-preference','reduce']) {
await call('Page.navigate', {url:'about:blank'});
await phase('future-phase');
await call('Emulation.setDeviceMetricsOverride', {width,height:900,deviceScaleFactor:1,mobile:false});