Skip to content

fix(scripts): capturing one screenshot scene keeps a device's other scenes - #32775

Open
only21mil wants to merge 1 commit into
pingdotgg:mainfrom
only21mil:fix/scripts-showcase-scene-keeps-others
Open

only21mil wants to merge 1 commit into
pingdotgg:mainfrom
only21mil:fix/scripts-showcase-scene-keeps-others

Conversation

@only21mil

Copy link
Copy Markdown
Contributor

Problem

pnpm screenshots:mobile --scene <name> is the documented way to recapture one scene (Fast iteration in docs/operations/mobile-app-store-screenshots.md). Before capturing, main removed each planned capture's whole folder. That folder is keyed by device, appearance and theme, not scene, so --device pixel --scene thread deleted the other five Pixel screenshots, captured thread.png, and still printed "Done. Upload-ready screenshots…" with exit 0. Only a later full --validate-only noticed the missing files.

Change

The clearing step moves into clearShowcaseCaptureOutputs:

  • A full capture set (every scene for that device) clears the folder as before, stale files included.
  • A --scene subset removes only the selected scenes' PNGs.

Clearing and validation share one isFullCapture check, so they always agree on what counts as a full run. Because a subset run now keeps the other scenes, its validation checks every PNG currently present; a full --validate-only confirms the complete scene set. Nothing else changes: --validate-only and when clearing runs relative to the build stay the same. CI never passes --scene, so CI captures behave as before.

Scope and approval

This is a small, focused fix to maintainer tooling: one helper in scripts/mobile-showcase.ts plus one test in its existing test file. A partial run should not delete scenes it was not asked to capture, and the docs already describe --scene as capturing "one scene". So I opened this as a PR without a prior issue. #28012 and #25968 also edit scripts/mobile-showcase.ts, in other hunks; that file merges cleanly with both.

Verification

  • vp test run scripts/mobile-showcase.test.ts: 8 passed. The new table-driven test seeds a temp folder with every Pixel scene plus a stale file, plans captures with the real config, and checks which files survive. With --scene thread, the other five scenes and the stale file remain. With no scene filter, the folder is empty. main has no such helper to call, so for the before run the helper first did exactly what main does today (remove the folder, then recreate it). That run failed on the file-survival assertion.
  • vp run check:changed 71c2d3a302: format, lint, knip, typecheck and the changed test file all passed.
  • Runtime: the real script ran against main and against this branch with a stub adb (no device, no build, no Metro). The fixture servers were stubbed, and the folder was seeded with six valid 1080×1920 PNGs.

Before (main): --scene thread leaves only thread.png, reports success, and the full validate fails.

transcript-before

After: the same run replaces only thread.png (its hash changes), keeps the other five, and the full validate passes.

transcript-after

After: a full run still clears the folder first, so stale.png goes.

full-run-after

The new test failing when the helper wipes the folder (before), and passing on this branch (after):

test-before

test-after

Not checked: a real simulator or emulator capture. The change runs before any device step, and the stubbed run exercises the same main path. I also did not check iOS, but iOS uses the same folder-clearing step.

Generated with Claude Opus 5.5 and GPT-6.1 Sol in T3 Code Nightly

…cenes

A `--scene` run of the mobile showcase script cleared the whole capture
folder for each planned device before capturing, so recapturing one scene
deleted the device's other scene screenshots while still reporting success.

Clearing now happens in `clearShowcaseCaptureOutputs`: a full capture set
still clears the folder, stale files included, while a scene subset removes
only the selected scenes' PNGs.
@github-actions github-actions Bot added vouch:unvouched PR author is not yet trusted in the VOUCHED list. size:M 30-99 changed lines (additions + deletions). labels Nov 8, 2026
@macroscopeapp

macroscopeapp Bot commented Nov 8, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Approved at e43fce3

Macroscope's review found this PR approvable — Single-scene screenshot captures now preserve the device’s other screenshots, while full captures still clear their output folder. The change is confined to generated local artifacts and reduces unintended deletion.

You can add or adjust custom eligibility rules. Learn more.

@coderabbitai

coderabbitai Bot commented Nov 8, 2026

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

Capture output cleanup now preserves files for unselected scenes during partial captures and clears the full output directory for full captures. Capture validation uses a shared full-capture check to determine when the minimum screenshot count applies.

Changes: Showcase capture output handling

Layer / File(s) Summary
Capture output cleanup
scripts/mobile-showcase.ts, scripts/mobile-showcase.test.ts
Added full-capture detection and cleanup that removes the full output directory or only selected scene PNGs. A temporary-directory test checks partial and empty scene selections.
Capture flow integration
scripts/mobile-showcase.ts
Capture setup uses the cleanup helper. Pre- and post-capture validation use the full-capture check to decide whether the minimum screenshot count applies.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Suggested labels: bugfix

Suggested reviewers: juliusmarminge, macroscopeapp

Merge Risk: Minimal · up to e43fc

The change preserves unselected scene screenshots during partial captures while retaining full-capture cleanup. No merge-blocking issue is established.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the main behavior change: a single-scene capture no longer deletes the device's other scenes. The changeset matches this. Before the change, main removed the whole device/appearance/th…
Description check Passed The description follows the repository template. It has Problem, Change, Scope and approval, and Verification sections, and each contains specific content. The Problem section gives the reproduction c…
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.
Full details: Title check

Explanation

The title names the main behavior change: a single-scene capture no longer deletes the device's other scenes. The changeset matches this. Before the change, main removed the whole device/appearance/theme folder before a capture. The change moves clearing into clearShowcaseCaptureOutputs, which removes only the selected scene PNGs for partial captures and still clears the full folder for full captures. The title follows the conventional commit style that the template requests.

Full details: Description check

Explanation

The description follows the repository template. It has Problem, Change, Scope and approval, and Verification sections, and each contains specific content. The Problem section gives the reproduction command, the observed wrong behavior, and the cause. The Change section explains the helper move and the shared isFullCapture check. The Scope section explains why no prior issue was opened and names related PRs. The Verification section gives the test command, results, a runtime check with stub adb, and items that were not checked. The template asks for a model and harness line at the end, and the description includes one. The Verification section also links screenshots, which the template requires for UI changes. This change is a CLI script change, so that requirement does not apply.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 71c2d3a and e43fce3.

Files selected for processing: 2

  • scripts/mobile-showcase.test.ts
  • scripts/mobile-showcase.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 0 remain after this review.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:M 30-99 changed lines (additions + deletions). vouch:unvouched PR author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant