Skip to content

Feat(linting): Prepare Rust and Node.js toolchains - #67

Merged
askb merged 1 commit into
lfreleng-actions:mainfrom
modeseven-lfreleng-actions:feat/linting-toolchain-inputs
Oct 15, 2026
Merged

askb merged 1 commit into
lfreleng-actions:mainfrom
modeseven-lfreleng-actions:feat/linting-toolchain-inputs

Conversation

@ModeSevenIndustrialSolutions

@ModeSevenIndustrialSolutions ModeSevenIndustrialSolutions commented Oct 12, 2026 •

Copy link
Copy Markdown
Member

Summary

Moves the linting workflow's executor from standalone-linting-action
v0.6.0 to v0.8.0. It also forwards the new toolchain inputs,
so language: system hooks for Rust and Node.js projects run in CI.
Closes #66.

  • v0.7.0 (#183): rust_toolchain_setup prepares the toolchain
    rust-toolchain.toml pins, for cargo fmt / cargo clippy hooks.
  • v0.8.0 (#185): node_setup selects Node.js and installs the
    project's dependencies frozen to its lockfile (npm, Yarn, pnpm or
    Bun), for eslint, prettier and tsc hooks.

Both default to auto. They act only on a repository that tracks a
Cargo.toml or package.json under path_prefix, so every other
caller is unaffected. Between v0.6.0 and v0.8.0, the executor's
action.yaml diff only adds inputs and outputs; no existing input or
default changed.

Changes

  • .github/workflows/linting.yaml
    • New inputs: rust_toolchain_setup, rust_components,
      node_setup, node_version, node_install_scripts. They use
      the executor's names and defaults; node_install_scripts is a
      boolean, rendered to 'true'/'false' like per_hook_runs.
    • The plan job validates them to the executor's own rules, so a
      bad value fails once before any hook rather than in every lint
      job. The rules are verdict functions in the extracted
      input_rules region, so the fixture suite reaches them.
    • The executor is pinned to the v0.8.0 commit
      c63239ab493b3ddb506524143c34a723880d3e3c, not the annotated tag
      object c408a14…. The release-history comment is extended.
  • docs/linting.md: a new Project toolchains section. It
    covers what each language prepares, how to opt out or require
    preparation, and the cost split_hooks multiplies (one dependency
    install per lint job). It also notes the timeout a large project
    may need. The inputs table gains five rows.
  • tests/test-locate-rules.sh: 38 table cases for the three
    verdicts. They cover accepted forms, ranges, option-shaped values,
    shell metacharacters and control characters.
  • tests/test-lint-plan.sh: a wiring check per input. It is
    declared with the executor's type and default, forwarded verbatim
    in the executor step's with:, and (for the string inputs) handed
    to the plan validation. The self-test jobs can't catch a dropped
    forwarding line by themselves, since the executor shares the
    defaults.
  • Self-test fixtures and jobs (linting-action.yaml): two jobs
    run fixture projects through the workflow with every toolchain
    input at its default, selecting each fixture's ci.skip hooks.
    • tests/fixtures/rust pins toolchain 1.90.0 with the minimal
      profile. Its cargo fmt and cargo clippy hooks run with
      RUSTUP_AUTO_INSTALL=0, so they pass only when the executor
      installed that toolchain plus the forwarded rustfmt and
      clippy components.
    • tests/fixtures/node pins prettier in its lockfile. Its hook
      runs npx --no-install prettier, so it passes only after the
      executor's frozen install.
    • Lockfiles and other comment-less fixture files are licensed
      through a new REUSE.toml, and build output is git-ignored.
    • Side effect: Rust detection is recursive, so the three existing
      .-prefixed self-test jobs also prepare the runner's
      preinstalled stable toolchain. That is a rustup check, not a
      download.

Egress

Not changed here. #65 moved the workflow onto the organisation
allow-list (.github v0.17.1), which already carries every host
preparation reaches: static.rust-lang.org and the crates.io hosts,
nodejs.org, registry.npmjs.org, registry.yarnpkg.com and
repo.yarnpkg.com (added in lfreleng-actions/.github#268). That
matters because the ci.skip self-test now runs under block and,
with Rust detection being recursive, also prepares the stable
toolchain. The default egress policy stays audit.

Validation

  • tests/test-locate-rules.sh: 150 passed (112 on main), under
    both bash 5 and bash 3.2.
  • Both fixture configurations pass through prek locally once
    prepared. The Rust fixture fails on a bare minimal toolchain
    (cargo-fmt is not installed), which is what gives its job teeth.
  • The extracted plan validation step was also run against 18
    scratch cases: defaults pass, and every invalid form fails with
    the intended message.
  • tests/test-lint-plan.sh: 180 passed (175 before). Deleting
    node_setup from the executor with:, changing the
    rust_components default, or rewiring INPUT_NODE_VERSION each
    fails exactly one case, naming the input.
  • tests/test-relax-matches.sh (52) passes.
  • prek passes on every file the branch changes.
  • zizmor --persona auditor reports no findings on both workflows.
  • aislop ci --changes --base upstream/main is clean.
  • markdown-table-fixer reports no issues.

This comment was marked as outdated.

Copilot AI balanced review requested due to automatic review settings October 12, 2026 13:50

This comment was marked as outdated.

Copilot AI balanced review requested due to automatic review settings October 12, 2026 13:59

This comment was marked as outdated.

@ModeSevenIndustrialSolutions
ModeSevenIndustrialSolutions marked this pull request as draft October 12, 2026 14:08
Hooks declared 'language: system' run the project's own tools: cargo
fmt and clippy need the toolchain rust-toolchain.toml pins, and
eslint, prettier and tsc need the project's node_modules. Repositories
list them under ci.skip because pre-commit.ci cannot prepare them, and
this workflow could not either.

standalone-linting-action v0.7.0 and v0.8.0 added that preparation.
Move the executor pin from v0.6.0 to v0.8.0 and forward its five new
inputs (rust_toolchain_setup, rust_components, node_setup,
node_version, node_install_scripts) with the executor's defaults, so
'auto' prepares a project that tracks a Cargo.toml or package.json and
leaves every other repository as it was. The plan job validates the
values to the executor's own rules, so a typo fails once before any
hook rather than once per lint job.

The rules live in the input_rules region as verdict functions, which
tests/test-locate-rules.sh extracts and drives with table fixtures
(38 new cases, accepted and hostile forms alike).
tests/test-lint-plan.sh adds a wiring check per input: declared with
the executor's default, forwarded verbatim to the executor step, and
handed to the plan job's validation.

Two self-test jobs run fixture projects through the workflow with
every toolchain input at its default, selecting each fixture's
ci.skip hooks:

- tests/fixtures/rust pins toolchain 1.90.0, minimal profile, and its
  cargo fmt / clippy hooks run with RUSTUP_AUTO_INSTALL=0, so they
  pass only when the executor installed that toolchain and the
  forwarded rustfmt and clippy components.
- tests/fixtures/node pins prettier in its lockfile, and its hook
  runs 'npx --no-install prettier', so it passes only after the
  executor's frozen install.

Egress is unchanged here: lfreleng-actions#65 moved
block mode onto the organisation allow-list, which already carries the
Rust, Node.js and Yarn hosts these steps reach, including for the
ci.skip self-test that now runs under 'block'.

docs/linting.md gains a Project toolchains section, including the
cost split_hooks multiplies (one install per lint job) and the
timeout a large project may need.

Copilot review: all findings addressed. The validation moved into
the extracted region with permanent fixtures; the fixture jobs
demonstrate both preparation paths end to end; and because the
executor shares the workflow's defaults, so those jobs alone could
not see a dropped forwarding line, the wiring check pins the
executor's with: block directly.

Closes: lfreleng-actions#66
Co-authored-by: Claude <noreply@anthropic.com>
Signed-off-by: Matthew Watkins <mwatkins@linuxfoundation.org>
@ModeSevenIndustrialSolutions
ModeSevenIndustrialSolutions marked this pull request as ready for review October 15, 2026 00:52
Copilot AI balanced review requested due to automatic review settings October 15, 2026 00:52

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔵 Needs a closer look

Default toolchain preparation changes existing callers’ execution and network behavior, warranting final human review.

0 open findings

Files not reviewed (1)
  • tests/fixtures/node/package-lock.json: Generated file

🧠 Review effort: Balanced

@askb
askb merged commit 568e672 into lfreleng-actions:main Oct 15, 2026
24 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feat: Pass toolchain inputs to standalone linting

3 participants