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 <[email protected]>
HANTAisHere pushed a commit to HANTAisHere/Mythic that referenced this pull request Nov 28, 2026
HANTAisHere pushed a commit to HANTAisHere/Mythic that referenced this pull request Nov 28, 2026
The unknown entry is kept as a plain Game, so its storefront tag is lost
on re-save. Tracked for the Steam work, where entries will be preserved.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
HANTAisHere pushed a commit to HANTAisHere/Mythic that referenced this pull request Nov 29, 2026
PR MythicApp#292 stopped one unknown storefront tag from emptying the library,
but kept the entry as a plain Game, so the next save dropped its tag
and storefront fields for good: an older build would turn a newer
build's games into untyped entries. UnknownStorefrontGame now keeps the
stored entry as a PropertyListValue and AnyGame writes it back
unchanged.

Such entries (and bare Game ones) are hidden from the library and
'recent': Game's launch/update/move are fatalError, so pressing Play on
one would have crashed.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
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