Skip to content

Stop before-after's base stacks from the worktree that started them - #1624

Merged
quanvu309 merged 1 commit into
mainfrom
t3/verify-before-after-cleanup
Nov 24, 2026
Merged

quanvu309 merged 1 commit into
mainfrom
t3/verify-before-after-cleanup

Conversation

@quanvu309

@quanvu309 quanvu309 commented Nov 24, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

before-after and bench stop every run they start, and remove every scratch tree, on success, failure, SIGINT and SIGTERM. VERIFY_AIRDESIGN_OWNER is gone, so a run's owner is only the real path of the worktree that launched it. stop keeps #1622's rule for everyone else.

 before-after / bench
-  launch base run, owner = caller (VERIFY_AIRDESIGN_OWNER)
-  stop base run as caller
+  cleaning(body)                       # success, throw, SIGINT, SIGTERM
+    stackFor -> launchAt(tree)         # own process group, owner = tree
+  finally
+    end launches in flight (SIGTERM their group)
+    stop each run as the tree that owns it
+    remove each scratch tree

 launch
+  try ... catch/SIGINT/SIGTERM -> rollbackLaunch
+    end serve, tear the run down (Postgres too), remove run folder
 serve
+  signal and failure handlers from the start; each resource registers its close
+  Postgres stops on any failure after it starts
 leftover-runs
-  writeOwner(dir, repo, env, scratchRoot)   # override in scratch tree-*
+  writeOwner(dir, repo)                     # realpath; owner compared by realpath

launch, not the caller, tears down its own half-started run, so a failed base startup, a site build error and an interrupt all go through one boundary. A tree-owned run is stopped as the tree, which passes the owner rule with no override. Round 1 and round 2 widened ownership; this removes the widening.

With --keep, a succeeded run is kept and the stop command for each is printed (the base run belongs to its tree). A failed or interrupted run is cleaned even with --keep.

Surfaces: verification tooling only. Canvas, design panel, filmstrip, undo and replay, agent tools and PowerPoint are untouched.

Evidence

  • Before (the previous head of this PR): the new tests fail on it. launch-cleanup.test.mjs: Postgres still alive after a base launch fails after it starts; a run folder left after a site build error; launch killed by SIGINT with the stack still running. leftover-runs.test.mjs: a symlinked tree-link records the override's foreign owner.
  • After: all pass on this head. pnpm gate, pnpm test:tooling, pnpm rules exit 0.
it("leaves no Postgres and no run folder when a base launch fails after Postgres starts")
it("leaves no run folder when the site build fails")
it("leaves no Postgres and no run folder when a launch is interrupted before it is ready")
it("is the real path of the worktree that launched, whatever name reached it")
it("stops what it started and ends a launch in flight when interrupted")   # SIGINT to a real process

Real before-after against HEAD~1, private home each time: success exits 0; Postgres failure after state is recorded exits 1; injected site build error exits 1; SIGINT with Postgres up exits 1 ("interrupted by SIGINT"). Each leaves no scratch run, no Postgres directory, no worktree and no process. bench --cases doom-open-40 --runs 2 leaves nothing on success or on the same Postgres failure.

Merge Danger

Door: two-way. Tooling only; revert restores round 2.

Blast Radius: verification commands. serve now exits 1 on a startup failure, where it exited 0 on uncaught errors after ready. launch waits for a serve it ends, up to 15 s.

@github-actions github-actions Bot added the verify Touches the verify-airdesign skills or journeys label Nov 24, 2026
@quanvu309
quanvu309 force-pushed the t3/verify-before-after-cleanup branch from 0416c4c to 63b8d43 Compare November 24, 2026 17:26
launch and serve release Postgres and the run folder on any failure or signal. before-after and bench stop the base run as the scratch tree that owns it, on success, failure, SIGINT and SIGTERM. The owner override is gone; ownership compares real paths.
@quanvu309
quanvu309 force-pushed the t3/verify-before-after-cleanup branch from 63b8d43 to 6581d70 Compare November 24, 2026 17:53
@quanvu309
quanvu309 merged commit f9bd91e into main Nov 24, 2026
12 checks passed
@quanvu309
quanvu309 deleted the t3/verify-before-after-cleanup branch November 24, 2026 18:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

verify Touches the verify-airdesign skills or journeys

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant