Mark many chat session related types as readonly#303644
Merged
mjbvz merged 4 commits intomicrosoft:mainfrom Mar 21, 2026
Merged
Mark many chat session related types as readonly#303644mjbvz merged 4 commits intomicrosoft:mainfrom
mjbvz merged 4 commits intomicrosoft:mainfrom
Conversation
These types are generally expected to be immutable
Contributor
There was a problem hiding this comment.
Pull request overview
Marks chat session-related types as readonly to better reflect their intended immutability, and updates affected call sites to avoid mutating session DTOs/items in-place.
Changes:
- Add
readonlymodifiers to multiple chat session interfaces (items, options, timing, stats). - Update
MainThreadChatSessionsto avoid mutatingDto<IChatSessionItem>and to compute/returnchangeswithout assigning back to the DTO. - Update sessions web test mock to avoid mutating
IChatSessionItem.timingin-place.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| src/vs/workbench/contrib/chat/common/chatSessionsService.ts | Makes various chat session-related interfaces readonly (items/options/file change metadata). |
| src/vs/workbench/contrib/chat/common/chatService/chatService.ts | Makes session timing and stats types readonly. |
| src/vs/workbench/api/browser/mainThreadChatSessions.ts | Stops mutating incoming session DTOs; uses local variables/copies for overrides and changes. |
| src/vs/sessions/test/web.test.ts | Adjusts mock session item updates to work with readonly timing/items. |
roblourens
approved these changes
Mar 21, 2026
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.
These types are generally expected to be immutable. This makes them easier to reason about too