Broadcast thread section changes to connected clients (#58380)

## Why

Clients need to refresh section membership and ordering when another client moves a thread.

## What changed

Broadcast `thread/section/changed` after a successful `thread/section/move`, including moves within the same section. Send the response before the notification, and include `threadId` and the destination `sectionId`, using `null` for removal. Failed moves do not emit the notification.

Add the notification to the protocol schemas, TypeScript exports, and Python SDK models and registry, and document its behavior.

## Testing

Add a WebSocket integration test with separate writer and observer clients covering section insertion, reordering, removal, and a failed move.

GitOrigin-RevId: 128ba7eddc9aae8e3bac766f47e4a2c55c64a6a5
This commit is contained in:
Charlie Marsh
2026-10-30 16:09:46 +00:00
committed by copyberry
parent 483d98a441
commit 1f0290c607
22 changed files with 307 additions and 15 deletions
@@ -2017,6 +2017,7 @@ server_notification_definitions! {
ThreadReverted => "thread/reverted" (v2::ThreadRevertedNotification),
SkillsChanged => "skills/changed" (v2::SkillsChangedNotification),
ThreadNameUpdated => "thread/name/updated" (v2::ThreadNameUpdatedNotification),
ThreadSectionChanged => "thread/section/changed" (v2::ThreadSectionChangedNotification),
ThreadAttachmentUpdated => "thread/attachment/updated" (v2::ThreadAttachmentUpdatedNotification),
ThreadGoalUpdated => "thread/goal/updated" (v2::ThreadGoalUpdatedNotification),
#[experimental("thread/prediction/updated")]
@@ -1130,6 +1130,20 @@ pub struct ThreadSectionMoveParams {
#[ts(export_to = "v2/")]
pub struct ThreadSectionMoveResponse {}
/// Broadcast after a successful move into, within, or out of a section.
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, JsonSchema, TS)]
#[serde(rename_all = "camelCase")]
#[ts(export_to = "v2/")]
pub struct ThreadSectionChangedNotification {
pub thread_id: String,
/// Destination section, or `null` when the thread was removed from its section.
#[schemars(
required,
schema_with = "crate::protocol::serde_helpers::nullable_string_schema"
)]
pub section_id: Option<String>,
}
#[derive(Serialize, Deserialize, Debug, Clone, Copy, PartialEq, Eq, JsonSchema, TS)]
#[serde(rename_all = "lowercase")]
#[ts(rename_all = "lowercase")]