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

@@ -21,7 +21,7 @@ Remote base before local roadmap commits: `b2d839e Merge branch 'codex/n15-repor
- `win_helper_dump_uia`
- `isphere_receive_messages`
- C# `ISphereWinHelper` exists under `native/ISphereWinHelper` and uses the `isphere.helper.v1` stdin/stdout JSON contract.
- `scripts/verify-win-helper.ps1` and `scripts/verify-go-mcp.ps1` provide repeatable local checks for the helper, five-tool MCP surface, and default empty-source `isphere_receive_messages` smoke call.
- `scripts/verify-win-helper.ps1` and `scripts/verify-go-mcp.ps1` provide repeatable local checks for the helper, five-tool MCP surface, default empty-source `isphere_receive_messages`, and synthetic configured-source receive smoke.
- N12-pre and N12R documents define safe offline evidence intake and internal-sandbox live UIA capture procedures.
- N13/N14/N15 produced selector catalog/report validation infrastructure, but those are supporting validation assets only.
@@ -48,7 +48,7 @@ N13/N14/N15 are pre-business validation results. They can help identify UI eleme
## Current loop
Current loop: `Stage C / Loop C6 - fixture-backed operator smoke for configured receive source`.
Current loop: `Stage C / Loop C7 - log-backed contact candidate extraction`.
Plan file: `docs/superpowers/plans/2026-07-09-stage-c-log-backed-receive-messages-loop.md`.
@@ -67,11 +67,12 @@ Current loop output so far:
4. C4: repeatable operator verification and docs for the five-tool surface.
5. C5: safe `ISPHERE_PACKET_LOG_FILE` loader for operator-local encrypted PacketReader log lines.
6. C6: fixture-backed operator smoke for configured receive source.
7. C7: log-backed contact candidate extraction from sender/receiver JIDs.
## Next business mainline
1. Finish Stage C Loop C6: add fixture-backed configured-source operator smoke.
2. Rewrite the next loop around either production-safe source configuration hardening or the next read capability, based on C6 results.
3. Add contact/group/file read tools after their source decisions are recorded.
1. Implement Stage C Loop C7: extract searchable contact candidates from log-backed messages.
2. Register `isphere_search_contacts` after contact source tests pass.
3. Add group/file read tools after their source decisions are recorded.
4. Add `isphere_send_message` and `isphere_send_file` after source discovery and connector selection.
5. Keep UIA selector/report work as fallback support, not as the primary roadmap.

View File

@@ -93,6 +93,7 @@ The verification confirms:
- Exactly five tools are exposed: four WinHelper observation tools plus `isphere_receive_messages`.
- `win_helper_version` returns `ISphereWinHelper`.
- `isphere_receive_messages` is callable and returns an empty `messages` array from the default empty source.
- A synthetic configured-source smoke check proves `ISPHERE_PACKET_LOG_FILE` can drive `isphere_receive_messages` end-to-end with one redacted fixture message.
- Verification uses synthetic/local helper checks and does not load raw N12-pre evidence.
- Contact/group/file/search/send business tools remain later-stage work.
@@ -112,7 +113,7 @@ $env:ISPHERE_PACKET_LOG_FILE = "E:\coding\codex\isphere-ai-bridge\runs\offline-e
The file must contain one encrypted Base64 log line per line. Blank lines are ignored. Keep this file under ignored `runs/` paths or another operator-local location; do not commit raw logs or decrypted message content.
Then start the MCP server normally. The command entry point uses `ISPHERE_PACKET_LOG_FILE` if it is set; the repeatable verification script clears it so the default smoke test remains deterministic.
Then start the MCP server normally. The command entry point uses `ISPHERE_PACKET_LOG_FILE` if it is set. The repeatable verification script checks both paths: it clears the variable for the default empty-source smoke test, then creates a temporary synthetic encrypted fixture file and proves the configured-source path returns one redacted message.
## 7. Configure MCP client command

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.