Skip to content

core: add the preview screenshot scenario - #182

Merged
sarensw merged 6 commits into
mainfrom
sarensw/screenshot-automation
Aug 15, 2026
Merged

core: add the preview screenshot scenario#182
sarensw merged 6 commits into
mainfrom
sarensw/screenshot-automation

Conversation

@sarensw

@sarensw sarensw commented Aug 11, 2026

Copy link
Copy Markdown
Owner

The media kit needs a ninth frame: an archive open with README.md selected, to show the preview feature. No demo archive looked like a source project.

09-preview

["-DisableUpdateChecks", "YES",
 "-ArchivePath", "assets/screenshots/demo/markdown-kit.zip",
 "-SelectItem", "README.md"]

Quick Look runs in another process SandboxPilot cannot capture, so the scenario produces only MacPacker's window with the file selected — FrameBison composes the preview panel on top. Verified by launching the debug build with those arguments and capturing the window:

Entries at the archive root: src/, tests/, .gitignore, LICENSE, package.json, README.md — reads as a checkout at a glance, no -NavigatePath needed.

The archive is committed, not generated

markdown-kit.zip is a small but genuinely working repository — npm install, npm run build and npm test all succeed in it. That is deliberate: it is also the fixture for archiving a checkout while honoring its .gitignore, which needs the node_modules/ and dist/ that .gitignore names to actually exist. So it lives in MacPacker-TestArchives (sarensw/MacPacker-TestArchives#1) with a zip/make_markdown_kit.sh that rebuilds it byte-identically.

make_demo_archives.py therefore gains a copy step next to its generate steps. It has to copy rather than read in place: MacPacker is sandboxed to the downloads entitlement and cannot reach the submodule inside the repo, and LaunchParameters.demoFile(named:) only looks in ~/Downloads/MacPacker-Demo. Its docstring also now says out loud that nothing runs it for you — it is a manual pre-session step, which it always was.

SandboxPilotKit 1.3.0

Bumped from 1.1.0. A screenshot run used to override the appearance on the already-running app; AppKit resolves some colors once, when a control is set up, so the search field focused at launch kept its dark-resolved white text through the flip to light and drew white on a light field. 1.3.0 applies the appearance at launch instead. See LeanBytes/SandboxPilotKit#2 and LeanBytes/SandboxPilot#32.

Sequencing

  1. test: add markdown-kit.zip, a working repo fixture MacPacker-TestArchives#1 merges → push the submodule pointer here (deliberately not in this commit).
  2. SandboxPilotKit 1.3.0 is tagged → xcodebuild resolves again. swift test --package-path Modules is unaffected, since the kit is an Xcode-project dependency only.

No changelog entry: the plan file, a test fixture, the staging script and a DEBUG-only dependency pin are not user-visible. No existing issue covers this and I did not open one just to link.

Summary by CodeRabbit

  • New Features

    • Added a preview scenario for opening markdown-kit.zip with README.md selected, enabling composited Quick Look screenshots.
    • Demo archive generation now includes the committed Markdown fixture alongside generated archives.
    • Added a stable accessibility identifier for the archive content search field.
  • Bug Fixes

    • Updated archive fixtures and sandbox package compatibility.
    • Search fields no longer automatically receive focus when launched with a search query.
  • Documentation

    • Clarified demo archive sources and Finder and Quick Look process handling.

The media kit needs a frame for the preview feature: an archive open with
README.md selected. No demo archive looked like a source project, so
09-preview opens markdown-kit.zip — a small but genuinely working
JavaScript repository, committed to MacPacker-TestArchives rather than
generated, because it is also the fixture for archiving a checkout that
honors its .gitignore.

Quick Look runs in another process that SandboxPilot cannot capture, so the
scenario produces only MacPacker's window with the file selected; FrameBison
composes the preview panel on top.

make_demo_archives.py copies that fixture into ~/Downloads/MacPacker-Demo
alongside the archives it generates. It has to be copied rather than read in
place: MacPacker is sandboxed to the downloads entitlement and cannot reach
the submodule inside the repo.

Also requires SandboxPilotKit 1.3.0, which applies a screenshot run's
appearance at launch instead of flipping the running app — without it the
search field keeps its dark-resolved white text through the light pass and
draws white on white.
@coderabbitai

coderabbitai Bot commented Aug 11, 2026

Copy link
Copy Markdown

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 65d1069c-710c-4132-9907-18e1c0120383

📥 Commits

Reviewing files that changed from the base of the PR and between fc774ca and 3ba84df.

📒 Files selected for processing (5)
  • MacPacker.xcodeproj/project.pbxproj
  • MacPacker/Core/AccessibilityIdentifiers.swift
  • MacPacker/Features/ArchiveWindow/ArchiveWindow.swift
  • MacPackerUITests/MacPackerUITests.swift
  • sandboxpilot.json
🚧 Files skipped from review as they are similar to previous changes (1)
  • MacPacker.xcodeproj/project.pbxproj

📝 Walkthrough

Walkthrough

The project updates the SandboxPilotKit minimum version to 1.4.0. The archive tooling stages markdown-kit.zip. The sandbox configuration adds a Quick Look preview scenario. The viewer publishes a search identifier and no longer focuses search on launch.

Changes

Archive preview and search behavior

Layer / File(s) Summary
Stage the archive preview fixture
assets/screenshots/make_demo_archives.py, Modules/Tests/CoreTests/TestArchives, sandboxpilot.json
The script stages markdown-kit.zip. The submodule reference is updated. The configuration adds 09-preview, which opens the archive and selects README.md.
Publish the toolbar search identifier
MacPacker/Core/AccessibilityIdentifiers.swift, MacPacker/Features/ArchiveWindow/ArchiveWindow.swift, MacPackerUITests/MacPackerUITests.swift, sandboxpilot.json
The archive window assigns archive.searchField after toolbar updates. The UI test verifies the identifier. The search scenario focuses the identified field.
Remove launch-time search autofocus
MacPacker/Features/ArchiveContentViewer/ContentView.swift
ContentView no longer applies FocusSearchWhenLaunchedIntoOne or its supporting availability handling.
Update the package requirement
MacPacker.xcodeproj/project.pbxproj
The SandboxPilotKit minimum version changes from 1.1.0 to 1.4.0.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant ArchiveWindowController
  participant NSWindow
  participant SearchField
  participant MacPackerUITests
  ArchiveWindowController->>NSWindow: Publish accessibility identifiers
  NSWindow->>SearchField: Assign archive.searchField
  MacPackerUITests->>SearchField: Locate and verify the search field
Loading

Possibly related PRs

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly identifies the main change: adding the preview screenshot scenario.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch sarensw/screenshot-automation

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@assets/screenshots/make_demo_archives.py`:
- Around line 150-152: Update stage(FIXTURE) to fail when the required fixture
source is missing instead of printing “skip” and returning successfully; raise
an error or propagate a failure status that aborts the main flow, while
preserving skip behavior for non-required sources handled separately.

In `@MacPacker.xcodeproj/project.pbxproj`:
- Line 1385: Update the Package.resolved lockfile entry for SandboxPilotKit to a
resolved version compatible with the minimumVersion 1.3.0 requirement, including
its corresponding revision metadata; do not change the project setting itself.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 76074cbc-371c-4c4a-a0e2-94b3ca67b6cf

📥 Commits

Reviewing files that changed from the base of the PR and between 3de1e7c and babdd56.

📒 Files selected for processing (3)
  • MacPacker.xcodeproj/project.pbxproj
  • assets/screenshots/make_demo_archives.py
  • sandboxpilot.json

Comment on lines +150 to +152
if not os.path.exists(source):
print(f"skip {name} (no {relative_path} — run `git submodule update --init`)")
return

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

Fail when the required fixture is missing.

stage(FIXTURE) prints skip and returns successfully when the submodule is not initialized. The 09-preview scenario then has no markdown-kit.zip, but the script reports success.

Raise an error for this required fixture, or return a failure status and abort the main flow.

Proposed fix
     if not os.path.exists(source):
-        print(f"skip   {name} (no {relative_path} — run `git submodule update --init`)")
-        return
+        raise SystemExit(
+            f"missing {name} ({relative_path} — run `git submodule update --init`)"
+        )

Also applies to: 161-161

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@assets/screenshots/make_demo_archives.py` around lines 150 - 152, Update
stage(FIXTURE) to fail when the required fixture source is missing instead of
printing “skip” and returning successfully; raise an error or propagate a
failure status that aborts the main flow, while preserving skip behavior for
non-required sources handled separately.

Comment thread MacPacker.xcodeproj/project.pbxproj Outdated
1.3.0 traps on launch whenever a screenshot run left an appearance behind:
NSApp does not exist yet when SandboxPilot.start() runs from the app's
initializer. See LeanBytes/SandboxPilotKit#3.
FocusSearchWhenLaunchedIntoOne forced the cursor into the search field when
a window was launched into a search, because an unfocused field appeared to
draw its text in the placeholder's grey, unreadable in the light appearance.

That grey was the stale-appearance bug, not a real unfocused style: the
screenshot run relaunched the app in the system appearance and flipped it
afterwards, so text colours stayed resolved against the previous one. With
SandboxPilotKit 1.3.1 applying the appearance at launch, an unfocused field
draws normal text in both appearances — verified in light and dark.

Removing it takes the last piece of screenshot-only behaviour out of the
window code, and the shots read better without a focus ring and a caret in
them.
Splits the two things a screenshot scenario needs. Launch parameters keep
deciding state — which archive, which path, which selection — and the plan's
new `actions` drive the UI on top, naming a control by accessibility
identifier for SandboxPilotKit to act on inside MacPacker. No Accessibility
permission is involved, because a process may drive its own accessibility
tree, and neither SandboxPilot nor the kit learns anything about MacPacker:
sandboxpilot.json stays the only place that knows the control exists.

So 04-search asks for the search field to be focused, where until now the
app focused it itself on seeing -SearchQuery.

SwiftUI gives the field behind `.searchable` no identifier — the modifier
takes none, and applying one sets it on the container — so the window
publishes it through the toolbar item that backs the field, the same route
⌘F already uses. That is ordinary accessibility work: VoiceOver and the UI
tests want identifiers regardless, and the existing suite resorts to
matching toolbar buttons by geometry for want of them.

Requires SandboxPilotKit 1.4.0.
@sarensw
sarensw merged commit 17b2f60 into main Aug 15, 2026
5 checks passed
@sarensw
sarensw deleted the sarensw/screenshot-automation branch August 15, 2026 11:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant