Skip to content

test(cli): cover the host-mediated refusal for reviewProviderAdapterFor(pi) - #4156

Open
Clowraider wants to merge 1 commit into
Gentleman-Programming:mainfrom
Clowraider:test/review-provider-adapter-pi
Open

Clowraider wants to merge 1 commit into
Gentleman-Programming:mainfrom
Clowraider:test/review-provider-adapter-pi

Conversation

@Clowraider

@Clowraider Clowraider commented Sep 4, 2026 •

Copy link
Copy Markdown
Contributor

🔗 Linked Issue

Closes #3258


🏷️ PR Type

What kind of change does this PR introduce?

  • type:bug — Bug fix (non-breaking change that fixes an issue)
  • type:feature — New feature (non-breaking change that adds functionality)
  • type:docs — Documentation only
  • type:refactor — Code refactoring (no functional changes)
  • type:chore — Build, CI, or tooling changes
  • type:breaking-change — Breaking change (fix or feature that changes existing behavior)

📝 Summary

Adds table-driven unit test coverage for reviewProviderAdapterFor in internal/cli/review_provider_test.go, covering:

  • Claude Code returning its compiled adapter
  • Codex returning its compiled adapter
  • OpenCode returning its host-mediated refusal
  • Pi returning its distinct host-mediated refusal
  • An unsupported runtime returning the unregistered adapter refusal
  • Rejection of contracts lacking the required transport capability before runtime selection

Addresses the missing coverage for Pi's host-mediated refusal branch noted in #3258 and follows the contributor scope clarification.


📂 Changes

File / Area What Changed
internal/cli/review_provider_test.go Added TestReviewProviderAdapterFor covering runtime selection and refusals

🤖 AI Assistance

Select exactly one option. Do not check both options.

  • None — No material AI assistance was used.
  • Material assistance used — Complete all applicable declaration fields below.

Tool/model (if known): OpenCode

Material scope: Test code generation and validation against issue requirements.

Verification performed: Executed go test -v -run TestReviewProviderAdapterFor ./internal/cli and go run ./internal/gofmtcheck.


🧪 Test Plan

Unit Tests

go test -v -run TestReviewProviderAdapterFor ./internal/cli

Go Format

go run ./internal/gofmtcheck

Benchmark Validation
N/A — test-only addition covering adapter selection boundary.

  • Unit tests pass (go test ./...)
  • Go format passes (go run ./internal/gofmtcheck)
  • E2E tests pass (cd e2e && ./docker-test.sh)
  • Manually tested locally

✅ Contributor Checklist

  • PR is linked to an issue with status:approved
  • PR stays within 400 changed lines, or I have requested/obtained maintainer-applied size:exception with rationale documented
  • I have added the appropriate type:* label to this PR
  • Unit tests pass (go test ./...)
  • Go format passes (go run ./internal/gofmtcheck)
  • E2E tests pass (cd e2e && ./docker-test.sh)
  • Benchmark validation completed, or this change is not applicable to the benchmark (explain why in the Test Plan).
  • I have updated documentation if necessary
  • My commits follow Conventional Commits format
  • I understand, reviewed, and take responsibility for the complete submission
  • I selected exactly one AI-assistance option and, if material assistance was used, completed all applicable declaration fields
  • My commits do not include Co-Authored-By trailers

Summary by CodeRabbit

  • Tests
    • Expanded coverage for reviewer-provider selection across supported and unsupported runtimes.
    • Added checks that incompatible review contracts are rejected before runtime selection.
    • Verified error handling for unavailable or unsupported provider adapters.

@coderabbitai

coderabbitai Bot commented Sep 4, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: 376153ee-fa83-4feb-81b8-27972a93f62d

📥 Commits

Reviewing files that changed from the base of the PR and between 2d3f283 and c8941de.


📒 Files selected for processing (1)
  • internal/cli/review_provider_test.go

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review.



📝 Walkthrough

Walkthrough

The PR adds table-driven tests for reviewer provider adapter selection. The tests cover compiled adapters, host-mediated refusal errors, unsupported runtimes, and missing transport capability validation.

Changes

Review provider adapter coverage

Layer / File(s) Summary
Transport capability validation
internal/cli/review_provider_test.go
Tests verify that agents without compiled transport capability return the expected error and a nil adapter before runtime selection.
Runtime adapter outcomes
internal/cli/review_provider_test.go
Tests verify Claude and Codex adapters, OpenCode and Pi host-mediated refusal errors, and unsupported-runtime errors.

Priority: ⬇️ Low

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

Change: Other

Suggested reviewers: alan-thegentleman


Merge Risk: ⚪ Minimal · up to c8941

The new tests cover the requested Pi reviewer-task instruction; no actionable merge risk remains.

Pre-merge checks | Passed 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 identifies the added CLI test coverage for the Pi host-mediated refusal branch in reviewProviderAdapterFor, which is the linked issue objective. It is concise and specific.
Linked Issues check Passed Issue #3258 requires test coverage for the pi host-mediated refusal in reviewProviderAdapterFor. The added pi returns distinct host-mediated refusal case checks the exact refusal message and ver…
Out of Scope Changes check Passed The pull request changes only internal/cli/review_provider_test.go. The added table-driven cases cover adapter selection and refusal behavior for the same function. The additional cases provide rele…
Docstring Coverage Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 1 files.


✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Commit to this branch
  • Create a new PR

🧪 Generate unit tests (beta)
  • Create a new PR



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.

@Clowraider
Clowraider force-pushed the test/review-provider-adapter-pi branch from 2d3f283 to c8941de Compare October 9, 2026 23:42
@Clowraider

Copy link
Copy Markdown
Contributor Author

Rebased cleanly onto upstream/main (v4.0.0). All pre-merge checks and formatting pass.

Could a maintainer please apply the type:chore label?

This branch has not been deployed

No deployments
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.

test(cli): cover the host-mediated refusal for reviewProviderAdapterFor(pi)

1 participant