Skip to content

flags: persist URL flags for the session, add flagEnabled - #321

Merged
mosherBT merged 2 commits into
masterfrom
flags-persist-url-flags
Aug 20, 2026
Merged

flags: persist URL flags for the session, add flagEnabled#321
mosherBT merged 2 commits into
masterfrom
flags-persist-url-flags

Conversation

@mosherBT

@mosherBT mosherBT commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

Why

getFlags() reads flags from the URL but never writes them to sessionStorage, so a flag only applies to the page whose query string carried it. Navigate once and it's gone.

What Changed

  • parseFlags() persists URL flags to sessionStorage. URL still wins over a stored value.
  • Adds flagEnabled(), used by the three buildRTD call sites. Flag values are strings and "0" is truthy, so ?optableDebug=0 used to turn debug on. setupAB is untouched — optableControlGroup is two-state and already compares explicitly.
  • Adds optableForceTokenize, optableResolveId5, optableResolveID5ID to FLAG_KEYS.
  • New lib/core/flags.md and README section.

How to Test

Load a page with ?optableForceGlobalRouting, then navigate to a second page without it. Routing should stay global.

?optableDebug=0 should leave RTD logging off.

  • Tested
  • Docs updated

Notes

  • Breaking change
  • Requires release

Flags were parsed from the URL on every page load but never written back, so
a flag only applied to the page whose query string carried it. getFlags()
already reads sessionStorage as a fallback; nothing ever populated it.

- parseFlags() now persists URL-supplied flags to sessionStorage, so a flag
  set once holds for the rest of the tab session. A URL parameter still wins
  over a stored value, so "?optableDebug=0" corrects a stored "1".
- Adds flagEnabled(), and switches the three buildRTD call sites to it.
  Flag values are strings and "0" is truthy, so "?optableForceSkipMerge=0"
  previously enabled the flag. Persisting values makes that stick for the
  session rather than one page, so the truthiness bug is fixed here rather
  than left to become permanent. setupAB is unaffected — it already compares
  against "1" and "0" explicitly, and optableControlGroup stays two-state.
- Adds optableForceTokenize, optableResolveId5 and optableResolveID5ID to
  FLAG_KEYS. All three are in use but unrecognised, so they were neither
  parsed nor persisted. optableResolveID5ID becomes URL-settable for the
  first time; previously it could only be set by writing sessionStorage.

Adds lib/core/flags.md and a README section — neither existed, so the flag
names and their meanings were only discoverable by reading the source.
@mosherBT
mosherBT requested review from a team as code owners August 19, 2026 17:41
@mosherBT
mosherBT requested a review from nyssaoptable August 19, 2026 17:41
Comment thread lib/core/flags.test.ts
Comment thread lib/core/flags.ts
Comment thread lib/core/flags.ts
@mosherBT
mosherBT merged commit 241f475 into master Aug 20, 2026
7 checks passed
@mosherBT
mosherBT deleted the flags-persist-url-flags branch August 20, 2026 13:52
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.

3 participants