Skip to content

fix: validate the stored label and burg group registries - #67

Merged
barrulus merged 1 commit into
mainfrom
fix/validate-persisted-options-fork
Sep 5, 2026
Merged

fix: validate the stored label and burg group registries#67
barrulus merged 1 commit into
mainfrom
fix/validate-persisted-options-fork

Conversation

@barrulus

@barrulus barrulus commented Sep 5, 2026

Copy link
Copy Markdown
Owner

Fork port of upstream PR Azgaar#1801 (upstream issue Azgaar#1771). Cherry-pick of 61c156f2.

options.labels and options.burgs.groups are seeded straight from localStorage with 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.js and again in randomizeOptions() in public/modules/ui/options.js. Fixing only the boot site passes every unit test and still leaves the browser broken; both now go through Labels.parseStoredOptions / Burgs.parseStoredGroups.

Port notes

Verification

  • npx vitest run — 970 passing
  • tsc --noEmit clean; biome check clean (2 pre-existing warnings in untouched fork-only files)
  • tests/e2e/stored-options.spec.ts run against a dev server on this branch — passes; confirmed upstream to fail without the public/ changes

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.
@netlify

netlify Bot commented Sep 5, 2026

Copy link
Copy Markdown

Deploy Preview for bazgaars-fmg ready!

Name Link
🔨 Latest commit d7c7b5d
🔍 Latest deploy log https://app.netlify.com/projects/bazgaars-fmg/deploys/6a9bc8880afa84000858055a
😎 Deploy Preview https://deploy-preview-67--bazgaars-fmg.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@barrulus
barrulus merged commit cbe0880 into main Sep 5, 2026
6 checks passed
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