Skip to content

docs(sdk): rewrite doc 05 around the two-persona SDK plan#245

Merged
mfw78 merged 1 commit into
dev/m1from
docs/m1-sdk-design-rewrite
Jul 15, 2026
Merged

docs(sdk): rewrite doc 05 around the two-persona SDK plan#245
mfw78 merged 1 commit into
dev/m1from
docs/m1-sdk-design-rewrite

Conversation

@mfw78

@mfw78 mfw78 commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

What

Rewrites docs/05-sdk-design.md end to end around the two-persona SDK plan from issue #224.

  • Documents the module-author persona as actually shipped: crate layout for nexum-sdk and shepherd-sdk, the host-trait seam (ChainHost / LocalStoreHost / LoggingHost plus the supertrait Host), and the bind_host_via_wit_bindgen! adapter.
  • Documents the single #[nexum::module] attribute macro shipped by nexum-macros, verified against crates/nexum-macros/src/lib.rs and the modules/examples/http-probe port.
  • Corrects two things the old aspirational doc got wrong: there is one macro, not a #[nexum::module]/#[shepherd::module] pair, and it always targets the blanket shepherd:cow world today.
  • Corrects the old doc's async assumption: handlers are synchronous, with no async/block_on/&RootProvider injection.
  • Documents the nexum-sdk-test/shepherd-sdk-test MockHost testing story as it actually exists.
  • Introduces the venue-adapter persona as planned but not shipped, marked clearly as design intent tracked by a separate epic.

Why

The old doc described the 0.3+ north-star vision (macro-driven, async, two-macro split) rather than what shipped, so it misled module authors into writing against an API surface that does not exist. The rewrite realigns the doc with the shipped host-trait seam from ADR-0009 and the code under crates/nexum-sdk/, crates/shepherd-sdk/, and crates/nexum-macros/.

Testing

Docs-only change: a single file, docs/05-sdk-design.md (+267 / -956). No .rs, .wit, crate, module, or WIT-package files are touched.

  • Confirmed the diff is docs-only (one Markdown file); no code or config surface to compile or exercise.
  • cargo fmt --all -- --check (not applicable, no code touched)
  • cargo clippy --workspace --all-targets -- -D warnings (not applicable, no code touched)
  • cargo test --workspace (not applicable, no code touched)

AI Assistance

Claude (Opus) used for the docs rewrite.

Closes #224

@mfw78 mfw78 changed the base branch from feat/m1-mock-store-namespaces to feat/m1-nexum-macros July 6, 2026 23:10
@mfw78 mfw78 force-pushed the feat/m1-nexum-macros branch from 89a3f54 to acac557 Compare July 7, 2026 23:12
@mfw78 mfw78 force-pushed the docs/m1-sdk-design-rewrite branch from edd46ba to af4a126 Compare July 7, 2026 23:12
@mfw78 mfw78 force-pushed the feat/m1-nexum-macros branch from acac557 to 124e4c7 Compare July 8, 2026 00:42
@mfw78 mfw78 force-pushed the docs/m1-sdk-design-rewrite branch from af4a126 to ef2e37a Compare July 8, 2026 00:42
@mfw78 mfw78 force-pushed the feat/m1-nexum-macros branch from 124e4c7 to 27e018b Compare July 8, 2026 01:19
@mfw78 mfw78 force-pushed the docs/m1-sdk-design-rewrite branch from ef2e37a to f33abe9 Compare July 8, 2026 01:19
@mfw78 mfw78 force-pushed the feat/m1-nexum-macros branch from 27e018b to 46d350e Compare July 8, 2026 01:44
@mfw78 mfw78 force-pushed the docs/m1-sdk-design-rewrite branch from f33abe9 to 41018ab Compare July 8, 2026 01:44
@mfw78 mfw78 force-pushed the feat/m1-nexum-macros branch from 46d350e to 04f1c16 Compare July 8, 2026 02:10
@mfw78 mfw78 force-pushed the docs/m1-sdk-design-rewrite branch from 41018ab to 1554feb Compare July 8, 2026 02:10
@mfw78 mfw78 force-pushed the feat/m1-nexum-macros branch from 04f1c16 to 5a5324b Compare July 8, 2026 02:19
@mfw78 mfw78 force-pushed the docs/m1-sdk-design-rewrite branch from 1554feb to 9285d37 Compare July 8, 2026 02:19
@mfw78 mfw78 force-pushed the feat/m1-nexum-macros branch from 5a5324b to c7ac51b Compare July 8, 2026 02:22
@mfw78 mfw78 force-pushed the docs/m1-sdk-design-rewrite branch from 9285d37 to ceab8bd Compare July 8, 2026 02:22
@mfw78 mfw78 force-pushed the feat/m1-nexum-macros branch from c7ac51b to fe4a2f2 Compare July 8, 2026 03:03
@mfw78 mfw78 force-pushed the docs/m1-sdk-design-rewrite branch from ceab8bd to eaab2ce Compare July 8, 2026 03:03
@mfw78 mfw78 force-pushed the feat/m1-nexum-macros branch from fe4a2f2 to b6a56c2 Compare July 8, 2026 04:59
@mfw78 mfw78 force-pushed the docs/m1-sdk-design-rewrite branch from eaab2ce to 6168e79 Compare July 8, 2026 04:59
@mfw78 mfw78 force-pushed the feat/m1-nexum-macros branch from b6a56c2 to 948391a Compare July 8, 2026 05:31
@mfw78 mfw78 force-pushed the docs/m1-sdk-design-rewrite branch from 6168e79 to 319f48e Compare July 8, 2026 05:31
@mfw78 mfw78 force-pushed the feat/m1-nexum-macros branch from 948391a to d588446 Compare July 8, 2026 06:21
@mfw78 mfw78 force-pushed the docs/m1-sdk-design-rewrite branch from 319f48e to 93b1a7d Compare July 8, 2026 06:21
@mfw78 mfw78 force-pushed the feat/m1-nexum-macros branch from d588446 to 06af3fe Compare July 8, 2026 06:40
@mfw78 mfw78 force-pushed the docs/m1-sdk-design-rewrite branch from 93b1a7d to bfd97b4 Compare July 8, 2026 06:40
@mfw78 mfw78 force-pushed the feat/m1-nexum-macros branch from 06af3fe to d4bf947 Compare July 8, 2026 07:06
@mfw78 mfw78 force-pushed the docs/m1-sdk-design-rewrite branch from bfd97b4 to 6c22e84 Compare July 8, 2026 07:06
@mfw78 mfw78 force-pushed the feat/m1-nexum-macros branch from d4bf947 to 025f997 Compare July 8, 2026 07:21
@mfw78 mfw78 force-pushed the docs/m1-sdk-design-rewrite branch from 6c22e84 to 489bea6 Compare July 8, 2026 07:21
@mfw78 mfw78 force-pushed the feat/m1-nexum-macros branch from 025f997 to 6ed52a4 Compare July 8, 2026 07:36
@mfw78 mfw78 force-pushed the feat/m1-nexum-macros branch from dd01a0a to 146d296 Compare July 8, 2026 08:55
@mfw78 mfw78 force-pushed the docs/m1-sdk-design-rewrite branch from ef63158 to 7044e1f Compare July 8, 2026 08:55
@mfw78 mfw78 force-pushed the feat/m1-nexum-macros branch from 146d296 to f8d1b90 Compare July 8, 2026 09:02
@mfw78 mfw78 force-pushed the docs/m1-sdk-design-rewrite branch from 7044e1f to 127ccf3 Compare July 8, 2026 09:02
@mfw78 mfw78 force-pushed the feat/m1-nexum-macros branch from f8d1b90 to 284b138 Compare July 8, 2026 09:18
@mfw78 mfw78 force-pushed the docs/m1-sdk-design-rewrite branch from 127ccf3 to 7f54893 Compare July 8, 2026 09:18
@mfw78 mfw78 force-pushed the feat/m1-nexum-macros branch from 284b138 to abae5d8 Compare July 8, 2026 12:09
@mfw78 mfw78 force-pushed the docs/m1-sdk-design-rewrite branch from 7f54893 to aafc6bb Compare July 8, 2026 12:10
@mfw78 mfw78 force-pushed the feat/m1-nexum-macros branch from abae5d8 to 04c36aa Compare July 8, 2026 12:20
@mfw78 mfw78 force-pushed the docs/m1-sdk-design-rewrite branch from aafc6bb to e73d859 Compare July 8, 2026 12:20
@mfw78 mfw78 force-pushed the feat/m1-nexum-macros branch from 04c36aa to 9ae1e41 Compare July 8, 2026 12:49
@mfw78 mfw78 force-pushed the docs/m1-sdk-design-rewrite branch from e73d859 to 23b9b9b Compare July 8, 2026 12:49
@mfw78 mfw78 force-pushed the feat/m1-nexum-macros branch from 9ae1e41 to b063f5e Compare July 8, 2026 13:40
@mfw78 mfw78 force-pushed the docs/m1-sdk-design-rewrite branch from 23b9b9b to cc9d464 Compare July 8, 2026 13:40
@mfw78 mfw78 force-pushed the feat/m1-nexum-macros branch from b063f5e to 869f2a4 Compare July 8, 2026 13:59
@mfw78 mfw78 force-pushed the docs/m1-sdk-design-rewrite branch from cc9d464 to f21768f Compare July 8, 2026 13:59
@mfw78 mfw78 force-pushed the feat/m1-nexum-macros branch from 869f2a4 to 636c42e Compare July 8, 2026 14:08
@mfw78 mfw78 force-pushed the docs/m1-sdk-design-rewrite branch from f21768f to ac21033 Compare July 8, 2026 14:08

@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.

Solid rewrite — removing the aspirational table and marking the venue-adapter persona clearly as unshipped is the right call. All six factual claims verified against the code. Three doc accuracy/completeness items inline.

Comment thread docs/05-sdk-design.md
the bound host logging call. `shepherd-sdk::bind_cow_host_via_wit_bindgen!`
layers the `CowApiHost` impl on top of the same `WitBindgenHost` type.

### The `#[nexum::module]` macro

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.

The prose here and throughout the doc uses `#[nexum::module]`, but the actual attribute a module author writes is `#[nexum_sdk::module]` — the macro is re-exported at nexum_sdk::module, not under a nexum crate path. The code example a few lines below correctly writes #[nexum_sdk::module], so a careful reader notices the conflict; a reader who skims the prose will write #[nexum::module] and get an unresolved-macro error.

Suggestion: use `#[nexum_sdk::module]` everywhere in prose, and update this section header to ### The `#[nexum_sdk::module]` attribute.

Comment thread docs/05-sdk-design.md
impl<T: ChainHost + LocalStoreHost + LoggingHost> Host for T {}
```

`shepherd-sdk` adds a fourth trait, `CowApiHost` (`submit_order`), and

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.

CowApiHost is introduced with only submit_order named in the parenthetical. The trait also has cow_api_request — the REST passthrough for everything else: quotes, order-status, get-order, raw endpoints. A CoW module author who needs a quote (the common case for conditional orders) will look for a typed Cow client (which was described in the old doc; now deferred) and not find it, without realising cow_api_request is the raw fallback available today.

Suggestion: name both methods and add one line: `CowApiHost` (`submit_order` for order placement; `cow_api_request(method, path, body)` for the REST passthrough — quotes, order status, raw endpoints).

Comment thread docs/05-sdk-design.md
name = "my-cow-module"
version = "0.1.0"
edition = "2024"
Two things worth being precise about, since they differ from earlier

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.

The note that handlers are synchronous appears after the code example. Readers who follow the prose example will have already attached async fn expectations — the old doc had extensive async fn on_block(block, &RootProvider) examples and many Rust frameworks use this shape. Moving the "Two things worth being precise about" block to before the code example (or adding a one-line callout at the top of the section) catches the async assumption before it lands.

Comment thread docs/05-sdk-design.md Outdated
The `Guest`/`export!` shape the macro emits still follows the
`strategy.rs` (pure logic, tested against `&impl Host`) / `lib.rs`
(handlers plus the macro attribute) split from ADR-0009. The chassis
helpers in `nexum_sdk::chassis` - `WatchSet`, `Gates`, `Journal`,

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.

One sentence for the chassis is thin for the primary abstraction used by TWAP-monitor, stop-loss, and any conditional-order module. Module authors targeting these flows land on WatchSet / Gates / Journal / ConditionalSource immediately, with none of the key invariants described here:

  • WatchSet key format (watch:{owner}:{hash} in the local store)
  • Gates semantics (TryOnBlock / TryAtEpoch gate poll timing)
  • Journal for idempotent submission (submitted: prefix)
  • ConditionalSource — the trait a module must implement

The //! doc block at crates/nexum-sdk/src/chassis.rs has a worked example covering all of this. Even a link or a three-line excerpt would save a conditional-order author from reverse-engineering the key convention from the TWAP monitor.

@mfw78 mfw78 force-pushed the feat/m1-nexum-macros branch from 636c42e to aad1119 Compare July 8, 2026 22:33
@mfw78 mfw78 force-pushed the docs/m1-sdk-design-rewrite branch 2 times, most recently from 5281ffa to eeb9deb Compare July 8, 2026 23:05
@mfw78 mfw78 force-pushed the feat/m1-nexum-macros branch 2 times, most recently from 85779fd to 683f3ed Compare July 8, 2026 23:24
@mfw78 mfw78 force-pushed the docs/m1-sdk-design-rewrite branch 2 times, most recently from 428db31 to e205b8b Compare July 8, 2026 23:29
@mfw78 mfw78 force-pushed the feat/m1-nexum-macros branch from 683f3ed to 3b2551b Compare July 8, 2026 23:29
@mfw78 mfw78 force-pushed the docs/m1-sdk-design-rewrite branch from e205b8b to ef44329 Compare July 9, 2026 02:09
@mfw78 mfw78 force-pushed the feat/m1-nexum-macros branch from 3b2551b to 9d5dc99 Compare July 9, 2026 02:09
Doc 05 was stamped future-direction and described the superseded
macro/TypedState/Signer/HostTransport vision. Replace it with the
shipped module-author persona (nexum-sdk + shepherd-sdk + the landed
#[nexum::module] macro) and the planned venue-adapter persona
(nexum-venue-sdk / per-venue-crate), clearly labelled as design intent
tracked by a separate epic. Drop the deferred-features table and
cross-link ADR-0009 and sdk.md.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr-train Part of the current stacked PR train; lands in sequence, do not merge out of order.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants