Repository navigation
refactor(schema): declare event durability at definition level - #35172
Merged
Merged
Conversation
Add explicit durable and ephemeral event definition constructors. Derive durable inventories from definition metadata while preserving classifications. Regenerate client and legacy SDK outputs and document the schema refactor.
kitlangton
force-pushed
the
event-foundations
branch
from
July 3, 2026 16:25
3788ab9 to
7acb392
Compare
This was referenced Jul 19, 2026
jinhuang712
pushed a commit
to jinhuang712/opencode
that referenced
this pull request
Sep 26, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of the V2 event audit (#35021, first slice of #35014).
What
Event.durable(...)/Event.ephemeral(...)definition constructors; every event definition inpackages/schemanow declares its durability at the definition site.Event.defineentirely (nodurableconfig ⇒ silently ephemeral was exactly the failure mode this refactor exists to prevent). Core test call sites converted to the explicit constructors.DurableDefinitionsand the V1 durable/live manifest split are now derived by filtering definition metadata instead of hand-maintained inventory lists; hand-counted manifest tests replaced with derivation-based membership assertions.durable: { aggregateID, seq, version }, ephemeral events omit the field entirely (previouslydurable?was optional on every event type).Definitionis a discriminatedDurableDefinition | EphemeralDefinitionunion, so payload types narrow. Runtime already guaranteed this — every durable publish/replay/commit path attaches the position before any envelope-schema encode; verified no path validates earlier.Not in this PR
Zero behavior change by design: no event renames, no payload changes, no migrations. Durable membership before/after is identical (38 durable / 65 ephemeral, membership diffed empty in both directions). The rename sweep, payload strips, stored envelope
created, and the reset migration follow in the next PR.Test-only fallout: event fixtures in
packages/sdk-nextand twopackages/opencodetest files (stream-v2 transport, message-updater) gained required durable envelopes / narrowing — no V1 production code touched.Verification
bun turbo typecheck(35 packages) green.packages/schemaevent/manifest tests;packages/coreevent, session-log, session-prompt, tool-progress, and session-create tests;packages/sdk-nextembedded tests;packages/opencodestream-v2 transport + message-updater tests.bun run generate(packages/client) andpackages/sdk/js/script/build.ts; no hand edits. Generated diff shape confirmed: nodurable?remains anywhere.Event.definecall sites remain.