Skip to content

Commit a427fcb

Browse files
committed
chore(screenshots): Commit only English Play Store screenshots
Only en-US screenshots are tracked from now on. The other 67 locales are generated on demand and gitignored, which drops 35 PNGs and roughly 5 MB from the repository and stops every screenshot refresh from churning binaries in five languages nobody reviews. Play Store still gets the full 68 locales. supply only uploads what is present under fastlane/metadata/android/<locale>/images/phoneScreenshots/ and retains whatever was last pushed for locales absent from an upload, so localization is maintained by an occasional manual regen plus screenshots_only rather than by every PR. PlayStoreLocales.kt had been committed since February holding a truncated four-locale batch slice, left behind when a run was killed before its EXIT trap restored the file. The next run then copied that slice over its own backup and faithfully restored the corruption, which is why the remnant survived six months. It is replaced with a documented en-US placeholder, the generator no longer emits an annotation nothing references, and the script now refuses to start when a stale .bak is present instead of clobbering the only good copy. The refresh runbook is corrected as well: it ended with a checkout that restores tracked files from the index, which would have reverted the freshly rendered English screenshots while the store received them, and its upload step is now gated so a failed upload leaves them staged for a retry rather than committed as though deployed.
1 parent c49cd62 commit a427fcb

40 files changed

Lines changed: 31 additions & 32 deletions

.claude/rules/screenshots.md

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,15 @@ ScreenshotContent.kt (mock data + composables)
3232
|------|---------|
3333
| `app/src/debug/java/.../screenshots/ScreenshotContent.kt` | Mock data composables (7 exist; `HomescreenWidgetContent` has an IDE preview only and is **not** in the Play Store pipeline) |
3434
| `app/src/screenshotTest/kotlin/.../screenshots/PlayStoreScreenshots.kt` | `@PreviewTest` functions (currently: `DashboardLight`, `DashboardDark`, `CasePopUp`, `DeviceProfiles`, `AddProfile`, `DeviceSettingsReactions`, `WidgetConfiguration`) |
35-
| `app/src/screenshotTest/kotlin/.../screenshots/PlayStoreLocales.kt` | Multi-preview annotations (auto-generated by batch script) |
35+
| `app/src/screenshotTest/kotlin/.../screenshots/PlayStoreLocales.kt` | Multi-preview annotations. The committed content is an en-US placeholder, not meaningful data — `generate_screenshots.sh` rewrites it per batch and restores it from a `.bak` on exit. A run killed hard leaves that `.bak` behind, so the script now refuses to start until it is restored by hand |
3636
| `fastlane/generate_screenshots.sh` | Batched generation; locale list (`ALL_LOCALES`) and `BATCH_SIZE` are defined inside the script |
3737
| `fastlane/copy_screenshots.sh` | Copies rendered PNGs into fastlane structure |
3838

3939
## Commit policy
4040

41-
Only the 6 smoke locales (en-US, de-DE, ja-JP, ar, zh-CN, pt-BR) have `phoneScreenshots/*.png` checked into the repo. Non-smoke locales are excluded by `.gitignore`. This mirrors permission-pilot and keeps repo size small (~7 MB vs ~67 MB for the full 68 locales).
41+
Only `en-US` has `phoneScreenshots/*.png` checked into the repo — 7 PNGs, ~1 MB tracked. Every other locale is excluded by `.gitignore`.
42+
43+
`--smoke` still *renders* 6 locales (en-US, de-DE, ja-JP, ar, zh-CN, pt-BR), but only en-US is committed. The other five cover LTR, RTL and CJK layout so a render that breaks on non-Latin script fails during generation, and the resulting PNGs sit in the working tree for manual inspection. Nothing compares them against a baseline, so this is render coverage plus eyeballing, not regression checking.
4244

4345
Play Store's `supply` only uploads what's present in `fastlane/metadata/android/<locale>/images/phoneScreenshots/`. For locales not in the upload, Play Store retains whatever was last pushed. So full localization on Play Store is maintained by an **occasional manual** full regen + `:screenshots_only` upload — not by every PR.
4446

@@ -90,11 +92,20 @@ Periodic, manual operation — not per-PR:
9092
```bash
9193
./fastlane/generate_screenshots.sh # full, ~30 min, 476 PNGs (68 locales x 7)
9294
./fastlane/copy_screenshots.sh --clean
93-
bundle exec fastlane screenshots_only # uploads all 68 locales to Play Store
94-
git checkout -- fastlane/metadata/android/ # discard non-smoke changes (gitignored anyway)
95+
git add fastlane/metadata/android/en-US/images/phoneScreenshots/
96+
if bundle exec fastlane screenshots_only; then
97+
git checkout -- fastlane/metadata/android/ &&
98+
git commit --only -m "chore(screenshots): Refresh Play Store screenshots" -- \
99+
fastlane/metadata/android/en-US/images/phoneScreenshots/
100+
else
101+
git checkout -- fastlane/metadata/android/
102+
echo "Upload failed; the refreshed en-US screenshots remain staged for retry."
103+
fi
95104
```
96105

97-
The `.gitignore` rule keeps non-smoke output unstaged automatically, so only the smoke locales' refreshed PNGs would show up as modifications and can be committed.
106+
The `git add` has to happen before the upload. The final `git checkout` restores every tracked file under that path **from the index**, so staging the refreshed English set is precisely what makes it survive the checkout — skip the `git add` and the checkout silently reverts the refresh while the store still receives the new images.
107+
108+
Restoring is the checkout's job otherwise: `screenshots_only` runs `remove_unsupported_languages.sh`, which deletes 9 tracked locale directories (es-AR, sc-IT, sq-AL, uz, kmr-TR, ur-IN, zu, si-LK, nb) from the working tree before uploading — 35 tracked files, a subset of the 309 tracked non-screenshot metadata files under that path, all of them put back by the checkout. It does **not** touch the regenerated non-English PNGs: those are untracked and ignored, so they stay on disk and never show up in `git status`. Because the checkout discards any uncommitted metadata text edits too, run this refresh only with an otherwise-clean metadata tree. The final commit is path-limited on purpose, so an unrelated staged change can't ride along, and it is gated on `screenshots_only` succeeding rather than merely sequenced after it: if the upload fails, the refreshed English files stay staged for a retry instead of being committed as though they were deployed. The deleted locale directories are restored on either path.
98109

99110
## Technical Notes
100111

.gitignore

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,11 @@
1717
.kotlin
1818
# Screenshot test reference images (ephemeral, regenerated on demand)
1919
app/src/screenshotTest*/reference/
20-
# Play Store phone screenshots: commit only the 6 smoke locales (mirrors permission-pilot).
20+
# Play Store phone screenshots: commit only en-US.
2121
# Full localization is uploaded by occasional manual regen + screenshots_only;
2222
# Play Store retains previously-uploaded screenshots for locales not pushed.
2323
fastlane/metadata/android/*/images/phoneScreenshots/*.png
2424
!fastlane/metadata/android/en-US/images/phoneScreenshots/*.png
25-
!fastlane/metadata/android/de-DE/images/phoneScreenshots/*.png
26-
!fastlane/metadata/android/ja-JP/images/phoneScreenshots/*.png
27-
!fastlane/metadata/android/ar/images/phoneScreenshots/*.png
28-
!fastlane/metadata/android/zh-CN/images/phoneScreenshots/*.png
29-
!fastlane/metadata/android/pt-BR/images/phoneScreenshots/*.png
3025
.codex
3126
protocol-research/
3227
_site/

app/src/screenshotTest/kotlin/eu/darken/capod/screenshots/PlayStoreLocales.kt

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,26 +4,17 @@ import android.content.res.Configuration
44
import androidx.compose.ui.tooling.preview.Preview
55

66
/**
7-
* Multi-preview annotation generating one preview per Play Store-supported locale (light mode).
8-
* Each [name] is the fastlane metadata directory name for direct use in the copy script.
7+
* Placeholder locale set. `fastlane/generate_screenshots.sh` rewrites this file per batch and
8+
* restores it afterwards, so the committed content only decides what a bare
9+
* `./gradlew updateGplayDebugScreenshotTest` renders.
10+
*
11+
* [name] is the fastlane metadata directory the copy script sorts the output into.
912
*/
1013
@Preview(locale = "en", name = "en-US", device = DS)
11-
@Preview(locale = "af", name = "af", device = DS)
12-
@Preview(locale = "am", name = "am", device = DS)
13-
@Preview(locale = "ar", name = "ar", device = DS)
1414
annotation class PlayStoreLocales
1515

1616
/**
1717
* Same locales but with night mode enabled for dark theme screenshots.
1818
*/
1919
@Preview(locale = "en", name = "en-US", device = DS, uiMode = Configuration.UI_MODE_NIGHT_YES)
20-
@Preview(locale = "af", name = "af", device = DS, uiMode = Configuration.UI_MODE_NIGHT_YES)
21-
@Preview(locale = "am", name = "am", device = DS, uiMode = Configuration.UI_MODE_NIGHT_YES)
22-
@Preview(locale = "ar", name = "ar", device = DS, uiMode = Configuration.UI_MODE_NIGHT_YES)
2320
annotation class PlayStoreLocalesDark
24-
25-
/**
26-
* Smoke test subset for fast iteration (6 locales covering LTR, RTL, CJK).
27-
*/
28-
@Preview(locale = "en", name = "en-US", device = DS)
29-
annotation class PlayStoreLocalesSmoke

fastlane/generate_screenshots.sh

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,15 @@ echo "=== Localized Screenshot Generation ==="
122122
echo "Locales: $TOTAL | Batch size: $BATCH_SIZE | Batches: $NUM_BATCHES"
123123
echo ""
124124

125+
# A leftover .bak means a previous run died before its trap restored the file: the real source is
126+
# in the .bak and copying over it here would destroy the only good copy.
127+
if [[ -e "$LOCALES_FILE.bak" ]]; then
128+
echo "ERROR: Stale backup found: $LOCALES_FILE.bak"
129+
echo "A previous run was interrupted. Restore it first:"
130+
echo " mv \"$LOCALES_FILE.bak\" \"$LOCALES_FILE\""
131+
exit 1
132+
fi
133+
125134
# Back up the original file
126135
cp "$LOCALES_FILE" "$LOCALES_FILE.bak"
127136
trap 'mv "$LOCALES_FILE.bak" "$LOCALES_FILE"; echo "Restored original PlayStoreLocales.kt"' EXIT
@@ -166,13 +175,6 @@ HEADER
166175
done
167176
echo "annotation class PlayStoreLocalesDark" >> "$file"
168177
echo "" >> "$file"
169-
170-
# Smoke annotation (single entry placeholder)
171-
echo "/**" >> "$file"
172-
echo " * Smoke test subset for fast iteration (6 locales covering LTR, RTL, CJK)." >> "$file"
173-
echo " */" >> "$file"
174-
echo "@Preview(locale = \"en\", name = \"en-US\", device = DS)" >> "$file"
175-
echo "annotation class PlayStoreLocalesSmoke" >> "$file"
176178
}
177179

178180
for (( batch=0; batch < NUM_BATCHES; batch++ )); do
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

0 commit comments

Comments
 (0)