Skip to content

refactor(core): centralize session message rows - #41830

Open
kitlangton wants to merge 1 commit into
v2from
message-row-codec
Open

refactor(core): centralize session message rows#41830
kitlangton wants to merge 1 commit into
v2from
message-row-codec

Conversation

@kitlangton

Copy link
Copy Markdown
Contributor

What

Centralizes the persisted SessionMessage representation boundary in SessionMessageRow instead of repeating { id, type, data } assembly and splitting throughout session persistence.

How

  • Adds packages/core/src/session/message-row.ts with effectful decode, synchronous decode, and synchronous encode operations.
  • Migrates message persistence in the store, history, pending promotion, revert planning, projector, and transfer import paths.
  • Keeps transaction handling, sequence numbers, timestamps, session ownership, and decode error policy at each call site.
  • Keeps session_pending row codecs and fork row copying separate because those operations do not encode or decode the canonical message-row representation.
  • Adds focused tests for representation round trips and canonical column precedence over stale JSON keys.

Scope

This is representation-only refactoring. It does not change the session_message schema, durable event behavior, pending input encoding, fork batching, or caller-specific error handling.

Testing

  • bun run test test/session-message-row.test.ts test/session-projector.test.ts test/session-create.test.ts test/session-prompt.test.ts from packages/core: 86 passed
  • bun typecheck from packages/core
  • Push hook: typechecked all 39 workspace packages
  • Prettier check on all changed files
  • git diff --check

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant