Skip to content

cow: cleave the cow venue from the composable-cow keeper#462

Merged
mfw78 merged 1 commit into
dev/m1from
feat/m4-cleave-cow-venue
Jul 23, 2026
Merged

cow: cleave the cow venue from the composable-cow keeper#462
mfw78 merged 1 commit into
dev/m1from
feat/m4-cleave-cow-venue

Conversation

@mfw78

@mfw78 mfw78 commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

What

Splits crates/cow-venue in two: the venue keeps only the orderbook (OrderBody, the borsh codec, classification, client); a new composable-cow crate takes ComposableBody, the structured poll seam (Verdict, LegacyRevertAdapter, IConditionalOrder), and everything ComposableCoW-specific. The Composable variant drops from CowIntent. shepherd-sdk's cow module and twap-monitor now import poll types from composable-cow instead of re-exporting them off the venue. Adds a blocking CI gate (check-cow-orderbook-only.sh) that scans crates/cow-venue for composable symbols and fails if any leak in. Goldens regenerated to drop the composable vectors.

Why

The CoW venue contract is the orderbook alone: submit, quote, status, cancel, and orderbook-error mapping, with zero knowledge of ComposableCoW, getTradeableOrderWithSignature, revert selectors, or TWAP. Mixing the composable keeper into the venue crate meant a new CoW keeper couldn't be written without dragging in composable machinery. This is a pure-Rust re-split with no contract dependency, so it lands ahead of the ADR-0013 poll wire-swap.

Closes #395

Testing

  • cargo fmt --all --check
  • cargo clippy --workspace --all-targets --all-features -- -D warnings
  • cargo nextest run for cow-venue, composable-cow, shepherd-sdk, twap-monitor (85 passed)
  • scripts/check-cow-orderbook-only.sh passes locally

AI Assistance

Implemented with Claude Code.

@lgahdl lgahdl left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Clean, well-executed split — unlike the similar zero-leak scripts in #432/#449/#450, this one gets the polarity right (rg match -> fail, no match -> pass) and its symbol list uses the CURRENT names of what actually moved out, correctly scoped to crates/cow-venue only (doesn't false-fail on composable-cow's own legitimate use of these symbols). Split completeness verified too: cow-venue no longer imports ComposableBody, CowIntent lost the Composable variant, and every downstream consumer (shepherd-sdk, twap-monitor) imports poll types directly from composable-cow with no leftover stale re-export path. Goldens/vectors were correctly updated, including the trailing-bytes failure vector switching from Composable(...) to Order(...) so it still exercises the failure path.

One gap in the gate itself:

Comment thread scripts/check-cow-orderbook-only.sh Outdated

status=0

symbols='composable|getTradeableOrder|IConditionalOrder|LegacyRevertAdapter|OrderNotValid|PollTryNextBlock|PollTryAtBlock|PollTryAtEpoch|PollNever'

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This pattern omits bare Verdict — the structured poll seam type this very PR's lib.rs re-exports (pub use poll::{IConditionalOrder, LegacyRevertAdapter, Verdict};) and that's used throughout the codebase as composable_cow::Verdict. A stray use composable_cow::Verdict; (or a local re-export) landing back in cow-venue wouldn't match any of composable|getTradeableOrder|IConditionalOrder|LegacyRevertAdapter|OrderNotValid|PollTry*|PollNever, so this "zero-leak" gate would report a clean pass on that specific leak. Worth adding \bVerdict\b to the pattern.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Confirmed and fixed at 69a18ea. Verified your premise first: composable-cow/src/lib.rs:15 does re-export it (pub use poll::{IConditionalOrder, LegacyRevertAdapter, Verdict};), and composable_cow::Verdict is used in four files across shepherd-sdk and shepherd-sdk-test, so a stray import landing back in cow-venue was genuinely invisible to the gate.

Added \bVerdict\b to the symbols list, placed next to IConditionalOrder and LegacyRevertAdapter so the pattern mirrors that re-export line.

Two things I checked rather than assumed. The gate greps with rg -in, so a case-insensitive Verdict would false-fail on any prose use of the word: there are zero occurrences of "verdict" in any case under crates/cow-venue, so widening the pattern is safe. And since you noted on #520 that a bite-test claim is not verifiable from a diff, here is the actual sequence, run three times against the pushed head:

  • clean tree: [cow PASS] cow-venue symbol scan empty
  • after appending use composable_cow::Verdict; to crates/cow-venue/src/lib.rs: [cow FAIL] composable symbols leak into crates/cow-venue, naming the injected line
  • after reverting: [cow PASS] again

On placement, since there is a queue of cars behind this one: the gap survives to the end of the train unchanged (the tip's shepherd/scripts/check-cow-orderbook-only.sh:21 has a byte-identical symbols line), and of every open car only this one and the M5 grouping car touch the file, the latter only relocating it. So fixing it here costs no ripple conflicts across the twelve M4 cars behind it, and the relocation carries the corrected pattern forward.

@mfw78
mfw78 force-pushed the feat/m3-dx-polish-cluster branch from b4bd0e5 to 63ce698 Compare July 22, 2026 14:26
Base automatically changed from feat/m3-dx-polish-cluster to dev/m1 July 22, 2026 15:04
@mfw78
mfw78 force-pushed the feat/m4-cleave-cow-venue branch from 72b7b37 to e9d8504 Compare July 23, 2026 01:10
The venue crate is the orderbook alone. ComposableBody and the
structured poll seam (Verdict, LegacyRevertAdapter, IConditionalOrder)
move to the new composable-cow keeper crate, the Composable variant
drops from the venue body, the goldens shed the composable vectors,
and a blocking CI gate keeps composable symbols out of
crates/cow-venue.
@mfw78
mfw78 force-pushed the feat/m4-cleave-cow-venue branch from e9d8504 to 69a18ea Compare July 23, 2026 01:35
@mfw78
mfw78 merged commit 55d0f99 into dev/m1 Jul 23, 2026
7 checks passed
@mfw78
mfw78 deleted the feat/m4-cleave-cow-venue branch July 23, 2026 01:51
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.

2 participants