test(verifier): replace recordingChecker with a mockery mock - #1418
Open
tt-cll wants to merge 1 commit into
Open
test(verifier): replace recordingChecker with a mockery mock#1418tt-cll wants to merge 1 commit into
tt-cll wants to merge 1 commit into
Conversation
tt-cll
force-pushed
the
tt/policy-checker-mockery
branch
from
September 9, 2026 11:20
cc57825 to
a345386
Compare
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
The generated Checker mock exposes an internal request type in its public helper API and the added .mockery.yaml rationale comment is misleading about import-cycle avoidance.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
This PR updates the verifier policy-hook tests to use a mockery-generated Checker mock instead of a bespoke recordingChecker, and wires mockery config to generate that mock in a dedicated package.
Changes:
- Added a mockery-generated
MockCheckerforpolicy.Checker. - Updated
policy_hook_test.goto assertChecker.Evaluateinteractions via testify/mock expectations. - Extended
.mockery.yamlto generate theCheckermock intoverifier/pkg/policy/mocks.
File summaries
| File | Description |
|---|---|
| verifier/pkg/policy/mocks/mock_Checker.go | Adds mockery-generated mock for policy.Checker. |
| verifier/pkg/commit/policy_hook_test.go | Replaces custom checker stub with mockery mock + interaction assertions. |
| .mockery.yaml | Configures mockery generation for the new Checker mock output directory/package. |
Review details
Files not reviewed (1)
- verifier/pkg/policy/mocks/mock_Checker.go: Generated file
- Files reviewed: 2/3 changed files
- Comments generated: 2
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+26
to
+28
| // Evaluate provides a mock function with given fields: ctx, req | ||
| func (_m *MockChecker) Evaluate(ctx context.Context, req policyapi.EvaluateRequest) (policy.Verdict, error) { | ||
| ret := _m.Called(ctx, req) |
Comment on lines
+125
to
+129
| # The Checker mock gets its own package rather than the flat verifier/internal/mocks, because | ||
| # both packages that would import it are in-package tests that the flat one cannot serve: | ||
| # gate_test.go is package policy, and a mocks package importing policy is a cycle for it; and | ||
| # verifier/pkg/commit reaches commit again through the flat package's cctp mock. Its own | ||
| # directory imports only policy, so neither cycle exists. |
tt-cll
force-pushed
the
tt/policy-checker-mockery
branch
from
September 9, 2026 12:38
a345386 to
3e4b699
Compare
tt-cll
force-pushed
the
tt/policy-checker-mockery
branch
from
September 9, 2026 16:20
3e4b699 to
158ff89
Compare
tt-cll
force-pushed
the
tt/policy-checker-mockery
branch
from
September 9, 2026 19:36
158ff89 to
36eebf2
Compare
tt-cll
force-pushed
the
tt/policy-checker-mockery
branch
from
September 9, 2026 23:10
36eebf2 to
7eb6346
Compare
|
Code coverage report:
Files removed (from
Files added (in
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Testing
Checklist
changelogdirectory)Stack created with GitHub Stacks CLI • Give Feedback 💬