Skip to content

test(agent): add generated interface mocks - #408

Open
rice-riley wants to merge 1 commit into
agent-step-execution-219from
agent-mocks-219
Open

test(agent): add generated interface mocks#408
rice-riley wants to merge 1 commit into
agent-step-execution-219from
agent-mocks-219

Conversation

@rice-riley

Copy link
Copy Markdown
Member

Description

Adds reproducible Mockery tooling and generated test doubles for the interfaces used by the final Go agent orchestration layer.

  • Adds an agent-specific Mockery configuration for config validation, history, interrupts, and steps.
  • Pins Mockery and exposes make generate-mocks through the component toolchain.
  • Checks in generated testify mocks and the required module dependencies.
  • Replaces the hand-written schema-validator fake with the generated mock.

Depends on #407.
Part of #219

Checklist

  • I am familiar with the Contributing Guidelines.
  • My commits are signed off (git commit -s) per the DCO.
  • New or existing tests cover these changes.
  • The documentation is up to date with these changes.

@github-actions github-actions Bot added component/operator Skyhook operator (controller-manager) component/agent Skyhook agent (package executor) component/ci CI workflows, GitHub Actions, and repo tooling labels Aug 4, 2026
@coderabbitai

coderabbitai Bot commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Note

Reviews paused

It 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 reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Added Mockery tooling and Testify dependencies. Added generated mocks for SchemaValidator, Store, Interrupt, and Step. Updated the schema-validation test to use MockSchemaValidator instead of a local fake implementation.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Suggested reviewers: lockwobr, ayuskauskas

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: adding generated interface mocks for agent tests.
Description check ✅ Passed The description directly explains the Mockery tooling, generated mocks, dependencies, and test fake replacement.
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 agent-mocks-219

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

@rice-riley
rice-riley requested a review from a team August 4, 2026 19:55

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

📥 Commits

Reviewing files that changed from the base of the PR and between d8efce7 and 2772b92.

⛔ Files ignored due to path filters (1)
  • agent/go/go.sum is excluded by !**/*.sum
📒 Files selected for processing (9)
  • agent/go/.mockery.yaml
  • agent/go/Makefile
  • agent/go/deps.mk
  • agent/go/go.mod
  • agent/go/internal/config/mock/SchemaValidator.go
  • agent/go/internal/config/validate_test.go
  • agent/go/internal/history/mock/Store.go
  • agent/go/internal/interrupts/mock/Interrupt.go
  • agent/go/internal/step/mock/Step.go

Comment thread agent/go/deps.mk

GOLANGCI_LINT_VERSION ?= v2.12.2
GINKGO_VERSION ?= v2.32.0
MOCKERY_VERSION ?= v3.7.0

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 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 || true

Repository: 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:


🏁 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
MAKE

Repository: 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.

Suggested change
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.

Comment thread agent/go/Makefile
@coderabbitai

coderabbitai Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

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.

@coderabbitai

coderabbitai Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

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.

Signed-off-by: Riley Rice <rrice@nvidia.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

component/agent Skyhook agent (package executor) component/ci CI workflows, GitHub Actions, and repo tooling component/operator Skyhook operator (controller-manager)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants