test: verify configured receive source smoke

This commit is contained in:
zhaoyilun
2026-07-09 23:27:52 +08:00
parent 28bcb94b41
commit 878b729015
4 changed files with 202 additions and 10 deletions

View File

@@ -864,7 +864,7 @@ Implemented and verified in this loop:
- New fixture smoke creates a temporary synthetic/redacted PacketReader plaintext, encrypts it with the known log policy inside the temporary Go harness, writes one encrypted line to a temp file, sets `ISPHERE_PACKET_LOG_FILE` to that temp file, starts `mcpserver.NewServerFromEnv()`, calls `isphere_receive_messages`, and asserts one normalized message.
- No raw N12-pre evidence or decrypted user content is written to the repo.
- [ ] **Step 1: Capture current fixture-smoke gap**
- [x] **Step 1: Capture current fixture-smoke gap**
Run the current verification script and note that it only proves the default empty source, not configured fixture ingestion:
@@ -874,15 +874,15 @@ powershell -NoProfile -ExecutionPolicy Bypass -File scripts/verify-go-mcp.ps1
Expected: PASS with `receive_message_count: 0`, but no configured-source proof yet.
- [ ] **Step 2: Update the temporary Go harness**
- [x] **Step 2: Update the temporary Go harness**
Extend the generated harness with a second server session that sets `ISPHERE_PACKET_LOG_FILE` to a temp synthetic encrypted log-line file and asserts one returned message with redacted content.
- [ ] **Step 3: Update docs**
- [x] **Step 3: Update docs**
Update the runbook/status card to say verification covers both default empty source and synthetic configured-source smoke.
- [ ] **Step 4: Run full verification and commit**
- [x] **Step 4: Run full verification and commit**
Run:
@@ -897,6 +897,67 @@ Expected: all exit 0. Remove any generated root `isphere-mcp.exe` after build. C
---
## Loop C6 Result
Implemented and verified in this loop:
- `scripts/verify-go-mcp.ps1` now verifies two receive paths: default empty source (`receive_message_count: 0`) and synthetic configured source (`configured_receive_message_count: 1`).
- The configured-source smoke creates a temporary encrypted PacketReader fixture line inside the generated Go harness, sets `ISPHERE_PACKET_LOG_FILE`, starts `mcpserver.NewServerFromEnv()`, calls `isphere_receive_messages`, and asserts one normalized redacted message.
- Docs now state that operator verification covers both default empty-source and synthetic configured-source paths.
- Verification completed for C6 with `powershell -NoProfile -ExecutionPolicy Bypass -File scripts/verify-go-mcp.ps1`; full verification is run again before commit.
---
## Loop C7: Log-backed contact candidate extraction
**Goal:** Build the next read-capability foundation by extracting searchable contact candidates from normalized log-backed messages, using sender/receiver bare JIDs as stable contact ids until richer roster/display-name evidence is available.
**Contract source:** `docs/mcp-core-tools-contract.md`, tool `isphere_search_contacts`.
**Planned files:**
- Create: `internal/isphere/contacts.go`
- Create: `internal/isphere/contacts_test.go`
- Modify: `docs/source-discovery/capability-source-matrix.md`
- Modify: `docs/superpowers/plans/2026-07-09-stage-c-log-backed-receive-messages-loop.md`
**Planned behavior:**
- Consume `[]isphere.Message` records from the existing receive source layer.
- Extract unique contacts from `SenderID` and `ReceiverID`.
- Contact fields: `ContactID`, `DisplayName`, `Account`, `Source`, `Confidence`, `RawRef`.
- For now, `DisplayName` and `Account` both use the bare JID because no richer roster evidence is validated yet.
- Search query matches bare JID/display name case-insensitively.
- `Limit <= 0` returns all matches; positive `Limit` truncates.
- This loop does not register the MCP tool yet; registration comes after source behavior passes tests.
- [ ] **Step 1: Write failing contact extraction test**
Create `internal/isphere/contacts_test.go` and run:
```powershell
go test ./internal/isphere -run TestSearchContactsFromMessagesMatchesBareJIDs -v
```
Expected initial failure: contact search types/functions do not exist.
- [ ] **Step 2: Implement contact extraction/search**
Create `internal/isphere/contacts.go` with minimal pure Go logic over normalized messages. Use synthetic/redacted fixtures only.
- [ ] **Step 3: Run full verification and rewrite Loop C8**
Run:
```powershell
git diff --check
go test ./...
go build ./cmd/isphere-mcp
powershell -NoProfile -ExecutionPolicy Bypass -File scripts/verify-go-mcp.ps1
```
Expected: all exit 0. Remove any generated root `isphere-mcp.exe` after build. Rewrite Loop C8 around registering `isphere_search_contacts` from the C7 source behavior.
---
## Self-Review
- Spec coverage: the plan follows the user's cyclic requirement: plan first, implement one loop at a time, update the next loop after each result, and ask only on blockers.