Registry Mirror
Skip to content

Conversation

@scuttletoby

Copy link
Copy Markdown
Owner

Why

Slow-test hunt. fork-kit/golive/tests/install.test.py (weight ~168s, the slowest fork-kit file) and fork-kit/common/tests/kit_install.test.py (~95s) spent nearly all their time in one place. A profile of one golive test put about 95% of it in kit_install.self_test. Every install self-tests its copy with three Python starts (the module import and two --help runs), and the copies a test file makes are nearly all byte-identical. RedCheck adds 58 more installs to golive's file on its own.

What

fork-kit/common/tests/install_fixture.py: load() gives the engine a subprocess (SelfTestRuns) that records a passing self-test run. The record is keyed on the command (with the copy's path left out) and a digest of the copied tree (names, modes, owners, bytes, link targets). A run whose command and tree match a recorded pass is not run again.

  • Only passes are kept. A failing run always runs again.
  • Any change to the tree or to the command (MODULES, the --help asked for, a RedCheck break that changes the call) is a new run, so the shortcut never hides a broken copy.
  • tree_problems (in-process) still runs every time. Any other command goes to the real subprocess.
  • The engine uses subprocess only in self_test. The bootstrap and the tests' own subprocess calls are not affected.

kit_install.test.py gets a new SelfTestRuns class with five tests: a pass runs once for the same tree wherever it is; a failure runs again; a changed byte, mode, file or command runs again; other commands are the real subprocess; the engine is wired to it. All five fail on main's fixture (5 errors) and pass with this change.

.github/fork-ci-tests.txt: golive install ~168s → ~50s, kit_install ~36s. Both are estimates: local time times each file's old CI/local ratio. If CI measures a different value, its weight check will name the number to write.

Timing (same machine, run one after the other, clean origin/main export vs this branch)

file before after
golive/tests/install.test.py 92.1s 28.1s
common/tests/kit_install.test.py 98.6s (220 tests OK) 37.2s (225 tests OK)
agent-guards/tests/install.test.py 39.6s 35.8s
cleaner/tests/install.test.py 7.1s 1.2s
claude-login/tests/install.test.py 1.9s 0.5s
gardener/tests/install.test.py 5.1s 1.1s
schedule-kick/tests/install.test.py 4.6s 0.9s
update-policy/tests/install.test.py 8.8s 1.8s

Every file has the same results before and after. golive shows 2 errors on both sides from the local sandbox, not from this change: test_the_hand_copy_comes_back_with_its_own_mode_and_owner cannot chmod 4755 in its temp folder there. CI runs it.

Most of golive's remaining ~28s is four RedCheck mutants that block until no_hang's 5 s alarm fires (~21s). This PR leaves that alone.

Checks run

  • the 8 installer test files above
  • node --test .github/scripts/fork-ci-tests.test.cjs (81 pass)
  • fork-schema-check, fork-upstream-files-check and fork-seam-check on this diff: all clean

No unexplained test failure turned up in the last 40 failed runs: each one traced to its own PR's change, or to a dispatch that tested a PR's tree.

🤖 Generated with Claude Code

Every install in the installer tests self-tests its copy with three
Python starts (the module import and two --help runs), and that was
nearly all of each test's time: the copies one test file makes are
nearly all byte-identical. install_fixture now gives the loaded engine a
subprocess whose self-test runs (this Python, cwd a copied tree) keep a
pass per command and tree digest (names, modes, owners, bytes, link
targets). A failure always runs again, and any change to the tree or the
command (modules, --help asked for, a RedCheck break) is a new run, so
no broken copy is hidden. tree_problems still runs every time.

Locally: golive/tests/install.test.py 92 s -> 28 s,
common/tests/kit_install.test.py 99 s -> 37 s, the other installer tests
2-9 s -> about 1 s each. Weights in fork-ci-tests.txt follow.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@scuttletoby scuttletoby added the fork:merge-ready Merge conveyor: lenses done, merge when green (PRs) label Nov 29, 2026
@scuttletoby
scuttletoby merged commit 1faa36b into main Nov 30, 2026
53 checks passed
@scuttletoby
scuttletoby deleted the fork/kit-install-self-test-memo branch November 30, 2026 05:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fork:merge-ready Merge conveyor: lenses done, merge when green (PRs)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant