Repository navigation
perf(bots): a groups notice names the room that changed, and only that room re-reads #47523
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 1 commit
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
2d14127
perf(bots): a groups notice names the room that changed, and only tha…
brennanb2025 1e8badd
perf(bots): read a room notice once for every window listener, and lo…
brennanb2025 072e6b1
fix(bots): a groups change with an empty room list reaches every room
brennanb2025 808ef8c
perf(bots): read a notice's room list only where an open room asks, n…
brennanb2025 b10edb4
fix(bots): keep a notice's rooms when the window reads a notice the b…
brennanb2025 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
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
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
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
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
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -31,5 +31,5 @@ export function saveGroupPeerAnswer( | |
| : turn | ||
| ) | ||
| }) | ||
| groups.changed() | ||
| groups.changed(message.groupId) | ||
| } | ||
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
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
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
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
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
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| import { expect, it } from 'vitest' | ||
| import { | ||
| addBotChange, | ||
| botChangeNotice, | ||
| botGroupRoomConcerned, | ||
| pendingBotChanges, | ||
| readBotChangeScope, | ||
| type BotChangeScope | ||
| } from './bot-change-scope' | ||
|
|
||
| // One quiet window's notice, as it leaves the host and as a reader reads it back. | ||
| function notice(...changes: BotChangeScope[]): BotChangeScope | undefined { | ||
| const pending = pendingBotChanges() | ||
| changes.forEach((change) => addBotChange(pending, change)) | ||
| return readBotChangeScope(JSON.parse(JSON.stringify(botChangeNotice(pending)))) | ||
| } | ||
|
|
||
| const rooms = (scope: BotChangeScope | undefined) => | ||
| ['room-a', 'room-b', 'room-c'].filter((id) => botGroupRoomConcerned(scope, id)) | ||
|
|
||
| it('re-reads only the rooms a window named, and every room once a change names none', () => { | ||
| const named = notice( | ||
| { kinds: ['groups'], groupIds: ['room-a'] }, | ||
| { kinds: ['groups'], groupIds: ['room-b'] }, | ||
| { botIds: ['bot-1'], kinds: ['status'] } | ||
| ) | ||
| expect(rooms(named)).toEqual(['room-a', 'room-b']) | ||
| // A groups change that names no room (a roster edit, an older caller) reaches every room. | ||
| expect(rooms(notice({ kinds: ['groups'], groupIds: ['room-a'] }, { kinds: ['groups'] }))).toEqual( | ||
| ['room-a', 'room-b', 'room-c'] | ||
| ) | ||
| expect(rooms(notice({ kinds: ['groups'] }, { kinds: ['groups'], groupIds: ['room-a'] }))).toEqual( | ||
| ['room-a', 'room-b', 'room-c'] | ||
| ) | ||
| // A change of every kind, an older host's bare notice, and a kind this build doesn't know all reach | ||
| // every room; another kind alone reaches none. | ||
| expect(rooms(notice({ kinds: ['groups'], groupIds: ['room-a'] }, {}))).toHaveLength(3) | ||
| expect(rooms(undefined)).toHaveLength(3) | ||
| expect(rooms(readBotChangeScope({ kinds: ['future-kind'], groupIds: ['room-a'] }))).toHaveLength( | ||
| 3 | ||
| ) | ||
| expect(rooms(notice({ botIds: ['bot-1'], kinds: ['status'] }))).toEqual([]) | ||
| }) |
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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.