Skip to content

Emit sequencer block-instance state_change items on target state mutations - #11

Merged
jhoffner merged 1 commit into
mainfrom
codex/linear-mention-fix-65-sequencer-stateschema-state-change
Mar 1, 2026
Merged

jhoffner merged 1 commit into
mainfrom
codex/linear-mention-fix-65-sequencer-stateschema-state-change

Conversation

@jhoffner

@jhoffner jhoffner commented Mar 1, 2026

Copy link
Copy Markdown
Collaborator

Motivation

  • Wire state-change emission for sequencer instance state mutations so UI/devtools can react to ctx.sequencer / getTarget(name) state ops.
  • Ensure emitted items include instance provenance and operation metadata so clients can route updates to the correct component.
  • Preserve existing transience rules (production vs dev/persist override) for state_change items.

Description

  • Add optional blockInstanceId?: string to the core StateChangeItem type so block-instance events carry explicit instance routing metadata.
  • Implement emitStateChangeItem and createTargetStateOps in the server execution context and wrap sequencer TargetHandle state ops (patchState, setState, incState, pushState, setStateRecord, deleteStateRecord, atomicState) to emit state_change items with scope: "block_instance", operation, delta/path, and monotonic version from the instance state container.
  • Wire getTarget(name) / ctx.sequencer to provide the wrapped ops (including blockInstanceId in item provenance) so emissions include the sequencer's runtime identity.
  • Implement transience policy: items are transient in production by default, persisted when flow.persistStateChanges === true, and persisted by default outside production (used to support devtools timeline).
  • Add server-side tests validating emission for all sequencer target state ops, operation values, monotonic version increments, block-instance provenance, and transience behavior.

Testing

  • Ran pnpm --filter @flow-state-dev/core build (succeeds) and pnpm --filter @flow-state-dev/server typecheck (succeeds).
  • Ran pnpm --filter @flow-state-dev/server test -- execution.test.ts and the full @flow-state-dev/server test suite; all server tests passed.
  • Ran workspace pnpm typecheck (succeeds).
  • Ran workspace pnpm test; most packages passed, but the workspace run failed due to an existing package-resolution issue in examples/hello-chat resolving @flow-state-dev/testing that is unrelated to these changes.

Codex Task

@linear

linear Bot commented Mar 1, 2026

Copy link
Copy Markdown

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, you can upgrade your account or add credits to your account and enable them for code reviews in your settings.

@vercel

vercel Bot commented Mar 1, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
flow-state-dev-docs Ready Ready Preview, Comment Mar 1, 2026 7:22pm
flow-state-dev-kitchen-sink Ready Ready Preview, Comment Mar 1, 2026 7:22pm

This branch was successfully deployed

2 active deployments
Preview – flow-state-dev-kitchen-sink — 52b76586 Deployed Mar 1, 2026 by vercel[bot]
Preview – flow-state-dev-docs — 52b76586 Deployed Mar 1, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant