Repository navigation
cocoa live tests: write captures to captureDir, never the working directory - #136
Merged
Merged
Conversation
…ectory TestLiveCocoaWindow wrote a window-server screenshot (screencapture -l) and its own render into the package directory. That directory is this public repository, so the files sat one `git add -f` away from publication, and the .gitignore entry is a safety net, not a barrier. writeArtifact, used by the legibility, drag-and-drop and vibrancy proofs, did the same. All three writers now go through captureDir (go-appdirs/outdir), which refuses any directory inside a git work tree. The capture directory is resolved on the test goroutine, before callOnMain. captureDir fails the test when the directory is refused, and a t.Fatal from inside the main-thread closure ends that closure, not the test: the test then waited forever. That hang is how a refused directory showed up at first. CI: the darwin live step sets WINDOW_CAPTURE_DIR under runner.temp, outside the checkout, and the artifact upload reads from there. Checked live on macOS, in both directions. With the default directory the test passes, writes both PNGs under ~/Library/Application Support, and leaves no PNG in the work tree, ignored ones included. With WINDOW_CAPTURE_DIR inside the work tree it fails in 0.2 s, naming the tree, and creates nothing. Co-Authored-By: Claude Opus 5.5 (1M context) <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.
The defect
TestLiveCocoaWindowwrote a window-server screenshot (screencapture -l) and its own render into the package directory. That directory is this public repository, so the files sat onegit add -faway from publication; the.gitignoreentry is a safety net, not a barrier.writeArtifact, used by the legibility, drag-and-drop and vibrancy proofs, did the same. Found during #135: a run leftinternal/cocoa/cocoa-screencapture-2026-08-10.pngin a worktree. It has been moved out.The fix
captureDir, which uses go-appdirs/outdir and refuses any directory inside a git work tree.callOnMain.captureDirfails the test when the directory is refused, and at.Fatalinside the main-thread closure ends the closure, not the test: the test then waited forever. That hang is how the refused case first showed up.WINDOW_CAPTURE_DIRunderrunner.temp, outside the checkout, and the artifact upload reads from there.Checked live on macOS, both directions
~/Library/Application Support/go-widgets-window/captures/, andgit status --ignoredshows no PNG in the tree.WINDOW_CAPTURE_DIRinside the work tree: FAIL in 0.2 s, the message names the tree, and nothing is created.Tests only; no release needed.
🤖 Generated with Claude Code