fix: validate the stored label and burg group registries - #67
Merged
Conversation
A value persisted by an older build can be structurally valid and still
leave the renderer with nothing to draw - `{groups: []}` has every key,
the right types, and produces a map with no labels at all. Both keys are
read unvalidated on boot and again in randomizeOptions, so the bad value
survives every new map until the user clears site data.
Parse them through Labels.parseStoredOptions and Burgs.parseStoredGroups
instead: drop entries the renderer cannot use, restore any label type
left without a group, and keep a default burg group for assignment to
fall back on.
✅ Deploy Preview for bazgaars-fmg ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
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.
Fork port of upstream PR Azgaar#1801 (upstream issue Azgaar#1771). Cherry-pick of
61c156f2.options.labelsandoptions.burgs.groupsare seeded straight fromlocalStoragewith no validation. A value written by an older build can be structurally valid and still leave the renderer with nothing to draw —{"resizeOnZoom":true,"showAll":false,"groups":[]}has every key and the right types, and produces a map with no labels at all. Because it is re-read for every new map, it keeps doing so until the user clears site data.Both keys are read in two places — once at boot in
public/main.jsand again inrandomizeOptions()inpublic/modules/ui/options.js. Fixing only the boot site passes every unit test and still leaves the browser broken; both now go throughLabels.parseStoredOptions/Burgs.parseStoredGroups.Port notes
display: noneinto persisted label group styles Azgaar/Fantasy-Map-Generator#1773 pair.src/index.htmlasset-stamp hashes; resolved by taking fork main's and re-runningnpm run stamp-assets.display: noneinto persisted label group styles Azgaar/Fantasy-Map-Generator#1773 port, already merged). The two touch different structures — this one rebuildsoptions.labels.groups, fix: strip zoom auto-visibility display from migrated label group styles #66 stripsdisplayfromstyle.labels.groups.*.style.Verification
npx vitest run— 970 passingtsc --noEmitclean;biome checkclean (2 pre-existing warnings in untouched fork-only files)tests/e2e/stored-options.spec.tsrun against a dev server on this branch — passes; confirmed upstream to fail without thepublic/changes