Repository navigation
Add a Caller pre-test Hook That Runs Before the .NET Unit Tests - #4269
Conversation
A .NET caller of validate-task.yml had no step of its own before its unit tests, so a test that shells out to a system tool such as exiftool or ffmpeg skipped or failed in CI. The install-test-deps hook runs per Python leg after the .NET tests, and the validate hook runs in another job on another runner. Each unit-test leg now runs the caller's .github/actions/pre-test composite action before the .NET SDK setup, where a .NET test project exists and the caller carries the hook. It takes no inputs and reports nothing back, and a caller without it is unaffected. install-test-deps keeps its own contract. Closes #4265 Co-Authored-By: Claude Opus 5.5 <[email protected]>
GitHub runs a local action from action.yml or action.yaml, so the pre-test step and the install-test-deps check each look for both. A caller whose hook was action.yaml had its pre-test step skipped, or a false missing-hook error. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Every hub task gate reads a caller hook as action.yml, and no fleet repository carries an action.yaml hook, so the two-name check is reverted for consistency and the hook contract states the one name instead. This reverts commit ac0ba80. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 50 minutes. View limit details
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. |
|
A recorded local strict-review pass covers head |
There was a problem hiding this comment.
🔵 Needs a closer look
Defer until a downstream .NET caller exercises the reusable workflow and confirms the local composite action installs the required system tool before tests, since this hub cannot verify that end-to-end behavior.
No open issues 🎉
What changed in this PR
Adds an optional caller-owned pre-test hook to reusable validation so .NET callers can install system tools before SDK setup and unit tests.
Changes:
- Runs the pre-test hook when .NET test projects and the caller hook are present.
- Documents the hook contract and
action.ymldiscovery rule. - Adds regression coverage for the hook's gate and execution order.
| File | Description |
|---|---|
| tests/test_release_guards.py | Adds regression coverage verifying the pre-test hook's exact gate and placement before .NET setup and unit tests. |
| docs/reusable-workflows.md | Documents the pre-test hook contract, discovery rule, behavior, and hook catalog entry. |
| .github/workflows/validate-task.yml | Runs the optional caller pre-test hook before .NET SDK setup and unit tests when applicable. |
Review effort: Lite
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #4269 +/- ##
===========================================
- Coverage 81.60% 78.46% -3.15%
===========================================
Files 26 42 +16
Lines 9070 15434 +6364
===========================================
+ Hits 7402 12110 +4708
- Misses 1668 3324 +1656
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
@coderabbitai review |
|
/review |
Action not completed
|
|
Answering the Copilot round on 7c04aac (#4269 (review)), whose headline counts no finding (0) and reads: "Defer until a downstream .NET caller exercises the reusable workflow and confirms the local composite action installs the required system tool before tests, since this hub cannot verify that end-to-end behavior." No change needed. The hub tracks no |
…a pre-test Hook (#4270) ## Summary Promotes three changes from develop to main: - #4267: every ruff call that can reach a downstream repository's root `hub_fetch_run.py` passes `--extend-exclude ./hub_fetch_run.py --force-exclude`. That covers the hook snippets, the Python VS Code tasks, `validate-task.yml`, the `pypi-build-default` action and the `python-codestyle` skill. No repository adds the helper to its own ruff config. - #4268: each npm install the agent installers run passes `--allow-scripts=<pkg>` for the one package it installs. npm 12 otherwise skips the package's `postinstall`, which leaves opencode unable to start while the step reports clean. - #4269: a new opt-in caller hook, `.github/actions/pre-test`, runs in each `unit-test` leg before the .NET SDK setup, where a .NET test project exists and the caller carries the hook. ptr727/PhotoCleaner#277 is waiting on it. ## Open after release - **Native Windows check of #4268.** On a Windows host with an npm-owned opencode, run `host-setup\windows\install-agents.ps1 -Upgrade -DryRun opencode`. Expect `npm install -g --allow-scripts=@opencode/cli @opencode/cli@latest`. Then run `-Upgrade opencode`, and expect `opencode --version` to answer with no `install-scripts` warning. Linux was verified natively, and the flag was measured against the real package on npm 9 through 12. - **Downstream proof of #4269.** ptr727/PhotoCleaner#277 adds the hook and bumps its pin once this is released. Closes #4263 Closes #4264 Closes #4265 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Summary
Closes #4265.
A .NET caller of
validate-task.ymlhad no step of its own before its unit tests. A test that shells out to a system tool, such as exiftool or ffmpeg, therefore skipped or failed in CI.install-test-depsruns per Python leg after the .NET tests, and thevalidatehook runs in another job on another runner.Each
unit-testleg now runs a new opt-in caller hook,.github/actions/pre-test, beforeSetup .NET SDK step. It runs where a .NET test project (**/*Tests*.csproj) exists and the caller carries the hook. It takes no inputs and reports nothing back. A caller without the hook is unaffected, since the step skips, the same pattern theinstall-test-depsstep relies on.install-test-depskeeps its own contract. The maintainer chose this shape on 2026-11-18.docs/reusable-workflows.mddocuments the hook in "The Hook Contract" and the hooks table. It also states that every task finds a hook by itsaction.ymlalone, the one name each hub task's gate reads.Verification
tests/test_release_guards.pygainstest_validator_pre_test_hook_runs_before_the_dotnet_tests. It asserts the order (checkout, pre-test hook, .NET SDK setup, unit tests) and the step's exact gate anduses:. 42 tests OK.scripts/docker_lint.py, ruff, and the prose gate pass.*Tests*.csprojand carries no pre-test hook..github/actions/pre-test/action.ymland bumps its pin.Local passes
Three recorded passes.
action.yml, while GitHub also runsaction.yaml. Fixed in ac0ba80 by checking both names here and at theinstall-test-depscheck.action.ymlalone, so that per-site fix leftvalidate-task.ymlinconsistent. No fleet repository carries anaction.yamlhook, so 7c04aac reverts ac0ba80 and documents the one name instead.The
commentslabel covers the new step's one comment line, which states why the hook runs before the SDK setup.🤖 Generated with Claude Code