feat: select explicit msglib receive source
This commit is contained in:
@@ -2762,17 +2762,59 @@ DB-backed receive source adapter result:
|
||||
- Standard `verify-go-mcp.ps1` should remain deterministic and should not require copied DB env.
|
||||
- Optional copied-DB verification can be added only if its printed output stays sanitized.
|
||||
|
||||
- [ ] **Step 1: Write source-selection RED test**
|
||||
- [x] **Step 1: Write source-selection RED test**
|
||||
|
||||
Create a fake primary PacketReader source and fake MsgLib receive source; assert default/auto uses primary and explicit MsgLib selection uses the MsgLib source.
|
||||
Added `TestISphereReceiveMessagesToolSelectsExplicitMsgLibSource` with fake primary and fake MsgLib receive sources. RED failed because `RegisterISphereReadToolsWithReceiveSources` did not exist.
|
||||
|
||||
- [ ] **Step 2: Implement minimal selector**
|
||||
- [x] **Step 2: Implement minimal selector**
|
||||
|
||||
Add the smallest selector layer needed by the test. Keep current rejection behavior when explicit MsgLib is requested but not configured.
|
||||
Added `RegisterISphereReadToolsWithReceiveSources` and `receiveMessagesSourceForPreference`. Empty/`auto`/`local_readonly` use the primary source; `msglib_readonly` uses the configured MsgLib receive source; explicit MsgLib is rejected when absent.
|
||||
|
||||
- [ ] **Step 3: Verify and update operator docs**
|
||||
- [x] **Step 3: Verify and update operator docs**
|
||||
|
||||
Run full verification and update docs to describe the explicit opt-in route and the unchanged default route.
|
||||
Updated status, matrix, contract, and this plan. Operator runbook/env wiring is deferred to C41 because C40 only proves the tool-layer selector.
|
||||
|
||||
---
|
||||
|
||||
## Loop C40 Result
|
||||
|
||||
Explicit MsgLib receive source selection result:
|
||||
|
||||
- Added tool-level explicit source selection for `isphere_receive_messages`.
|
||||
- Default/`auto` behavior remains PacketReader/log-backed and does not call the MsgLib receive source.
|
||||
- `source_preference="msglib_readonly"` selects a configured MsgLib receive source and preserves `msglib:<table>` raw refs through the response mapping.
|
||||
- Explicit MsgLib selection is rejected when no MsgLib receive source is configured.
|
||||
- No server env wiring or copied-DB MCP smoke is added in C40.
|
||||
|
||||
---
|
||||
|
||||
## Loop C41: MsgLib receive env wiring and optional smoke
|
||||
|
||||
**Goal:** Wire the C39 adapter and C40 selector into server env configuration so operators can explicitly call `isphere_receive_messages` with `source_preference="msglib_readonly"`, while keeping default verification deterministic.
|
||||
|
||||
**Planned files:**
|
||||
- Modify: `internal/mcpserver/server.go` and tests.
|
||||
- Modify or extend: `scripts/verify-msglib-mcp-enrichment.ps1` or add a focused optional smoke.
|
||||
- Modify docs/status/matrix/runbook/plan.
|
||||
|
||||
**Planned behavior:**
|
||||
- If full MsgLib env is configured, build both display enrichment source and MsgLib receive source from the same sidecar client.
|
||||
- Empty/`auto` remains PacketReader/log-backed.
|
||||
- Explicit `source_preference="msglib_readonly"` uses `MsgLibMessageSource`.
|
||||
- Standard `scripts/verify-go-mcp.ps1` remains deterministic and should still report `msglib_configured=false`.
|
||||
- Optional copied-DB smoke must print only counts/source refs/booleans and must not print message body values, file paths, raw rows, entity values, sends, downloads, hooks, injection, or DB writes.
|
||||
|
||||
- [ ] **Step 1: Write server wiring RED test**
|
||||
|
||||
Use injected/fake sources or env-shaped construction to prove the server can register both primary and MsgLib receive sources while default calls stay on primary.
|
||||
|
||||
- [ ] **Step 2: Implement env wiring**
|
||||
|
||||
Reuse `msglib.ConfigFromEnv`/client construction and pass `isphere.MsgLibMessageSource` into the C40 selector. Keep partial-env failure behavior.
|
||||
|
||||
- [ ] **Step 3: Add optional sanitized smoke and docs**
|
||||
|
||||
Extend optional verification to call explicit `msglib_readonly` only when copied DB env is present, printing sanitized result only.
|
||||
|
||||
---
|
||||
## Self-Review
|
||||
|
||||
Reference in New Issue
Block a user