Contract — R93 B3 Document Dual Error-Envelope Pattern in s17

Round: R93 debug-sweep Branch: feature/r93-b3-s17-dual-envelope Audit: docs/audits/r93-b3-s17-dual-envelope-audit.md β task: 1a267787-b864-4f5f-a7dd-669a6268dbe7

§1. Invariants

ID Invariant Verifier
I-1 docs/spec/s17-mcp-surface.md §6 documents BOTH Pattern A (throw → α envelope) and Pattern B (return error-as-data). Visible in the diff.
I-2 A client-developer reading §6 alone can determine which pattern a tool uses for at least the documented tool families (β tasks, η proof, δ router, θ consensus, ζ thought, ε skill, system). Per-family attribution table present.
I-3 The source-of-truth comment at src/tools/merkle.ts:392-405 is cited as the canonical Pattern B definition. Cross-reference present in the new §6.x.
I-4 Wire-level examples for BOTH patterns are present — at least one success and one failure example for each pattern. New examples in §6.2.
I-5 No code is modified. No handler behaviour changes. git diff origin/main..HEAD -- src/ is empty.
I-6 npm run build && npm run lint && npm test still pass (baseline 3492 / 79 suites + documented flakes). Verify step.

§2. Non-invariants

  • N-1. The per-tool catalogue (docs/reference/mcp-tools-phase-0.md) is NOT updated. That document still describes only the 14 Phase 0 tools; extending it to the post-R89B-R92 27-tool surface is a different slice.
  • N-2. The handler behaviour is unchanged. Pattern B handlers keep returning {ok:false, error:{...}} as data. Pattern A handlers keep throwing.
  • N-3. ADR-004 is not amended. The dual-pattern doc clarifies the existing surface; no new architectural decision.

§3. Acceptance criteria

  • AC-1. git diff origin/main..HEAD -- docs/spec/s17-mcp-surface.md shows §6 restructured into success + failure subsections; word count +200 to +500 (roughly).
  • AC-2. No changes outside docs/spec/s17-mcp-surface.md and the four 5-step chain docs.
  • AC-3. npm run build && npm run lint && npm test exit 0 (modulo documented flakes).
  • AC-4. PR body summarises the dichotomy + cites the source comment.
  • AC-5. Writeback per CLAUDE.md §7.

Proceeding to packet.


Back to top

Colibri — documentation-first MCP runtime. Apache 2.0 + Commons Clause.

This site uses Just the Docs, a documentation theme for Jekyll.