refactor(#86): SETS → discriminated union + factories #93
Labels
No labels
blocked
bug
design
documentation
duplicate
enhancement
future
good first issue
help wanted
invalid
question
refactoring
tracker
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
jelmer/topoquiz#93
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Part of #86 (code-audit scope 1). Zie AUDIT.md §4.
Context
`SETS` in `cities.js` heeft 12 velden × 32 sets. Niet elke set gebruikt elk veld → overal in de consumenten-code (`index.html`) staan `>25` ad-hoc guards (`SETS[n]?.phases?`, `SETS[n]?.clickCorrectKm ??` etc.).
3 duidelijke varianten te onderscheiden:
Scope
Verificatie
Effort/Impact/Risico
3 / 3 / 3 — raakt alle call-sites
Afhankelijkheid
Liever na #94 (centrale router) — route-switching gaat door dezelfde call-sites.
Fixed in v2.19.3 — SETS zijn nu aangemaakt via simpleSet/phasedSet/dailyBonusSet factories die een kind-discriminator stempelen. Alle consumenten in index.html branchen op switch(set.kind)/set.variant i.p.v. ad-hoc null-checks op .phases/.daily/.bonus. Legacy velden verwijderd, clickResult genormaliseerd (expliciete thresholds op sets 61-67), SETS_BEHAVIOR_SNAPSHOT + CLICK_GOLDEN oracles in test.js bewaken regressie.
Release: https://github.com/jelmerkk/topoquiz/releases/tag/v2.19.3