Skip to content

Fix test execution and lint tooling#14

Merged
satococoa merged 3 commits intomainfrom
codex/fix-test-execution
Apr 3, 2026
Merged

Fix test execution and lint tooling#14
satococoa merged 3 commits intomainfrom
codex/fix-test-execution

Conversation

@satococoa
Copy link
Copy Markdown
Owner

@satococoa satococoa commented Apr 2, 2026

Summary

  • use a dedicated fixture file in integration tests
  • make Make targets use repo-local Go caches and install a pinned golangci-lint into
  • remove obsolete hook command/docs/tests and stabilize the gitexec stderr assertion

Testing

  • make ci

Summary by CodeRabbit

  • Breaking Changes

    • Removed the hook subcommand and all hook path/print functionality.
  • Documentation

    • Removed hook-related docs and updated post-checkout hook setup; noted that make lint installs a pinned linter into the local cache on first run (network required).
  • Chores

    • Build/test tooling now uses isolated cache/tmp/bin dirs and auto-installs a pinned linter.
  • Tests

    • Tests updated to use a per-test include filename and removed hook-related tests.
  • Repository

    • Added .cache/ to .gitignore.

Copilot AI review requested due to automatic review settings April 2, 2026 16:14
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 2, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 082f07a9-e73d-4bcd-b364-0295d28606fd

📥 Commits

Reviewing files that changed from the base of the PR and between 42a61f3 and 5ecf6ba.

📒 Files selected for processing (2)
  • Makefile
  • internal/gitexec/gitexec_test.go
✅ Files skipped from review due to trivial changes (1)
  • internal/gitexec/gitexec_test.go
🚧 Files skipped from review as they are similar to previous changes (1)
  • Makefile

📝 Walkthrough

Walkthrough

This PR removes the CLI hook subcommand and the internal/hooks package, deletes Engine.HookPath, updates tests to use a per-test include filename, adds .cache/ to .gitignore, and refactors the Makefile to pin golangci-lint and use explicit Go cache/tmp/bin dirs for vet/lint/test targets.

Changes

Cohort / File(s) Summary
Gitignore
./.gitignore
Added .cache/ to ignore the cache directory.
Makefile / Build tooling
Makefile
Added GO_TEST_CACHE_DIR, GO_TEST_TMP_DIR, GO_BIN_DIR, GOLANGCI_LINT_CACHE_DIR, GO_RUN_ENV, LINT_RUN_ENV, GOLANGCI_LINT_VERSION, GOLANGCI_LINT; updated GOFILES to filter existing *.go; create cache/tmp/bin dirs; added on-demand install target for pinned golangci-lint; run vet/lint/test/test-race with pinned env.
README
README.md
Removed hook subcommand docs; replaced hook-generation step with inline heredoc for post-checkout; documented that make lint installs a pinned linter into .cache/bin.
CLI implementation
internal/cli/cli.go
Removed registration and implementation of the hook subcommand and related helpers; removed internal/hooks import.
CLI tests
internal/cli/cli_integration_test.go, internal/cli/cli_unit_test.go
Deleted tests covering hook subcommands; integration tests introduce const testIncludeFile = ".test.worktreeinclude" and pass --include where applicable.
Engine implementation & tests
internal/engine/engine.go, internal/engine/engine_integration_test.go
Removed (*Engine).HookPath(...); renamed TestEngineDoctorAndHookPathTestEngineDoctor and removed HookPath assertions; integration tests use testIncludeFile.
Hooks package
internal/hooks/hooks.go, internal/hooks/hooks_test.go
Deleted the hooks package file and its tests, removing exported PrintSnippet.
Git exec test
internal/gitexec/gitexec_test.go
Adjusted TestRunnerRunIncludesCommandAndStderr to initialize a temp repo and expect an invalid-git-command error for a bad subcommand.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Poem

🐰 I nudged the hooks right out the door,

Cache bins tucked beneath .cache's floor,
Tests don tiny .test.worktreeinclude hat,
Linter pinned, build paths tidy and flat,
A rabbit hops—clean trees, and that's that.

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Fix test execution and lint tooling' is partially related to the changeset—it accurately describes improvements to test execution and build tooling (Makefile changes), but omits the significant removal of the hook subcommand and related code, which represents a major portion of the changes.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ 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 codex/fix-test-execution

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 and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
Makefile (1)

40-45: Optional DRY cleanup: reuse GO_RUN_ENV in test targets.

test and test-race duplicate env assignments already captured by GO_RUN_ENV.

Suggested diff
 test:
 	`@mkdir` -p "$(GO_TEST_CACHE_DIR)" "$(GO_TEST_TMP_DIR)"
-	GOCACHE="$(GO_TEST_CACHE_DIR)" GOTMPDIR="$(GO_TEST_TMP_DIR)" go test ./...
+	$(GO_RUN_ENV) go test ./...
 
 test-race:
 	`@mkdir` -p "$(GO_TEST_CACHE_DIR)" "$(GO_TEST_TMP_DIR)"
-	GOCACHE="$(GO_TEST_CACHE_DIR)" GOTMPDIR="$(GO_TEST_TMP_DIR)" go test -race ./...
+	$(GO_RUN_ENV) go test -race ./...
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@Makefile` around lines 40 - 45, The test targets duplicate the environment
setup; refactor the test and test-race targets to use the existing GO_RUN_ENV
variable instead of repeating GOCACHE and GOTMPDIR assignments. Modify the test
and test-race rules to call GO_RUN_ENV (which should include
GOCACHE="$(GO_TEST_CACHE_DIR)" GOTMPDIR="$(GO_TEST_TMP_DIR)") before the go test
./... command; update references to GO_TEST_CACHE_DIR and GO_TEST_TMP_DIR only
within GO_RUN_ENV so the targets simply invoke GO_RUN_ENV go test ./... using
the same behavior.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@Makefile`:
- Around line 40-45: The test targets duplicate the environment setup; refactor
the test and test-race targets to use the existing GO_RUN_ENV variable instead
of repeating GOCACHE and GOTMPDIR assignments. Modify the test and test-race
rules to call GO_RUN_ENV (which should include GOCACHE="$(GO_TEST_CACHE_DIR)"
GOTMPDIR="$(GO_TEST_TMP_DIR)") before the go test ./... command; update
references to GO_TEST_CACHE_DIR and GO_TEST_TMP_DIR only within GO_RUN_ENV so
the targets simply invoke GO_RUN_ENV go test ./... using the same behavior.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 39e26924-adca-44d3-8a6d-1ae29d82ed78

📥 Commits

Reviewing files that changed from the base of the PR and between 243ecb1 and e5c5e2d.

📒 Files selected for processing (11)
  • .gitignore
  • Makefile
  • README.md
  • internal/cli/cli.go
  • internal/cli/cli_integration_test.go
  • internal/cli/cli_unit_test.go
  • internal/engine/engine.go
  • internal/engine/engine_integration_test.go
  • internal/gitexec/gitexec_test.go
  • internal/hooks/hooks.go
  • internal/hooks/hooks_test.go
💤 Files with no reviewable changes (5)
  • internal/hooks/hooks_test.go
  • internal/hooks/hooks.go
  • internal/cli/cli_unit_test.go
  • internal/cli/cli.go
  • internal/engine/engine.go

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR focuses on stabilizing CI/local developer workflows by adjusting integration test fixtures, simplifying hook-related surface area, and making lint/test tooling more reproducible via repo-local caches and a pinned linter binary.

Changes:

  • Update integration tests to use a dedicated include fixture file (.test.worktreeinclude) instead of .worktreeinclude.
  • Pin and auto-install golangci-lint into .cache/bin and run Go tooling with repo-local GOCACHE/GOTMPDIR.
  • Remove the obsolete hook CLI command and related engine/hooks code and tests; adjust related docs and assertions.

Reviewed changes

Copilot reviewed 10 out of 11 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
README.md Removes hook command docs and documents manual post-checkout hook setup; notes pinned linter install behavior.
Makefile Adds repo-local Go cache/tmp dirs and installs a pinned golangci-lint into .cache/bin for make lint.
internal/hooks/hooks.go Removes hook snippet generation helper (feature removed).
internal/hooks/hooks_test.go Removes tests for hook snippet generation (feature removed).
internal/gitexec/gitexec_test.go Adjusts stderr assertion by using an invalid git subcommand in a real repo.
internal/engine/engine.go Removes HookPath functionality (feature removed).
internal/engine/engine_integration_test.go Switches integration tests to use .test.worktreeinclude fixture file.
internal/cli/cli.go Removes hook subcommand wiring and related helpers.
internal/cli/cli_unit_test.go Removes unit tests for hook print (feature removed).
internal/cli/cli_integration_test.go Updates CLI integration tests to pass --include .test.worktreeinclude; removes hook integration tests.
.gitignore Ignores .cache/ for the new repo-local caches/binaries.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Makefile Outdated
Comment on lines +32 to +37
$(GOLANGCI_LINT):
@mkdir -p "$(GO_TEST_CACHE_DIR)" "$(GO_TEST_TMP_DIR)" "$(GO_BIN_DIR)"
GOBIN="$(GO_BIN_DIR)" $(GO_RUN_ENV) go install github.com/golangci/golangci-lint/v2/cmd/golangci-lint@$(GOLANGCI_LINT_VERSION)

lint: $(GOLANGCI_LINT)
$(GO_RUN_ENV) $(GOLANGCI_LINT) run
Copy link

Copilot AI Apr 2, 2026

Choose a reason for hiding this comment

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

The $(GOLANGCI_LINT) target is just the binary path, so if GOLANGCI_LINT_VERSION changes later, make lint may keep using the previously installed binary because the file already exists and the rule won’t re-run. Consider versioning the installed path (e.g., include the version in the filename) or writing a small stamp file keyed by $(GOLANGCI_LINT_VERSION) so bumps reliably trigger a reinstall.

Copilot uses AI. Check for mistakes.
Comment on lines 89 to 90
if !strings.Contains(msg, "is not a git command") {
t.Fatalf("error should include git stderr, got %q", msg)
Copy link

Copilot AI Apr 2, 2026

Choose a reason for hiding this comment

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

This test matches a specific substring from Git’s stderr ("is not a git command"), which can vary across Git versions/builds and with localization settings, making the test potentially flaky. A more robust assertion would be to check that the error includes the invoked command context (already done) and that the stderr portion is non-empty / includes the unknown subcommand name, without depending on the exact phrasing.

Suggested change
if !strings.Contains(msg, "is not a git command") {
t.Fatalf("error should include git stderr, got %q", msg)
if !strings.Contains(msg, "definitely-not-a-command") {
t.Fatalf("error should mention unknown subcommand, got %q", msg)

Copilot uses AI. Check for mistakes.
@satococoa satococoa merged commit 435ee07 into main Apr 3, 2026
5 checks passed
@satococoa satococoa deleted the codex/fix-test-execution branch April 3, 2026 14:07
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.

2 participants