mirror of
https://github.com/garrytan/gbrain.git
synced 2026-07-28 14:59:47 +00:00
* test: add withEnv helper + canonical PGLite block JSDoc withEnv(overrides, fn) saves prior values, runs the callback, restores via try/finally — including on throw. Handles delete via undefined override. Nested calls compose. Cross-test safe; explicitly NOT intra-file concurrent-safe (process.env is process-global). 7 unit cases covering sync, async, delete-key, delete-when-prior-unset, restore-on-throw, nested compose, multi-key atomic restore. reset-pglite.ts JSDoc extended with the canonical 4-line PGLite block (beforeAll create + afterAll disconnect + beforeEach reset). The lint script in the next commit enforces this exact shape. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * test: add check-test-isolation lint script + wire into verify Grep-based lint enforcing 4 rules on non-serial unit test files: R1: no process.env mutations (use withEnv() or rename to *.serial.test.ts) R2: no mock.module() (rename to *.serial.test.ts) R3: new PGLiteEngine( only inside beforeAll() context R4: PGLiteEngine creators must pair with afterAll{disconnect} Wired into 'bun run verify' and 'bun run check:all' (NOT 'bun run test' which is the parallel runner script with no pre-check chain). Matches the existing scripts/check-*.sh family shape (jsonb, progress, etc). 51 baseline violators captured in scripts/check-test-isolation.allowlist. List MUST shrink over time — entries removed by v0.26.8 (env sweep) and v0.26.9 (PGLite sweep). New files cannot be added. CLAUDE.md ## Testing section extended with R1-R4 rules table, the canonical 4-line PGLite block, withEnv pattern, and when-to-quarantine guidance. 16 fixture-driven test cases for the lint: clean, R1 (5 patterns + 1 negative), R2, R3 (top-level vs in-beforeAll), R4 (missing disconnect), *.serial.test.ts skip, test/e2e/ skip, allowlist (3 cases). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * test: quarantine cycle and embed mock.module test files Both files use mock.module(...) at top level — leaks across files in the same shard process. The check-test-isolation lint (R2) bans this pattern in non-serial files; quarantine is the escape hatch. Per v0.26.7 plan D5: prefer quarantine over DI on runCycle/runEmbed. Production signatures stay frozen; tests run at --max-concurrency=1 in the serial post-pass (the existing pattern shipped in v0.26.4 for brain-registry and reconcile-links). Quarantine count: 2 → 4. Cap raised to 10 informational per D15. Renames: test/core/cycle.test.ts → test/core/cycle.serial.test.ts test/embed.test.ts → test/embed.serial.test.ts Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * chore: bump version and changelog (v0.26.7) Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * docs: post-ship documentation sync for v0.26.7 - README.md "Contributing" line: point to bun run test + bun run verify (parallel fast loop) - CONTRIBUTING.md "Running tests": rewrite for the v0.26.4/v0.26.7 test surface (parallel runner, verify, slow/serial/e2e tiers) - CONTRIBUTING.md adds "Writing tests that survive the parallel loop" section: R1-R4 lint, canonical PGLite block, withEnv pattern, when to quarantine - llms-full.txt regenerated to pick up the README + CONTRIBUTING changes Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
74 lines
2.4 KiB
Plaintext
74 lines
2.4 KiB
Plaintext
# v0.26.7 baseline allow-list for scripts/check-test-isolation.sh.
|
|
#
|
|
# Files here violate one or more of the lint rules (env mutation,
|
|
# mock.module, PGLite outside beforeAll, missing afterAll{disconnect}).
|
|
# The lint ships in v0.26.7 and v0.26.8 (env sweep) + v0.26.9 (PGLite
|
|
# sweep) remove entries from this file as each sweep makes the file
|
|
# clean.
|
|
#
|
|
# RULES:
|
|
# - This list MUST shrink over time. Never add new entries — adding a
|
|
# new file means accepting cross-file flake risk for that file.
|
|
# - When you fix a file (apply withEnv, add the canonical PGLite
|
|
# block, etc.), remove its entry here.
|
|
# - When you cannot fix a file cleanly (genuinely env-coupled,
|
|
# or shares state intentionally), rename it to *.serial.test.ts
|
|
# instead of leaving it allow-listed.
|
|
#
|
|
# Permanent exemption: the test of the lint itself. Its fixture strings
|
|
# (passed verbatim into subprocesses) legitimately match the lint
|
|
# patterns it is testing detection of. The file does NOT mutate
|
|
# process.env at runtime. Permanent — do not remove.
|
|
test/scripts/check-test-isolation.test.ts
|
|
test/autopilot-install.test.ts
|
|
test/bootstrap.test.ts
|
|
test/brain-resolver.test.ts
|
|
test/check-resolvable-cli.test.ts
|
|
test/claw-test-cli.test.ts
|
|
test/code-def-refs.test.ts
|
|
test/core/cycle.test.ts
|
|
test/destructive-guard.test.ts
|
|
test/doctor-minions-check.test.ts
|
|
test/doctor.test.ts
|
|
test/dream.test.ts
|
|
test/embed.test.ts
|
|
test/eval-capture.test.ts
|
|
test/friction-cli.test.ts
|
|
test/friction.test.ts
|
|
test/gbrain-home-isolation.test.ts
|
|
test/helpers/with-env.test.ts
|
|
test/http-transport.test.ts
|
|
test/hybrid-meta.test.ts
|
|
test/init-migrate-only.test.ts
|
|
test/integrations.test.ts
|
|
test/mcp-eval-capture.test.ts
|
|
test/migrate.test.ts
|
|
test/migration-resume.test.ts
|
|
test/migrations-v0_11_0.test.ts
|
|
test/migrations-v0_13_1.test.ts
|
|
test/migrations-v0_14_0.test.ts
|
|
test/migrations-v0_19_0.test.ts
|
|
test/migrations-v0_22_4.test.ts
|
|
test/minions-shell.test.ts
|
|
test/minions.test.ts
|
|
test/mounts-cli.test.ts
|
|
test/multi-source-integration.test.ts
|
|
test/orphans.test.ts
|
|
test/pages-soft-delete.test.ts
|
|
test/preferences.test.ts
|
|
test/reindex-code.test.ts
|
|
test/resolve-prepare.test.ts
|
|
test/resolvers.test.ts
|
|
test/scenarios.test.ts
|
|
test/schema-bootstrap-coverage.test.ts
|
|
test/search-limit.test.ts
|
|
test/seed-pglite.test.ts
|
|
test/skillpack-check.test.ts
|
|
test/source-resolver.test.ts
|
|
test/storage-sync.test.ts
|
|
test/subagent-audit.test.ts
|
|
test/supervisor.test.ts
|
|
test/sync-failures.test.ts
|
|
test/sync-parallel.test.ts
|
|
test/transcription.test.ts
|