feat(server): add safe service runtime pruning - #7811
Conversation
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
One finding on the new prune error modeling in apps/server/src/cloud/bootService.ts. Everything else (inline prune on the Context.Service interface, BootService["Service"]["prune"] typing, namespace imports, make/layer placement, focused tests for the new behavior) follows the conventions.
Posted via Macroscope — Effect Service Conventions
ApprovabilityVerdict: Not approved Macroscope's review found this PR not approvable — This PR adds a new You can add or adjust custom eligibility rules. Learn more. |
What Changed
t3 service prunewith a--dry-runpreview.Why
Service updates install immutable runtimes so the launcher can roll back, but old installs currently accumulate without a supported cleanup path. This adds an explicit maintenance command that uses launcher-owned state and does not stop or restart the service.
Testing
pnpm exec vp test run apps/server/src/cloud/pinnedRuntime.test.ts apps/server/src/cloud/bootService.test.ts apps/server/src/cli/service.test.ts(30 tests)pnpm --filter t3 typecheckvp lintandvp fmt --checkon the changed filespnpm --filter t3 build:bundlenode apps/server/src/bin.ts service prune --helpModel and harness: OpenAI Codex; repository toolchain plus manual WSL service validation.
Note
Medium Risk
Deletes versioned runtime directories on disk, so incorrect candidate selection could remove a needed rollback install. Guards (pending-update refusal, sentinel/realpath checks, protected versions) keep the blast radius limited.
Overview
Adds
t3 service pruneso old pinned service runtimes can be cleaned up without stopping or restarting the background service.--dry-runlists the same candidates without deleting them.Only completed exact-version installs older than the active runtime are removed. The active version and both versions named by the latest update record are kept. Incomplete installs, staging dirs, symlinks, unexpected names, and newer versions are ignored. Prune refuses to run if launcher state is missing/invalid or a remote update is still pending.
Reviewed by Cursor Bugbot for commit 2a2ac12. Bugbot is set up for automated code reviews on this repo. Configure here.
Note
Add
t3 service prunecommand for safe runtime pruningprunesubcommand to the service CLI with a--dry-runflag for previewing removals without touching the filesystem.prunePinnedRuntimesin pinnedRuntime.ts, which selects only completed, unreferenced runtime versions strictly older than the active version and not named in a pending update. Symlinks, staging dirs, incomplete runtimes, and protected versions are preserved.BootServicein bootService.ts with aprunemethod that refuses when service state is missing/invalid or an update is pending, and deletes without restarting the service.prunedeletes runtime version directories recursively with force; it fails closed on missing state and refuses during pending updates. Reviewers should verify candidate filtering inprunePinnedRuntimesand the protected-set logic aroundactiveVersion/update.fromVersion/update.targetVersion.Macroscope summarized 2a2ac12.