Skip to content

Rebuild the screenshots with one command, and guard them - #18

Merged
vimoxshah merged 1 commit into
mainfrom
tooling/shoot-media
Sep 7, 2026
Merged

Rebuild the screenshots with one command, and guard them#18
vimoxshah merged 1 commit into
mainfrom
tooling/shoot-media

Conversation

@vimoxshah

Copy link
Copy Markdown
Owner

The screenshots went stale silently. For a whole release the README hero and the landing page's only image showed a filter wall and a two-row tab bar that no longer existed, plus a typo that had been fixed. Nothing failed, because nothing checked. A screenshot is a build artifact and should be rebuildable.

npm run media

Drives a real headless browser over the DevTools protocol against a throwaway synthetic store, and rewrites docs/media. No dependencies: Node ships a WebSocket client, and Chromium is a tool on the machine rather than something this project installs (CHROME=/path overrides discovery; it fails with the list of paths it tried).

Two of the five shots are driven, not staged. The filter image clicks + Filter, picks a dimension and ticks two values, and throws if no chip appears. The palette image presses the real hotkey and throws if it opens with no commands. So the script cannot produce a screenshot of a state the UI could not reach, which is exactly how the closed-palette bug would have been caught.

MEDIA is the single source of truth for the shot list. MEDIA_NOT_SHOT_HERE records the three images that cannot be produced here and why: the two menu bar popovers need the Swift target's off-screen preview path, and the architecture hero is drawn by hand.

The guards

test/media.test.js holds the three things that let this go unnoticed, and each was mutation-tested against its own defect rather than assumed to work:

Guard Mutation Result
referenced but missing added a bogus image reference to the README 2 fail
shipped but unused dropped a spare PNG into docs/media 1 fail
linked with no way to rebuild it removed an entry from MEDIA_NOT_SHOT_HERE 1 fail
restored 5 pass

What it deliberately does not claim

It is not idempotent, and a diff is not a signal. The mock corpus is seeded and stable, but its window ends on the day it runs, so the dates and every pixel shift daily. That is stated in the script header and in the README, so nobody wires it into CI expecting a clean diff. No test can tell whether a screenshot is current; only a person looking at it can, and the script says so when it finishes.

841 tests, lint clean over 169 files, zero type errors. Ran end to end: all five images regenerated and reviewed.

@vimoxshah
vimoxshah merged commit c0d42ec into main Sep 7, 2026
9 checks passed
@vimoxshah
vimoxshah deleted the tooling/shoot-media branch September 7, 2026 02:13
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