test(agent): add generated interface mocks - #408
Conversation
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughAdded Mockery tooling and Testify dependencies. Added generated mocks for Estimated code review effort: 3 (Moderate) | ~20 minutes Suggested reviewers: 🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
d8efce7 to
2772b92
Compare
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@agent/go/deps.mk`:
- Line 23: Add `unexport MOCKERY_VERSION` immediately after the
`MOCKERY_VERSION` assignment in the Makefile, keeping the variable available for
Makefile expansion while preventing it from being passed to Mockery’s
environment.
In `@agent/go/Makefile`:
- Around line 66-69: Update the generate-mocks target to ensure newly generated
mocks receive the repository’s Apache SPDX license header, since make fmt does
not process untracked files. Configure Mockery with the repository-managed
boilerplate file via .mockery.yaml or run addlicense on the generated mock paths
after $(MOCKERY) completes, while preserving the existing formatting step.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Enterprise
Run ID: 8cc963a8-4e89-45a1-94ce-f76b76734d9a
⛔ Files ignored due to path filters (1)
agent/go/go.sumis excluded by!**/*.sum
📒 Files selected for processing (9)
agent/go/.mockery.yamlagent/go/Makefileagent/go/deps.mkagent/go/go.modagent/go/internal/config/mock/SchemaValidator.goagent/go/internal/config/validate_test.goagent/go/internal/history/mock/Store.goagent/go/internal/interrupts/mock/Interrupt.goagent/go/internal/step/mock/Step.go
|
|
||
| GOLANGCI_LINT_VERSION ?= v2.12.2 | ||
| GINKGO_VERSION ?= v2.32.0 | ||
| MOCKERY_VERSION ?= v3.7.0 |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
printf '%s\n' '--- agent/go/deps.mk ---'
cat -n agent/go/deps.mk
printf '%s\n' '--- Makefile and mockery references ---'
rg -n -C 4 'MOCKERY_VERSION|mockery|generate-mocks' agent/go --glob '!*vendor*'
printf '%s\n' '--- repository metadata ---'
rg -n 'mockery' .github Makefile* agent/go 2>/dev/null || trueRepository: NVIDIA/nodewright
Length of output: 9434
🌐 Web query:
Mockery v3 MOCKERY_VERSION environment variable configuration fails when set official documentation
💡 Result:
The issue where setting the MOCKERY_VERSION environment variable causes Mockery v3 to fail is a documented, known behavior [1][2][3]. Mockery uses the Viper library for configuration management [1][3]. Viper is configured to automatically detect and map environment variables that align with Mockery's internal configuration structure [3]. Because Mockery has an internal configuration setting named version, Viper automatically maps the MOCKERY_VERSION environment variable to this setting [1][2]. When you set MOCKERY_VERSION (for example, in a Dockerfile or CI environment), Mockery attempts to parse that value into its internal version configuration [3]. Since this internal configuration expects a boolean value (e.g., true/false), providing a version string like 2.5.1 or 3.6.4 results in a parsing error and prevents Mockery from executing [3]. The official resolution is to rename the environment variable to something other than MOCKERY_VERSION (e.g., MOCKERY_INSTALL_VERSION) to avoid this collision [1][3].
Citations:
- 1: https://vektra.github.io/mockery/v3.6/faq/
- 2: https://vektra.github.io/mockery/v3.7/faq/
- 3: Mockery fails when the envvar 'MOCKERY_VERSION' is set to a value other than 'true' or 'false' vektra/mockery#391
🏁 Script executed:
#!/bin/bash
set -eu
printf '%s\n' '--- agent/go/Makefile ---'
cat -n agent/go/Makefile | sed -n '1,75p'
printf '%s\n' '--- GNU Make export behavior: command-line override ---'
make -f - MOCKERY_VERSION=v3.7.0 <<'MAKE'
.PHONY: probe
probe:
`@env` | grep '^MOCKERY_VERSION=' || true
MAKE
printf '%s\n' '--- GNU Make export behavior: command-line override plus unexport ---'
make -f - MOCKERY_VERSION=v3.7.0 <<'MAKE'
MOCKERY_VERSION ?= v3.7.0
unexport MOCKERY_VERSION
.PHONY: probe
probe:
`@if` env | grep '^MOCKERY_VERSION='; then exit 1; else echo 'MOCKERY_VERSION not exported'; fi
MAKE
printf '%s\n' '--- GNU Make export behavior: environment override plus unexport ---'
MOCKERY_VERSION=v3.7.0 make -f - <<'MAKE'
MOCKERY_VERSION ?= v3.7.0
unexport MOCKERY_VERSION
.PHONY: probe
probe:
`@if` env | grep '^MOCKERY_VERSION='; then exit 1; else echo 'MOCKERY_VERSION not exported'; fi
MAKERepository: NVIDIA/nodewright
Length of output: 3782
Keep MOCKERY_VERSION out of Mockery’s environment.
Mockery v3 maps this environment variable to its boolean version configuration. A version string causes Mockery to fail. Add unexport MOCKERY_VERSION after the assignment, or rename the Make variable.
Proposed fix
MOCKERY_VERSION ?= v3.7.0
+unexport MOCKERY_VERSION📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| MOCKERY_VERSION ?= v3.7.0 | |
| MOCKERY_VERSION ?= v3.7.0 | |
| unexport MOCKERY_VERSION |
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@agent/go/deps.mk` at line 23, Add `unexport MOCKERY_VERSION` immediately
after the `MOCKERY_VERSION` assignment in the Makefile, keeping the variable
available for Makefile expansion while preventing it from being passed to
Mockery’s environment.
2772b92 to
781de3a
Compare
781de3a to
965cfb7
Compare
|
Note GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer. |
965cfb7 to
7030867
Compare
|
Note GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer. |
7030867 to
cb1ee65
Compare
cb1ee65 to
550cabf
Compare
550cabf to
b66aa26
Compare
b66aa26 to
3f75318
Compare
Signed-off-by: Riley Rice <rrice@nvidia.com>
3f75318 to
b0005d2
Compare
Description
Adds reproducible Mockery tooling and generated test doubles for the interfaces used by the final Go agent orchestration layer.
Depends on #407.
Part of #219
Checklist
git commit -s) per the DCO.