Skip to content

feat(dev-tools): rotate sessions tool and experiment feature flags#700

Draft
Just-Insane wants to merge 8 commits into
SableClient:devfrom
Just-Insane:feat/developer-tools
Draft

feat(dev-tools): rotate sessions tool and experiment feature flags#700
Just-Insane wants to merge 8 commits into
SableClient:devfrom
Just-Insane:feat/developer-tools

Conversation

@Just-Insane
Copy link
Copy Markdown
Contributor

Summary

Consolidates two developer-tooling branches. Adds a "Rotate Sessions" tool to Developer Tools settings and an Experiments panel for percentage-rollout feature flags, with build-time injection from environment variables.


Changes

feat/devtool-rotate-sessions

  • Add a Rotate Sessions button to the Developer Tools settings panel.
  • Calls prepareToEncrypt() on all joined rooms to force Megolm session rotation, useful for testing encryption key rotation flows.
  • Includes error handling and user feedback via toast/alert.

feat/feature-flag-env-vars

  • deepMerge prototype-pollution fix: block keys like __proto__, constructor, and prototype in the deep-merge utility used to inject runtime config.
  • Build-time config injection: scripts/inject-client-config.js reads CLIENT_CONFIG_* environment variables at build time and merges them into config.json, enabling CI/CD pipelines and GitHub Actions to configure feature flags without modifying the source file.
  • Experiment bucketing (useExperimentVariant): typed helper that deterministically buckets users into experiment variants by percentage rollout, based on user ID hash.
  • ExperimentsPanel: new settings panel under Developer Tools listing active experiments and their variant assignments.
  • useClientConfig test: unit tests covering experiment bucketing logic and the useExperimentVariant hook.

Testing Checklist

  • Developer Tools → "Rotate Sessions": button present, triggers Megolm rotation, error handled gracefully
  • Developer Tools → Experiments panel: visible, lists configured experiments
  • CLIENT_CONFIG_* env vars at build time: merged into runtime config correctly
  • deepMerge with __proto__ key: rejected, no prototype pollution

Changeset

  • feat: Rotate Sessions developer tool
  • feat: Experiment bucketing with env-var-injectable config
  • fix: Prototype-pollution guard in deepMerge

@Just-Insane Just-Insane force-pushed the feat/developer-tools branch from d82f8e4 to 0625646 Compare May 11, 2026 01:44
@Just-Insane Just-Insane force-pushed the feat/developer-tools branch 2 times, most recently from 3dc1788 to 90967a2 Compare May 14, 2026 19:41
Just-Insane and others added 8 commits May 14, 2026 16:41
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Add scripts/inject-client-config.js which reads HOMESERVER_LIST,
ELEMENT_CALL_URL, EXPERIMENTS and other config keys from the GH Actions
environment and merges them into config.json at build time.
CI workflows pass these through via env; the setup action prints an
injected-config summary in the job summary.
knip.json updated to include the new script as an entry point.
…ntages

useClientConfig.ts gains getExperimentVariant() which deterministically
buckets a userId into a variant using a hash of userId+experimentName, then
checks it against rolloutPercentage. Experiment defaults shape is typed so
all callers get compile-time checking of known experiment names.
ExperimentsPanel shows every experiment name, current variant, rollout
percentage, and whether the user is enrolled — readable without opening
the console. DevelopTools.tsx wires it into the developer settings tab.
@Just-Insane Just-Insane force-pushed the feat/developer-tools branch from e551b10 to bafe036 Compare May 14, 2026 20:42
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