Garry's Opinionated OpenClaw/Hermes Agent Brain
TypeScript
docs: move lane C detail out of TESTING.md into docs/operations/verify-and-nightly-e2e.md
garrytand7d07e162d69
diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.ymlindex 8aedfa9de2..417c1eeb95 100644--- a/.github/workflows/e2e.yml+++ b/.github/workflows/e2e.yml@@ -887,7 +887,7 @@ jobs:# failure). A shard that failed or hit timeout-minutes in a run nobody# cancelled stays a failure. cancelled() cannot tell (it is false in an# always() job started after the cancel), so the script reads the shard- # jobs' annotations. docs/TESTING.md#full-corpus-report-states+ # jobs' annotations. docs/operations/verify-and-nightly-e2e.md#full-corpus-report-states- name: Classify full E2E shardsid: shardsenv:diff --git a/docs/TESTING.md b/docs/TESTING.mdindex 85da3e122c..cb507b6be8 100644--- a/docs/TESTING.md+++ b/docs/TESTING.md@@ -404,7 +404,7 @@ Test command tiers, each with a clear scope:| Command | What it runs | Wallclock | When to use ||---|---|---|---|| `bun run test` | Parallel unit loop (`scripts/run-unit-parallel.sh`): weighted shards (CPU-detected, 4 by default, at most 8; CI uses 8), then the serial pass. Excludes `*.slow.test.ts` and `test/e2e/*`; no typecheck. Builds the PGLite schema snapshot first and exports `GBRAIN_PGLITE_SNAPSHOT` (opt out: `GBRAIN_NO_SNAPSHOT=1`). Caps total concurrency to available memory at `GBRAIN_TEST_MEM_PER_FILE_MB` (default 1536) per slot, shedding intra-shard width before shards. Shards that fail with the WASM out-of-memory signature or are killed externally get one serial rescue pass: phantoms go green with an `oom_rescued` note, real failures stay red. Knobs: `GBRAIN_TEST_NO_MEM_ADAPT=1`, `GBRAIN_TEST_NO_OOM_FALLBACK=1`, `GBRAIN_TEST_MAX_CONCURRENCY` (default 4), `GBRAIN_TEST_SHARD_TIMEOUT` / `GBRAIN_TEST_SHARD_KILL_AFTER`, `--shards N` / `--max-concurrency N` / `--dry-run`. | a few minutes on a laptop | Inner edit loop. Default. |-| `bun run verify` | CI's authoritative pre-test gate set, fanned out by `scripts/run-verify-parallel.sh` through a bounded worker pool (default `detect_cpus`; override `GBRAIN_VERIFY_MAX_PARALLEL`) with the heavy checks ordered first (typecheck, the two compile-embed checks, admin build, fuzz bundles, whole-tree greps), then the `SOLO_CHECKS` that time themselves (the guard self-test and its 30 s budget) one at a time after the pool drains, so their budgets measure their own work and not the heavy checks beside them. `outcomes.tsv` in the log directory records every check's wall seconds and the summary names the five slowest. `check:eval-chronicle` and `check:eval-canary` are deliberately NOT in the battery (their test-file twins `test/eval-chronicle.test.ts` and `test/eval-canary.test.ts` run the identical evals in the unit matrix, and CI's verify job and matrix always run together — the package scripts stay for on-demand runs, so `verify`-only local callers should know both evals ride the unit lane instead). The `CHECKS` array in that script is the single source of truth — CI literally calls `bun run verify` in a dedicated job. | ~65-85s (pool makespan, typecheck dominates, plus the ~15-19s solo guard self-test) | Before pushing; before `/ship`. |+| `bun run verify` | CI's authoritative pre-test gate set, fanned out by `scripts/run-verify-parallel.sh` through a bounded worker pool (default `detect_cpus`; override `GBRAIN_VERIFY_MAX_PARALLEL`) with the heavy checks ordered first (typecheck, the two compile-embed checks, admin build, fuzz bundles, whole-tree greps), then the self-timed `SOLO_CHECKS` alone ([why](operations/verify-and-nightly-e2e.md#verify-solo-checks)). `check:eval-chronicle` and `check:eval-canary` are deliberately NOT in the battery (their test-file twins `test/eval-chronicle.test.ts` and `test/eval-canary.test.ts` run the identical evals in the unit matrix, and CI's verify job and matrix always run together — the package scripts stay for on-demand runs, so `verify`-only local callers should know both evals ride the unit lane instead). The `CHECKS` array in that script is the single source of truth — CI literally calls `bun run verify` in a dedicated job. | ~65-85s | Before pushing; before `/ship`. || `bun run test:full` | `verify && bun run test && bun run test:slow && [smart e2e]`. Smart e2e runs only when `DATABASE_URL` is set and propagates its failure; otherwise it prints a skip notice to stderr. Use `ci:local` to provision the databases and require PgBouncer execution. | ~3-5min depending on slow + e2e | Pre-merge sanity, before opening a PR. || `bun run ci:local` | Independent host gitleaks scans, then frozen dependencies, guards/typecheck, the complete serial and slow lanes, and four unit/E2E shards inside Docker. Each E2E shard has its own pgvector database; selected PgBouncer tests must execute against the transaction-mode pooler. Unit, serial, and slow lanes have database URL overrides unset. Any failed stage fails the command. Complete shard logs survive container teardown under `.context/ci-local-shards/`. `ci:local:diff` runs only gitleaks and the doc checks on a doc-only diff and the full gate otherwise; `--no-shard` runs unit/E2E sequentially. Doc-only diffs still require successful gitleaks scans. | Depends on the full corpus | Full local gate before shipping. || `bun run ci:ubicloud` | The `ci:local` lanes (gitleaks, guards/typecheck, serial, slow, unit, all E2E with required PgBouncer execution) fanned out across ephemeral Ubicloud VMs from one heaviest-first work queue; `ci:ubicloud:diff` takes the same doc-only fast path as `ci:local:diff`. Needs `UBICLOUD_API_KEY` or `UBICLOUD_API_TOKEN`, no local Docker. See "Ubicloud fan-out" below. | ~5 min (floor: the longest single file) | Full gate before shipping when a Ubicloud token is available. |@@ -432,8 +432,7 @@ array in `scripts/run-verify-parallel.sh` is the single execution list`check:no-legacy-getconnection`). The guard REGISTRY is `scripts/guards-manifest.tsv` (see "Guard registry andself-test" below).-`bun run typecheck` runs tsc under `node --max-old-space-size=6144` (tsc peaks-near 3.5 GB of heap; Node's default limit is about 2 GB on an 8 GB host) and uses TypeScript's native incremental analysis in+`bun run typecheck` ([heap ceiling](operations/verify-and-nightly-e2e.md#typecheck-heap)) uses TypeScript's native incremental analysis in`node_modules/.cache/gbrain-typecheck.tsbuildinfo`. Every invocation still runsthe compiler; source, root-file, configuration and dependency changes invalidatethe affected analysis, and cached diagnostics remain failures. The cache is local@@ -1276,25 +1275,7 @@ cancellations cannot report complete execution, and the report refuses topublish without that evidence. Receipts prove file execution, not everyoptional assertion within a file.-#### Full-corpus report states--`coverage-full-report` classifies the four full E2E shards before merging-anything (`scripts/classify-full-e2e-shards.ts`, reading this run attempt's-shard jobs and their check-run annotations; `cancelled()` cannot tell, since it-reads false in an `always()` job that starts after the cancel, and a timed-out-shard also reports `cancelled` through `needs`). All shards succeeded: it-merges, renders and gates the full corpus.-The run was cancelled (by a newer run in its concurrency group or by a user)-before the shards finished: it reports `Full E2E shards cancelled` as a-warning and a step-summary section, publishes no coverage and does not fail,-because nothing was measured; re-run with-`gh workflow run e2e.yml --ref master -f full_corpus=true` or wait for the next-schedule. Any other non-success (a shard failed, or hit its `timeout-minutes`-in a run nobody cancelled) is a failure: read `gh run view <run-id> --log-failed`,-fix the shard, then `gh run rerun <run-id> --failed`. Shard evidence that-cannot be read is a failure, never a cancellation on a guess. Scheduled runs use their-own `-nightly` concurrency group, so a push to master no longer cancels the-nightly full corpus (#6040).+Shard cancellation versus failure in `coverage-full-report`: [full-corpus report states](operations/verify-and-nightly-e2e.md#full-corpus-report-states).**Merge** (`scripts/merge-lcov.ts`) sums DA hits per file and line across theinput directories, normalizes paths, and emits a merged lcov plus a summarydiff --git a/docs/operations/verify-and-nightly-e2e.md b/docs/operations/verify-and-nightly-e2e.mdnew file mode 100644index 0000000000..1c1373e1bb--- /dev/null+++ b/docs/operations/verify-and-nightly-e2e.md@@ -0,0 +1,62 @@+# Verify scheduling and the nightly E2E report++How `bun run verify` schedules its checks, why `typecheck` sets its own heap+ceiling, and how the nightly full-corpus E2E report tells a cancelled run from+a failed one. Test tiers and the rest of CI live in [TESTING.md](../TESTING.md).++## Verify solo checks++`scripts/run-verify-parallel.sh` runs `CHECKS` through a worker pool sized to+the CPU count, heaviest first, then runs each `SOLO_CHECKS` entry alone after+the pool has drained. A solo check is one that enforces its own wall-clock+budget: today only `check:guard-self-test` (30 s, `BUDGET_SECONDS` in+`scripts/guard-self-test.sh`). Inside the pool that budget measured the+neighbours instead of the guards: `typecheck`, two `bun build --compile`+checks and the admin build each use more than one core, so the self-test+(15-19 s alone on a Ubicloud standard-2 or standard-8) reached 31 s on the+8-vCPU verify runner and 32 s on macOS 26.++Add a new check as one line in the right block of `CHECKS`. Add to+`SOLO_CHECKS` only a check that times itself. The 120 s per-check cap+(`GBRAIN_VERIFY_TIMEOUT`) applies to both phases.++Every run writes `outcomes.tsv` in the log directory with each check's+outcome and wall seconds, and the summary line names the five slowest checks,+so an overrun shows whether the check or its neighbours grew.++## Typecheck heap++`bun run typecheck` runs `node --max-old-space-size=6144+node_modules/typescript/bin/tsc`. tsc needs about 3.5 GB of heap on this repo+(`--extendedDiagnostics`: about 7,350 files, 1.3 M lines). Node's default heap+limit follows host memory, about 2 GB on an 8 GB host, so without the flag+typecheck aborts with `JavaScript heap out of memory` on 8 GB machines such as+a Ubicloud standard-2. The value is a ceiling, not a reservation: peak RSS is+about 3.7 GB with ceilings of 3,800, 4,096 or 6,144 MB, and wall time is the+same. If tsc reaches the ceiling, find what grew the program (the+`Files`/`Memory used` lines of `--extendedDiagnostics`) before raising it.++## Full-corpus report states++`coverage-full-report` in `.github/workflows/e2e.yml` first runs+`scripts/classify-full-e2e-shards.ts`, which reads this run attempt's four+`coverage-full-e2e` jobs and their check-run annotations:++| Shards | Report | Job | Next step |+|---|---|---|---|+| All succeeded | Merges, renders and gates the full corpus | per gates | none |+| Every unfinished shard carries GitHub's run-cancel annotation (`Canceling since a higher priority waiting request …` or `The run was canceled by …`) | `Full E2E shards cancelled` warning and step summary; no coverage | success | `gh workflow run e2e.yml --ref master -f full_corpus=true`, or wait for the next schedule |+| A shard failed, hit its `timeout-minutes`, or the evidence cannot be read | `Full E2E shards failed` error | failure | `gh run view <run-id> --log-failed`, fix the shard, `gh run rerun <run-id> --failed` |++The workflow cannot decide this from expressions. `cancelled()` reads false in+an `always()` job that starts after the run was cancelled, and a shard that+hits `timeout-minutes` also reports `cancelled` through `needs`. Unreadable+evidence is a failure, never a cancellation on a guess.++Scheduled E2E runs use their own `-nightly` concurrency group, as `test.yml`+does, so a push to master does not cancel the nightly full corpus.++## Changelog++- 2026-10-05: created (green master wave, lane C): solo verify phase,+ typecheck heap ceiling, full-corpus shard classification (#6040, #6056).diff --git a/scripts/classify-full-e2e-shards.ts b/scripts/classify-full-e2e-shards.tsindex 6e332bc5e0..e1d95593b3 100644--- a/scripts/classify-full-e2e-shards.ts+++ b/scripts/classify-full-e2e-shards.ts@@ -20,12 +20,12 @@* Usage (Actions): FULL_E2E_RESULT=<needs result> GH_TOKEN=<token>* bun scripts/classify-full-e2e-shards.ts* Writes state=complete|cancelled to $GITHUB_OUTPUT; exits 0 for complete or- * cancelled, 1 for failed. Docs: docs/TESTING.md#full-corpus-report-states+ * cancelled, 1 for failed. Docs: docs/operations/verify-and-nightly-e2e.md#full-corpus-report-states*/import { appendFileSync } from 'node:fs';import { type GitHubClient, inert, restClient } from './lib/gh-issue.ts';-export const DOCS = 'docs/TESTING.md#full-corpus-report-states';+export const DOCS = 'docs/operations/verify-and-nightly-e2e.md#full-corpus-report-states';const SHARD_JOB = /^coverage-full-e2e \(\d+\)$/;const RUN_CANCELLED = [/^Canceling since a higher priority waiting request for .+ exists/, /^The run was canceled by /];const TIMED_OUT = /has exceeded the maximum execution time/;diff --git a/test/scripts/nightly-e2e.test.ts b/test/scripts/nightly-e2e.test.tsindex 8bbd1cde21..a12af95daf 100644--- a/test/scripts/nightly-e2e.test.ts+++ b/test/scripts/nightly-e2e.test.ts@@ -148,7 +148,8 @@ describe('nightly E2E scheduling', () => {for (const name of ['Merge full corpus', 'Coverage summary → step summary', 'Baseline gate (fullCorpus, like-for-like)']) {expect(report.steps.find((step: any) => step.name === name).if).toBe("steps.shards.outputs.state == 'complete'");}- expect(readFileSync(join(repo, 'docs/TESTING.md'), 'utf8')).toMatch(/^#+ Full-corpus report states$/m);+ expect(CLASSIFY_DOCS).toBe('docs/operations/verify-and-nightly-e2e.md#full-corpus-report-states');+ expect(readFileSync(join(repo, 'docs/operations/verify-and-nightly-e2e.md'), 'utf8')).toMatch(/^## Full-corpus report states$/m);const status = workflow.jobs['e2e-status'];expect(status.if).toBe('always()');expect(status.needs).toContain('coverage-full-e2e');