fix(images): export light/dark pairs together with granular cache - #84
Merged
Conversation
`ImagesLoader.loadFromSingleFileWithGranularCache` filtered to changed nodes
without pairing, so a designer edit to only the dark variant produced an orphan
dark asset and `ImagesProcessor` rejected the whole config:
Error: Asset count mismatch: light=0, dark=1
Missing assets in Light: safety-sos-button-color
f124526 added pairing to `IconsLoader` only. `ImagesLoader` was never updated,
and both of its branches were affected — the PNG branch had no pairing-aware
helper at all. This broke `03_daily_assets_update` in Oymyakon-Atoms-iOS on
every day the illustrations file changed (4 runs in July).
- `loadPNGImagesWithGranularCache` takes `darkModeSuffix: String? = nil` and
routes to `fetchImageComponentsWithGranularCacheAndPairing` when set
- single-file PNG branch passes `darkSuffix`; SVG branch switches to
`loadVectorImagesWithGranularCacheAndPairing`
- `loadFromLightAndDarkFileWithGranularCache` keeps `nil` on purpose: light and
dark live in separate files and are filtered independently
Also fixed, found during the same investigation:
- `batch` returned exit code 0 while reporting failures, so CI treated a broken
export as green — now throws `ExitCode.failure` when `failureCount > 0`
- the failure table truncates both config name and error, making CI logs
useless for diagnosis — full errors are now printed underneath it
- 5 tests in `SubcommandFaultTolerancePrecedenceTests` crashed on
`ParsableArguments.init()`, which leaves every `@Option` undecoded so the
first read traps. Switched to `try FaultToleranceOptions.parse([])`, the
pattern already used throughout `FaultToleranceOptionsTests`. Under
`--parallel` this surfaced as a non-zero exit with no `XCTAssert` failure
line, which is why it read as a green suite.
Full suite now green: 1996 XCTest + 211 swift-testing, exit 0.
|
Caution The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased. |
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.
Problem
ImagesLoader.loadFromSingleFileWithGranularCachefiltered to changed nodes without pairing light/dark variants. A designer edit touching only the dark variant produced an orphan dark asset, andImagesProcessorthen rejected the whole config:f124526added pairing toIconsLoaderonly —ImagesLoaderwas never updated, and both of its branches were affected (the PNG branch had no pairing-aware helper at all). This broke03_daily_assets_updatein Oymyakon-Atoms-iOS on every day the illustrations file changed (4 runs in July).Changes
loadPNGImagesWithGranularCachetakesdarkModeSuffix: String? = niland routes tofetchImageComponentsWithGranularCacheAndPairingwhen setdarkSuffix; SVG branch switches toloadVectorImagesWithGranularCacheAndPairingloadFromLightAndDarkFileWithGranularCachekeepsnilon purpose — light and dark live in separate files and are filtered independentlyAlso fixed (found during the same investigation)
batchreturned exit code 0 while reporting failures, so CI treated a broken export as green — now throwsExitCode.failurewhenfailureCount > 0SubcommandFaultTolerancePrecedenceTestscrashed onParsableArguments.init(), which leaves every@Optionundecoded so the first read traps. Switched totry FaultToleranceOptions.parse([]), the pattern already used throughoutFaultToleranceOptionsTests. Under--parallelthis surfaced as a non-zero exit with noXCTAssertfailure line, which is why it read as a green suite.Tests
New
ImagesLoaderGranularCachePairingTestscovers both branches:testOnlyDarkChanged_vectorBranch_includesBothVersionstestOnlyDarkChanged_pngBranch_includesBothVersionsFull suite: 1996 XCTest + 211 swift-testing, exit 0 (
swift test --parallel, Swift 6.3).Docs
Updated
.claude/rules/cache-granular.md,gotchas.md, andmodification-checklists.mdso the pairing requirement is recorded next to the granular-cache rules it belongs to.