Skip to content

github-issue-929-add-serialized-command-executor-contract-for-wasm-local-re#930

Merged
tomohisa merged 2 commits intomainfrom
takt/929/implement-using-only-the-files
Feb 16, 2026
Merged

github-issue-929-add-serialized-command-executor-contract-for-wasm-local-re#930
tomohisa merged 2 commits intomainfrom
takt/929/implement-using-only-the-files

Conversation

@tomohisa
Copy link
Contributor

Summary

Goal

Introduce a serialized command executor contract in Sekiban so WASM local/remote command models can use the same server-side commit semantics without relying on typed ISekibanExecutor paths.

Why this is needed

Current Sekiban command execution is typed-first (ISekibanExecutor, ICommandContext).
For WASM command execution, we need a boundary where:

  • tag state is fetched as SerializableTagState,
  • command output events are accepted as serialized payload candidates,
  • server generates event metadata and applies consistency reservation before write.

Without this, SekibanWasmRuntime must duplicate commit semantics outside Sekiban.

Scope (Sekiban side only)

  • Add serialized command executor interface + DTOs in Core.
  • Add Orleans implementation with reservation/write/confirm/cancel flow.
  • Register via DI (additive).
  • Add tests and docs.

References

  • tasks/0220_serialized_command_wasm_contract/design.md
  • tasks/0220_serialized_command_wasm_contract/implementation-plan.md
  • dcb/src/Sekiban.Dcb.Core/Storage/IEventStore.cs
  • dcb/src/Sekiban.Dcb.Core/Actors/CoreGeneralSekibanExecutor.cs

Task Checklist

Phase 1: Contract

  • Add ISerializedSekibanDcbExecutor
  • Add SerializedCommitRequest, SerializableEventCandidate, SerializedCommitResult

Phase 2: Orleans implementation

  • Implement GetTagStateAsync (serialized return)
  • Implement CommitSerializableEventsAsync with consistency reservation flow

Phase 3: Wiring

  • Register implementation in Orleans DI extensions
  • Keep existing typed executor registrations untouched

Phase 4: Tests

  • success path (single event)
  • success path (multi event)
  • conflict path (mismatch)
  • rollback/cancel path

Phase 5: Docs

  • Add concise docs for purpose and intended WASM integration usage

Success Criteria

  • Serialized command executor works end-to-end in Orleans runtime.
  • Existing ISekibanExecutor behavior remains unchanged.
  • Contract is enough for SekibanWasmRuntime to implement both local and remote WASM command paths without additional Sekiban API changes.

Non-goals

  • Implement full WASM runtime in Sekiban.
  • Replace typed command APIs.

Execution Report

Piece default completed successfully.

Closes #929

@tomohisa
Copy link
Contributor Author

Follow-up fixes pushed for review findings:

  • Hardened cancellation/reservation flow:
    • removed from serialized reservation path
    • reservation now uses direct await with cancellation checks
    • added guarded rollback () when failure/cancellation happens before confirmation
  • Added request validation for consistency tags:
    • reject duplicate
    • reject consistency tags not present in
  • Added tests:

Validation:

  • MSBUILD : error MSB1009: Project file does not exist.
    Switch: dcb/tests/Sekiban.Dcb.WithResult.Tests/Sekiban.Dcb.WithResult.Tests.csproj passed on net9/net10.

@tomohisa
Copy link
Contributor Author

Follow-up fixes pushed for review findings:

  • Hardened CommitSerializableEventsAsync cancellation/reservation flow:
    • removed ContinueWith(..., cancellationToken) from serialized reservation path
    • reservation now uses direct await with cancellation checks
    • added guarded rollback (CancelReservationsAsync) when failure/cancellation happens before confirmation
  • Added request validation for consistency tags:
    • reject duplicate ConsistencyTags
    • reject consistency tags not present in EventCandidates[*].Tags
  • Added tests:
    • CommitWithUnknownConsistencyTag_Should_Fail
    • CommitWithDuplicateConsistencyTags_Should_Fail

Validation:

  • dotnet test dcb/tests/Sekiban.Dcb.WithResult.Tests/Sekiban.Dcb.WithResult.Tests.csproj --filter "FullyQualifiedName~SerializedCommitTests|FullyQualifiedName~TagReservationHelperTests" passed on net9/net10.

@sonarqubecloud
Copy link

Quality Gate Failed Quality Gate failed

Failed conditions
8.4% Duplication on New Code (required ≤ 3%)

See analysis details on SonarQube Cloud

@tomohisa tomohisa merged commit 11e9a1c into main Feb 16, 2026
3 of 4 checks passed
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.

Add serialized command executor contract for WASM local/remote execution

1 participant

Comments