feat: load packet logs from directory source
This commit is contained in:
@@ -1456,7 +1456,7 @@ Evidence precheck result:
|
||||
- Extend verification with a synthetic directory fixture proving configured receive/contact/group/file-list tools still work from the hardened source path.
|
||||
- Keep raw N12-pre evidence under ignored/operator-local paths; commit only synthetic fixtures/tests.
|
||||
|
||||
- [ ] **Step 1: Write failing directory source test**
|
||||
- [x] **Step 1: Write failing directory source test**
|
||||
|
||||
Create or extend `internal/isphere/file_source_test.go` and run:
|
||||
|
||||
@@ -1466,15 +1466,15 @@ go test ./internal/isphere -run TestLoadEncryptedPacketLogSourceFromDirectoryRea
|
||||
|
||||
Expected initial failure: directory loader does not exist.
|
||||
|
||||
- [ ] **Step 2: Implement directory/multi-file loader**
|
||||
- [x] **Step 2: Implement directory/multi-file loader**
|
||||
|
||||
Implement minimal deterministic loading over `.log`/`.txt` files without decrypting during load.
|
||||
|
||||
- [ ] **Step 3: Wire env and verification**
|
||||
- [x] **Step 3: Wire env and verification**
|
||||
|
||||
Add `ISPHERE_PACKET_LOG_DIR` handling in `mcpserver.NewServerFromEnv()` and update the verification script with a synthetic directory smoke.
|
||||
|
||||
- [ ] **Step 4: Run full verification and commit**
|
||||
- [x] **Step 4: Run full verification and commit**
|
||||
|
||||
Run:
|
||||
|
||||
@@ -1489,6 +1489,57 @@ Expected: all exit 0. Remove any generated root `isphere-mcp.exe` after build. C
|
||||
|
||||
---
|
||||
|
||||
## Loop C16 Result
|
||||
|
||||
Implemented and verified in this loop:
|
||||
|
||||
- `internal/isphere.LoadEncryptedPacketLogSourceFromDirectory(path)` loads operator-local encrypted PacketReader `.log` and `.txt` files recursively, sorts file paths deterministically, and ignores blank lines.
|
||||
- `internal/mcpserver.NewServerFromEnv()` now supports `ISPHERE_PACKET_LOG_FILE` for a single encrypted log-line file or `ISPHERE_PACKET_LOG_DIR` for a directory source. It fails fast if both variables are set.
|
||||
- `scripts/verify-go-mcp.ps1` now verifies three read-source paths: default empty source, synthetic configured file source, and synthetic configured directory source. The directory smoke covers receive messages, contact search, group search, and file-list extraction.
|
||||
- Runbook/status/matrix docs now describe the dual file/directory configuration while keeping raw N12-pre evidence under ignored/operator-local paths.
|
||||
- This is still a log-backed local evidence source, not a production ingestion connector.
|
||||
|
||||
---
|
||||
|
||||
## Loop C17: Read-tool contract alignment precheck
|
||||
|
||||
**Goal:** Audit the four registered business read tools against `docs/mcp-core-tools-contract.md`, then choose the smallest safe implementation slice that makes digital-employee consumption more stable without opening write/send behavior.
|
||||
|
||||
**Planned files:**
|
||||
- Modify: `docs/source-discovery/capability-source-matrix.md`
|
||||
- Modify: `docs/current-status-card.md`
|
||||
- Modify: `docs/superpowers/plans/2026-07-09-stage-c-log-backed-receive-messages-loop.md`
|
||||
- Optionally modify `internal/tools/isphere_read.go`, `internal/tools/isphere_read_test.go`, and `scripts/verify-go-mcp.ps1` if the precheck confirms a low-risk response-shape fix.
|
||||
|
||||
**Planned behavior:**
|
||||
- Compare current outputs for `isphere_receive_messages`, `isphere_search_contacts`, `isphere_search_groups`, and `isphere_receive_files` with the contract's `ok`, `next_cursor`, `audit`, and business field names.
|
||||
- Prioritize `isphere_receive_messages` because its current output remains parser-native (`id`, `text`, `subject`, etc.) instead of contract-facing (`message_id`, `content_text`, `content_type`, attachments, source/raw_ref).
|
||||
- Do not change send-message or send-file behavior in this loop.
|
||||
- If output-shape changes are backward-compatible and small, implement them with tests; if they are breaking or broad, document the compatibility decision and write the next implementation loop.
|
||||
|
||||
- [ ] **Step 1: Run contract/output precheck**
|
||||
|
||||
Inspect current tool registration code and tests, then record exact gaps against `docs/mcp-core-tools-contract.md`.
|
||||
|
||||
- [ ] **Step 2: Choose one small fix or defer**
|
||||
|
||||
If a small non-breaking fix is available, write the failing test first. Otherwise update docs with the contract gap and rewrite C18 as the implementation node.
|
||||
|
||||
- [ ] **Step 3: Verify and commit**
|
||||
|
||||
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. Commit exact C17 paths only and rewrite the next loop from actual results.
|
||||
|
||||
---
|
||||
|
||||
## 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.
|
||||
|
||||
Reference in New Issue
Block a user