Garry's Opinionated OpenClaw/Hermes Agent Brain
TypeScript
docs: keep TESTING.md and the tooling key-files page under their size caps
garrytan22cc71bd111d
diff --git a/docs/TESTING.md b/docs/TESTING.mdindex e350e16a0f..272097646e 100644--- a/docs/TESTING.md+++ b/docs/TESTING.md@@ -676,18 +676,8 @@ keys stripped and local environment-file loading disabled. No partition relieson a preceding file to create shared tables. Bootstrap is a separate timed CIstep and must be included in end-to-end comparisons.-Each unit shard's mined weight must fit the `test` job's 22 minutes twice-over, after a minute of setup, with a minute to spare (`UNIT_SHARD_BUDGET_MS`,-600 s, in `scripts/sharding.ts`): master shards ran 0.8-1.4x their predicted-weight, and at 10 shards one was cancelled at the timeout with no failing test.-`test/scripts/unit-shard-budget.test.ts` sums each shard of-`test-shard.sh`'s own partition at `UNIT_SHARDS` and fails over the budget;-`test/scripts/ci-gates.test.ts` pins test.yml's matrix, step and coverage-manifest and e2e.yml's `coverage-full-unit` to `UNIT_SHARDS`. When it fails,-re-mine the unit weights from a green master run, then raise `UNIT_SHARDS` and-both workflows to the smallest count that leaves room for new files. With the-unit and slow lanes, `ci:ubicloud` also sums its measured durations over that-partition and fails when a shard passes the job's 21 minutes after setup.+Twice a unit shard's mined weight, plus setup, must end a minute inside its+job (`UNIT_SHARD_BUDGET_MS`); on failure re-mine, then raise `UNIT_SHARDS`.Refresh after a large test wave or when the longest shard repeatedly exceedsthe mean shard execution time by 25%. `bun run check:weight-coverage` (in@@ -712,9 +702,7 @@ serial or explicit full-profile E2E run replaces that lane's entire map. Capturesuccessful completion marker, and GitHub imports verify every expected job.Incomplete or failed inputs leave the existing map intact. Sidecar metadatarecords the source run/commit, units, and counts. Unit/E2E weights are milliseconds;-serial weights remain seconds. New files receive the corpus p75 estimate. Empty-maps and zero-cost ties distribute files deterministically; corrupt serial-weights warn and retain safe fallback scheduling.+serial weights remain seconds. New files receive the corpus p75 estimate.The default E2E miner reads selected jobs and merges partial observations.`--e2e-profile full` instead requires a successful GitHub run with a source SHA@@ -1282,7 +1270,7 @@ there even though they pass on Linux and macOS.### CI vs local: intentionally divergent file sets-- **CI matrix** (`.github/workflows/test.yml`) runs `scripts/test-shard.sh` across `UNIT_SHARDS` (18) shards split by weight-aware LPT bin-packing (`scripts/sharding.ts`; unweighted files get the p75 weight) and includes `*.slow.test.ts` files without a dedicated job, plus keyless-allowlisted `evals/**/*.test.ts` (`test/scripts/evals-collection.test.ts`). Shards keep planned file order (`test-shard.sh --dry-run-list <i> 18`) and print their predicted weight (`sharding.ts --sum`). Every Bun job activates the PGLite schema snapshot (built in-runner, cached across jobs; the runner's hash check is authoritative). Serial files run across four `serial-tests` workers via `bun run test:serial`; `verify` and the BrainBench memory-conformance gate (`scripts/ci-brainbench-gate.sh`, compared against `evals/brainbench/baselines/main.json`) have their own jobs, all aggregated by `test-status`. `e2e.yml` aggregates through `e2e-status`, with jsonb-parity gating Tier 2's token spend; scheduled runs also require the full-corpus lanes. Both aggregates reject failures, cancellations and unexpected skips, and successful test results are never reused. CI is the ground truth for "did everything pass."+- **CI matrix** (`.github/workflows/test.yml`) runs `scripts/test-shard.sh` across 18 shards split by weight-aware LPT bin-packing (`scripts/sharding.ts`; unweighted files get the p75 weight) and includes `*.slow.test.ts` files without a dedicated job, plus keyless-allowlisted `evals/**/*.test.ts` (`test/scripts/evals-collection.test.ts`). Shards keep planned file order (`test-shard.sh --dry-run-list <i> 18`) and print their predicted weight (`sharding.ts --sum`). Every Bun job activates the PGLite schema snapshot (built in-runner, cached across jobs; the runner's hash check is authoritative). Serial files run across four `serial-tests` workers via `bun run test:serial`; `verify` and the BrainBench memory-conformance gate (`scripts/ci-brainbench-gate.sh`, compared against `evals/brainbench/baselines/main.json`) have their own jobs, all aggregated by `test-status`. `e2e.yml` aggregates through `e2e-status`, with jsonb-parity gating Tier 2's token spend; scheduled runs also require the full-corpus lanes. Both aggregates reject failures, cancellations and unexpected skips, and successful test results are never reused. CI is the ground truth for "did everything pass."- **Local fast loop** (`scripts/run-unit-shard.sh` via the parallel wrapper) uses the same weighted partitioner as CI and EXCLUDES `*.slow.test.ts` AND `*.serial.test.ts`. Each shard runs its complete ordered selection with a fresh Bun process per file, without adding workers. Later groups still run after failures; missing summaries or file-completion evidence fail the shard. Local trades coverage for inner-loop speed; CI catches what local skips.`test/scripts/run-unit-shard.test.ts` pins what the local loop includes, anddiff --git a/docs/architecture/key-files/tooling-and-tests.md b/docs/architecture/key-files/tooling-and-tests.mdindex 98f334abe5..83dd8c4b07 100644--- a/docs/architecture/key-files/tooling-and-tests.md+++ b/docs/architecture/key-files/tooling-and-tests.md@@ -80,7 +80,7 @@ Current behavior and load-bearing invariants; history belongs in Git and CHANGEL- `scripts/select-e2e.ts` + `scripts/ci-changed-files.sh` + `scripts/ci-doc-checks.sh` — E2E selection. `select-e2e.ts` classifies the changed files (git: committed `origin/master...HEAD`, working tree and untracked-unignored files; or `--changed-files <path|->`) as EMPTY / DOC_ONLY / SRC: DOC_ONLY (root `*.md`, `docs/`, LICENSE, VERSION) selects nothing, everything else selects every `test/e2e/*.test.ts` and prints "E2E narrowing is retired" (a diff map selected all files on 40 of 40 merged PRs). `ci-changed-files.sh` lists a PR's or merge-group entry's files from the GitHub API for `prepare-e2e` and exits 1 on a capped (3000 PR / 300 compare), short or failed list or with no PR context, so the workflow falls back to the whole corpus. `ci-doc-checks.sh` is the doc-only gate `ci:local:diff` and `ci:ubicloud:diff` run (llms freshness, `check:doc-history`, `test/docs-repo-paths.test.ts`, skill refs, privacy guards). Tests: `test/select-e2e.test.ts`, `test/scripts/e2e-wiring.test.ts`, `test/scripts/ci-local-rendering.test.ts`.-- `scripts/sharding.ts` + `scripts/mine-shard-weights.ts` + `scripts/capture-test-log.ts` — shared deterministic weighted partitioning and timing refresh. CLI accepts lane-specific weights; missing entries use p75, equal loads prefer fewer files then shard index, and serial may explicitly opt into warning/fallback on bad advisory weights. `UNIT_SHARDS` (18) is test.yml's unit matrix and e2e.yml's `coverage-full-unit` matrix (pinned by `test/scripts/ci-gates.test.ts`); `unitShards(root, n)` returns each shard's files from `test-shard.sh --dry-run-list`, and `test/scripts/unit-shard-budget.test.ts` fails when a shard's predicted weight passes `UNIT_SHARD_BUDGET_MS` (600 s: the 22-minute `UNIT_JOB_TIMEOUT_MS` less a minute of setup and a minute of slack, halved), which `ci:ubicloud` also checks against measured durations. `--sum` reads a shard's file list and prints its predicted weight (test-shard.sh prints it beside the `(LPT-balanced)` line; test.yml's unit job prints nproc, loadavg, steal jiffies and the CPU model before and after the shard, so a slow draw is told apart from slow tests). `weights:mine --lane unit|serial|e2e` validates completed lane logs before replacement and records run/commit/unit metadata. A GitHub refresh reads one job at a time (a whole-run `gh run view --log` is refused above gh's job cap): unit from each shard's `timings-unit-N` capture artifact, which must record one capture start and a final `complete exit=0`; serial from `gh run view --job <id> --log`. E2E defaults to merging selected-job observations; explicit `--e2e-profile full --run ID` requires a successful source-matched run, pins its attempt/job IDs, resolves basename headers against committed default discovery including the outside-directory parity entry, and replaces the map only after exact disjoint corpus validation. Metadata retains log/corpus hashes; file/stdin sources cannot claim full-profile provenance. Capture preserves stdout/stderr, records timestamped GitHub-format artifacts, forwards cancellation to its owned process group and marks failed runs unmineable. On a failed run under Actions it appends the last 50 failures to the step summary: file, test, backend arm, the first error block and a reproduction command (or the last log lines when no `(fail)` line was printed). Unit and E2E artifact retention is 14 days. `scripts/check-weight-coverage.ts` (`check:weight-coverage`, in verify) fails on a unit/serial/E2E/Ubicloud weight entry naming a missing file and on an unweighted lane share above 5% (unit) or 10% (serial, E2E) only when `GITHUB_EVENT_NAME=schedule`; otherwise the share warns (stdout + step summary) with the lane's miner command. Tests: `test/scripts/check-weight-coverage.test.ts` plus guard self-test fixtures.+- `scripts/sharding.ts` + `scripts/mine-shard-weights.ts` + `scripts/capture-test-log.ts` — shared deterministic weighted partitioning and timing refresh. CLI accepts lane-specific weights; missing entries use p75, equal loads prefer fewer files then shard index, and serial may explicitly opt into warning/fallback on bad advisory weights. `UNIT_SHARDS` sizes both unit matrices under `UNIT_SHARD_BUDGET_MS` (`test/scripts/unit-shard-budget.test.ts`). `--sum` prints a shard's predicted weight (test-shard.sh logs it; the unit job logs nproc, load, steal and CPU model, so a slow draw is told apart from slow tests). `weights:mine --lane unit|serial|e2e` validates completed lane logs before replacement and records run/commit/unit metadata. A GitHub refresh reads one job at a time (a whole-run `gh run view --log` is refused above gh's job cap): unit from each shard's `timings-unit-N` capture artifact, which must record one capture start and a final `complete exit=0`; serial from `gh run view --job <id> --log`. E2E defaults to merging selected-job observations; explicit `--e2e-profile full --run ID` requires a successful source-matched run, pins its attempt/job IDs, resolves basename headers against committed default discovery including the outside-directory parity entry, and replaces the map only after exact disjoint corpus validation. Metadata retains log/corpus hashes; file/stdin sources cannot claim full-profile provenance. Capture preserves stdout/stderr, records timestamped GitHub-format artifacts, forwards cancellation to its owned process group and marks failed runs unmineable. On a failed run under Actions it appends the last 50 failures to the step summary: file, test, backend arm, the first error block and a reproduction command (or the last log lines when no `(fail)` line was printed). Unit and E2E artifact retention is 14 days. `scripts/check-weight-coverage.ts` (`check:weight-coverage`, in verify) fails on a unit/serial/E2E/Ubicloud weight entry naming a missing file and on an unweighted lane share above 5% (unit) or 10% (serial, E2E) only when `GITHUB_EVENT_NAME=schedule`; otherwise the share warns (stdout + step summary) with the lane's miner command. Tests: `test/scripts/check-weight-coverage.test.ts` plus guard self-test fixtures.- `test/e2e/codex-plugin-install-real.serial.test.ts` + `test/e2e/claude-plugin-install-real.serial.test.ts` — the plugin doors: clean-tree staging (`git archive HEAD`), real marketplace add/plugin add, snapshot + exec-bit + non-root-mcp.json pins, tools/list starter-surface oracle, cold-home fast-fail, --source-guard block/allow, coexistence + removal probes, auth-gated SMOKE turns. CI: the `plugin-doors` job in heavy-tests.yml (pinned binary provisioning + expected-pass-count refuse-green).