Skip to content

spec(contracts): enforce cross-field relationships in standard MCP and retained private compatibility schemas #2048

Open

Description

@EffortlessSteven

Parents and current authority

Problem

The review finding behind this issue was valid: individually closed vocabularies can still permit invalid cross-field combinations. The original examples were custom riprAgent request/success envelopes. That custom public protocol is no longer the product architecture.

The durable contract rule applies to:

standard MCP tool inputs/results and resources
RIPR-owned data carried inside standard LSP messages/commands
any retained private compatibility schema

Invalid combinations must fail at the live producer/consumer boundary rather than being accepted because each field is independently valid.

Required outcome

After #1599/#1896 disposition the experimental schemas, enforce cross-field relationships only on contracts that survive.

Standard MCP examples

Pin the applicable relationships such as:

tool name ↔ input schema
result kind ↔ tool name
resource URI/template ↔ resource content kind
snapshot/item/attempt identity required by the selected operation
readiness state ↔ presence/absence of repair fields
execution_mode ↔ required/forbidden CommandSpec fields
receipt state ↔ before/after/verify bindings
pagination token ↔ snapshot/profile/budget identity

Use JSON Schema if/then, oneOf, or domain validation where schema alone cannot express the invariant.

Standard LSP examples

Contract only RIPR-owned payloads inside standard messages:

Diagnostic.code ↔ data kind/recovery
CodeAction kind ↔ data/command role
command identifier ↔ argument object
resultId ↔ selected diagnostic payload identity

Do not respecify the complete LSP protocol.

Private compatibility

If any custom request/response schema survives under #3080:

  • label it private_compatibility;
  • retain version/request-kind/mode/result-kind constraints;
  • ensure it cannot appear in public standard support;
  • remove it when the last private consumer retires.

Analyzer fixture separation

Re-check the structured-versus-prose discriminator consistency in the original lsp_agent_protocol fixture. If that fixture becomes historical/private, move the analyzer assertion to the canonical producer fixture rather than preserving it solely to support a retired transport.

Required proof

  • wrong MCP result kind for a tool fails;
  • tool input missing operation-specific identity fails;
  • invalid CommandSpec field combination fails;
  • wrong resource content kind/URI pairing fails;
  • standard LSP command/action mismatch fails;
  • private custom request mode/kind mismatch fails only if that contract survives;
  • retired schemas are absent from live validation and discovery;
  • schema pointer resolving no producer bytes fails;
  • mutation removing one relationship makes the contract suite fail.

Acceptance

Proof

cargo test -p ripr --test mcp_conformance -- --nocapture
cargo test -p ripr --test lsp_standard_client -- --nocapture
cargo test -p xtask verification_contracts -- --nocapture
cargo xtask check-verification-contracts --check
cargo xtask check-output-contracts
cargo xtask check-capabilities
cargo xtask check-fixture-contracts
cargo xtask check-traceability
cargo xtask check-pr
git diff --check

Non-goals

  • no new custom public request protocol;
  • no redefinition of complete LSP/MCP standards;
  • no new handler merely to satisfy a design-only schema;
  • no source edit or command execution;
  • no support promotion.

Claim boundary

Completion makes surviving standard and private integration contracts reject invalid field combinations. It does not prove transport behavior or real repair usefulness.

Activity

  1. added
    vscode
    on Jul 20, 2026
  2. coderabbitai commented on Jul 20, 2026

    @coderabbitai
    🔗 Related PRs

    #3069 - test(release): negative corpus harness with artifact-family cases (#2824) [merged]
    #3071 - test(release): verify and receipt negative cases complete the corpus (#2824) [merged]
    #3078 - release(denominator): adjudicate P..C to zero decisions for the 0.11.0 hard cut (#2825) [merged]
    #3086 - fix(skills): resolve repaired review threads during merge prep (#3079) [open]


    📝 Issue Planner

    Check the box below or use the @coderabbitai plan command to generate an implementation plan and prompts that you can use with your favorite coding assistant.

    • Create Plan

    🧪 Issue enrichment is currently in open beta.

    You can configure auto-planning by selecting labels in the issue_enrichment configuration.

    To disable automatic issue enrichment, add the following to your .coderabbit.yaml:

    issue_enrichment:
      auto_enrich:
        enabled: false

    💬 Have feedback or questions? Drop into our discord!

  3. EffortlessSteven commented on Aug 1, 2026

    @EffortlessSteven
    MemberAuthor

    Earnest review (2026-08-01)

    Open: there are zero if/then cross-field constraints in the riprAgent schemas, even though the pattern is already established elsewhere (repair-assurance, review-comments). This is a small, well-bounded PR with an existing in-repo precedent to copy. Recommend lifting the constraint helper from an existing schema and applying it here as a single focused change.

  4. added
    status/needs-work
    on Aug 6, 2026
  5. added this to the 0.13.0 milestone on Aug 8, 2026
  6. changed the title [-]spec(lsp): enforce cross-field discriminator relationships in riprAgent schemas[/-] [+]spec(contracts): enforce cross-field relationships in standard MCP and retained private compatibility schemas[/+] on Aug 9, 2026
  7. added
    status/blocked-repo
    and removed
    status/needs-work
    on Aug 9, 2026
  8. added
    release-check
    status/needs-work
    on Aug 9, 2026
  9. EffortlessSteven commented on Nov 11, 2026

    @EffortlessSteven
    MemberAuthor

    Reconciled against main cb95c5b0: partial. The 2026-08-01 review ("zero if/then cross-field constraints in the riprAgent schemas") no longer matches source.

    Landed (retained riprAgent contract only)

    • schemas/ripr/ripr-agent-success.schema.json now has 14 if/then clauses under allOf. The first one read in this pass: verify_route_readiness in typed_direct | typed_shell_required | manual requires an object verify_command_spec (the "readiness state ↔ repair fields" relationship named in the body). I could not name the landing PR and SHA: the path-scoped history query did not finish in this checkout, so treat this as a source anchor without a merge receipt.
    • That schema is dispositioned experimental_not_public in policy/ripr-agent-disposition.toml (schema:ripr-agent-success; fix(lsp): disposition experimental riprAgent as private compatibility (#1896) #12403, 05678623), which bears on the "retained private compatibility remains constrained and non-public" item.
    • The other three riprAgent schemas (-request, -error, -capability) have no if / oneOf / allOf.

    Residual

    • Standard MCP contracts: there is no MCP schema under schemas/ripr/, and no "if" in crates/ripr/src/mcp/*.rs. The proof target mcp_conformance named in the body does not exist under crates/ripr/tests/ (existing MCP targets: mcp_stdio, mcp_sdk, mcp_cli_repair_parity, mcp_interrupts, mcp_workspace_config, agentic_bench_mcp).
    • RIPR-owned standard-LSP payload relationships: lsp_standard_client test target does not exist.
    • A removal experiment showing that dropping one relationship fails a contract suite; the slice(contracts): bind live standard LSP and MCP surfaces to producer-backed schemas and capability receipts #3009 registry naming each relationship owner; the analyzer-fixture separation item.

    Label set to status/partial (dropping the contradictory status/needs-work).


    Generated by Claude Code

  10. removed
    status/needs-work
    on Nov 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    release-checkstatus/blocked-repostatus/partialvscode

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions