From 43cdaf7a666df76617ad121e253eae09fd0cb9fd Mon Sep 17 00:00:00 2001 From: Chris Phillipson Date: Sun, 27 Sep 2026 09:03:30 -0700 Subject: [PATCH 01/28] docs(plan): Branch 2 test hermeticity code-level plan --- .../2026-09-27-branch-2-test-hermeticity.md | 1723 +++++++++++++++++ 1 file changed, 1723 insertions(+) create mode 100644 docs/superpowers/plans/2026-09-27-branch-2-test-hermeticity.md diff --git a/docs/superpowers/plans/2026-09-27-branch-2-test-hermeticity.md b/docs/superpowers/plans/2026-09-27-branch-2-test-hermeticity.md new file mode 100644 index 00000000..070ea2ef --- /dev/null +++ b/docs/superpowers/plans/2026-09-27-branch-2-test-hermeticity.md @@ -0,0 +1,1723 @@ +# Branch 2: Test Hermeticity Implementation Plan + +> **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking. + +**Goal:** Make it impossible for `pnpm test` and `pnpm run test:ui` to change real user state without failing, and remove every known way the suite does it today. + +**Architecture:** A cross-platform fingerprint library and a suite runner (both in `scripts/`) snapshot the real state directories before and after the existing test commands and fail, naming each changed path, when anything changed. The dashboard server refuses its real-state-writing defaults when a caller injected fakes. Shared test helpers give every spawned child and every in-process spawn a sandboxed environment and self-cleaning temporary folders; three UI checks become deterministic. + +**Tech Stack:** Node 22.13+ ESM (`node:test`, `node:child_process`, `node:crypto`), Playwright (`tests/ui`), pnpm in CI (never in this worktree). + +**Spec:** [Remediation program, Branch 2](2026-09-26-remediation-program.md#branch-2-fixtest-hermeticity); [audit record](../../audits/2026-09-26-issues-237-238-239-verification-and-decisions.md) Open items ("Needs the maintainer's action": the dashboard server's hermeticity guard gap; "Carried from the earlier stages": spawn tests inheriting `XDG_*`, UI suite outside `test:ui`; "Not run": the memory-routing live test uses the real home folder); SDD ledger deferred minors `hermeticity-suite-writes-enclosing-repo`, `hermeticity-temp-dir-leaks`, the `host-readiness.mjs` flake and the MNT-UX-007 flake. + +## Global Constraints + +- Commits carry no `Co-Authored-By` or other attribution trailer, and no trailer-like last line. +- Nothing is pushed, opened as a pull request, merged or posted without the maintainer's explicit go-ahead. +- Never run `pnpm` in this worktree (`node_modules` is a symlink). Use `node --test`, `npx tsc -p tsconfig.json`, `npx eslint`, `npx markdownlint-cli2`, `node scripts/build-check.mjs`. +- Stage files by name; never `git add -A`/`git add .`; never commit `.harness/`, `.swarm/`, `.claude-flow/`, `.agentic-qe/`. +- Disposable environments use `env -u XDG_CONFIG_HOME -u XDG_DATA_HOME -u XDG_CACHE_HOME -u XDG_STATE_HOME` (or `env -i`) and a `mktemp -d