Skip to content

test(mcp): enforce directional tool contract - #3

Merged
barbatdev merged 1 commit into
mainfrom
feat/mcp-contract-baseline-03-directional
Aug 31, 2026
Merged

test(mcp): enforce directional tool contract#3
barbatdev merged 1 commit into
mainfrom
feat/mcp-contract-baseline-03-directional

Conversation

@barbatdev

Copy link
Copy Markdown
Owner

🔗 Linked Issue

Upstream issue: Gentleman-Programming#717 (status:approved).

This is a fork-first staging PR and intentionally does not close the upstream issue.


🏷️ PR Type

  • type:bug — Bug fix
  • type:feature — New feature
  • type:docs — Documentation only
  • type:refactor — Code refactoring (no behavior change)
  • type:chore — Maintenance, dependencies, tooling
  • type:breaking-change — Breaking change

📝 Summary

  • Replace conservative exact live equality with bounded baseline-to-live directional compatibility.
  • Add deterministic drift diagnostics and a build-tagged, explicitly gated fixture writer.
  • Remove duplicate broad registry inventories while retaining focused behavior and profile checks.

📂 Changes

File Change
internal/mcp/tool_contract_test.go Adds directional comparison, widening rules, deterministic drift records, and fixture self-canonicality validation.
internal/mcp/tool_contract_update_test.go Adds the build-tagged writer with CI, mode, overwrite, compatibility, temporary-file, and rename safeguards.
internal/mcp/mcp_test.go Replaces duplicate full inventories with dynamic comparisons while preserving focused assertions.

🧪 Test Plan

  • Compatible live-only simple additions pass; narrowing and unproven changes fail closed.
  • Focused contract and writer-refusal tests pass.
  • go test ./internal/mcp -count=1 passes with 88.8% package coverage.
  • go build ./... and go test -tags e2e ./internal/server/... pass.
  • Ordinary builds exclude writer behavior and preserve fixture SHA-256.
  • go test ./... is fully green locally: two known macOS /var versus /private/var assertions fail outside internal/mcp.

🤖 Automated Checks

Fork-first note: the upstream issue is approved, but the fork-local governance job may not resolve an upstream issue through context.repo. The final upstream PR will use the canonical issue-closing reference.


✅ Contributor Checklist

  • The approved upstream issue is linked above.
  • Exactly one PR type and matching label are present.
  • Commits follow conventional-commit format.
  • No Co-Authored-By trailers are present.
  • The exact delta is 286 additions plus 67 deletions across three paths.
  • The fixture delta is zero and runtime behavior is unchanged.

💬 Notes for Reviewers

Fork-first stack, PR 3 of 3. PR 1 and PR 2 are already integrated into the fork base, so this PR shows only the 353-line directional/writer/inventory delta.

The complete integrated feature passed SDD verification for 9/9 requirements and 16/16 scenarios. Native high-risk RDD reviewed all four integrated MCP paths through risk, resilience, readability, and reliability lenses and approved the candidate without a correction transition. Four advisory-only findings remain documented for later work.

@barbatdev barbatdev added the type:feature New feature label Aug 31, 2026
@barbatdev
barbatdev merged commit 7869ee1 into main Aug 31, 2026
7 of 9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type:feature New feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant