mirror of
https://github.com/Monkopedia/rouse-context.git
synced 2026-10-21 22:30:32 +00:00
Two gates to prevent reintroduction of the malformed-JSON bug class that shipped in #417 (Outreach error helpers used a """{...}""" template with raw exception text, producing unparseable bodies). (A) Harness-level JSON parse assertion. Introduces shared `McpToolTestHarness` (in `integrations/src/test/.../testing/`) that wraps the duplicated mockk(Server) + addTool capture pattern previously copy-pasted across `OutreachMcpProviderTest`, `UsageMcpProviderTest`, `NotificationMcpToolExecutionTest`, and `NotificationMcpProviderToolsTest`. Every `callTool(...)` invocation runs the result body through `Json.parseToJsonElement`; parse failures throw with the offending tool name and body content. Per-call `expectJsonBody = false` opt-out for tools whose contract is plain text (currently only one test uses it, referencing #427 which tracks the underlying core MCP DSL gap the harness surfaced). Regression test `McpToolTestHarnessTest` constructs fake tools that return non-JSON bodies and asserts the harness throws with the tool name + body in the message, plus a passing-case to lock down the expectJsonBody opt-out. (B) CI grep check. New `scripts/check-no-manual-json.sh` greps `*/src/main/*.kt` for `"""\{` and fails the build on hits unless the line carries a `// allow-manual-json: <reason>` marker, or matches the explicit `AuditDetailScreen.kt` allowlist (Compose preview fixtures). Wired into `.github/workflows/android-ci.yml` next to the existing `check-zombie-screens.sh` step. Verified manually that the script fires on a synthetic `"""{"x":"$bar"}"""` and clears once the marker is added. Documents the convention in new `docs/agent-quickstart.md`. Co-authored-by: Claude Opus 4 (1M context) <noreply@anthropic.com> |
||
|---|---|---|
| .. | ||
| backfill-relay-secrets.sh | ||
| check-no-manual-json.sh | ||
| check-zombie-screens.sh | ||