fix(cli): clean up failed watcher rebuilds #556
main fromrefs/pull/556/head·merged by tannerlinsley Failed dev-watch rebuilds can leave temporary generation directories behind. Run their cleanup in finally so failures receive the same cleanup as successful syncs.
AI review notes: A real watcher subprocess removes a selected add-on from the refreshed framework and triggers two rebuild failures after temporary-directory allocation. Current main fails the directory-removal assertion, and shutdown can only remove the latest allocation. The correction removes both directories and leaves the target unchanged. All four watcher regressions pass, including repeated successful edits and interrupted allocation. The actual compiled watcher also passes the repeated-failure fixture outside the monorepo. Only fixture-owned directories are inspected or removed; no installer or provider is called. The unchanged normal hook passed 10 builds, 551 unit tests and all eight Chrome e2e tests. Affected lint has no errors and one existing require-await warning. The compiled dev-watch module adds eight raw bytes and zero gzip bytes against current main. No dependencies, workflows or public API change. Includes an @tanstack/cli patch changeset. Release remains held by the staged core artifact tracked in #551.
Summary by CodeRabbit#
- Bug Fixes
- Temporary build directories are now cleaned up after failed development-watch rebuilds, as well as successful ones. This helps prevent leftover temporary files when a rebuild encounters an error. Cleanup issues continue to be reported as warnings, and subsequent rebuilds can proceed without stale temporary directories accumulating.
- 1
No actionable comments were generated in the recent review.
Walkthrough
-
Dev-watch rebuilds now attempt temporary-directory cleanup after both successful and failed builds. A failure-mode fixture triggers repeated failed rebuilds and verifies that their temporary directories are removed.
Changes: Dev-watch cleanup
Layer / File(s) Summary Cleanup on rebuild failure
packages/cli/src/dev-watch.ts,packages/cli/tests/fixtures/dev-watch-rebuild.mjs,packages/cli/tests/dev-watch.test.ts,.changeset/watch-failed-build-cleanup.mdCleanup now runs from finally, and cleanup failures are logged as warnings. The failure-mode fixture and test verify that repeated failed rebuilds remove their temporary directories. A patch changeset records the cleanup change.Estimated code review effort: 2 (Simple) | ~10 minutes
Change: Bug fix
Possibly related PRs
- TanStack/cli#536: Changes the
DevWatchManagertemporary-directory lifecycle and tests directory removal. - TanStack/cli#535: Updates temporary-directory handling and cleanup tests in
dev-watch.ts.
Suggested reviewers:
43081j - TanStack/cli#536: Changes the
Merge Risk:
Minimal · up tob3046-
The cleanup change is ready to merge after normal checks.
Pre-merge checks:
5-
Check name Status Explanation Description Check Check skipped - CodeRabbit’s high-level summary is enabled. Title check The title clearly and concisely describes the main change: cleaning up temporary directories after failed CLI watcher rebuilds. Docstring Coverage No eligible functions found in the changed files. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentat… Linked Issues check Check skipped because no linked issues were found for this pull request. Out of Scope Changes check Check skipped because no linked issues were found for this pull request. Full details: Docstring Coverage
-
Explanation
No eligible functions found in the changed files. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 0 functions across 3 files. (1 skipped: 1 unsupported.)
-
Finishing Touches
-
Generate docstrings
-
- Commit to this branch
- Create a new PR
Generate unit tests (beta)
-
- Commit to this branch
- Create a new PR
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Warning
Some tools did not complete. Review the errors below.
ESLint-
If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.
packages/cli/tests/dev-watch.test.ts
-
Parsing error: "parserOptions.project" has been provided for
@typescript-eslint/parser. The file was not found in any of the provided project(s): packages/cli/tests/dev-watch.test.ts
-
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.
CodeRabbit Verify#
- Run CodeRabbit Verify to test the changes in this pull request.
Recent review info-
Run configuration-
- Source mode: Auto
- Repository: Unavailable
- Branch: Unavailable
- File: No configuration file from this repository applied
- Commit: Unavailable
- Layers: defaults
- Review profile: CHILL
- Plan: Advanced
- Run ID:
e5c32af0-d24f-473b-a43f-7bcf94ad9fb3
Commits-
Reviewing files that changed from the base of the PR and between f63f296d5ba120c46082d67849e3834f77c4ffc0 and b304614e33cc0d63b5e1a1c57f5f77bb27da9551.
Files selected for processing: 4-
.changeset/watch-failed-build-cleanup.mdpackages/cli/src/dev-watch.tspackages/cli/tests/dev-watch.test.tspackages/cli/tests/fixtures/dev-watch-rebuild.mjs
Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 2 remain after this review.
-
-
tannerlinsley merged this5f31ee8
tannerlinsley closed this
Sign in to join this conversation.
🦋 Changeset detected#
Latest commit: b304614e33cc0d63b5e1a1c57f5f77bb27da9551
The changes in this PR will be included in the next version bump.
This PR includes changesets to release 6 packages
Not sure what this means? Click here to learn what changesets are.
Click here if you're a maintainer who wants to add another changeset to this PR