diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f9498ebe45..495e02ce18 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -58,20 +58,23 @@ concurrency: jobs: # Three-layer CI (#3295) plan: decide the matrix scope BEFORE paying for # legs. One cheap ubuntu job picks one of three scopes: - # core — every PR (push) and master push: 9 test legs (all three combos at - # /3 shards: ubuntu 22, ubuntu 24, windows 22 — #4351 rebalance) + 2 + # core — every PR (push) and master push: 11 test legs (ubuntu 22/24 at + # /3, windows 22 at /5 — #4351 rebalance, then duration-weighted + # re-shard below) + 2 # static legs (ubuntu 24, windows 22 — #3406 item 8: the windows # static leg keeps typecheck/build + the kernel/pi-subagents # suites covered on windows for EVERY PR, not only ci:full/nightly). - # The blocking layer. master's required-checks list still carries - # the legacy 12 FULL-matrix leg names; core produces 9 of them (the - # win node-24 legs appear only in FULL scope), enforce_admins off. + # The blocking layer. master's required-checks list still carries + # the legacy 12 FULL-matrix leg names; core produces 11 of the 16 + # current names (windows node-24 legs appear only in FULL scope), + # and the four NEW windows shard-4/5 names must be added to branch + # protection before they gate merges, enforce_admins off. # full — `ci:full` label on a PR, a release PR (#3688: bot-authored # one-click fallback PRs, *_release-v* head branches, or a # "[PR] release…"/"release vN…" title — no label needed), # workflow_dispatch full=true, or the 30-min - # cron when master moved since the last green scheduled run: the - # historical 12-leg test matrix + 4-leg static-gates. + # cron when master moved since the last green scheduled run: the + # full 16-leg test matrix + 4-leg static-gates. # skip — a `labeled` event for a label other than ci:full, or a cron tick # where master HEAD == the last green scheduled run's head: nothing # to do, every dependent job skips (run concludes success so the @@ -115,10 +118,13 @@ jobs: # core shape stayed frozen at its ~650-file design point (#3295), so # its heaviest legs became the wall-clock floor: the ubuntu-24 # single-leg whole suite measured ~21 min and the windows 2-shard - # halves ~13-17 min (up to ~35 min tails on flake re-runs). All three - # combos now shard /3: partitionAll stays total for any i/N, so - # union of shards == every file — zero coverage loss; wall drops to - # the slowest shard (~7-12 min). The win node-24 legs stay FULL-only. + # halves ~13-17 min (up to ~35 min tails on flake re-runs). The + # combos now shard /3 on ubuntu and /5 on windows (duration-weighted + # re-balance: line-count LPT balanced bytes, not seconds — see + # scripts/ci-shard-partition.mjs): partitionAll stays total for any + # i/N, so union of shards == every file — zero coverage loss; wall + # drops to the slowest shard (~7 min windows target). The windows + # node-24 legs stay FULL-only. CORE_TEST='{"include":[ {"os":"ubuntu-latest","node-version":22,"shard":1,"shardTotal":3}, {"os":"ubuntu-latest","node-version":22,"shard":2,"shardTotal":3}, @@ -126,9 +132,11 @@ jobs: {"os":"ubuntu-latest","node-version":24,"shard":1,"shardTotal":3}, {"os":"ubuntu-latest","node-version":24,"shard":2,"shardTotal":3}, {"os":"ubuntu-latest","node-version":24,"shard":3,"shardTotal":3}, - {"os":"windows-latest","node-version":22,"shard":1,"shardTotal":3}, - {"os":"windows-latest","node-version":22,"shard":2,"shardTotal":3}, - {"os":"windows-latest","node-version":22,"shard":3,"shardTotal":3}]}' + {"os":"windows-latest","node-version":22,"shard":1,"shardTotal":5}, + {"os":"windows-latest","node-version":22,"shard":2,"shardTotal":5}, + {"os":"windows-latest","node-version":22,"shard":3,"shardTotal":5}, + {"os":"windows-latest","node-version":22,"shard":4,"shardTotal":5}, + {"os":"windows-latest","node-version":22,"shard":5,"shardTotal":5}]}' CORE_STATIC='{"include":[{"os":"ubuntu-latest","node-version":24},{"os":"windows-latest","node-version":22}]}' FULL_TEST='{"include":[ {"os":"ubuntu-latest","node-version":22,"shard":1,"shardTotal":3}, @@ -137,12 +145,16 @@ jobs: {"os":"ubuntu-latest","node-version":24,"shard":1,"shardTotal":3}, {"os":"ubuntu-latest","node-version":24,"shard":2,"shardTotal":3}, {"os":"ubuntu-latest","node-version":24,"shard":3,"shardTotal":3}, - {"os":"windows-latest","node-version":22,"shard":1,"shardTotal":3}, - {"os":"windows-latest","node-version":22,"shard":2,"shardTotal":3}, - {"os":"windows-latest","node-version":22,"shard":3,"shardTotal":3}, - {"os":"windows-latest","node-version":24,"shard":1,"shardTotal":3}, - {"os":"windows-latest","node-version":24,"shard":2,"shardTotal":3}, - {"os":"windows-latest","node-version":24,"shard":3,"shardTotal":3}]}' + {"os":"windows-latest","node-version":22,"shard":1,"shardTotal":5}, + {"os":"windows-latest","node-version":22,"shard":2,"shardTotal":5}, + {"os":"windows-latest","node-version":22,"shard":3,"shardTotal":5}, + {"os":"windows-latest","node-version":22,"shard":4,"shardTotal":5}, + {"os":"windows-latest","node-version":22,"shard":5,"shardTotal":5}, + {"os":"windows-latest","node-version":24,"shard":1,"shardTotal":5}, + {"os":"windows-latest","node-version":24,"shard":2,"shardTotal":5}, + {"os":"windows-latest","node-version":24,"shard":3,"shardTotal":5}, + {"os":"windows-latest","node-version":24,"shard":4,"shardTotal":5}, + {"os":"windows-latest","node-version":24,"shard":5,"shardTotal":5}]}' FULL_STATIC='{"include":[ {"os":"ubuntu-latest","node-version":22}, {"os":"ubuntu-latest","node-version":24}, diff --git a/scripts/ci-shard-partition.d.mts b/scripts/ci-shard-partition.d.mts new file mode 100644 index 0000000000..0cf2f49b5c --- /dev/null +++ b/scripts/ci-shard-partition.d.mts @@ -0,0 +1,8 @@ +interface ShardWeights { + msPerLineFallback: number; + files: Record; +} + +export function lineCount(rel: string): number; +export function fileWeight(rel: string, table?: ShardWeights): number; +export function partitionAll(files: string[], n: number, table?: ShardWeights): string[][]; diff --git a/scripts/ci-shard-partition.mjs b/scripts/ci-shard-partition.mjs new file mode 100644 index 0000000000..d43e90ed29 --- /dev/null +++ b/scripts/ci-shard-partition.mjs @@ -0,0 +1,58 @@ +// Shard partitioning with MEASURED-duration weights (#4360). +// +// Line-count LPT balanced bytes, not seconds: process-spawning suites +// (node child per case) cost orders of magnitude more per line than pure +// assertion files, and the line-count layout piled several of them into one +// shard (5-way split ran 5min..37min legs from a "perfectly balanced" 48.9K +// lines/shard). Weight = last measured wall-clock ms per file +// (scripts/ci-shard-weights.json, regenerated by +// scripts/measure-test-durations.mjs); files missing from the table fall +// back to lineCount * msPerLineFallback so a NEW file still gets a sane +// first-run weight. The partition stays DETERMINISTIC and TOTAL: fixed +// weights => same bins every run, and every file lands in exactly one bin. +import { readFileSync } from "node:fs"; +import { dirname, join } from "node:path"; +import { fileURLToPath } from "node:url"; + +const ROOT = dirname(dirname(fileURLToPath(import.meta.url))); + +let defaultTable = { msPerLineFallback: 15, files: {} }; +try { + const raw = JSON.parse(readFileSync(join(ROOT, "scripts", "ci-shard-weights.json"), "utf8")); + if (typeof raw?.msPerLineFallback === "number" && raw?.files && typeof raw.files === "object") { + defaultTable = raw; + } +} catch { + // absent/malformed table => pure line-count fallback (old behavior) +} + +export function lineCount(rel) { + try { + return Math.max(1, readFileSync(join(ROOT, rel), "utf8").split("\n").length); + } catch { + return 1; + } +} + +export function fileWeight(rel, table = defaultTable) { + const measured = table.files[rel]; + if (typeof measured === "number" && measured > 0) return measured; + return Math.round(lineCount(rel) * (table.msPerLineFallback || 15)); +} + +// LPT bin-packing over fileWeight: sort desc (ties by path asc), assign each +// file to the currently-lightest bin (lowest index breaks ties). Targets the +// HEAVIEST shard (the wall clock), not equal file counts. +export function partitionAll(files, n, table = defaultTable) { + const weight = (f) => fileWeight(f, table); + const order = [...files].sort((a, b) => weight(b) - weight(a) || (a < b ? -1 : a > b ? 1 : 0)); + const bins = Array.from({ length: n }, () => []); + const load = new Array(n).fill(0); + for (const f of order) { + let best = 0; + for (let k = 1; k < n; k++) if (load[k] < load[best]) best = k; + bins[best].push(f); + load[best] += weight(f); + } + return bins; +} diff --git a/scripts/ci-shard-weights.json b/scripts/ci-shard-weights.json new file mode 100644 index 0000000000..71a305ff15 --- /dev/null +++ b/scripts/ci-shard-weights.json @@ -0,0 +1,852 @@ +{ + "v": 1, + "platform": "linux", + "note": "measured 2026-10-23 post-#4380 (closeAllConnections linger cut), node --test single-file, VM; ms are wall time incl. spawn; rc=124 files capped at 150000 (local-env hangs, CI completes them); rc=1 local env-fails excluded", + "msPerLineFallback": 4, + "timedOut": [ + "tests/dsh-native.test.ts", + "tests/dsh-settings-ui.test.ts" + ], + "files": { + "tests/accept-encoding-restrict.test.ts": 246, + "tests/absorb-emission.test.ts": 414, + "tests/absorb.test.ts": 420, + "tests/acp-panel.test.ts": 272, + "tests/acp-status-estimator.test.ts": 368, + "tests/acp-status-marker-block.test.ts": 366, + "tests/acp-status-storage-degraded.test.ts": 396, + "tests/abort-rewind-cache-seam.test.ts": 1452, + "tests/acp-status.test.ts": 466, + "tests/adapter-google.test.ts": 389, + "tests/admin-probe.test.ts": 546, + "tests/advisory.test.ts": 512, + "tests/acp-cache-diff.test.ts": 3551, + "tests/affinity-neutral.test.ts": 264, + "tests/advisory-endpoint-parity.test.ts": 3492, + "tests/advisory-panel.test.ts": 3743, + "tests/agent-providers.test.ts": 1091, + "tests/affinity-crosswire-fold.test.ts": 3748, + "tests/anthropic-lane-nudge.test.ts": 139, + "tests/absorb-plugin.test.ts": 6596, + "tests/anthropic-pck-verbatim.test.ts": 861, + "tests/anthropic-round2-stream.test.ts": 385, + "tests/anthropic-thinking-replay.test.ts": 383, + "tests/anthropic-truncation-unsigned-thinking.test.ts": 385, + "tests/apig-resign.test.ts": 870, + "tests/append-system-text.test.ts": 98, + "tests/auto-mode-forge.test.ts": 145, + "tests/affinity-persist.test.ts": 5828, + "tests/backpressure-drain.test.ts": 447, + "tests/banner-identity.test.ts": 472, + "tests/basic.test.ts": 241, + "tests/bili-artifact-strip.test.ts": 275, + "tests/bili-message-roundtrip.test.ts": 122, + "tests/blind-tunnel-stats.test.ts": 542, + "tests/bounded-storage-scale.test.ts": 1199, + "tests/bounded-storage.test.ts": 565, + "tests/build-info.test.ts": 631, + "tests/cache-friendly-proxy.test.ts": 1734, + "tests/anthropic-pck-identity.test.ts": 12640, + "tests/cache-ledger-effort-switch.test.ts": 266, + "tests/cache-keepalive.test.ts": 485, + "tests/cache-ledger-key-switch.test.ts": 264, + "tests/cache-ledger-projection-switch.test.ts": 258, + "tests/cache-ledger-prompt-switch.test.ts": 266, + "tests/cache-ledger.test.ts": 289, + "tests/cache-seam-client-insert.test.ts": 266, + "tests/cache-seam-detector.test.ts": 277, + "tests/cache-proof.test.ts": 3311, + "tests/anthropic-beta-window.test.ts": 18646, + "tests/cache-theorem.test.ts": 192, + "tests/cache-warn.test.ts": 114, + "tests/ca-combined.test.ts": 394, + "tests/cache-seam-fuzz.test.ts": 8958, + "tests/cache-seam-probes.test.ts": 6829, + "tests/chain-checkpoint-step2.test.ts": 583, + "tests/chain-checkpoint-step3.test.ts": 695, + "tests/check-dist-external.test.ts": 110, + "tests/check-dist-external-zod.test.ts": 101, + "tests/ci-runner-failure-shapes.test.ts": 102, + "tests/cjk-context-overflow.test.ts": 111, + "tests/anthropic-cache-control.test.ts": 26302, + "tests/ccr-v2.test.ts": 9691, + "tests/claude-mcp-entry.test.ts": 432, + "tests/claude-fork-lineage.test.ts": 9871, + "tests/claude-bridge-e2e.test.ts": 14181, + "tests/cli-export.test.ts": 474, + "tests/cli-parseargs.test.ts": 459, + "tests/cache-friendly-plugin.test.ts": 34361, + "tests/codex-compact.test.ts": 275, + "tests/codex-install-block-end.test.ts": 356, + "tests/codex-live-window.test.ts": 398, + "tests/ccr-plugin.test.ts": 24858, + "tests/codex-models.test.ts": 279, + "tests/claude-subagent-split.test.ts": 10813, + "tests/codex-overlay-env.test.ts": 416, + "tests/codex-profile-effective.test.ts": 126, + "tests/claude-transcript-lineage.test.ts": 9748, + "tests/codex-official.test.ts": 3588, + "tests/codex-responses-ws.test.ts": 4109, + "tests/codex-turn-isolation.test.ts": 3578, + "tests/compaction-archive.test.ts": 390, + "tests/compaction-trigger-finality.test.ts": 3556, + "tests/codex-local-compaction.test.ts": 12739, + "tests/compress-credit.test.ts": 407, + "tests/compress-fingerprint-refold.test.ts": 398, + "tests/compress-from-store.test.ts": 585, + "tests/compress-observability.test.ts": 395, + "tests/compress-prompt-pack.test.ts": 241, + "tests/compress-recovery-ranges.test.ts": 387, + "tests/compress-reject-reasons.test.ts": 375, + "tests/compress-settings.test.ts": 242, + "tests/compress-span-hint.test.ts": 395, + "tests/compress-success-tail.test.ts": 395, + "tests/config-epoch.test.ts": 269, + "tests/config-file-cache.test.ts": 237, + "tests/config-surface-guard.test.ts": 137, + "tests/compat-drop.test.ts": 15661, + "tests/conflict-lifecycle.test.ts": 270, + "tests/conflict-remediation.test.ts": 281, + "tests/content-encoding.test.ts": 228, + "tests/context-overflow.test.ts": 117, + "tests/context-provenance-ledger.test.ts": 259, + "tests/configured-window-outranks-registry.test.ts": 6591, + "tests/conversation-recall.test.ts": 106, + "tests/copilot-schema-contract.test.ts": 116, + "tests/count-tokens.test.ts": 467, + "tests/cross-platform-argv.test.ts": 347, + "tests/dead-ranges.test.ts": 275, + "tests/dead-ref-range-filter.test.ts": 360, + "tests/codex-window-align.test.ts": 24785, + "tests/decompress-empty-range.test.ts": 421, + "tests/decompress-image-ref-dispatch.test.ts": 388, + "tests/deferred-tool-budget.test.ts": 662, + "tests/derived-fork-block-inheritance.test.ts": 3607, + "tests/compat-roles.test.ts": 24816, + "tests/dist-import-annotations.test.ts": 117, + "tests/dist-ready.test.ts": 106, + "tests/dsh-acp.test.ts": 121, + "tests/decode-fail-passthrough.test.ts": 13281, + "tests/dsh-compaction-guard.test.ts": 109, + "tests/dsh-conversation-recall.test.ts": 442, + "tests/discover.test.ts": 8538, + "tests/dsh-llm-stream-attribution.test.ts": 569, + "tests/dsh-fork-adopt.test.ts": 3615, + "tests/dsh-panel-embed-cors.test.ts": 509, + "tests/dsh-patch-entries.test.ts": 121, + "tests/dsh-persona-continuity.test.ts": 6619, + "tests/dsh-authored-compaction.test.ts": 21822, + "tests/dsh-refresh.test.ts": 121, + "tests/codex-compact-e2e.test.ts": 61334, + "tests/dsh-title-sidecar-handle.test.ts": 3632, + "tests/dsh-title-side-lane.test.ts": 346, + "tests/context-provenance-outbound.test.ts": 49081, + "tests/dumps-dir.test.ts": 99, + "tests/dump-observability.test.ts": 436, + "tests/dsh-persona-fingerprint.test.ts": 27941, + "tests/e2e-bili-chain.test.ts": 573, + "tests/e2e-compress-cascade.test.ts": 220, + "tests/durable-tool-identity.test.ts": 15838, + "tests/e2e-compress-prompts.test.ts": 9578, + "tests/e2e-export-handoff.test.ts": 3527, + "tests/e2e-grow-compress.test.ts": 4935, + "tests/e2e-google-compress.test.ts": 13793, + "tests/e2e-issue3450-stated-counts.test.ts": 6618, + "tests/e2e-mid-system.test.ts": 3665, + "tests/e2e-anthropic.test.ts": 34723, + "tests/e2e-issue3900-overflow-teaches.test.ts": 6628, + "tests/e2e-plugin-grow-compress.test.ts": 4906, + "tests/e2e-plugin-tool-routing.test.ts": 6571, + "tests/e2e-proxy-smoke.test.ts": 3780, + "tests/e2e-overflow-selfheal.test.ts": 9695, + "tests/e2e-ptc-runcode-shape.test.ts": 1050, + "tests/e2e-relay-5xx-selfheal.test.ts": 9649, + "tests/e2e-responses-offhead-system.test.ts": 887, + "tests/e2e-responses-mid-developer.test.ts": 9806, + "tests/e2e-stable-system-anchor.test.ts": 3626, + "tests/e2e-tag-echo.test.ts": 6592, + "tests/e2e-responses-chat-relay.test.ts": 22312, + "tests/e2e-trae-model-restamp.test.ts": 3613, + "tests/empty-finish-reason-terminal.test.ts": 381, + "tests/error-dump.test.ts": 216, + "tests/export-block-summaries.test.ts": 257, + "tests/export-jsonl.test.ts": 750, + "tests/export-uncompressed.test.ts": 264, + "tests/e2e-vertex-anthropic.test.ts": 6566, + "tests/external-summary-badge.test.ts": 3527, + "tests/external-summary-batch.test.ts": 178, + "tests/external-summary-executor-parallel.test.ts": 232, + "tests/external-summary-http.test.ts": 947, + "tests/external-summary-live.test.ts": 345, + "tests/external-summary-runtime.test.ts": 2349, + "tests/external-summary-settings.test.ts": 337, + "tests/external-summary.test.ts": 381, + "tests/fake-completion.test.ts": 15686, + "tests/fallback-window-floor.test.ts": 6570, + "tests/first-sight-drain.test.ts": 216, + "tests/e2e-session-identity.test.ts": 52163, + "tests/fix-1001-history-rewrite.test.ts": 6713, + "tests/fix-1012-inherited-aux-egress.test.ts": 327, + "tests/fix-1039-toolargs-verbatim.test.ts": 383, + "tests/fix-1061-held-done-ordering.test.ts": 383, + "tests/first-sight-drain-wire.test.ts": 12742, + "tests/fix-1075-side-request.test.ts": 3560, + "tests/fix-1124-compress-receipt.test.ts": 343, + "tests/fix-1205-file-parts.test.ts": 453, + "tests/fix-1292-windows-claude-settings.test.ts": 373, + "tests/fix-1439-responses-json-triggers.test.ts": 360, + "tests/fix-15-abort-lifetime.test.ts": 436, + "tests/fix-1760-cjk-single-line-visible-turn.test.ts": 375, + "tests/dsh-native.test.ts": 150009, + "tests/fix-401-storage.test.ts": 3315, + "tests/fix-1117-passthrough.test.ts": 9598, + "tests/fix-437-idle-timeout.test.ts": 2525, + "tests/fix-551-upstream-timeout.test.ts": 4749, + "tests/fix-679-windows-launch.test.ts": 334, + "tests/fix-1897-leaked-tools-side.test.ts": 12619, + "tests/fix-78-connect-timeout.test.ts": 272, + "tests/external-summary-autofold.test.ts": 64651, + "tests/dsh-settings-ui.test.ts": 1000, + "tests/fix-488-multimodal.test.ts": 9815, + "tests/fix-781-summary-images.test.ts": 9673, + "tests/fix-config-session.test.ts": 275, + "tests/fix-decompress-reaper.test.ts": 364, + "tests/fix-decompress-tofile.test.ts": 353, + "tests/fix-responses-guard.test.ts": 367, + "tests/fix-stream.test.ts": 1399, + "tests/fold-anchor-doctrine.test.ts": 352, + "tests/fix-920-bypass-drop.test.ts": 9587, + "tests/fold-drift.test.ts": 277, + "tests/fix-806-request-watchdog.test.ts": 11265, + "tests/fix-arm-headroom-clamp.test.ts": 9731, + "tests/fold-reconcile-positional.test.ts": 274, + "tests/fold-reconcile.test.ts": 502, + "tests/fork-adoption-plan.test.ts": 375, + "tests/fold-reconcile-perf.test.ts": 2692, + "tests/fix-806-malformed-body.test.ts": 15648, + "tests/fork-ccr-adoption.test.ts": 397, + "tests/fold-round2-shape.test.ts": 3942, + "tests/fork-adoption.test.ts": 6744, + "tests/fork-nudge-trigger.test.ts": 3613, + "tests/fold-images-archive.test.ts": 9720, + "tests/fork-side-request-lane.test.ts": 3643, + "tests/fork-nudge-deadzone.test.ts": 9649, + "tests/golden-storage-render.test.ts": 2195, + "tests/fork-adoption-wires.test.ts": 12871, + "tests/fork-replica-convergence.test.ts": 6782, + "tests/graceful-close.test.ts": 4984, + "tests/hook-command.test.ts": 361, + "tests/hook-graceful-exit.test.ts": 532, + "tests/hop-by-hop.test.ts": 488, + "tests/forward-absolute-url.test.ts": 12574, + "tests/grok-session-identity.test.ts": 9580, + "tests/identity-proof.test.ts": 2203, + "tests/host-native-caller.test.ts": 6576, + "tests/identity-registry.test.ts": 868, + "tests/image-restore.test.ts": 280, + "tests/headroom-output-fallback.test.ts": 18760, + "tests/hermes-native.test.ts": 19574, + "tests/incremental-client-recovery.test.ts": 104, + "tests/image-request-budget.test.ts": 10015, + "tests/inc-canonical-pointers.test.ts": 10051, + "tests/host-usage-postfold.test.ts": 15849, + "tests/instance-governance.test.ts": 646, + "tests/index-entry-guard.test.ts": 1645, + "tests/invariant-judge.test.ts": 282, + "tests/issue1029-acp-marker-stale-refs.test.ts": 378, + "tests/issue1002-opencode-foreign-entries.test.ts": 911, + "tests/issue1158-no-model-request-warning.test.ts": 684, + "tests/issue1192-disabled-tools.test.ts": 385, + "tests/issue1086-chain-self-exemption.test.ts": 2828, + "tests/issue1206-thirdparty-scan.test.ts": 281, + "tests/issue1204-rules-google-plugin.test.ts": 6563, + "tests/issue1284-misrouted-messages.test.ts": 6535, + "tests/issue1307-side-snapshot.test.ts": 3548, + "tests/issue1195-overflow-refold.test.ts": 12698, + "tests/invariant-judge-e2e.test.ts": 16205, + "tests/issue1372-preflight-skip-diagnostics.test.ts": 371, + "tests/issue1320-thinking-mass.test.ts": 3560, + "tests/issue1453-rerequest-transport.test.ts": 9411, + "tests/issue1455-truncation-ping.test.ts": 398, + "tests/issue1470-anthropic-nudge.test.ts": 395, + "tests/issue1333-derived-inheritance.test.ts": 16640, + "tests/issue1452-socket-hardening.test.ts": 16062, + "tests/issue1494-compress-params.test.ts": 369, + "tests/issue1495-partial-compress-drop.test.ts": 366, + "tests/issue1502-raw-args-salvage.test.ts": 393, + "tests/issue1542-chain-embedded-strip.test.ts": 860, + "tests/issue1492-stale-estimate-view.test.ts": 9744, + "tests/issue1547-nonstream-cache-ledger.test.ts": 3519, + "tests/issue1615-preflight-split-surrogate.test.ts": 326, + "tests/issue1321-tier-window-cap.test.ts": 24700, + "tests/issue1733-config-update.test.ts": 156, + "tests/issue1683-chain-egress-off.test.ts": 665, + "tests/issue1766-terminal-extra.test.ts": 380, + "tests/issue1815-unknown-top-level-keys.test.ts": 212, + "tests/issue1819-regurgitation-guard.test.ts": 409, + "tests/issue1493-arm-outbound-payload.test.ts": 9770, + "tests/issue1820-post-rebuild-anchor.test.ts": 9683, + "tests/issue1569-window-stamp-and-anchor.test.ts": 15667, + "tests/issue1843-learned-image-cost.test.ts": 3784, + "tests/issue1875-plugin-tool-outcome.test.ts": 451, + "tests/issue1841-preflight-futility.test.ts": 9628, + "tests/issue1881-reasoning-tag-leak.test.ts": 380, + "tests/issue1839-ghost-denominator.test.ts": 18678, + "tests/issue1800-image-arbitration-compress.test.ts": 21780, + "tests/issue1908-fold-state-repro.test.ts": 944, + "tests/issue1958-routed-warn.test.ts": 341, + "tests/issue1960-loop-redacted.test.ts": 375, + "tests/issue1960-steady-redacted.test.ts": 135, + "tests/issue1960-thinking-verbatim.test.ts": 369, + "tests/issue1891-seam-nobaseline.test.ts": 3523, + "tests/incremental-lane.test.ts": 67110, + "tests/issue2011-integer-output-budget.test.ts": 334, + "tests/issue1987-preflight-baseline-anchor.test.ts": 3632, + "tests/issue2028-dsh-compaction-toggle.test.ts": 493, + "tests/issue1881-acp-tags-decoupled.test.ts": 9600, + "tests/issue2023-refs-residue.test.ts": 2239, + "tests/issue2042-carrier-index.test.ts": 431, + "tests/issue1933-preflight-calibration.test.ts": 6589, + "tests/issue2078-outbound-estimate.test.ts": 435, + "tests/issue2082-desktop-boot-smoke.test.ts": 503, + "tests/issue2029-status-baseline-provenance.test.ts": 3564, + "tests/issue2033-anonymous-anchor.test.ts": 6592, + "tests/issue2096-clamp-headroom-window.test.ts": 3552, + "tests/issue2072-native-caller-stamping.test.ts": 7193, + "tests/issue2122-clamp-calibration.test.ts": 344, + "tests/issue2117-context-estimate-provenance.test.ts": 3547, + "tests/issue2131-body-stability-visibility.test.ts": 297, + "tests/issue2131-seam-capped-body-attribution.test.ts": 274, + "tests/issue2146-compress-loop-breaker.test.ts": 361, + "tests/issue2129-restart-measurement-state.test.ts": 3638, + "tests/issue1993-preflight-400.test.ts": 15705, + "tests/issue2171-zero-byte-truncation-retry.test.ts": 398, + "tests/issue2187-dsh-spawn-retry.test.ts": 482, + "tests/issue2187-launcher-slow-start.test.ts": 397, + "tests/issue2190-degen-close.test.ts": 412, + "tests/issue2202-coverage-accrual.test.ts": 252, + "tests/issue2204-decompress-to-file-outcome.test.ts": 432, + "tests/issue2155-self-heal.test.ts": 9760, + "tests/issue2248-exit-audit.test.ts": 389, + "tests/issue2260-inert-resign-passthrough.test.ts": 218, + "tests/issue2303-draft-tail.test.ts": 399, + "tests/issue2189-preflight-billing-block.test.ts": 12694, + "tests/issue2317-route-miss-diagnostics.test.ts": 3521, + "tests/issue2218-relay-affinity-signal.test.ts": 15673, + "tests/issue2323-sse-crlf-cross-chunk.test.ts": 414, + "tests/issue2328-terminal-diag.test.ts": 407, + "tests/issue2347-dump-sse-plugin-lane.test.ts": 1063, + "tests/issue2360-compress-receipt.test.ts": 365, + "tests/issue2366-cjk-billed-status.test.ts": 378, + "tests/issue2313-probe-forward.test.ts": 12764, + "tests/issue2407-thinking-caliber.test.ts": 431, + "tests/issue2407-google-khat-lane.test.ts": 3534, + "tests/issue2322-session-name.test.ts": 7150, + "tests/issue2432-breaker-awareness.test.ts": 364, + "tests/issue2421-dump-body-buffer.test.ts": 6531, + "tests/issue2419-dsh-skill-catalog.test.ts": 9700, + "tests/issue2446-dsh-mcp-catalog.test.ts": 9690, + "tests/issue2455-nonascii-model-header.test.ts": 276, + "tests/issue2462-plugin-advisory.test.ts": 125, + "tests/issue2447-dsh-workspace-instructions.test.ts": 9700, + "tests/issue2484-overflow-and-summary.test.ts": 3513, + "tests/issue2481-dsh-runtime-context.test.ts": 9690, + "tests/issue2451-dsh-responses-compaction.test.ts": 12694, + "tests/issue2432-dsh-local-compaction.test.ts": 21831, + "tests/issue2558-clamp-image.test.ts": 340, + "tests/issue2578-mcp-hard-protection.test.ts": 270, + "tests/issue2563-transparent-truncation.test.ts": 386, + "tests/issue2592-rebase-floor.test.ts": 349, + "tests/issue2580-compress-arg-salvage.test.ts": 410, + "tests/issue2601-model-drift-absorption.test.ts": 271, + "tests/issue2605-dsh-retry-patch.test.ts": 331, + "tests/issue2612-compaction-draft-tail.test.ts": 405, + "tests/issue2483-render-strategy.test.ts": 12630, + "tests/issue2627-turn-sep-coverage.test.ts": 464, + "tests/issue2645-pck-banner-escape.test.ts": 108, + "tests/issue2601-persona-fork-lineage.test.ts": 3544, + "tests/issue2639-ext-summary-fresh-budget.test.ts": 2886, + "tests/issue2652-plugin-tool-timeout.test.ts": 394, + "tests/issue2499-anthropic-round2-cache.test.ts": 6588, + "tests/issue2490-ledger-floor-doomed-probe.test.ts": 9688, + "tests/issue2682-preflight-payoff-order.test.ts": 394, + "tests/issue2701-threads-continue.test.ts": 384, + "tests/issue2709-dsh-native-compaction-attribution.test.ts": 256, + "tests/issue2672-preflight-blocked-split.test.ts": 3534, + "tests/issue2733-preflight-codex-shape.test.ts": 6585, + "tests/issue2752-forward-partial-outcome.test.ts": 2265, + "tests/issue2756-degenerate-gate.test.ts": 410, + "tests/issue2766-durable-role-gate.test.ts": 134, + "tests/issue2645-pck-probe.test.ts": 17166, + "tests/issue2824-regression.test.ts": 1073, + "tests/issue2817-crosswire-persona-fold.test.ts": 3645, + "tests/issue2658-dsh-anthropic-google-compaction.test.ts": 18786, + "tests/issue2861-host-plugin-notice.test.ts": 125, + "tests/issue2868-byte-lcp-utf8.test.ts": 390, + "tests/issue2847-doomed-nonretryable-status.test.ts": 3585, + "tests/issue2915-order-centric-reconcile.test.ts": 273, + "tests/issue2929-codex-fold-double-miss.test.ts": 706, + "tests/issue2929-fold-claim-window.test.ts": 262, + "tests/issue2944-neutral-skeleton.test.ts": 263, + "tests/issue2709-passthrough-compaction-guard.test.ts": 18655, + "tests/issue2952-preflight-tier-recovery.test.ts": 422, + "tests/issue2954-launcher-clobber.test.ts": 373, + "tests/issue2970-mcp-compress-predicate.test.ts": 217, + "tests/issue2982-body-stability-tail-class.test.ts": 269, + "tests/issue2832-preflight-deterministic-empty.test.ts": 7611, + "tests/issue3071-planning-floor-min-output.test.ts": 354, + "tests/issue3116-spawn-failure-diagnostics.test.ts": 414, + "tests/issue3126-no-visible-context.test.ts": 369, + "tests/issue2948-aux-lane-lineage-guard.test.ts": 6566, + "tests/issue3129-v1internal.test.ts": 3665, + "tests/issue3131-pi-packages-object-entries.test.ts": 342, + "tests/issue3157-persist-durability.test.ts": 272, + "tests/issue3148-upstream-circuit.test.ts": 704, + "tests/issue3158-google-standalone-signature.test.ts": 405, + "tests/issue3199-overview-cold-scan.test.ts": 645, + "tests/issue2879-anon-provenance.test.ts": 12626, + "tests/issue3211-calibration-policy.test.ts": 260, + "tests/issue3222-mcp-reasoning-prune.test.ts": 432, + "tests/issue3004-nudge-decide-selfheal.test.ts": 9724, + "tests/issue3226-preflight-resign.test.ts": 561, + "tests/issue3250-wal-checkpoint.test.ts": 1220, + "tests/issue3260-text-run-guard.test.ts": 286, + "tests/issue3159-vertex-nudge-order.test.ts": 6591, + "tests/issue3245-zcode-self-tunnel.test.ts": 4522, + "tests/issue3302-sparse-ref-tombstones.test.ts": 373, + "tests/issue3304-incremental-direct-send.test.ts": 895, + "tests/issue3322-coverage-regression-guard.test.ts": 358, + "tests/issue3280-v1internal-loop-rounds.test.ts": 3574, + "tests/issue3204-dead-ref-nudge-panel.test.ts": 9637, + "tests/issue3354-dsh-compaction-disable.test.ts": 336, + "tests/issue3343-marker-divert-gate.test.ts": 1142, + "tests/issue3272-ccr-codex-lane-gate.test.ts": 6584, + "tests/issue3384-ledger-floor-starvation.test.ts": 3536, + "tests/issue3397-persona-restart-stability.test.ts": 3558, + "tests/issue3399-cross-route-load.test.ts": 491, + "tests/issue2678-preflight-batch-fold.test.ts": 44917, + "tests/issue3343-incremental-divert-authz.test.ts": 6810, + "tests/issue3406-writenow-concurrent.test.ts": 295, + "tests/issue3407-shadow-blockcontents-order.test.ts": 383, + "tests/issue3398-opaque-media-reserve.test.ts": 3650, + "tests/issue3436-native-proxy-reuse.test.ts": 353, + "tests/issue3434-first-byte-watchdog.test.ts": 1634, + "tests/issue3456-phantom-attachment.test.ts": 404, + "tests/issue3476-mid-insertion-append.test.ts": 266, + "tests/issue3406-param-drop-warn.test.ts": 3704, + "tests/issue3488-credential-status.test.ts": 254, + "tests/issue3496-dsh-ledger-convergence.test.ts": 550, + "tests/issue3544-stale-proxy-rotation.test.ts": 626, + "tests/issue3572-client-draft-parse.test.ts": 109, + "tests/issue3572-jsonc-config.test.ts": 221, + "tests/issue3572-web-jsonc-config.test.ts": 225, + "tests/issue3573-cold-load-diagnostics.test.ts": 277, + "tests/issue3461-overlimit-exits.test.ts": 3552, + "tests/issue3632-mitm-inert-key-warnings.test.ts": 438, + "tests/issue3400-image-rescale.test.ts": 7664, + "tests/issue3646-tier-recovery-picker.test.ts": 424, + "tests/issue3654-health-probe-three-state.test.ts": 1383, + "tests/issue3581-attribution-health.test.ts": 3500, + "tests/issue3662-dsh-gate-fallback.test.ts": 341, + "tests/issue3661-malformed-proxy-args-replay.test.ts": 394, + "tests/issue3701-ws-byte-budget.test.ts": 5124, + "tests/issue3477-responses-compaction-archive.test.ts": 15752, + "tests/issue3645-calibrated-futility.test.ts": 12676, + "tests/issue3686-pi-codex-ua-host-policy.test.ts": 9666, + "tests/issue3769-orphan-sweep-ledger.test.ts": 258, + "tests/issue3754-install-attribution.test.ts": 556, + "tests/issue3752-lite-anchors.test.ts": 2149, + "tests/issue3713-responses-sysdev-estimate.test.ts": 6573, + "tests/issue3769-pooled-bare-load.test.ts": 3734, + "tests/issue3801-model-drift-twin.test.ts": 225, + "tests/issue3787-overflow-refold.test.ts": 3561, + "tests/issue3833-cross-model-output-ceiling.test.ts": 436, + "tests/issue3769-upgrade-compat.test.ts": 6748, + "tests/issue3776-tls-mitm-diagnostics.test.ts": 6741, + "tests/issue3900-overflow-teaches-calibration.test.ts": 254, + "tests/issue3862-context-view.test.ts": 1588, + "tests/issue3813-responses-pck-ablation.test.ts": 6558, + "tests/issue3918-resident-eviction-refusal.test.ts": 379, + "tests/issue3919-shadow-drift-forensics.test.ts": 699, + "tests/issue3910-lane-nudge-wiring.test.ts": 6602, + "tests/issue402-min-compress-range-chars.test.ts": 273, + "tests/issue3918-preflight-progress-verdict.test.ts": 6774, + "tests/issue4079-egress-window-fuse.test.ts": 1269, + "tests/issue4110-recall-fingerprint.test.ts": 103, + "tests/issue404-restore-timestamps.test.ts": 1742, + "tests/issue4147-dsh-overlay-structural.test.ts": 109, + "tests/issue4159-client-mid-system-verbatim.test.ts": 3538, + "tests/issue-393-registry-window.test.ts": 12678, + "tests/issue3846-local-refusal-evidence.test.ts": 18918, + "tests/issue411-abort-usage.test.ts": 13408, + "tests/issue4185-identified-fresh-forward.test.ts": 12740, + "tests/issue496-forward-once-learn.test.ts": 3571, + "tests/issue539-loop-reasoning.test.ts": 388, + "tests/issue564-responses-ordering.test.ts": 462, + "tests/issue589-usage-frame.test.ts": 369, + "tests/issue453-backstop.test.ts": 12737, + "tests/issue4341-early-twin-adoption.test.ts": 15356, + "tests/issue793-zero-usage-abort.test.ts": 396, + "tests/issue532-panel-system-tokens.test.ts": 6579, + "tests/issue847-compress-failure-guards.test.ts": 362, + "tests/issue473-plugin-fake-completion.test.ts": 12666, + "tests/issue857-image-baseline.test.ts": 4232, + "tests/issue903-request-cost-log.test.ts": 3547, + "tests/kernel-tier-defaults.test.ts": 213, + "tests/issue927-opencode-install.test.ts": 930, + "tests/kimi-native.test.ts": 816, + "tests/knobs-config-precedence.test.ts": 229, + "tests/lane-decisions-b-class.test.ts": 351, + "tests/issue833-panel-effective-config.test.ts": 9609, + "tests/launcher-gemini-family.test.ts": 340, + "tests/launcher-max-outputs.test.ts": 213, + "tests/lane-decisions-matrix.test.ts": 2850, + "tests/lane-credentials.test.ts": 4533, + "tests/launcher-sqlite-overlay.test.ts": 4635, + "tests/issue767-pixel-billing.test.ts": 19138, + "tests/listen-policy.test.ts": 100, + "tests/logger-epipe.test.ts": 1472, + "tests/logger-rotate.test.ts": 126, + "tests/issue760-percall-conversation.test.ts": 22299, + "tests/logger-session-tag.test.ts": 189, + "tests/logger-rotation.test.ts": 578, + "tests/logger-stderr-mute.test.ts": 289, + "tests/logger-silent-loss.test.ts": 337, + "tests/launcher.test.ts": 9355, + "tests/loop-adapters.test.ts": 418, + "tests/loop-core.test.ts": 439, + "tests/loop-degenerate-retry.test.ts": 400, + "tests/loop-responses-orphan.test.ts": 381, + "tests/loop-compress.test.ts": 3430, + "tests/loop-strict-echo.test.ts": 3563, + "tests/loop-truncation-continuation.test.ts": 391, + "tests/loop-truncation-reasoning.test.ts": 381, + "tests/loop-strict-echo-responses.test.ts": 6612, + "tests/loop-truncation.test.ts": 394, + "tests/marker-echo.test.ts": 403, + "tests/marker-lane-coverage.test.ts": 266, + "tests/marker-render-contract.test.ts": 373, + "tests/lineage-reconcile-boot.test.ts": 16267, + "tests/media-cas.test.ts": 518, + "tests/memory-blockcontent-lazy.test.ts": 320, + "tests/memory-diagnostics.test.ts": 253, + "tests/memory-metadata-lazy.test.ts": 306, + "tests/memory-tail-folding.test.ts": 302, + "tests/mitm.test.ts": 1262, + "tests/model-windows.test.ts": 442, + "tests/log-mask.test.ts": 14212, + "tests/multi-agent-namespace.test.ts": 381, + "tests/launcher-plugin-mode.test.ts": 24989, + "tests/multi-instance-persist.test.ts": 1758, + "tests/multi-instance-live.test.ts": 1881, + "tests/named-provider-bind.test.ts": 243, + "tests/nameless-toolcall-observability.test.ts": 386, + "tests/native-intercept-selfheal.test.ts": 438, + "tests/mode-upgrade-proof.test.ts": 3706, + "tests/native-ws-intercept.test.ts": 225, + "tests/main-path-transport-retry.test.ts": 9847, + "tests/nudge-decide.test.ts": 100, + "tests/never-preserve-recent-tools.test.ts": 230, + "tests/omp-native-identity.test.ts": 808, + "tests/native-intercept.test.ts": 2557, + "tests/omp-native-incremental.test.ts": 900, + "tests/one-call-payload.test.ts": 223, + "tests/native-compact-terminal.test.ts": 3567, + "tests/openai-assistant-content-harden.test.ts": 393, + "tests/openai-finish-reason-dup.test.ts": 389, + "tests/openai-reasoning-content.test.ts": 392, + "tests/openai-toolcall-finish-reason.test.ts": 402, + "tests/openai-plugin-postfold-seam.test.ts": 976, + "tests/opencode-acp-command.test.ts": 308, + "tests/opencode-incremental.test.ts": 377, + "tests/mcp-native-thread.test.ts": 16271, + "tests/opencode-launcher.test.ts": 4571, + "tests/opencode-native-v1.test.ts": 992, + "tests/output-steering.test.ts": 155, + "tests/opencode-fork-adopt.test.ts": 6590, + "tests/overlay-busy-lock.test.ts": 1229, + "tests/persist-active-pack.test.ts": 262, + "tests/persist-encryption.test.ts": 323, + "tests/persist-eperm.test.ts": 109, + "tests/openai-pck-identity.test.ts": 9632, + "tests/persist-rollback-guard.test.ts": 511, + "tests/nudge-model-decided.test.ts": 12675, + "tests/persist-stats-roundtrip.test.ts": 265, + "tests/persist-tail.test.ts": 448, + "tests/persist-zstd.test.ts": 417, + "tests/pins-storage-refactor.test.ts": 222, + "tests/passthrough-visibility.test.ts": 3586, + "tests/pins-wire-id-mints.test.ts": 373, + "tests/persist-guard-ownership.test.ts": 2271, + "tests/pi-subagent-registry.test.ts": 851, + "tests/pi-subagents-wiring.test.ts": 755, + "tests/pi-omp-fork-adopt.test.ts": 1704, + "tests/plugin-empty-turn-retry.test.ts": 424, + "tests/plugin-bypass.test.ts": 565, + "tests/pi-inline.test.ts": 3047, + "tests/plugin-list-version.test.ts": 343, + "tests/plugin-install-opencode.test.ts": 935, + "tests/pi-subagent-channel.test.ts": 3571, + "tests/plugin-passthrough-finish-tail.test.ts": 404, + "tests/plugin-passthrough-tag-strip-chat.test.ts": 399, + "tests/plugin-passthrough-tag-strip.test.ts": 395, + "tests/plugin-agent.test.ts": 4022, + "tests/plugin-passthrough-tool-xml-warn.test.ts": 383, + "tests/plugin-native-binding.test.ts": 3207, + "tests/plugin-fork.test.ts": 10015, + "tests/plugin-update.test.ts": 322, + "tests/port-log-rotation.test.ts": 345, + "tests/port-owner.test.ts": 268, + "tests/port-race.test.ts": 662, + "tests/port-zone-live.test.ts": 319, + "tests/port-zone.test.ts": 433, + "tests/prefix-affinity-orphan.test.ts": 3529, + "tests/prefix-affinity-simhash.test.ts": 304, + "tests/prefix-affinity.test.ts": 307, + "tests/plugin-nudge-injection.test.ts": 15704, + "tests/preflight-client-abort.test.ts": 517, + "tests/preflight-compress-responses.test.ts": 3558, + "tests/plugin-status-provenance.test.ts": 24783, + "tests/plugin-terminal-usage.test.ts": 27735, + "tests/preflight-dead-ranges.test.ts": 397, + "tests/preflight-covered-ranges.test.ts": 5046, + "tests/preflight-compress.test.ts": 12711, + "tests/preflight-codex-headroom.test.ts": 18758, + "tests/preflight-emergency-fold.test.ts": 3811, + "tests/preflight-fork-estimate.test.ts": 6576, + "tests/preflight-google-summary.test.ts": 6588, + "tests/plugin-protocol.test.ts": 45977, + "tests/preflight-empty-summary.test.ts": 21898, + "tests/preflight-incomplete-json.test.ts": 12700, + "tests/preflight-fail-fast.test.ts": 24865, + "tests/preflight-responses-reasoning-extract.test.ts": 355, + "tests/preflight-nonstream-400-probe.test.ts": 6631, + "tests/preflight-sse-extraction.test.ts": 364, + "tests/preflight-multi-range.test.ts": 9740, + "tests/preflight-round-budget.test.ts": 7317, + "tests/preflight-summary-cap.test.ts": 416, + "tests/preflight-summary-length-budget.test.ts": 436, + "tests/preflight-max-output-tokens.test.ts": 18818, + "tests/preflight-transport-recovery.test.ts": 502, + "tests/preflight-window-clamp.test.ts": 411, + "tests/preflight-hold.test.ts": 27161, + "tests/private-http-providers.test.ts": 823, + "tests/preflight-transient-empty-retry.test.ts": 6628, + "tests/protected-latest-tools.test.ts": 225, + "tests/protected-tool-paths.test.ts": 282, + "tests/protected-tools.test.ts": 237, + "tests/preflight-stream-summary.test.ts": 9674, + "tests/proxy-basic.test.ts": 244, + "tests/preflight-stream-summary-config.test.ts": 12675, + "tests/proxy-message-id.test.ts": 121, + "tests/proxy-decompress-cache.test.ts": 369, + "tests/proxy-orphan-gc.test.ts": 141, + "tests/price-profile-stamp.test.ts": 6585, + "tests/proxy-readbody.test.ts": 453, + "tests/proxy-responses-review.test.ts": 410, + "tests/proxy-session-id.test.ts": 357, + "tests/proxy-stream-error.test.ts": 102, + "tests/ptc-runcode-tools.test.ts": 394, + "tests/reasoning-drop.test.ts": 216, + "tests/prompt-pack-tool-prompts.test.ts": 12621, + "tests/reasoning-echo.test.ts": 452, + "tests/reasoning-guard.test.ts": 272, + "tests/reasoning-echo-400.test.ts": 6543, + "tests/refold-wiring.test.ts": 369, + "tests/registry-output-limit.test.ts": 251, + "tests/registry-price-profile.test.ts": 263, + "tests/registry.test.ts": 269, + "tests/proxy-persist.test.ts": 9925, + "tests/removed-compress-keys-inert.test.ts": 220, + "tests/request-body-budget.test.ts": 260, + "tests/responses-empty-messages.test.ts": 380, + "tests/responses-fold-cache-seam.test.ts": 623, + "tests/redirect-passthrough.test.ts": 8559, + "tests/responses-mode-switch-fingerprint.test.ts": 3610, + "tests/provider-protocol.test.ts": 21723, + "tests/release-ci-gate.test.ts": 14198, + "tests/responses-prewarm-generate.test.ts": 253, + "tests/responses-proxy-id-replay.test.ts": 389, + "tests/responses-refold-cache-seam.test.ts": 768, + "tests/responses-refold-head-stability.test.ts": 749, + "tests/responses-round2-lifecycle.test.ts": 386, + "tests/responses-previous-response-id.test.ts": 6615, + "tests/responses-tool-images.test.ts": 1081, + "tests/responses-seam-probes.test.ts": 2959, + "tests/proxy-noinject-tag-strip.test.ts": 30833, + "tests/responses-instructions-drift.test.ts": 21777, + "tests/responses-plugin-dev-position.test.ts": 15724, + "tests/rollout.test.ts": 319, + "tests/resume-adoption-wires.test.ts": 9853, + "tests/routing.test.ts": 227, + "tests/rules.test.ts": 398, + "tests/responses-websocket.test.ts": 16850, + "tests/runaway-guard.test.ts": 291, + "tests/resume-ref-inheritance.test.ts": 12870, + "tests/search-context-2751.test.ts": 269, + "tests/search-context-cross-session.test.ts": 294, + "tests/search-context.test.ts": 381, + "tests/route-passthrough.test.ts": 16631, + "tests/served-markers.test.ts": 273, + "tests/search-plan-aware.test.ts": 6634, + "tests/rules-wire.test.ts": 18701, + "tests/session-gc.test.ts": 3568, + "tests/session-report.test.ts": 114, + "tests/responses-ws-http-fallback.test.ts": 30714, + "tests/session-transient-memory.test.ts": 1660, + "tests/side-lane-truth-table.test.ts": 376, + "tests/session-lock-concurrency.test.ts": 4372, + "tests/side-lane-invariants.test.ts": 5077, + "tests/skipped-proxy-hint.test.ts": 219, + "tests/snapshot-render-chain.test.ts": 264, + "tests/silent-backend-nudge.test.ts": 3718, + "tests/runtime-info.test.ts": 30921, + "tests/state-gc.test.ts": 232, + "tests/storage-archive-gc.test.ts": 513, + "tests/storage-backend-contract.test.ts": 550, + "tests/storage-backend-knob.test.ts": 291, + "tests/storage-backend-mysql-e2e.test.ts": 274, + "tests/storage-cantopen-hint.test.ts": 267, + "tests/storage-ccr.test.ts": 431, + "tests/storage-corpus.test.ts": 276, + "tests/storage-diagnostics-lines.test.ts": 251, + "tests/storage-durability.test.ts": 1343, + "tests/session-continuity-proof.test.ts": 27841, + "tests/storage-engine-bootstrap.test.ts": 1120, + "tests/snapshot-shadow.test.ts": 14616, + "tests/storage-ext.test.ts": 701, + "tests/storage-ingest-watermark.test.ts": 2378, + "tests/storage-full-flip.test.ts": 2959, + "tests/storage-json-writer-off.test.ts": 803, + "tests/storage-media-sidecar-split.test.ts": 443, + "tests/storage-mode-label.test.ts": 266, + "tests/storage-maintenance-cli.test.ts": 1321, + "tests/storage-orphan-representable.test.ts": 327, + "tests/storage-reap-journal.test.ts": 407, + "tests/storage-replicas.test.ts": 1010, + "tests/storage-review-fixes.test.ts": 900, + "tests/storage-state-fields.test.ts": 366, + "tests/storage-save-path.test.ts": 1187, + "tests/storage-engine-proofs.test.ts": 7904, + "tests/storage-write-amplification.test.ts": 1189, + "tests/store.test.ts": 517, + "tests/storage-unified.test.ts": 3889, + "tests/stream-terminal.test.ts": 135, + "tests/strict-echo-model-criterion.test.ts": 3542, + "tests/store-marker-gate.test.ts": 6611, + "tests/strip-images-removal.test.ts": 218, + "tests/stub-resubmission-guard.test.ts": 375, + "tests/subagent-sessions.test.ts": 380, + "tests/system-anchor.test.ts": 105, + "tests/system-to-user.test.ts": 104, + "tests/subagent-namespace.test.ts": 3556, + "tests/stream-keepalive.test.ts": 11635, + "tests/side-request-isolation.test.ts": 40313, + "tests/tag-imitation-cache.test.ts": 1152, + "tests/text-safe.test.ts": 492, + "tests/snapshot-render.test.ts": 38387, + "tests/test-suite-lock.test.ts": 1877, + "tests/tag-echo.test.ts": 5039, + "tests/title-derive.test.ts": 474, + "tests/tight-fold-summaries.test.ts": 831, + "tests/tool-guardrails-pi.test.ts": 242, + "tests/tool-pair-order.test.ts": 106, + "tests/tool-ring.test.ts": 720, + "tests/toolargs-adversarial.test.ts": 1462, + "tests/tag-echo-chunking-determinism.test.ts": 9542, + "tests/tool-witness-pipes.test.ts": 398, + "tests/truncation-fork.test.ts": 281, + "tests/unified-acp-invariants.test.ts": 400, + "tests/update-backoff.test.ts": 300, + "tests/update-dsh-converge.test.ts": 274, + "tests/update-desktop-inplace.test.ts": 667, + "tests/update-dsh-self-refresh.test.ts": 256, + "tests/update-host-guard.test.ts": 252, + "tests/update-install-dir.test.ts": 257, + "tests/tunnel-guard.test.ts": 1584, + "tests/update-integrity.test.ts": 247, + "tests/update-pi-self-refresh.test.ts": 276, + "tests/update-owner-lane-backoff.test.ts": 1101, + "tests/update-policy.test.ts": 735, + "tests/update-restart-reminder.test.ts": 247, + "tests/update-proxy.test.ts": 404, + "tests/update-tarball.test.ts": 439, + "tests/update-notes.test.ts": 1965, + "tests/upstream-fail.test.ts": 2156, + "tests/tmp-rm.test.ts": 9861, + "tests/upstream-truncation.test.ts": 429, + "tests/usage-observability.test.ts": 427, + "tests/usage-totals.test.ts": 120, + "tests/upstream-proxy-routing.test.ts": 3542, + "tests/util-surrogate-clamp.test.ts": 112, + "tests/verif-adapter-wire-stability.test.ts": 418, + "tests/verif-bug3676-wire-reorder.test.ts": 571, + "tests/verif-bug3691-oscillation.test.ts": 578, + "tests/verif-bug3769-orphan-window.test.ts": 511, + "tests/verif-bug3805-durable-ref-migration.test.ts": 617, + "tests/verif-conflict-watch.test.ts": 719, + "tests/verif-generic-append-stability.test.ts": 646, + "tests/verif-induction-append-stability.test.ts": 596, + "tests/verif-responses-ingress.test.ts": 829, + "tests/verif-snapshot-render.test.ts": 674, + "tests/verif-subset-guard.test.ts": 537, + "tests/verif-symbolic-smoke.test.ts": 637, + "tests/upstream-error-log.test.ts": 9629, + "tests/verif-tag-echo-filter.test.ts": 350, + "tests/verif-view-latch-discipline.test.ts": 513, + "tests/verif-wire-responses-stability.test.ts": 108, + "tests/verif-wire-anthropic-roundtrip.test.ts": 566, + "tests/vertex-fake-upstream.test.ts": 155, + "tests/verif-wire-google-rebuild-stability.test.ts": 571, + "tests/vertex-wire-fixture.test.ts": 111, + "tests/verify-sig-roundtrip.test.ts": 404, + "tests/vertex.test.ts": 460, + "tests/visibility-markers.test.ts": 421, + "tests/watchdog-health-daemon.test.ts": 524, + "tests/watchdog-health.test.ts": 519, + "tests/web-blocks-tree.test.ts": 310, + "tests/watcher-registration.test.ts": 393, + "tests/web-conflict-banner.test.ts": 144, + "tests/web-changelog.test.ts": 230, + "tests/web-fmtw.test.ts": 108, + "tests/web-diagnostics-enrichment.test.ts": 277, + "tests/web-handoff-roles.test.ts": 122, + "tests/web-hitrate-chart.test.ts": 2737, + "tests/web-logs-query.test.ts": 101, + "tests/web-i18n.test.ts": 3278, + "tests/web-ptools-position.test.ts": 109, + "tests/web-relay-warn.test.ts": 148, + "tests/vscode-copilot.test.ts": 5640, + "tests/web-logs-view.test.ts": 2522, + "tests/upstream-alerts.test.ts": 19711, + "tests/websearch-side-request.test.ts": 6585, + "tests/web-trajectory-brush.test.ts": 2714, + "tests/threads-lane.test.ts": 31421, + "tests/web-updates.test.ts": 515, + "tests/win-cmd-argv.test.ts": 355, + "tests/wire-contract-golden.test.ts": 390, + "tests/wire-contract-go-session.test.ts": 386, + "tests/web-update-banner.test.ts": 3526, + "tests/web-routing.test.ts": 15657, + "tests/web-sessions.test.ts": 15933, + "tests/web-storage-banner.test.ts": 15621, + "tests/wire-overhead.test.ts": 447, + "tests/wire-schema-portable.test.ts": 219, + "tests/ws-bridge.test.ts": 250, + "tests/wire-lone-surrogate-scrub.test.ts": 3553, + "tests/zcode-json-edit.test.ts": 127, + "tests/zcode-mcp-degraded.test.ts": 836, + "tests/zcode-mcp-entry.test.ts": 334, + "tests/zcode-native.test.ts": 657, + "tests/zcode-real-cli.test.ts": 102, + "tests/zero-config-routing.test.ts": 466, + "tests/ws-upgrade.test.ts": 3700, + "tests/wire-exit-gap-cells.test.ts": 14710, + "tests/wire-exit-matrix.test.ts": 15116, + "tests/wire-contract.test.ts": 24831, + "tests/incremental-ack-pull.test.ts": 10547, + "tests/issue4323-drift-escalation.test.ts": 2194, + "tests/pi-host-stub.test.ts": 136, + "tests/server-close-all-connections.test.ts": 3212 + } +} diff --git a/scripts/measure-test-durations.mjs b/scripts/measure-test-durations.mjs new file mode 100644 index 0000000000..179ba2370d --- /dev/null +++ b/scripts/measure-test-durations.mjs @@ -0,0 +1,82 @@ +// Regenerate scripts/ci-shard-weights.json: measured wall-clock ms per test +// file (single-file node --test runs, small parallel pool so port bands and +// CPU stay close to real CI scheduling). Run from the repo root: +// +// node scripts/measure-test-durations.mjs +// +// Weights only need to be APPROXIMATELY right — LPT just needs the ranking +// and magnitude of the heavyweights (process-spawning suites), which are +// stable across machines even when absolute times are not. Re-run when CI +// shard balance visibly degrades (new heavy suites landing via the +// line-count fallback). Timeout hits are recorded as the timeout value (a +// lower bound) and listed under "timedOut" for visibility. +import { spawn } from "node:child_process"; +import { readdirSync, readFileSync, writeFileSync } from "node:fs"; +import { dirname, join } from "node:path"; +import { fileURLToPath } from "node:url"; + +const ROOT = dirname(dirname(fileURLToPath(import.meta.url))); +const POOL = 5; +const PER_FILE_TIMEOUT_MS = 150_000; +const PRELOAD_ARGS = ["--import", "./tests/preload-storage-baseline.mjs", "--import", "./tests/preload-zone-slot.mjs", "--import", "tsx"]; + +const files = readdirSync(join(ROOT, "tests")) + .filter((f) => f.endsWith(".test.ts")) + .map((f) => `tests/${f}`) + .sort(); + +function measureOne(rel) { + return new Promise((resolve) => { + const t0 = Date.now(); + const child = spawn( + process.execPath, + [...PRELOAD_ARGS, "--test", rel], + { cwd: ROOT, stdio: "ignore" }, + ); + let done = false; + const finish = (timedOut) => { + if (done) return; + done = true; + resolve({ rel, ms: Math.max(1, Date.now() - t0), timedOut }); + }; + child.on("error", () => finish(false)); + child.on("close", () => finish(false)); + setTimeout(() => { + child.kill("SIGKILL"); + finish(true); + }, PER_FILE_TIMEOUT_MS); + }); +} + +const results = []; +let next = 0; +async function worker() { + while (next < files.length) { + const rel = files[next++]; + process.stdout.write(`\r[${results.length + 1}/${files.length}] ${rel} `); + results.push(await measureOne(rel)); + } +} +await Promise.all(Array.from({ length: POOL }, worker)); +process.stdout.write("\n"); + +const ratios = results + .filter((r) => !r.timedOut) + .map((r) => r.ms / Math.max(1, readFileSync(join(ROOT, r.rel), "utf8").split("\n").length)) + .sort((a, b) => a - b); +const msPerLineFallback = Math.round(ratios[Math.floor(ratios.length / 2)]); + +const out = { + // schema v1 — read by scripts/ci-shard-partition.mjs + v: 1, + platform: `${process.platform}/${process.arch} node ${process.version}`, + note: "wall-clock ms of single-file node --test runs; regenerate with scripts/measure-test-durations.mjs when shard balance degrades", + msPerLineFallback, + timedOut: results.filter((r) => r.timedOut).map((r) => r.rel), + files: Object.fromEntries(results.map((r) => [r.rel, r.ms]).sort((a, b) => a[0].localeCompare(b[0]))), +}; +writeFileSync(join(ROOT, "scripts", "ci-shard-weights.json"), JSON.stringify(out, null, 2) + "\n"); + +const top = [...results].sort((a, b) => b.ms - a.ms).slice(0, 20); +console.log(`msPerLineFallback=${msPerLineFallback}; top ${top.length} heavyweights:`); +for (const r of top) console.log(` ${String(r.ms).padStart(7)}ms ${r.timedOut ? "(timeout lower-bound) " : ""}${r.rel}`); diff --git a/scripts/run-ci-tests.mjs b/scripts/run-ci-tests.mjs index 6565a49eb2..e96aca8ba3 100644 --- a/scripts/run-ci-tests.mjs +++ b/scripts/run-ci-tests.mjs @@ -83,6 +83,7 @@ import { execFileSync, spawn } from "node:child_process"; import { LIVE_FILES } from "./live-files.mjs"; import { classifyPhaseFailure, describeDrainPass, describeRetryOutcome, extractDrainCancelledTests, shouldDrainPass } from "./ci-failure-shapes.mjs"; +import { partitionAll as partitionFiles } from "./ci-shard-partition.mjs"; import { readdirSync, readFileSync } from "node:fs"; import { freemem, loadavg, totalmem } from "node:os"; import { join } from "node:path"; @@ -116,12 +117,14 @@ function die(msg) { // #3143: shard parsing + balanced partitioning. CI_TEST_SHARD="i/N" selects this // leg's slice; absent means "run everything" (local / back-compat, unchanged). -// The partition is DETERMINISTIC and TOTAL: LPT bin-packing over a line-count -// weight (cheap, runtime-derived, self-maintaining for new files) puts every file -// in exactly ONE shard, so the union of all shards == allFiles and NOTHING is ever -// skipped. Same input => same partition; a newly-added file only re-partitions the -// bins, it never drops another. Balance targets the HEAVIEST shard (the wall clock), -// not equal file counts — the one 7k-line monster must not pile onto one leg. +// The partition is DETERMINISTIC and TOTAL: every file lands in exactly ONE +// shard, so the union of all shards == allFiles and NOTHING is ever skipped. +// Same input => same partition; a newly-added file only re-partitions the +// bins, it never drops another. Since #4360 the weight is the file's MEASURED +// duration (scripts/ci-shard-partition.mjs + ci-shard-weights.json; new files +// fall back to line-count × msPerLineFallback) — line-count balancing proved +// blind to process-spawning suites and produced 5min..37min legs out of +// "perfectly balanced" byte counts. function parseShard() { const raw = (process.env.CI_TEST_SHARD ?? "").trim(); if (raw === "") return null; @@ -133,25 +136,10 @@ function parseShard() { return { i, n }; } +// Weighted LPT lives in scripts/ci-shard-partition.mjs (unit-tested via its +// .d.mts; this script has top-level side effects and cannot be imported). function partitionAll(files, n) { - const weight = new Map(); - for (const f of files) { - let txt = ""; - try { txt = readFileSync(join(root, f), "utf8"); } catch { /* unreadable => weight floor 1 */ } - weight.set(f, Math.max(1, txt.split("\n").length)); - } - const order = [...files].sort( - (a, b) => weight.get(b) - weight.get(a) || (a < b ? -1 : a > b ? 1 : 0), - ); - const bins = Array.from({ length: n }, () => []); - const load = new Array(n).fill(0); - for (const f of order) { - let best = 0; - for (let k = 1; k < n; k++) if (load[k] < load[best]) best = k; // lowest index breaks ties - bins[best].push(f); - load[best] += weight.get(f); - } - return bins; + return partitionFiles(files, n); } for (const f of LIVE_FILES) { diff --git a/tests/ci-shard-weights.test.ts b/tests/ci-shard-weights.test.ts new file mode 100644 index 0000000000..133bf5c9cd --- /dev/null +++ b/tests/ci-shard-weights.test.ts @@ -0,0 +1,67 @@ +// Unit coverage for the measured-weight shard partition +// (scripts/ci-shard-partition.mjs): table-driven weights, fallback for +// unlisted files, LPT balance targeting the heaviest shard, determinism and +// the total-union invariant. +import { test } from "node:test"; +import assert from "node:assert/strict"; +import { readFileSync, readdirSync } from "node:fs"; +import { fileWeight, lineCount, partitionAll } from "../scripts/ci-shard-partition.mjs"; + +test("fileWeight: measured value wins; unlisted falls back to lineCount x k", () => { + const table = { msPerLineFallback: 7, files: { "tests/a.test.ts": 12_345 } }; + assert.equal(fileWeight("tests/a.test.ts", table), 12_345); + const unlisted = fileWeight("tests/does-not-exist.test.ts", table); + assert.equal(unlisted, 1 * 7, "unreadable file: line floor 1 x k"); + const real = lineCount("tests/ci-shard-weights.test.ts"); + assert.ok(real > 10, "lineCount reads the real file"); +}); + +test("LPT spreads measured heavyweights instead of piling them by lines", () => { + // 3 spawn-heavy monsters (low line count, huge runtime) + many light files. + const table = { + msPerLineFallback: 10, + files: { + "tests/h1.test.ts": 60_000, + "tests/h2.test.ts": 55_000, + "tests/h3.test.ts": 50_000, + }, + }; + const light = Array.from({ length: 60 }, (_, i) => `tests/l${i}.test.ts`); + const files = ["tests/h1.test.ts", "tests/h2.test.ts", "tests/h3.test.ts", ...light]; + // light files do not exist on disk -> lineCount floor 1 -> weight 10 each. + const bins = partitionAll(files, 3, table); + assert.deepEqual( + bins.map((b) => b[0]).sort(), + ["tests/h1.test.ts", "tests/h2.test.ts", "tests/h3.test.ts"], + "each monster opens its own bin", + ); + const loads = bins.map((b) => b.reduce((s, f) => s + fileWeight(f, table), 0)); + assert.ok(Math.max(...loads) - Math.min(...loads) < 10_000, `near-balanced loads: ${loads}`); +}); + +test("partition is deterministic, total, and every bin disjoint", () => { + const table = { + msPerLineFallback: 5, + files: { "tests/x.test.ts": 100, "tests/y.test.ts": 90, "tests/z.test.ts": 3 }, + }; + const files = ["tests/x.test.ts", "tests/y.test.ts", "tests/z.test.ts"]; + const b1 = partitionAll(files, 2, table); + const b2 = partitionAll(files, 2, table); + assert.deepEqual(b1, b2, "same input => same partition"); + assert.deepEqual([...b1].flat().sort(), [...files].sort(), "union == input, nothing dropped"); +}); + +test("checked-in weight table stays honest: every entry is a real test file", () => { + // A stale entry for a renamed/deleted file silently rots the balance + // story; this pins table hygiene (regen drops removed files naturally). + let raw; + try { + raw = JSON.parse(readFileSync("scripts/ci-shard-weights.json", "utf8")) as { files?: Record }; + } catch (e) { + if ((e as NodeJS.ErrnoException).code !== "ENOENT") throw e; // table absent pre-regen: acceptable, skip + return; + } + const onDisk = new Set(readdirSync("tests").filter((f) => f.endsWith(".test.ts"))); + const stale = Object.keys(raw.files ?? {}).filter((f) => !onDisk.has(f.split("/").pop() ?? f)); + assert.deepEqual(stale, [], `weight table references missing files: ${stale.join(", ")}`); +});