docs(sdk): rewrite doc 05 around the two-persona SDK plan#245
Conversation
89a3f54 to
acac557
Compare
edd46ba to
af4a126
Compare
acac557 to
124e4c7
Compare
af4a126 to
ef2e37a
Compare
124e4c7 to
27e018b
Compare
ef2e37a to
f33abe9
Compare
27e018b to
46d350e
Compare
f33abe9 to
41018ab
Compare
46d350e to
04f1c16
Compare
41018ab to
1554feb
Compare
04f1c16 to
5a5324b
Compare
1554feb to
9285d37
Compare
5a5324b to
c7ac51b
Compare
9285d37 to
ceab8bd
Compare
c7ac51b to
fe4a2f2
Compare
ceab8bd to
eaab2ce
Compare
fe4a2f2 to
b6a56c2
Compare
eaab2ce to
6168e79
Compare
b6a56c2 to
948391a
Compare
6168e79 to
319f48e
Compare
948391a to
d588446
Compare
319f48e to
93b1a7d
Compare
d588446 to
06af3fe
Compare
93b1a7d to
bfd97b4
Compare
06af3fe to
d4bf947
Compare
bfd97b4 to
6c22e84
Compare
d4bf947 to
025f997
Compare
6c22e84 to
489bea6
Compare
025f997 to
6ed52a4
Compare
dd01a0a to
146d296
Compare
ef63158 to
7044e1f
Compare
146d296 to
f8d1b90
Compare
7044e1f to
127ccf3
Compare
f8d1b90 to
284b138
Compare
127ccf3 to
7f54893
Compare
284b138 to
abae5d8
Compare
7f54893 to
aafc6bb
Compare
abae5d8 to
04c36aa
Compare
aafc6bb to
e73d859
Compare
04c36aa to
9ae1e41
Compare
e73d859 to
23b9b9b
Compare
9ae1e41 to
b063f5e
Compare
23b9b9b to
cc9d464
Compare
b063f5e to
869f2a4
Compare
cc9d464 to
f21768f
Compare
869f2a4 to
636c42e
Compare
f21768f to
ac21033
Compare
lgahdl
left a comment
There was a problem hiding this comment.
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.
| 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 |
There was a problem hiding this comment.
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.
| impl<T: ChainHost + LocalStoreHost + LoggingHost> Host for T {} | ||
| ``` | ||
|
|
||
| `shepherd-sdk` adds a fourth trait, `CowApiHost` (`submit_order`), and |
There was a problem hiding this comment.
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).
| name = "my-cow-module" | ||
| version = "0.1.0" | ||
| edition = "2024" | ||
| Two things worth being precise about, since they differ from earlier |
There was a problem hiding this comment.
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.
| 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`, |
There was a problem hiding this comment.
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:
WatchSetkey format (watch:{owner}:{hash}in the local store)Gatessemantics (TryOnBlock/TryAtEpochgate poll timing)Journalfor 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.
636c42e to
aad1119
Compare
5281ffa to
eeb9deb
Compare
85779fd to
683f3ed
Compare
428db31 to
e205b8b
Compare
683f3ed to
3b2551b
Compare
e205b8b to
ef44329
Compare
3b2551b to
9d5dc99
Compare
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.
What
Rewrites
docs/05-sdk-design.mdend to end around the two-persona SDK plan from issue #224.nexum-sdkandshepherd-sdk, the host-trait seam (ChainHost/LocalStoreHost/LoggingHostplus the supertraitHost), and thebind_host_via_wit_bindgen!adapter.#[nexum::module]attribute macro shipped bynexum-macros, verified againstcrates/nexum-macros/src/lib.rsand themodules/examples/http-probeport.#[nexum::module]/#[shepherd::module]pair, and it always targets the blanketshepherd:cowworld today.async/block_on/&RootProviderinjection.nexum-sdk-test/shepherd-sdk-testMockHosttesting story as it actually exists.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/, andcrates/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.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