Repository navigation
fix(health): notice a code component's file deleted outside the app - #1638
Merged
gregpriday merged 1 commit intoNov 28, 2026
Merged
gregpriday merged 1 commit into
gregpriday merged 1 commit into
Conversation
- hold the deletion as a conflict with the code last loaded, naming the component - offer to put the file back or remove the component and its placements in one undoable step - name a component opened without its file in Project health and the export - keep holds true as the file goes, comes back, or its component goes
gregpriday
force-pushed
the
bugfix/issue-1540-a-code-component-s-file-deleted-outside
branch
from
November 28, 2026 09:27
2018582 to
fa9fabf
Compare
gregpriday
deleted the
bugfix/issue-1540-a-code-component-s-file-deleted-outside
branch
November 28, 2026 09:40
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.
When a placed code component's
.sveltefile was deleted or moved away outside the app while the project was open, the reload read the missing file as empty code and took it as an ordinary outside change. Nothing reached the author: the status bar said No problems, and the break only showed on the next load ("took too long to open", Vite's "Does the file exist?") or at export, where the build namedsrc/routes/+page.svelterather than the component.Resolves #1540
Changes
ProjectSession.readBacktells a missing source from an empty one through the read's raw documents. A code component whose file was loaded and is now gone (confirmed bylstat) is held as a canonical conflict,deletedCode: { definitionId }, with the code last loaded as SiteOrigin Builder's version. The component keeps that code meanwhile, no History step is recorded, and the hold reaches the editor at once and survives a restart (conflicts.json).removechoice). The removal is one step of History that Undo takes back, file and all. It is refused while the file is back, while other code imports the component, while another kind of conflict is open, or while a page changed outside the app is still waiting to load. It never deletes a file that reappears during the removal, and nothing is removed when the hold has already settled.CODE_SOURCE_MISSING, names the component and its path in Project health. The session tracks which code sources were missing at the last read and clears them as the app writes them.Controller.exportBlockedand the Export dialog name the component for both cases, and the dialog holds both exports back up front for a component opened without its file.removalWithPlacements(src/engine/definitions.ts) plans the removal: each outermost placement, then the component.A project opened with the file already gone has no loaded code to put back, so it offers no one-click removal. Project health names the component, the file can be put back by hand, and the component can be removed through the library. The hold detection runs before the refused-edit check from #1606, so a deleted file is never reported as refused edited code.
Known gaps
Testing
tests/unit/deleted-code-source.test.ts(new, through the controller's fake watches), 15 tests:All fail on
develop.Adjacent:
source-refused-browser,code,conflict-versions,convert-edited,documents,held-handoff,history-steps,own-saves,read-only-open,removal-review,saved-versions,session-recovery,session,export-modal-actions-browser: green.Impact set: 58 of 576 unit test files (10%): all green.
npm run typecheck:changed: green.Not covered: no browser test renders the new Project health row, and the
tests/e2e/code.mjse2e was not extended.