test: add msglib mcp enrichment smoke

This commit is contained in:
zhaoyilun
2026-07-10 03:13:57 +08:00
parent 1277316663
commit 10e7a616c6
5 changed files with 243 additions and 14 deletions

View File

@@ -2366,10 +2366,11 @@ Optional MsgLib MCP enrichment result:
**Goal:** Add an optional verification path that proves `isphere_search_contacts` and `isphere_search_groups` can call the real copied-DB MsgLib sidecar through MCP, while printing only sanitized counts/source metadata by default.
**Planned files:**
- Modify: `scripts/verify-go-mcp.ps1` or add a focused optional verification script.
**Files:**
- Create: `scripts/verify-msglib-mcp-enrichment.ps1`
- Modify: `docs/current-status-card.md`
- Modify: `docs/source-discovery/capability-source-matrix.md`
- Modify: `docs/msglib-read-sidecar-contract.md`
- Modify: `docs/superpowers/plans/2026-07-09-stage-c-log-backed-receive-messages-loop.md`
**Planned behavior:**
@@ -2377,17 +2378,70 @@ Optional MsgLib MCP enrichment result:
- Optional verification is gated by explicit env variables and copied DB paths.
- Output only counts, source names, and booleans; do not print display names, JIDs, message bodies, file paths, or raw rows.
- [ ] **Step 1: Add optional real-MsgLib MCP smoke**
- [x] **Step 1: Add optional real-MsgLib MCP smoke**
Implement opt-in smoke with sanitized summary only.
Created `scripts/verify-msglib-mcp-enrichment.ps1`. It builds the sidecar, starts an in-memory MCP server with MsgLib env, calls `isphere_search_contacts` and `isphere_search_groups`, and outputs only counts/source refs.
- [ ] **Step 2: Run default and optional verification**
- [x] **Step 2: Run default and optional verification**
Run default full verification and optional copied-DB smoke if paths are available.
Default verification remains `scripts/verify-go-mcp.ps1` with MsgLib env cleared. Optional copied-DB smoke passed with sanitized output: `contact_count=5`, `contact_sources=["msglib:TD_CustomEffigy"]`, `group_count=3`, `group_sources=["msglib:TD_WorkGroupAuth"]`, `printed_entity_values=false`, `message_bodies_returned=false`, and `raw_rows_returned=false`.
- [ ] **Step 3: Update docs and commit**
- [x] **Step 3: Update docs and commit**
Record sanitized evidence and next loop.
Run before commit:
```powershell
git diff --check
go test ./...
go build ./cmd/isphere-mcp
powershell -NoProfile -ExecutionPolicy Bypass -File scripts\build-msglib-sidecar.ps1
powershell -NoProfile -ExecutionPolicy Bypass -File scripts\verify-msglib-sidecar.ps1
powershell -NoProfile -ExecutionPolicy Bypass -File scripts\verify-go-mcp.ps1
powershell -NoProfile -ExecutionPolicy Bypass -File scripts\verify-msglib-mcp-enrichment.ps1 # with copied DB env paths
```
Final verification passed: `git diff --check`, `go test ./...`, explicit `go build ./cmd/isphere-mcp`, default sidecar smoke, evidence-backed sidecar smoke, deterministic `scripts/verify-go-mcp.ps1`, and optional copied-DB `scripts/verify-msglib-mcp-enrichment.ps1` with sanitized output.
---
## Loop C31 Result
Optional real MsgLib MCP enrichment smoke result:
- Added `scripts/verify-msglib-mcp-enrichment.ps1`.
- Proved MCP-level contact/group enrichment through the real copied DB sidecar.
- Sanitized output contains counts and `msglib:<source_table>` refs only.
- No entity values, message bodies, file paths, or raw rows are printed by the smoke.
---
## Loop C32: Receive-message display-name enrichment
**Goal:** Reuse the optional MsgLib display-entity source to enrich `isphere_receive_messages` sender/conversation display fields, without changing message text/body handling or adding send/download/write behavior.
**Planned files:**
- Modify: `internal/tools/isphere_read.go`
- Modify: `internal/tools/isphere_read_test.go`
- Modify: `internal/mcpserver/server.go`
- Modify: `scripts/verify-go-mcp.ps1` or optional enrichment smoke as needed
- Modify: docs/status/matrix/plan
**Planned behavior:**
- Default behavior remains unchanged without MsgLib env.
- With injected display metadata, fill safe display fields such as `sender_name` and `conversation.display_name` when a matching contact/group entity exists.
- Do not alter `text`, `content_text`, attachments, raw refs, file paths, or message bodies.
- [ ] **Step 1: Write failing receive-message display-name tests**
Use fake display metadata to prove sender/conversation display enrichment while preserving existing message fields.
- [ ] **Step 2: Implement optional display-name enrichment**
Wire display metadata into receive message map output only.
- [ ] **Step 3: Verify/docs/commit**
Run the standard full gate and update status.
---