Skip to content

ci(store): add a Linux proxy gate for ASC marketing-frame drift - #1005

Merged
wei18 merged 2 commits into
mainfrom
ci/1001-frame-drift-gate
Aug 12, 2026
Merged

wei18 merged 2 commits into
mainfrom
ci/1001-frame-drift-gate

Conversation

@wei18

@wei18 wei18 commented Aug 11, 2026

Copy link
Copy Markdown
Owner

Summary

Adds a CI gate for the drift #995 and #998 both hit: a snapshot baseline that
feeds an ASC marketing frame changes, but docs/app-store/screenshots-ascspec/
doesn't get regenerated to match (#998's stale mac frames were live on App
Store Connect for six days).

Why not the obvious python3 scripts/build-ascspec-screenshots.py && git diff --exit-code gate. All five existing workflows run ubuntu-latest. The
generator loads macOS system fonts by absolute path — Hiragino Sans GB /
PingFang / AppleSDGothicNeo / Ayuthaya (see the header comment at
scripts/build-ascspec-screenshots.py:606-643) — so it fails at import time
on Linux, not just renders differently. The per-locale font choice is
deliberate (Hiragino has no Hangul, SFNS has no Thai), so swapping in Linux
fonts would silently change glyph shapes on exactly the CJK/th locales this
pipeline protects. A macos-latest runner would work but bills 10x Linux
minutes for ~210 render slots, unmeasured; that tradeoff is left for a future
PR if this proxy proves insufficient (see the issue's option 1/2 discussion).

What this does instead — the Linux proxy (option 3 in the issue). A pure
git/grep check, no Python/Pillow/fonts, that fails a PR when it changes a
snapshot baseline mapped by the generator's Slot() table without touching
anything under docs/app-store/screenshots-ascspec/ in the same PR. It
cannot verify pixel equality — only the real generator can — but it catches
the actual observed failure mode: a baseline moved, the frames didn't.

Precision. Most __Snapshots__ baselines feed no store frame at all,
so the gate only fires on the subset the SLOTS table in
scripts/build-ascspec-screenshots.py actually maps to a slot. That mapping
(30 baseline→slot rows) is parsed fresh out of the script on every run —
BASELINES_SUDOKU/BASELINES_MS plus every Slot(...) entry — instead of
being hardcoded, so it can't silently rot as slots are added/removed
(mise run scan:store_frame_drift --list prints the live table).

Escape hatch for the legitimate case (a baseline change that provably
doesn't alter the frame): PR label frame-drift-verified, or a commit
trailer Frame-Drift-Verified: <reason>. Both are documented in the gate's
own failure message. Added labeled/unlabeled to the workflow's PR
trigger types so applying the label actually turns a red check green.

Changed

  • mise-tasks/scan/store_frame_drift — the gate (new mise task, bash 3.2
    compatible, shellcheck-clean).
  • .github/workflows/lint.yml — wired as job 6 on the existing Lint
    workflow (ubuntu-latest, matches the other source-reading jobs' style).
  • .claude/skills/mise-task-operations/SKILL.md — indexed the new task.

Test plan

Ran locally against throwaway commits (deleted after, not pushed) diffed
against this branch as base:

  • True positive — touched a mapped baseline
    (HomeViewTests/snapshotIPhoneLight...png, feeds iphone-6.9/sudoku/01-home)
    with no screenshots-ascspec/ change → gate FAILS (exit 1) with the
    actionable message (baseline path, fed slot, fix command, escape hatch).
    This reproduces the exact fix(store): mac 01-home frames drift from current baselines (pre-existing, unrelated to #997) #998 shape.
  • True negative (unmapped) — touched a baseline that feeds no slot
    (StatsViewTests/snapshotIPhoneLight...png) → gate PASSES.
  • True negative (regenerated) — touched the same mapped baseline
    together with its corresponding screenshots-ascspec/sudoku/iphone-6.9/en/01-home.png
    → gate PASSES.
  • Escape hatch verified both ways: Frame-Drift-Verified: commit trailer
    and FRAME_DRIFT_LABEL_OVERRIDE=1 env (the PR-label path) both turn the
    true-positive case into a WARN + exit 0.
  • Derived mapping (--list, 30 rows) cross-checked by eye against
    scripts/build-ascspec-screenshots.py:491-593 — exact match.
  • shellcheck clean (via mise exec shellcheck -- shellcheck mise-tasks/scan/store_frame_drift).
  • Not verified: the actual GitHub Actions job (label expression,
    fetch-depth: 0 merge-base availability) — only the underlying mise task
    was exercised locally; the workflow YAML was validated for syntax only.

closes #1001

🤖 Generated with Claude Code

Co-Authored-By: Claude Opus 5 (1M context) [email protected]

wei18 and others added 2 commits August 11, 2026 19:22
Twice now (#995, #998) a snapshot baseline moved and the committed ASC
frames under docs/app-store/screenshots-ascspec/ were not regenerated
to match, so stale marketing screenshots reached App Store Connect
(#998's stale mac frames were live for six days).

The obvious fix — run scripts/build-ascspec-screenshots.py and
`git diff --exit-code` — cannot run on this repo's CI: all five
existing workflows run ubuntu-latest, and the generator loads macOS
system fonts by absolute path (Hiragino Sans GB / PingFang /
AppleSDGothicNeo / Ayuthaya), so it fails at import time on Linux. The
per-locale font choice is deliberate, not incidental, so substituting
Linux fonts would silently change glyph shapes on exactly the CJK/th
locales this pipeline exists to protect.

Add the Linux proxy gate instead (option 3 from the issue discussion):
a pure git/grep check that fails a PR when it changes a snapshot
baseline mapped by the generator's SLOTS table without touching
anything under docs/app-store/screenshots-ascspec/ in the same PR.
The mapping is parsed fresh out of scripts/build-ascspec-screenshots.py
on every run (BASELINES_SUDOKU/BASELINES_MS + every Slot(...) entry),
not hardcoded, so it cannot silently rot as slots are added/removed.
Deliberately does not fire on every __Snapshots__ change — only on the
subset the SLOTS table actually maps to a store frame.

Escape hatch for the legitimate case (a baseline change that provably
doesn't alter the frame): PR label `frame-drift-verified`, or a
`Frame-Drift-Verified: <reason>` commit-message trailer. Both are
documented directly in the gate's own failure message.

Changed:
- mise-tasks/scan/store_frame_drift: the gate itself (new mise task).
- .github/workflows/lint.yml: wire it as a 6th job on the existing
  Lint workflow (ubuntu-latest, matches the other 4 source-reading
  jobs' style); add labeled/unlabeled to the trigger types so the
  escape-hatch label can actually turn a red check green.
- .claude/skills/mise-task-operations/SKILL.md: index the new task.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
…sed header

Code review on #1005 found a structural flaw: `device`/`app` in
mise-tasks/scan/store_frame_drift were only ever assigned when a header
regex matched (`"<device>": {` / `"sudoku": [` / `"minesweeper": [`). If
a header line is ever reformatted so the regex misses it, the loop
neither errors nor drops the row — device/app silently keep the value
from the PREVIOUS matched block, so every Slot(...) under the
unrecognized header gets attributed to the wrong device/app. Because
`baselines_root` is selected by `$app`, a wrong app produces a
non-existent path and the row for a REAL baseline drops out of the
table entirely — the gate then goes vacuously green if that baseline
changes, which is worse than having no gate.

Reviewer reproduced this against a scratch copy of the real script with
two mutations (`"mac": {` and the mac-block `"sudoku": [` each getting
an extra space): both left the row count at 30 while silently
misattributing rows.

Fix: track block boundaries, not just block starts. The token stream
now also captures bare `]`/`}` characters; leaving an app's Slot list
(`]`) clears `app`, leaving a device's dict (`}`) clears `device` and
`app`. A header line that fails to match for ANY reason now leaves the
context EMPTY rather than STALE, which trips the existing "Slot(...)
found before a device/app context" guard — a loud failure instead of
silent misattribution. Verified against both reported mutations on a
scratch copy (script under review untouched).

Also fixes a dead diagnostic the reviewer flagged as a cheap nit: under
`set -o pipefail`, `VAR=$(grep ... | sed ...)` with no grep match exits
the script immediately at that line (pipefail propagates grep's
nonzero), so the "-z" checks that were supposed to print
"could not parse ... — script format changed" never ran. Added `|| true`
to each such pipeline so the intended diagnostic actually prints.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
@wei18
wei18 merged commit 6637acd into main Aug 12, 2026
6 checks passed
@wei18
wei18 deleted the ci/1001-frame-drift-gate branch August 12, 2026 02:20
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.

ci(store): gate that committed ASC frames match a fresh regeneration

1 participant