Skip to content

fix(review): tolerate added gates and projections, keep mandatory features exact - #263

Merged
Alan-TheGentleman merged 1 commit into
mainfrom
fix/additive-tolerant-floors
Aug 1, 2026
Merged

fix(review): tolerate added gates and projections, keep mandatory features exact#263
Alan-TheGentleman merged 1 commit into
mainfrom
fix/additive-tolerant-floors

Conversation

@Alan-TheGentleman

@Alan-TheGentleman Alan-TheGentleman commented Aug 1, 2026

Copy link
Copy Markdown
Collaborator

Quick win. Independent of the release-artifact initiative and of any tracker.

Problem

lib/review-integration-v2.ts validated the provider's advertised capability surface inconsistently: operations and schemas used assertSupersetOf (additive-tolerant, correct), while gates, projections and mandatory features used assertExactSet.

The file's own comment already recorded the lesson from v2.2.0 — "demanding an exact match rejects a compatible provider release" — but it was applied to only half the surface. Under the current provider release cadence, that rejects compatible releases repeatedly and predictably.

Change

Gates and projections become required floors that tolerate additions. Unknown added names decode safely, the required floor is verified, and internal use narrows to the supported required members so additions never leak into behavior.

Mandatory features intentionally stay exact and keep rejecting unknown additions. The provider's own contract advertises compatibility.unknown_mandatory: "reject" (contracts/review-integration/v2/fixtures/capabilities.fixture.json, constrained by "unknown_mandatory": {"const": "reject"} in the schema). Relaxing them would violate the contract the provider publishes.

Not a one-line swap

enumArray rejected unknown members before any assertion ran, and the gates/projections calls passed fixed minimum/maximum bounds of 5 and 2. Swapping only the assertion would have left enumArray rejecting first and the fix would silently have done nothing. The decode path itself changed.

Tests

Six behaviors, RED first:

  1. gate floor + 1 unknown gate — was TypeError: capabilities.gates has an invalid length, now passes
  2. projection floor + 1 unknown projection — same pattern
  3. gate set missing a required member — still rejected
  4. projection set missing a required member — still rejected
  5. mandatory features + 1 unknown addition — still rejected, proving the contract boundary did not regress
  6. unknown additions are absent from the decoded sets — additions never drive behavior

pnpm run check:transaction-runner passes (runtime/ regenerated, never hand-edited).

Three tests in native-review-parity-runtime.test.ts fail on this branch and fail identically on clean main — they require receipt-driven development to be enabled, which is globally off in this environment. Verified independently against the base commit.

Rollback

Single commit. No consumer code outside decodeReviewCapabilitiesV2 reads the raw gates/projections locals, so reverting restores exact-match validation with no other side effects.

Summary by CodeRabbit

  • Bug Fixes
    • Improved compatibility with providers that advertise additional capabilities.
    • Capability detection now accepts additive gates and projections while retaining the required supported set.
    • Added validation to ensure all mandatory capabilities remain available.

capabilities.gates and capabilities.projections used assertExactSet,
rejecting any provider release that advertises one extra gate or
projection beyond the required floor. Decode both as plain string
arrays instead of enumArray-against-the-known-enum, so an unknown
addition reaches assertSupersetOf instead of being rejected earlier
by the enum check, matching the superset-tolerant handling already
used for operations and schemas.

Unknown advertised gates/projections are still not leaked into
internal use: the decoded ReviewCapabilitiesV2 narrows to the
required members only, the same pattern already used for operations
and schemas. Mandatory features keep assertExactSet unchanged, per
the provider's own unknown_mandatory: "reject" contract.
@coderabbitai

coderabbitai Bot commented Aug 1, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 223216f4-4d57-4562-9d2e-b7730d6ee12c

📥 Commits

Reviewing files that changed from the base of the PR and between 5fe1bea and caed46d.

📒 Files selected for processing (3)
  • lib/review-integration-v2.ts
  • runtime/review-integration-v2.mjs
  • tests/review-integration-v2.test.ts

📝 Walkthrough

Walkthrough

Changes

Capability decoding

Layer / File(s) Summary
Extensible capability validation
lib/review-integration-v2.ts, runtime/review-integration-v2.mjs
Decoders accept additional gate and projection names, require the defined values, and return sets containing the required capabilities.
Capability decoder coverage
tests/review-integration-v2.test.ts
Tests cover mandatory capability rejection, additive values, filtering, and required capability enforcement.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

Suggested labels: type:bug

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: additive gates and projections are tolerated while mandatory features remain exact.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/additive-tolerant-floors

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@Alan-TheGentleman
Alan-TheGentleman merged commit 8ea7a4b into main Aug 1, 2026
2 checks passed
@Alan-TheGentleman
Alan-TheGentleman deleted the fix/additive-tolerant-floors branch August 1, 2026 08:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant