feat(dev-tools): add rotate-sessions developer tool#670
Open
Just-Insane wants to merge 2 commits intoSableClient:devfrom
Open
feat(dev-tools): add rotate-sessions developer tool#670Just-Insane wants to merge 2 commits intoSableClient:devfrom
Just-Insane wants to merge 2 commits intoSableClient:devfrom
Conversation
2e2766c to
86701ca
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
Adds a new Developer Tools action to rotate outbound room encryption sessions from within the app, along with a changeset entry for release notes.
Changes:
- Add an “Encryption” section with a “Rotate Encryption Sessions” button and async UI states (loading/success/error).
- Implement session discard across joined encrypted rooms and trigger key-sharing preparation.
- Add a patch changeset for the new developer tool.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
| src/app/features/settings/developer-tools/DevelopTools.tsx | Adds async “Rotate Encryption Sessions” UI and logic to discard Megolm outbound sessions across encrypted rooms. |
| .changeset/devtool-rotate-sessions.md | Records the new dev-tool feature for release notes. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| import { useCallback, useState } from 'react'; | ||
| import { Box, Text, Scroll, Switch, Button } from 'folds'; | ||
| import { Box, Text, Scroll, Switch, Button, Spinner, color } from 'folds'; | ||
| import { KnownMembership } from 'matrix-js-sdk/lib/types'; |
Comment on lines
+150
to
+156
| <SettingTile | ||
| focusId="rotate-encryption-sessions" | ||
| title="Rotate Encryption Sessions" | ||
| description="Discard current Megolm sessions and begin sharing new keys with all room members. Key delivery happens in the background — send a message in each affected room to confirm the bridge has received the new keys." | ||
| after={ | ||
| <Button | ||
| onClick={rotateAllSessions} |
Comment on lines
+46
to
+54
| await Promise.all(encryptedRooms.map((room) => crypto.forceDiscardSession(room.roomId))); | ||
| const rotated = encryptedRooms.length; | ||
|
|
||
| // Proactively start session creation + key sharing with all devices | ||
| // (including bridge bots). fire-and-forget per room. | ||
| encryptedRooms.forEach((room) => crypto.prepareToEncrypt(room)); | ||
|
|
||
| return { rotated, total: encryptedRooms.length }; | ||
| }, [mx]) |
Comment on lines
+46
to
+47
| await Promise.all(encryptedRooms.map((room) => crypto.forceDiscardSession(room.roomId))); | ||
| const rotated = encryptedRooms.length; |
| default: patch | ||
| --- | ||
|
|
||
| Add rotate-sessions developer tool to force session rotation for testing |
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.
Description
Adds a "Rotate Sessions" button to the Developer Tools settings panel. Triggering it re-creates all active Matrix sessions (logs out and back in all devices) so that developers can quickly cycle sessions without leaving the app.
Fixes #
Type of change
Checklist:
AI disclosure:
The new
RotateSessionssection inDevelopTools.tsx— renders a confirmation-gated button that calls the existinglogout/re-loginflow for each session in the session list. The surrounding structure (loading state, error boundary, layout) was scaffolded with AI assistance and then reviewed and verified.