feat: validate receive message contract args
This commit is contained in:
@@ -1693,14 +1693,76 @@ Implemented and verified in this loop:
|
||||
- Treat `include_attachment_metadata=false` as a request to suppress inline receive-message attachments while leaving `isphere_receive_files` available for explicit file listing.
|
||||
- Do not add write/send/file-download behavior.
|
||||
|
||||
- [ ] **Step 1: Write failing MCP argument validation tests**
|
||||
- [x] **Step 1: Write failing MCP argument validation tests**
|
||||
|
||||
Extend `internal/tools/isphere_read_test.go` with accepted safe args and rejected unsupported source/cursor cases.
|
||||
|
||||
- [ ] **Step 2: Implement argument validation and attachment toggle**
|
||||
- [x] **Step 2: Implement argument validation and attachment toggle**
|
||||
|
||||
Add minimal validation/helpers in `internal/tools/isphere_read.go`.
|
||||
|
||||
- [x] **Step 3: Update verification and docs**
|
||||
|
||||
Update `scripts/verify-go-mcp.ps1`, runbook, status card, and this plan.
|
||||
|
||||
- [x] **Step 4: Run full verification 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 C20 paths only and rewrite the next loop from actual results.
|
||||
|
||||
---
|
||||
|
||||
## Loop C20 Result
|
||||
|
||||
Implemented and verified in this loop:
|
||||
|
||||
- `isphere_receive_messages` now accepts the remaining safe read-contract arguments: `include_attachment_metadata`, `source_preference`, `preview`, and `cursor`.
|
||||
- `source_preference` accepts empty, `auto`, or `local_readonly`; bridge/uia/network are rejected until those connectors exist.
|
||||
- Empty `cursor` is accepted for contract compatibility; non-empty cursor is rejected until pagination exists.
|
||||
- `preview` is accepted without mutation; audit execution remains `read`.
|
||||
- `include_attachment_metadata=false` suppresses inline receive-message attachments while keeping explicit file listing available through `isphere_receive_files`.
|
||||
- `scripts/verify-go-mcp.ps1` now exercises the accepted contract arguments in default, configured-file, and configured-directory receive-message smokes.
|
||||
|
||||
---
|
||||
|
||||
## Loop C21: Contact/group search remaining contract argument validation
|
||||
|
||||
**Goal:** Apply the same contract-compatibility pattern to `isphere_search_contacts` and `isphere_search_groups` so digital employees can pass safe search-contract fields without tripping schema validation.
|
||||
|
||||
**Planned files:**
|
||||
- Modify: `internal/tools/isphere_contacts.go`
|
||||
- Modify: `internal/tools/isphere_contacts_test.go`
|
||||
- Modify: `internal/tools/isphere_groups.go`
|
||||
- Modify: `internal/tools/isphere_groups_test.go`
|
||||
- Modify: `scripts/verify-go-mcp.ps1`
|
||||
- Modify: `docs/go-mcp-runbook.md`
|
||||
- Modify: `docs/current-status-card.md`
|
||||
- Modify: `docs/superpowers/plans/2026-07-09-stage-c-log-backed-receive-messages-loop.md`
|
||||
|
||||
**Planned behavior:**
|
||||
- For contacts: accept `cursor`, `source_preference`, and `include_inactive`.
|
||||
- For groups: accept `cursor`, `source_preference`, and `include_archived`.
|
||||
- Accept empty cursor only; reject non-empty cursor until pagination exists.
|
||||
- Accept source preference empty, `auto`, or `local_readonly`; reject bridge/uia/network until those connectors exist.
|
||||
- Treat include flags as accepted no-op on local readonly JID-derived candidates because active/archive state is not available in current source.
|
||||
- Do not add write/send/file-download behavior.
|
||||
|
||||
- [ ] **Step 1: Write failing contact/group MCP arg tests**
|
||||
|
||||
Extend contact/group tool tests with accepted safe args plus rejected unsupported source/cursor cases.
|
||||
|
||||
- [ ] **Step 2: Implement validation helpers**
|
||||
|
||||
Add minimal validation to contact and group tool handlers.
|
||||
|
||||
- [ ] **Step 3: Update verification and docs**
|
||||
|
||||
Update `scripts/verify-go-mcp.ps1`, runbook, status card, and this plan.
|
||||
@@ -1716,7 +1778,7 @@ 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 C20 paths only and rewrite the next loop from actual results.
|
||||
Expected: all exit 0. Remove any generated root `isphere-mcp.exe` after build. Commit exact C21 paths only and rewrite the next loop from actual results.
|
||||
|
||||
---
|
||||
|
||||
|
||||
Reference in New Issue
Block a user