Skip to content

test(mcp): reject narrowing optional additions - #4

Merged
barbatdev merged 1 commit into
mainfrom
fix/mcp-contract-additional-properties-compat
Aug 31, 2026
Merged

test(mcp): reject narrowing optional additions#4
barbatdev merged 1 commit into
mainfrom
fix/mcp-contract-additional-properties-compat

Conversation

@barbatdev

Copy link
Copy Markdown
Owner

🔗 Linked Issue

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

This is a fork-first corrective 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

  • Reject optional named property additions when v1 allowed arbitrary additional-property values.
  • Preserve compatibility for simple optional additions when v1 previously rejected unknown properties.
  • Add the focused regression required by native RDD finding R3-001.

📂 Changes

File Change
internal/mcp/tool_contract_test.go Adds the permissive-baseline narrowing regression and conditions simple optional-property compatibility on the v1 additional-properties policy.

🧪 Test Plan

  • RED reproduced permissive additionalProperties optional addition error = <nil>.
  • Focused comparator and verification tests pass after GREEN.
  • go test ./internal/mcp -count=1 passes.
  • MCP package coverage remains 88.8%.
  • Fixture SHA-256 remains unchanged.

🤖 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.
  • Commit follows conventional-commit format.
  • No Co-Authored-By trailer is present.
  • The correction is one file and 15 changed lines.
  • No fixture or production behavior changed.

💬 Notes for Reviewers

This exceptional fourth fork PR is a bounded post-stack correction required by native high-risk RDD. The finding is semantic: naming and typing a previously arbitrary key narrows accepted inputs even when the new property is optional.

@barbatdev barbatdev added the type:bug Bug fix label Aug 31, 2026
@barbatdev
barbatdev merged commit e4606fa 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:bug Bug fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant