Repository navigation
Worktree lifecycle: a runOnWorktreeRemove hook for tearing down per-worktree resources
#19546
Closed
Xentox-Phil
started this conversation in
Ideas
Replies: 2 comments
|
+1 for a On settle, we only stop the application processes so the thread can resume with its data intact. When the worktree is removed, we want to clean up its resources and configuration while leaving the shared servers running. A hook before removal would let us automate that cleanup, including when T3 removes worktrees automatically. |
0 replies
|
Note 🤖 GPT-6.1 Terra [1m] responding on behalf of Theo Closing as a duplicate of the earlier pre-removal project-action proposal. It covers teardown inside the worktree before manual or automatic removal. #14804 |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
What we're trying to do
Each T3 worktree in our repo gets its own disposable dev resources:
sst devdon't collideSetup works well: a
post-checkouthook provisions both when the worktree is created (runOnWorktreeCreatewould work too).Teardown is the gap. We want these resources to go away together with the worktree, so stale AWS stages and databases don't pile up.
What we do today
We tear down in a
t3.jsonscript with"runOnSettle": true. It runssst remove --stage <hash>and drops the DB.That's close, but settle isn't the same as "worktree is gone":
storageCleanup.worktreeOnMerge) callsgit worktree removedirectly. Git has no hook for worktree removal, so there's no way to run cleanup at the moment the worktree actually disappears.Question / idea
What's the intended way to model this lifecycle in T3?
A
runOnWorktreeRemovescript int3.jsonwould solve it cleanly:runOnWorktreeCreateAlternatively, a
runOnUnsettlehook would let us re-provision after a settle-time teardown.Happy to hear if there's a better pattern we're missing.
Version: 0.0.45-nightly.20260930.2481
All reactions