Skip to content

Mark many chat session related types as readonly#303644

Merged
mjbvz merged 4 commits intomicrosoft:mainfrom
mjbvz:dev/mjbvz/fine-dingo
Mar 21, 2026
Merged

Mark many chat session related types as readonly#303644
mjbvz merged 4 commits intomicrosoft:mainfrom
mjbvz:dev/mjbvz/fine-dingo

Conversation

@mjbvz
Copy link
Collaborator

@mjbvz mjbvz commented Mar 20, 2026

These types are generally expected to be immutable. This makes them easier to reason about too

These types are generally expected to be immutable
Copilot AI review requested due to automatic review settings March 20, 2026 23:44
@mjbvz mjbvz self-assigned this Mar 20, 2026
@vs-code-engineering vs-code-engineering bot added this to the 1.113.0 milestone Mar 20, 2026
@mjbvz mjbvz enabled auto-merge March 20, 2026 23:46
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 readonly modifiers to multiple chat session interfaces (items, options, timing, stats).
  • Update MainThreadChatSessions to avoid mutating Dto<IChatSessionItem> and to compute/return changes without assigning back to the DTO.
  • Update sessions web test mock to avoid mutating IChatSessionItem.timing in-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.

@mjbvz mjbvz merged commit 8c3724e into microsoft:main Mar 21, 2026
18 checks passed
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