Skip to content

fix(AnyGame): one unknown storefront tag no longer empties the library (refs #289) - #292

Open
bcupello wants to merge 1 commit into
MythicApp:mainfrom
bcupello:fix/tolerant-library-decoding
Open

bcupello wants to merge 1 commit into
MythicApp:mainfrom
bcupello:fix/tolerant-library-decoding

Conversation

@bcupello

Copy link
Copy Markdown

AnyGame.init(from:) decoded the storefront tag with try, so a tag the running build does not recognise throws. GameDataStore decodes the whole [AnyGame] array in one call and UserDefaults.decodeAndGet swallows any error into nil, which the observer reads as an empty library — so a single unreadable row discards every game from every other storefront too.

Measured on 0.6.0 by seeding games with one unknown storefront tag plus one ordinary local game:

build games surviving
0.6.0 0 of 2 — library wiped, local game included
this change 2 of 2 — unknown tag degraded, local untouched

Worth shipping ahead of any new storefront case, because the build that needs the tolerance is the older one: by the time a new tag exists on disk, the release that cannot read it is already out.

Game.storefront on the base class logs instead of asserting, since a bare Game is now a legitimate decode outcome rather than a programmer error.

`AnyGame.init(from:)` decoded the storefront tag with `try`, so a tag the
running build does not recognise threw. `GameDataStore` decodes the whole
`[AnyGame]` array in one call and `UserDefaults.decodeAndGet` swallows any
error into `nil`, which the observer then reads as an empty library -- so a
single unreadable row discards every game from every other storefront too.

Measured on 0.6.0 by seeding `games` with one unknown storefront tag plus
one ordinary local game:

    0.6.0        0 of 2 survive -- library wiped, local game included
    this change  2 of 2 survive -- unknown tag degraded, local untouched

Worth shipping ahead of any new storefront case, because the build that
needs the tolerance is the older one: by the time a new tag exists on disk,
the release that cannot read it is already out.

`Game.storefront` on the base class logs instead of asserting, since a bare
`Game` is now a legitimate decode outcome rather than a programmer error.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
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