Skip to content

feat: add session/stateReplaced action for complete session state replacement - #372

Draft
DonJayamanne wants to merge 1 commit into
mainfrom
don/moral-viper
Draft

feat: add session/stateReplaced action for complete session state replacement#372
DonJayamanne wants to merge 1 commit into
mainfrom
don/moral-viper

Conversation

@DonJayamanne

@DonJayamanne DonJayamanne commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Adds the server-only session/stateReplaced action carrying a complete SessionState.
  • Defines full-replacement reducer semantics instead of merging with the previous state.
  • Updates the protocol schema, action metadata, generators, and generated Go, Kotlin, Rust, Swift, and TypeScript surfaces.
  • Adds reducer fixture coverage and a changelog fragment.

Motivation

A server can replace the authoritative state behind an already-subscribed session channel while preserving the channel URI. Incremental field actions cannot reliably represent that lifecycle transition because omitted fields from the previous state must also be removed.

This action lets the host publish one ordered, replayable authoritative replacement through the existing action stream. Clients retain their subscription while replacing the cached session state in full.

The immediate consumer is provisional-session recreation in VS Code: changing the working folder disposes and recreates an unsent provisional session under the same deterministic URI. Existing subscribers otherwise retain the previous session customizations and configuration.

Semantics

  • The action is server-only.
  • state is the complete authoritative session state.
  • Reducers replace the previous state entirely; they do not merge it.
  • The action is registered as part of the current 0.7.0 protocol surface.

Validation

  • npm run generate
  • npm test
  • Go client tests: go test ./...
  • Rust client tests: cargo test --workspace
  • Kotlin client tests: ./gradlew test --no-daemon --console=plain
  • Swift client build: swift build
  • TypeScript client tests and build: npm test && npm run build

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.

1 participant