feat: add msglib display entity extraction
This commit is contained in:
@@ -2238,7 +2238,7 @@ Go sidecar client result:
|
||||
|
||||
**Goal:** Extend the sidecar/client boundary from schema/display-source availability to bounded contact/group display-entity metadata, so a later loop can enrich `isphere_search_contacts` and `isphere_search_groups` without returning raw rows, message bodies, file paths, downloads, sends, writes, hooks, injection, or DB mutations.
|
||||
|
||||
**Planned files:**
|
||||
**Files:**
|
||||
- Modify: `native/MsgLibReadSidecar/Program.cs`
|
||||
- Modify: `docs/msglib-read-sidecar-contract.md`
|
||||
- Modify: `internal/msglib/sidecar_client.go`
|
||||
@@ -2249,25 +2249,91 @@ Go sidecar client result:
|
||||
- Modify: `docs/superpowers/plans/2026-07-09-stage-c-log-backed-receive-messages-loop.md`
|
||||
|
||||
**Planned behavior:**
|
||||
- Add a sidecar operation tentatively named `display_entities`.
|
||||
- Add a sidecar operation named `display_entities`.
|
||||
- Request args: `sqlite_dll_path`, `db_path`, optional `password`, `entity_type` (`contacts` or `groups`), optional `query`, and bounded `limit`.
|
||||
- Response data: normalized metadata only, such as `entity_type`, `source_table`, `jid`, `display_name`, `confidence`, and `matched_columns`.
|
||||
- Never return message bodies, file paths, raw SQL row maps, attachment contents, send/write capabilities, or unbounded result sets.
|
||||
- Use tests first. Normal Go tests should still use fake sidecar data; real copied DB verification stays opt-in through script/env paths.
|
||||
- Response data: normalized metadata only: `entity_type`, `source_table`, `jid`, `display_name`, `confidence`, and `matched_columns`.
|
||||
- Never return message bodies, message text, file paths, raw SQL row maps, attachment contents, send/write capabilities, or unbounded result sets.
|
||||
- Use tests first. Normal Go tests use fake sidecar data; real copied DB verification stays opt-in through script/env paths and prints only sanitized summaries.
|
||||
|
||||
- [ ] **Step 1: Write failing display-entity contract tests**
|
||||
- [x] **Step 1: Write failing display-entity contract tests**
|
||||
|
||||
Add sidecar/client tests for bounded contact/group entity decoding, query/limit validation, and rejection of unsupported entity types.
|
||||
Extended `internal/msglib/sidecar_client_test.go` with fake-sidecar tests for `DisplayEntities`, bounded args, decoded entity metadata, and unsupported entity type rejection. Verified RED with missing `DisplayEntities` / `DisplayEntitiesOptions` symbols.
|
||||
|
||||
- [ ] **Step 2: Implement sidecar `display_entities` operation**
|
||||
- [x] **Step 2: Implement sidecar `display_entities` operation**
|
||||
|
||||
Implement allowlisted table/column reads only for contact/group identity metadata, with parameterized query/limit and no raw row dumps.
|
||||
Implemented Go `DisplayEntities` wrapper and C# sidecar `display_entities` op. The sidecar uses allowlisted table/column pairs only, parameterized `query`, limit clamped to `1..100`, read-only SQLite connection settings, and normalized entity output.
|
||||
|
||||
- [ ] **Step 3: Extend Go client and verification script**
|
||||
- [x] **Step 3: Extend Go client and verification script**
|
||||
|
||||
Add Go wrapper types/methods and optional evidence-backed verification that reports only counts/source-table names, not personal values.
|
||||
Updated `scripts/verify-msglib-sidecar.ps1` to call `display_entities` when copied DB env paths are supplied. The verification output includes only `entity_count` and `source_tables`, not actual entity values.
|
||||
|
||||
- [ ] **Step 4: Update docs, run full verification, and commit**
|
||||
- [x] **Step 4: Update docs, run full verification, and commit**
|
||||
|
||||
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-msglib-sidecar.ps1 # with copied DB env paths
|
||||
powershell -NoProfile -ExecutionPolicy Bypass -File scripts\verify-go-mcp.ps1
|
||||
```
|
||||
|
||||
Final verification passed: `git diff --check`, `go test ./...`, explicit `go build ./cmd/isphere-mcp`, default sidecar smoke, evidence-backed sidecar smoke with sanitized `display_entity_summaries`, and `scripts/verify-go-mcp.ps1`.
|
||||
|
||||
Verification evidence from the copied DB smoke was sanitized: `contacts` returned count/source-table summary and `groups` returned count/source-table summary without printing names, JIDs, message bodies, file paths, or raw rows.
|
||||
|
||||
---
|
||||
|
||||
## Loop C29 Result
|
||||
|
||||
Bounded display entity extraction result:
|
||||
|
||||
- Added sidecar op `display_entities`.
|
||||
- Added Go client method `DisplayEntities(ctx, DisplayEntitiesOptions)` plus `DisplayEntity` metadata decoding.
|
||||
- Evidence-backed sidecar verification against the copied DB returned sanitized summaries: contacts count from `TD_CustomEffigy`; groups count from `TD_WorkGroupAuth`.
|
||||
- `isphere_search_contacts` and `isphere_search_groups` are still not wired to this source.
|
||||
|
||||
---
|
||||
|
||||
## Loop C30: Integrate MsgLib display entities into contact/group search
|
||||
|
||||
**Goal:** Wire the C29 bounded `DisplayEntities` source into `isphere_search_contacts` and `isphere_search_groups` as an optional env-configured enrichment path, while preserving the current log-backed fallback and keeping message bodies, file paths, downloads, sends, writes, hooks, injection, DB mutation, and raw row dumps out of scope.
|
||||
|
||||
**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: `internal/mcpserver/server.go`
|
||||
- Modify: `internal/mcpserver/server_test.go`
|
||||
- Modify: `scripts/verify-go-mcp.ps1`
|
||||
- Modify: `docs/current-status-card.md`
|
||||
- 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:**
|
||||
- Add an injectable display-entity source interface around `internal/msglib.Client`.
|
||||
- Keep default MCP behavior unchanged when `ISPHERE_MSGLIB_SIDECAR_EXE`, `ISPHERE_MSGLIB_SQLITE_DLL`, or `ISPHERE_MSGLIB_DB` are absent.
|
||||
- When all env vars are present, enrich contact/group search results from `DisplayEntities` with bounded `query` and `limit`.
|
||||
- Normal tests use fake display-entity source data; verification script should include a synthetic/fake enrichment smoke before any real copied DB smoke.
|
||||
- Do not expose a new MCP tool in this loop.
|
||||
|
||||
- [ ] **Step 1: Write failing contact/group enrichment tests**
|
||||
|
||||
Add tests proving contacts/groups can consume injected display entities and still pass existing log-backed/default behavior.
|
||||
|
||||
- [ ] **Step 2: Implement optional display-entity source wiring**
|
||||
|
||||
Implement source interface and env-configured `internal/msglib` client construction without changing default empty-source behavior.
|
||||
|
||||
- [ ] **Step 3: Update verification/docs**
|
||||
|
||||
Extend `scripts/verify-go-mcp.ps1` with synthetic/fake enrichment smoke and update status/matrix/plan.
|
||||
|
||||
- [ ] **Step 4: Full verification and commit**
|
||||
|
||||
Run:
|
||||
|
||||
|
||||
Reference in New Issue
Block a user