Skip to content

Promote Develop to Main: ruff Helper Exclude, npm allow-scripts, and a pre-test Hook - #4270

Merged
ptr727 merged 3 commits into
mainfrom
develop
Nov 18, 2026
Merged

ptr727 merged 3 commits into
mainfrom
develop

Conversation

@ptr727

@ptr727 ptr727 commented Nov 18, 2026 •

Copy link
Copy Markdown
Owner

Summary

Promotes three changes from develop to main:

Open after release

Closes #4263
Closes #4264
Closes #4265

🤖 Generated with Claude Code

ptr727 and others added 3 commits November 18, 2026 12:53
## Summary

Closes #4263.

A downstream repository's own ruff config may be stricter than the
hub's. In a layout whose Python lives only in subdirectories, there is
no root config to hold an exclude, and every root config home breaks
something. The maintainer decided on 2026-11-18 that the exclude goes on
ruff's command line. Every ruff call that can reach the carried root
`hub_fetch_run.py` passes `--extend-exclude ./hub_fetch_run.py
--force-exclude`:

- the pre-commit and Husky.Net hook snippets
- the Python VS Code tasks snippet
- `validate-task.yml`'s lint and format steps, in every ruff form
- the `pypi-build-default` action's lint and format steps
- the `python-codestyle` skill's local development loop

The `./` anchors the pattern to ruff's working directory, so the hub's
own `catalog/snippets/hub_fetch_run.py` is still linted. The snippet
READMEs drop the per-repository config instruction. `RESYNC.md` and
`STANDUP.md` point at the one place the flags are explained.

## Verification

- With ruff 0.17.5 in a scratch layout: the root copy is skipped for
`check` and `format --check`, on a directory and on explicit paths. A
nested copy of the same name is still linted, and so is the root copy
when the flags are left off.
- A new test, `test_every_carried_ruff_call_skips_the_root_helper`,
reads every carried snippet call and the PyPI action. Removing the flags
from one hook line makes it fail. `test_release_guards.py`'s CI stub
cases assert the flags on each validator form.
- Full suite: 4493 tests, OK (12 skipped). `build_dist.py --check` is
current, and the prose gate passes with `--allow-comments`.

The `comments` label covers three comment lines. Each states a
constraint the code cannot carry, and the pre-commit one replaces five
lines with one.

## Findings from the local passes, fixed

The third pass raised two `introduced` findings on `RESYNC.md` step 6,
with the edit budget spent. Both were on its sentence telling a resync
to remove an existing ruff config exclude for the helper. That removal
could strip the exclusion from repository-owned ruff calls the resync
does not touch. The `force-exclude = true` it named also could not be
told apart from one the repository set itself. Both are fixed in
fe7b904, which drops the sentence, since a leftover config entry is
redundant with the flags and harms nothing. The fourth pass raised one
more, "A fleet repo" in the python-codestyle skill being false for the
hub, fixed in 81f9c5a. The fifth pass was clean. Copilot then noted the
skill's example blocks still showed bare ruff commands, fixed in
60291b7. The sixth pass found the skill names ruff outside that section
too, fixed in bc2168e by scoping the flags to every ruff command the
skill and its references name. The seventh pass was clean.

## Pre-existing findings, filed

- `pre-existing`, a carrier's type checker can reach the root helper,
and `mypy --strict` reports one error in it: #4266.

## Declined findings

- The VS Code ruff extension's format-on-save can rewrite the helper
when someone opens and saves it. Declined under `GOVERNANCE.md` "Trust
Boundaries and Hardening Effort". The helper is the maintainer's own
file, saving it is a deliberate act, and the result is a visible
formatting-only diff, neither silent nor destructive.

🤖 Generated with [Claude Code](https://claude.com/claude-code)


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

<!-- coderabbit-ai-generated:v1 -->

## Summary by CodeRabbit

* **Bug Fixes**
* Updated Python linting and formatting checks to consistently skip the
root `hub_fetch_run.py` helper, including when it is explicitly named.
* **Documentation**
* Updated setup guidance and editor tasks to reflect the Ruff exclusion
behavior. Nested files with the same name remain covered by linting.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
## Summary

Closes #4265.

A .NET caller of `validate-task.yml` had 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-deps` 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 a new opt-in caller hook,
`.github/actions/pre-test`, before `Setup .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 the
`install-test-deps` step relies on. `install-test-deps` keeps its own
contract. The maintainer chose this shape on 2026-11-18.

`docs/reusable-workflows.md` documents the hook in "The Hook Contract"
and the hooks table. It also states that every task finds a hook by its
`action.yml` alone, the one name each hub task's gate reads.

## Verification

- `tests/test_release_guards.py` gains
`test_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 and `uses:`. 42 tests OK.
- actionlint through `scripts/docker_lint.py`, ruff, and the prose gate
pass.
- The hub's own CI is unaffected, since the hub tracks no
`*Tests*.csproj` and carries no pre-test hook.
- End-to-end proof needs a caller. Once this is released,
ptr727/PhotoCleaner#277 adds `.github/actions/pre-test/action.yml` and
bumps its pin.

## Local passes

Three recorded passes.

- **First pass:** the step read only `action.yml`, while GitHub also
runs `action.yaml`. Fixed in ac0ba80 by checking both names here and at
the `install-test-deps` check.
- **Second pass:** every other hub task gate reads `action.yml` alone,
so that per-site fix left `validate-task.yml` inconsistent. No fleet
repository carries an `action.yaml` hook, so 7c04aac reverts ac0ba80
and documents the one name instead.
- **Third pass:** clean.

The `comments` label covers the new step's one comment line, which
states why the hook runs before the SDK setup.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
#4268)

## Summary

Closes #4264.

From npm 12 on, now npm's `latest`, a global install skips a package's
install scripts unless the `allow-scripts` config names that package.
`@opencode/cli` and `@anthropic-ai/claude-code` each carry a
`postinstall`. Without it the install still exits 0, so the installer
reports a clean step, but opencode then refuses to start.

Each npm install the agent installers run names the one package it
installs, as `npm install -g --allow-scripts=<pkg> <pkg>@latest`. That
covers:

- the Linux `package_step` upgrade
- the Windows `Get-PackageStep` upgrade, through a new
`Get-NpmInstallArgument` helper
- the Windows managed opencode install and its `Source` string

The flag allows that package's scripts for that one run and writes no
user config. bun installs are unchanged. The help texts and
`docs/host-setup.md` say the npm install allows the one package's
scripts.

## The open points the issue raised

- **Older npm:** the flag is harmless. Measured against the real
`@opencode/cli` from the registry in throwaway prefixes, npm 12.2.3,
11.21.3, 10.9.11 and 9.9.4 each install a working `opencode v2.3.2` with
no warning. Without the flag, npm 12.2.3 prints `had install scripts
blocked`, and `opencode --version` fails with `@opencode/cli's
postinstall script was not run`.
- **npm 11's warning:** under npm 11.19 to 11.21 the `install-scripts`
warning is advisory, and the scripts still run. The skipped-script
symptom is npm 12's.
- **Surfacing a remaining warning:** not added. With the flag, the
installed package's own scripts run and npm prints nothing. A transitive
dependency's warning still reaches the step's output as npm prints it.
- **Dry run and remedies:** `[dry run]`, `running:` and every `run:`
remedy print the full command, flag included, since each one is built
from the same arguments.

## Verification

- `tests/test_install_agents.py`: the npm command expectations carry the
flag, on both platforms, while the bun ones do not. 128 tests OK (1
skipped). `test_cli_usage.py`, `test_bootstrap.py` and
`test_host_gate.py` pass, as do `spec/validate.py`, shellcheck, shfmt,
PSScriptAnalyzer and the prose gate.
- **Native Linux:** an npm-owned codex sat in a throwaway global prefix
first on `PATH`. `install-agents.sh --upgrade --yes codex` ran `npm
install -g --allow-scripts=@openai/codex @openai/codex@latest` and moved
it from 0.169.1 to 0.170.0. A second run printed `Nothing changed`.
- **Windows is not verified natively.** The tests run the `.ps1` whole
under pwsh on Linux against stub tools. 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
printed.

## Local passes

Two recorded passes. The first raised four `introduced` findings, all
fixed in af7b03b:

- a Linux comment naming opencode, which never upgrades through npm
there
- the latest-tag rationale split away from the npm branch
- two help sentences over the length cap

The second pass was clean.

The `comments` label covers the new comment lines. Each states why the
flag is there, a reason the code cannot carry.

🤖 Generated with [Claude Code](https://claude.com/claude-code)


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

<!-- coderabbit-ai-generated:v1 -->

## Summary by CodeRabbit

* **New Features**
* npm-managed agent installs and upgrades now allow the selected
package’s install scripts to run, including when upgrading to the latest
version. This also applies to OpenCode installs on Windows.

* **Documentation**
* Updated setup guidance and command help to describe npm’s
install-script behavior and the latest-tag install behavior.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
Copilot AI lite review requested due to automatic review settings November 18, 2026 22:57
@coderabbitai

coderabbitai Bot commented Nov 18, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

You'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 22 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 884ffbd and c76e275.

Files ignored due to path filters: 3

  • .claude-plugin/fleet-skills/.source-digests/python-codestyle is excluded by !.claude-plugin/fleet-skills/**
  • .claude-plugin/fleet-skills/skills/python-codestyle/SKILL.md is excluded by !.claude-plugin/fleet-skills/**
  • .github/skills/python-codestyle/SKILL.md is excluded by !.github/skills/**
Files selected for processing: 17

  • .agents/skills/python-codestyle/SKILL.md
  • .github/actions/pypi-build-default/action.yml
  • .github/workflows/validate-task.yml
  • RESYNC.md
  • STANDUP.md
  • catalog/snippets/configs/vscode-tasks-python.json
  • catalog/snippets/husky/README.md
  • catalog/snippets/husky/pre-commit
  • catalog/snippets/pre-commit/.pre-commit-config.yaml
  • catalog/snippets/pre-commit/README.md
  • docs/host-setup.md
  • docs/reusable-workflows.md
  • host-setup/linux/install-agents.sh
  • host-setup/windows/install-agents.ps1
  • tests/test_hub_fetch_run.py
  • tests/test_install_agents.py
  • tests/test_release_guards.py
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

Copilot AI 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.

🔵 Needs a closer look

Approval should wait for native Windows validation of the revised npm argument handling, ownership, PATH, postinstall behavior, and downstream caller hook, since Linux-hosted PowerShell stubs do not verify those paths end to end.

No open issues 🎉

What changed in this PR

This pull request promotes coordinated fleet updates for Ruff exclusions, npm install-script execution, and an opt-in pre-test hook in the reusable validation workflow.

Changes:

  • Excludes the carried root hub_fetch_run.py from Ruff checks across snippets, CI, actions, and Python guidance.
  • Allows install scripts for the exact npm package being installed on Linux and Windows.
  • Adds and documents a caller-owned pre-test hook before .NET SDK setup and unit tests.
  • Updates tests and documentation for the new behavior.
File Description
tests/​test_release_guards.py Tests Ruff arguments and pre-test hook ordering.
tests/​test_install_agents.py Updates Linux and Windows npm command expectations.
tests/​test_hub_fetch_run.py Verifies carried Ruff calls exclude the root helper.
STANDUP.md Documents the required Ruff flags during hook setup.
RESYNC.md Documents Ruff flag updates during resynchronization.
host-setup/​windows/​install-agents.ps1 Adds package-scoped npm install-script allowances.
host-setup/​linux/​install-agents.sh Adds package-scoped npm allowances during upgrades.
docs/​reusable-workflows.md Documents the pre-test hook contract and path.
docs/​host-setup.md Documents npm install-script behavior.
catalog/​snippets/​pre-commit/​README.md Documents command-line Ruff exclusions.
catalog/​snippets/​pre-commit/​.pre-commit-config.yaml Adds Ruff exclusion flags to pre-commit entries.
catalog/​snippets/​husky/​README.md Documents Ruff exclusions in the Husky hook.
catalog/​snippets/​husky/​pre-commit Adds Ruff exclusion flags to Husky commands.
catalog/​snippets/​configs/​vscode-tasks-python.json Adds Ruff exclusion flags to Python tasks.
.github/​workflows/​validate-task.yml Adds Ruff exclusions and invokes the caller pre-test hook.
.github/​skills/​python-codestyle/​SKILL.md Updates generated Python Ruff command guidance.
.github/​actions/​pypi-build-default/​action.yml Adds Ruff exclusions to PyPI validation.
.claude-plugin/​fleet-skills/​skills/​python-codestyle/​SKILL.md Updates the generated Claude Python skill copy.
.claude-plugin/​fleet-skills/​.source-digests/​python-codestyle Refreshes the generated skill digest.
.agents/​skills/​python-codestyle/​SKILL.md Updates the canonical Python development guidance.

Review effort: Lite

@codecov

codecov Bot commented Nov 18, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 78.46%. Comparing base (3bd10de) to head (c76e275).
⚠️ Report is 508 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #4270   +/-   ##
=======================================
  Coverage   78.46%   78.46%           
=======================================
  Files          42       42           
  Lines       15434    15434           
=======================================
  Hits        12110    12110           
  Misses       3324     3324           
Flag Coverage Δ
python-3.13 78.46% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@ptr727

ptr727 commented Nov 18, 2026

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@ptr727

ptr727 commented Nov 18, 2026

Copy link
Copy Markdown
Owner Author

/review

@coderabbitai

coderabbitai Bot commented Nov 18, 2026 •

Copy link
Copy Markdown
Action not completed

Review rate limited.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@ptr727

ptr727 commented Nov 18, 2026

Copy link
Copy Markdown
Owner Author

Answering the Copilot round on c76e275 (#4270 (review)), whose headline counts no finding (0) and reads: "Approval should wait for native Windows validation of the revised npm argument handling, ownership, PATH, postinstall behavior, and downstream caller hook, since Linux-hosted PowerShell stubs do not verify those paths end to end."

No change needed. The fleet's host-tool procedure ships a change whose platform is unavailable with that platform's native check handed to the operator rather than blocking on it. The exact Windows commands and expected output are in this body under "Open after release". What changed on Windows is only the npm argument list: ownership and PATH handling are untouched, and a real (not dry-run) pwsh run of -Install -Yes opencode asserts npm receives install -g --allow-scripts=@opencode/cli @opencode/cli whole. The flag itself was measured against the real @opencode/cli on npm 9.9.4, 10.9.11, 11.21.3 and 12.2.3, each installing a working binary. Without it, npm 12 already leaves a Windows opencode unable to start while the step reports clean. The caller hook's end-to-end proof is ptr727/PhotoCleaner#277, which needs this release first.

@ptr727
ptr727 merged commit a1fa51c into main Nov 18, 2026
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants