fix(vtz): recover from wiped .vertz/deps/ and clear stale dep re-bundle errors [#2954]#2995
Merged
viniciusdacal merged 2 commits intomainfrom Apr 24, 2026
Merged
Conversation
…le errors [#2954] Two compounding bugs on the dev-server dep-watcher path caused a cluster of "Failed to re-bundle upstream dep X: Failed to write entry file: No such file or directory (os error 2)" errors to survive forever in the error overlay, even though the app SSRed fine. 1. `prebundle_single` now `create_dir_all(deps_dir)` before writing its temporary entry file, so a wiped or missing `.vertz/deps/` no longer bubbles up as ENOENT when the dep watcher triggers a re-bundle. 2. The dep-watcher handler in `server::http` clears the `Build` error category whenever at least one package re-bundles successfully, before reporting the current cycle's failures. Stale dep-rebundle entries no longer accumulate in `ErrorState` (or the persisted `.vertz/dev/errors.json`) across cycles. The error-broadcast side effects were extracted into `watcher::dep_watcher::apply_dep_error_state` so the behavior is covered by regression tests without spinning up a full dev server. Closes #2954 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Adversarial review surfaced that the previous commit's
`clear_category(ErrorCategory::Build)` on a successful rebundle would
also wipe legitimate per-file user-source compile errors, which the
module server and file-change handler report under the same `Build`
category.
Tag every dep-rebundle error with a synthetic key
`<dep>:{package}` in the error's file field, and only clear that key
with `clear_file(ErrorCategory::Build, …)` for each package the current
cycle touches. Stale dep errors still disappear after a successful
rebundle, but file-scoped compile errors from user source code are now
left untouched.
Add `test_apply_dep_error_state_preserves_user_compile_errors` to
regress this exact case.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes #2954. Two compounding bugs in the dev-server dep-watcher path caused a cluster of
Failed to re-bundle upstream dep X: Failed to write entry file: No such file or directory (os error 2)errors to survive forever in the/__vertz_errorsoverlay — even though the app SSRed fine. The only cure was killing the dev server, deleting.vertz/dev/errors.json, and restarting.native/vtz/src/deps/prebundle.rs:prebundle_singlenowcreate_dir_all(deps_dir)before writing the temporary entry file, so a wiped or missing.vertz/deps/no longer surfaces as ENOENT when the dep watcher triggers a re-bundle.native/vtz/src/watcher/dep_watcher.rs+server/http.rs: the dep-watcher handler now tags every re-bundle error with a synthetic per-package key (<dep>:{pkg}) in the error'sfilefield, andclear_file(ErrorCategory::Build, …)each package it touches this cycle before reporting the current failure. Stale entries no longer linger inErrorState/.vertz/dev/errors.json.Why targeted (not
clear_category)An adversarial review blocked the first attempt (
clear_category(Build)on any successful rebundle): the module server and file-change handler report user-source compile errors under the sameBuildcategory, so clobbering the whole category on every successful rebundle would make real compile errors vanish from the overlay. The per-key clear avoids that, and is covered bytest_apply_dep_error_state_preserves_user_compile_errors.Public API Changes
apply_dep_error_stateanddep_error_fileare new public items in the internalvtzcrate; they are not part of any SDK/library surface.Test plan
cargo test --all(TDD — RED verified on both fixes before GREEN)cargo clippy --all-targets -- -D warningscargo fmt --all -- --checktest_prebundle_single_recreates_missing_deps_dirtest_apply_dep_error_state_clears_stale_build_errors_on_successtest_apply_dep_error_state_preserves_user_compile_errors(B1 review blocker)test_apply_dep_error_state_reports_new_failurestest_apply_dep_error_state_mixed_success_and_failuretest_apply_dep_error_state_all_failures_replace_stale_for_same_packages@vertz/runtime,patch)🤖 Generated with Claude Code