Skip to content

cow-venue: replace OrderBuilder typestate with constructor args - #581

Merged
mfw78 merged 1 commit into
dev/m1from
refactor/545-orderbuilder-constructor
Jul 24, 2026
Merged

cow-venue: replace OrderBuilder typestate with constructor args#581
mfw78 merged 1 commit into
dev/m1from
refactor/545-orderbuilder-constructor

Conversation

@mfw78

@mfw78 mfw78 commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

What

Replaces the OrderBuilder<S> typestate in cow-venue/src/order.rs with required constructor arguments. OrderBody::sell/OrderBody::buy now take the sell side, buy side, and valid_to directly. The PhantomData<S> state parameter, the NeedsBuy/NeedsSell/NeedsValidTo/Ready markers, and their per-state impl blocks are gone. Optional fields keep post-construction setters.

Why

Issue #545: the typestate enforced only "do not forget a required field", a weaker claim than call-order machinery is meant to express. Required constructor args preserve the same compile-time completeness guarantee with no phantom states, no per-state impl blocks, and no duplicated method surface.

Testing

Full battery in the worktree: cargo fmt --all -- --check; cargo clippy --workspace --all-targets --all-features --locked -- -D warnings; wasm build for the 16 example/venue modules plus a separate cow-venue/adapter build, wasm count verified at 17; cargo nextest run --workspace --all-features --no-fail-fast --locked (795 passed, 1 skipped); cargo test --doc --workspace --all-features --locked; RUSTDOCFLAGS="-D warnings" cargo doc --workspace --no-deps --locked; scripts/check-venue-agnostic.sh; scripts/check-cow-orderbook-only.sh. All green.

AI Assistance

Implemented with Claude Code.

Closes #545

@mfw78
mfw78 merged commit 2a1052f into dev/m1 Jul 24, 2026
7 checks passed
@mfw78
mfw78 deleted the refactor/545-orderbuilder-constructor branch July 24, 2026 11:54
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