Repository navigation
docs(test): label locale snapshot baselines as layout probes, not translation checks - #1006
Merged
Merged
Conversation
…nslation checks The snapshot harness injects `.environment(\.locale, ...)`, which its doc comment presented as the locale mechanism without qualification. It is not one for strings: `Text(LocalizedStringKey)` resolves against `Bundle.main`, and in a headless `swift test` host that is the xctest runner, which carries none of the App target's compiled `.lproj` resources. UI strings therefore stay English no matter which locale is injected — only date/number formatting and layout direction respond. That gap produced 108 byte-identical "localized" baselines in #976 (backed out) and contributed to two misdiagnoses. The three long-standing locale-tagged BoardView baselines (ja, ko, zh-TW) were always layout-robustness probes; nothing said so, so they read as translation coverage. This is documentation only — no behaviour change. #977 stays open as the record of the underlying limitation; per the product decision on 2026-08-11 the store frames keep rendering English app UI under localized marketing captions, so the fix is deferred rather than attempted. Both `hostingView` variants in each app's harness now carry the note, and the BoardView call sites say "layout probe" explicitly. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Documentation only — no behaviour change, no baseline re-recorded.
Why
The snapshot harness injects
.environment(\.locale, ...)and its doc comment presented that as the locale mechanism, unqualified. It is not one for strings.Text(LocalizedStringKey)resolves againstBundle.main, and in a headlessswift testhostBundle.mainis the xctest runner — which carries none of the App target's compiled.lprojresources. The string catalogs live atApp/Sudoku/Resources/Localizable.xcstringsandApp/Minesweeper/Resources/Localizable.xcstrings, inside the App targets; no Swift package owns them, andswift testnever builds an App target. So UI strings stay English regardless of the injected locale. Only date/number formatting and layout direction respond.That gap produced 108 byte-identical "localized" baselines in #976 (backed out) and contributed to two misdiagnoses. The three long-standing locale-tagged BoardView baselines (
ja,ko,zh-TW) were always layout-robustness probes — nothing said so, so they read as translation coverage to anyone skimming.What changed
SudokuUITests/SnapshotConfig.swift— thelocale:parameter doc now states plainly what it does and does not do, with theBundle.mainreason. The secondhostingViewvariant carries a one-line pointer.MinesweeperUITests/SnapshotConfig.swift— same note at both.environment(\.locale, ...)sites (the file had no///param docs to correct, so the note sits at the call site).SudokuUITests/BoardViewTests.swift— file header and the three locale tests now say "layout probe" explicitly.Both
SnapshotConfig.swiftandBoardViewTests.swiftsit at exactly the SwiftLintfile_lengthceiling of 400, so these edits were written to land at 400, not 401.swiftlint --stricton all three files:0 violations, 0 serious.Scope
#977 stays open. Per the product decision on 2026-08-11 the store frames keep rendering English app UI beneath localized marketing captions, so the underlying fix is deferred, not attempted. This PR only stops the harness from misrepresenting what it does — it is the cheap part that was worth doing regardless of which fix is eventually chosen.
For the record, the evaluation behind that deferral: option (a) — threading a bundle through every localizing call site — measures 203 call sites across the four shared UI targets (GameShellUI 21, SudokuUI 73, MinesweeperUI 71, SettingsUI 38), with no chokepoint component to narrow it, and would still leave the test host without a compiled
.lprojto point at. Option (b) — capturing from the Simulator — is structurally right but needs an iPad boot path, a brand-new macOS-native capture path, two new DEBUG route hooks, and a locale loop that does not exist yet.part of #977
🤖 Generated with Claude Code