Repository navigation
Test the preview overlay's view and edit modes instead of the old read-only copy - #1486
Merged
Merged
Conversation
…d-only copy #1477 made the overlay open the same document tabs use, in a viewing mode, so the document reports the machine's writability and the pane decides whether it can be edited. The lightbox test still expected the document itself to be read-only, which failed every Build on main since. The overlay now has two tests: a writable file opens read-only, the pencil makes it editable and the eye turns it back; a file the machine won't let you edit gets no pencil. Each fixture uses its own machine id so the shared document store doesn't hand one test another's document. Co-Authored-By: Claude Opus 5.5 <[email protected]>
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.
Main's Build has been red since #1477 on every merge (#1479, #1480, #1483). Each run had exactly one failure, in
ci / checks-swift: "The lightbox shows a file read-only even when the machine would let it be edited" (FileOpenerTests.swift:134,!page.document.isEditable). Nothing else in those Builds failed. The #1482 run was cancelled because #1483 superseded it.What was wrong
The test still assumed the old design. Before #1477, the overlay opened a separate read-only copy of the document, so
document.isEditablewas false. Since #1477, the overlay opens the same document tabs use, so the document reports what the machine allows. Whether the overlay can edit is now decided by the pane's mode (editor.isEditable, which is viewing/editing combined with the machine's permission).I checked #1477 for a real bug and found none. The overlay opens its pages with
access: .viewing. The text view (macOS and iOS) and the find bar's Replace both gate oneditor.isEditable. The pencil only appears when the machine allows editing.What changed
The stale test is replaced by two tests that describe #1477's intended behavior:
Each fixture now uses its own machine ID, because
FileDocumentStore.sharedcaches documents by machine and path, and parallel tests would otherwise get each other's document.Verification
swift test --filter "FileOpenerTests|FileEditorSessionTests": 18/18 passed, three times in a row..editingfails both new tests.node scripts/check.mjs --base=e513cc016 --lanes=swift-style,swift): format, lint and all Swift suites passed.notes.mdlink opened on the rendered preview with a pencil. Its text could be selected but not edited.chmod 444on the file, the overlay showed no pencil.🤖 Generated with Claude Code