A0: contract stubs types, transport, fake and registry seams
Land the shared peer contracts: types, error mapping, transport trait, fake transport and fixtures, registry/proxy/health skeletons, the AppState.peers and Config.peers seams, the ping and peers route stubs, and unit plus integration tests. No loops, no network, feature off by default.
This commit is contained in:
1 parent
746b389a2b
commit
4bfb097be6
22 files changed
+1781
-1
No files matched your search
@@ -44,6 +44,7 @@ Unit tests for validation and loader; a peer-less default config is byte-identic
|
||||
|
||||
## Handoff
|
||||
|
||||
- 2026-10-19 (A0): stubs are on branch `ws/A0`; C, D, E and B can compile against `src/peers/` now. Rebase rather than re-creating the files. `src/peers/{types,error,transport,testing}.rs` change only through contracts.md after this point; `registry.rs`, `proxy.rs` and `health.rs` are skeletons to be filled by WS-B (registry, health) and WS-C (proxy).
|
||||
- A0 merged: C, D, E, B compile against the stubs; post in all their Logs.
|
||||
- `PeersConfig`/`PeerConfig`, the secrets loader (`Secret`, `load_token(&PeerConfig) -> Result<Secret, PeerError>`) and `config.example.toml` `[peers]` block for B and F.
|
||||
- The `peer` subcommand for the docs (F4).
|
||||
@@ -51,3 +52,8 @@ Unit tests for validation and loader; a peer-less default config is byte-identic
|
||||
## Log
|
||||
|
||||
- 2026-10-19: Split from the single phase plan 2026-10-19. A0 added to cover the shared stubs so C/D/E/F can start against fakes; ownership of the stub files passes to B/C after A0 merges.
|
||||
- 2026-10-19 A0 (done): contract stubs landed. `src/peers/{types,error,transport,testing,registry,proxy,health}.rs`, `src/api/{ping,peers}.rs` stubs, `AppState.peers`, `Config.peers`, `src/api/mod.rs` merge seam, `tests/peers_config.rs`.
|
||||
- Decisions taken here (contract allows the implementer to choose): timestamps are `jiff::Timestamp` (the type the existing DTOs use); `testing.rs` is plain `pub` like `sources::fake`, because integration tests compile the library without `cfg(test)`; `health::check_once` is a minimal TCP + `GET /api/v1/ping` probe (401/403 -> `api.up = true, auth = rejected`, D4) and WS-B replaces its classification/version parsing; `ProxyOpts` lives in `registry.rs` as the contract says; `proxy::get` already adds `x-slinuxm-hop: 1` and any traceparent (never an Authorization header) but no allowlist (WS-C).
|
||||
- Contract discrepancy: section 3 declares `reload(&self, new: PeersConfig) -> Result<(), PeerConfigError>` but no `PeerConfigError` type exists in the contract or the tree. Implemented as `Result<(), crate::config::ConfigError>` (the existing error for invalid configuration). Please fix the name in contracts.md if that is not the intent.
|
||||
- `Cargo.toml`: added `url` (needed for the contract's `url::Url` field, already in `Cargo.lock` via reqwest) and `bytes` (contract's `Bytes` body type, already in the lock). `cargo tree -i openssl` still empty.
|
||||
- Logged in WS-C, WS-D and WS-E: stubs are available, compile against them.
|
||||
@@ -43,3 +43,4 @@ Behaviour tests with the fake transport for every error mapping row in D9; 405 o
|
||||
## Log
|
||||
|
||||
- 2026-10-19: Split from the single phase plan 2026-10-19. The proxy logic is placed in `src/peers/proxy.rs` (not `api/peers.rs`) so REST and MCP share one implementation, as the original plan required.
|
||||
- 2026-10-19 (A0): contract stubs landed (`src/peers/{types,error,transport,testing,registry,proxy,health}.rs`, `src/api/peers.rs` stub, `AppState.peers`, `Config.peers`, `tests/peers_config.rs`). `PeerRegistry::get` forwards through `PeerTransport` and `proxy.rs` already adds `x-slinuxm-hop` and traceparent; path/query allowlists, the hop-header rejection and the `x-slinuxm-peer` response header are still yours. `api::peers::routes()` is empty and merged only when `state.peers.is_some()`, so fill it without touching `api/mod.rs`.
|
||||
@@ -82,3 +82,4 @@ Both snapshot variants pass; each tool with `peer` returns the peer's data via t
|
||||
4. Not a risk for the rest of D3: `list_resources`, `list_prompts` and `get_info`/instructions are hand-written in this repo, so `peers://status`, the peer-aware prompt argument and the conditional instructions text are plain `state.peers.is_some()` branches, not router features.
|
||||
5. Runtime toggling is not required (peers are declared at startup; SIGHUP rotates tokens, not `enabled`), but `disable_route`/`enable_route` can emit `notifications/tools/list_changed` via `bind_peer_notifier` if a later phase needs it.
|
||||
- 2026-10-19: **Handoff (D0 complete).** Deliverable: the spike answer and recommendation above. Verdict: `rmcp` 3.5.1 supports the 8/10 conditional tool list natively via `ToolRouter::disable_route`, so D2 can proceed without a contract change; the only follow-up is stripping the optional `peer` property from the eight schemas when peers are disabled (point 3 above). No `src/` production code was changed; the throwaway test was removed after running and the tree is clean apart from this Log. Verification: `cargo fmt --check`, `cargo clippy --all-targets -- -D warnings` and `cargo test` all pass. Commits: findings `c168551`, this handoff. Next: D1/D2 once A0 (`AppState.peers`, `registry_with`, `static_registry`, `fake_state_with_peers`) is merged; rewrite the snapshot test to use `TrackerService::new` for both variants.
|
||||
- 2026-10-19 (A0): contract stubs landed. `PeerRegistry` (`snapshot`, `status`, `contains`, `config`, `get`) and `ProxyOpts` are available, `AppState.peers: Option<Arc<PeerRegistry>>` exists, and `testing::{fake_peers_config, registry_with, static_registry, fake_state_with_peers, FakeTransport}` let MCP tests run without sockets. `PeerRegistry::get` is the single proxy path to call.
|
||||
@@ -40,3 +40,4 @@ Metrics test with the fake registry; with `otel.enabled` and no peers nothing ne
|
||||
## Log
|
||||
|
||||
- 2026-10-19: Split from the single phase plan 2026-10-19. Note added that "peer remove" in the collector check means removal from config plus SIGHUP (D1).
|
||||
- 2026-10-19 (A0): contract stubs landed. `PeerRegistry::snapshot()` returns `PeerStatus` sorted by name (jiff timestamps, `since: None` until a check), `AppState.peers` is `None` when the feature is off, and `testing::static_registry` renders fixed snapshots for metric tests.
|
||||
Reference in new issue
Block a user