Repository navigation
feat(hooks): shellcheck the run bodies of composite actions - #1718
Merged
Merged
Conversation
A step whose `shell:` is neither a checked shell nor a known non-shell must not drop out of the gate silently. Refs: #1704
`python`, `pwsh`, `powershell`, `cmd` and `node` are skipped silently; any other `shell:` outside the checked set (a typo, a custom template) prints a stderr note naming the file and step. Refs: #1704
…ck hook A preserved `.pre-commit-config.yaml` only gains a new hook through an insert row, which lands with the release that first ships it. Refs: #1704
Closed
2 tasks
c-vigo
added a commit
that referenced
this pull request
Sep 25, 2026
…ain (#1723) ## Description #1718 added the scaffolded `shellcheck-composite-actions` hook. A consumer whose `.pre-commit-config.yaml` is preserved receives a new hook only through `inserted_hook_blocks()` in `assets/init-workspace.sh`, whose rows are keyed on the *first release that ships the hook*. That version is a literal nothing else checks, trains have been renamed mid-flight twice, and a stale number either under-inserts or re-adds a hook a consumer deleted. The row for the new hook therefore goes on the release branch once the version is fixed (#1717 stays open for that). What can land now is the guard against forgetting: the Phase 1 prerequisites in `docs/RELEASE_CYCLE.md` gain one bullet — re-check the table's rows against the version being cut — so the lesson is a repo artefact rather than session memory. Triage notes on the issue confirm the mechanism already accepts a hook with no feature group and extracts the block structurally, so no code change is needed on `dev`. ## Type of Change - [ ] `feat` -- New feature - [ ] `fix` -- Bug fix - [x] `docs` -- Documentation only - [ ] `chore` -- Maintenance task (deps, config, etc.) - [ ] `refactor` -- Code restructuring (no behavior change) - [ ] `test` -- Adding or updating tests - [ ] `ci` -- CI/CD pipeline changes - [ ] `build` -- Build system or dependency changes - [ ] `revert` -- Reverts a previous commit - [ ] `style` -- Code style (formatting, whitespace) ### Modifiers - [ ] Breaking change (`!`) -- This change breaks backward compatibility ## Changes Made `docs/RELEASE_CYCLE.md` - One prerequisite bullet under Phase 1: every hook added since the last release has its `inserted_hook_blocks()` row, every row's version is the one being cut, rows are added or fixed on the release branch with `tests/test_scaffold_preserved_hooks.py` updated to match ## Changelog Entry No changelog needed — devkit-internal release procedure; the doc is not scaffolded. ## Testing - [x] Tests pass locally (`just test`) - [ ] Manual testing performed (describe below) ### Manual Testing Details N/A — `prek run --all-files` (pymarkdown, typos, generate-docs) all green; `docs/RELEASE_CYCLE.md` is not template-generated. ## Checklist - [x] My code follows the project's style guidelines - [x] I have performed a self-review of my code - [ ] I have commented my code, particularly in hard-to-understand areas - [x] I have updated the documentation accordingly (edit `docs/templates/`, then run `just docs`) - [ ] I have updated `CHANGELOG.md` in the `[Unreleased]` section (and pasted the entry above) - [x] My changes generate no new warnings or errors - [ ] I have added tests that prove my fix is effective or that my feature works - [x] New and existing unit tests pass locally with my changes - [x] Any dependent changes have been merged and published ## Additional Notes The issue stays open: its row (`'X.Y.Z shellcheck-composite-actions'`, after the actionlint row, plus `COMPOSITE_SINCE` and the boundary tests) is release-branch work. Refs: #1717
c-vigo
added a commit
that referenced
this pull request
Sep 25, 2026
The composite-action shellcheck hook (#1704, scaffolded by #1718) reaches new scaffolds only: a preserved .pre-commit-config.yaml never receives template evolution (#878), so every existing consumer leaves .github/actions/*/action.yml run bodies unlinted. Case 2 of #1654 is the seam that fixes it, and it needs one row in inserted_hook_blocks(). The row's version is 1.17.0. dev already holds two feat commits since 1.16.0 (#1718 and #1724) and no breaking change, so the next train is 1.17.0 by construction; the only rename still possible is upward, and an upward rename is harmless for this row (every consumer's pin is below 1.17.0 at adoption, and nobody can sit exactly at 1.17.0). A DOWNWARD rename is the one that would hurt — it re-adds a hook a consumer deleted, the #1651 defect — and a feat on dev rules that out. #1723's Phase 1 prerequisite covers the re-check either way. Two fields, not three: the hook belongs to no feature group, so the row omits the group and `read -r ver hook feat` leaves feat empty. The row must also come AFTER the actionlint one, because the insert anchors on the previous hook in template order: a pre-1.16.0 tree receives actionlint first and anchors this block on what that row just inserted, in a single pass. The three boundary tests (pin at 1.17.0, pin at 1.17.1, hook already present) pass vacuously until the row exists; they are the guard against the row being set too low later. Refs: #1717
c-vigo
added a commit
that referenced
this pull request
Sep 25, 2026
…ed configs from 1.17.0 One row in inserted_hook_blocks(), so Case 2 of #1654 carries #1704's hook into the preserved .pre-commit-config.yaml of every consumer whose tree predates it. Until now the hook reached new scaffolds only (#1718), leaving every existing repo's .github/actions/*/action.yml run bodies unlinted — actionlint refuses a composite action outright and has no composite mode. The row is two fields wide: the hook belongs to no feature group, and `read -r ver hook feat` leaves feat empty, which the gate reads as "never opted out". It sits AFTER the actionlint row because the insert anchors on the hook the template places before this one, so a pre-1.16.0 tree gains actionlint and then anchors this block on it within the same pass. 1.17.0 is the version by construction: dev already holds two feat commits since 1.16.0 (#1718, #1724) and no breaking change, so the next train is a minor. The only rename still available is upward, and an upward rename leaves the row harmless — every consumer's pin is below 1.17.0 at adoption and nobody can be pinned exactly at 1.17.0. A downward rename is the direction that would re-add a hook a consumer deleted (the #1651 defect); it would have to edit this row on the release branch, which #1723's Phase 1 prerequisite now makes a checked step. Refs: #1717
Merged
11 of 22 tasks
c-vigo
added a commit
that referenced
this pull request
Sep 25, 2026
…ed configs from 1.17.0 (#1726) ## Description #1718 added the scaffolded `shellcheck-composite-actions` hook, but a consumer with a preserved `.pre-commit-config.yaml` only receives a new hook through the `inserted_hook_blocks()` table in `assets/init-workspace.sh`, keyed on the first release that ships it. #1723 already put the re-check of that table on the Phase 1 prerequisites; this adds the row itself. **Why the version can be fixed now.** `dev` holds two `feat` commits since 1.16.0 (#1718 and #1724) and no breaking change, so the next train is `1.17.0` by construction, and it is planned for Monday 2026-09-28. The only rename possible from here is upward, and an upward rename leaves a `1.17.0` row harmless: every consumer's pin is still below it at adoption, and nobody can ever sit exactly at `1.17.0`. The #1651 defect (re-adding a hook a consumer deleted) needs the row to be *below* the real first release, which would require a downward rename that a `feat` on `dev` rules out unless both are pulled — the case the #1723 prerequisite now catches on the release branch. **Mechanism, verified rather than assumed.** Rows are `<first release> <hook> [feature group]`; `insert_missing_hook_blocks` reads `read -r ver hook feat`, so the two-field row is legal and the empty group never gates. The block comes from the rendered template structurally (the `- repo:` entry holding `- id: shellcheck-composite-actions`); the anchor derived from the template is `actionlint`, so the row must follow the actionlint row: a pre-1.16.0 tree gains actionlint first and the composite block right after it, in one pass. **End-to-end, with the real script:** a temp workspace at `DEVKIT_VERSION=1.16.0` whose config lacks the composite block gains exactly that block after the actionlint sentinel end, nothing else changes, and a second run is byte-identical. Output: `Inserted the 'shellcheck-composite-actions' hook after 'actionlint' (shipped since 1.17.0, this tree predates it at 1.16.0, #1654).` ## Type of Change - [x] `feat` -- New feature - [ ] `fix` -- Bug fix - [ ] `docs` -- Documentation only - [ ] `chore` -- Maintenance task (deps, config, etc.) - [ ] `refactor` -- Code restructuring (no behavior change) - [x] `test` -- Adding or updating tests - [ ] `ci` -- CI/CD pipeline changes - [ ] `build` -- Build system or dependency changes - [ ] `revert` -- Reverts a previous commit - [ ] `style` -- Code style (formatting, whitespace) ### Modifiers - [ ] Breaking change (`!`) -- This change breaks backward compatibility ## Changes Made `assets/init-workspace.sh` - `inserted_hook_blocks()`: `'1.17.0 shellcheck-composite-actions'` after the actionlint row, with a comment carrying the version rationale and the ordering constraint `tests/test_scaffold_preserved_hooks.py` - `COMPOSITE_SINCE` / `COMPOSITE_HOOK`; the table test asserts the quoted two-field row and that it follows the actionlint row; `_composite_seed()` builds the 1.16.0 shape; a 1.16.0 pin gains exactly the block (no consumer line removed, every added line the template's own), 1.17.0 and 1.17.1 pins are left alone, an existing hook is never duplicated, a pre-1.16.0 tree gains both blocks in template order `[shellcheck, actionlint, shellcheck-composite-actions, typos]`, `--preview` reports the planned insert. RED before the row: 5 failed / 22 passed. Two existing assertions were scoped from `preserved-hook-insert:` to `preserved-hook-insert: actionlint` where an older pin now legitimately gains the composite hook; the at-release pin test stays unscoped (review finding) ## Changelog Entry No changelog needed — the issue says so; the consumer-visible feature is #1718's entry, this is its delivery path for preserved configs. ## Testing - [x] Tests pass locally (`just test`) - [x] Manual testing performed (describe below) ### Manual Testing Details - End-to-end upgrade run described above, plus idempotence on a second pass - `uv run pytest tests/test_scaffold_preserved_hooks.py tests/test_flake_hooks.py -q` → 105 passed - `bats -j 4 --filter '1660|1651|preserved|hook' tests/bats/init-workspace.bats` → 48 ok; the one failure is the pre-existing environmental one (the test shells out to a bare `python3` that lacks PyYAML in the plain `nix develop` shell; green in CI) - `shellcheck -x` clean; `prek run --all-files` → 55 hooks passed ## Checklist - [x] My code follows the project's style guidelines - [x] I have performed a self-review of my code - [x] I have commented my code, particularly in hard-to-understand areas - [ ] I have updated the documentation accordingly (edit `docs/templates/`, then run `just docs`) - [ ] I have updated `CHANGELOG.md` in the `[Unreleased]` section (and pasted the entry above) - [x] My changes generate no new warnings or errors - [x] I have added tests that prove my fix is effective or that my feature works - [x] New and existing unit tests pass locally with my changes - [x] Any dependent changes have been merged and published ## Additional Notes Found while verifying, not fixed here: a consumer pinned below 1.17.0 with `DEVKIT_FEATURES_DISABLED=actionlint` has no actionlint block to anchor on, so the composite insert is skipped with a warning (exit 0, no partial write). Safe, but the message reads as a defect to that consumer; a fallback anchor would be the fix. No known consumer is in that state. Filed separately: #1725. Refs: #1717
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
actionlintlints the shell in workflowrun:steps but refuses composite actions outright (unexpected key "runs" for "workflow" section) and has no composite mode (#245 closed as a duplicate of the dormant #46; 1.7.12 is the latest release). So the 44run:bodies across the seven composites — devkit'sbuild-image,setup-env,test-image,test-integration,test-project, and the scaffold'sresolve-toolchainandsetup-devkit-toolchainunderassets/workspace/, which are the ones consumers actually run — had no shellcheck pass at all, locally or in CI. #1692 moved seven more bodies intotest-project, each shellchecked by hand for that PR and unguarded since.This adds
shellcheck-composite-actions, a vig-utils console script wired as a scaffolded pre-commit hook. It reproduces actionlint's own recipe rather than approximating it: stdin =set -eo pipefail+ body, each${{ … }}replaced by same-length underscores with newlines kept (so line and column offsets are exact), and actionlint's exclude list passed verbatim (SC1091,SC2194,SC2050,SC2153,SC2154,SC2157,SC2043— precisely the placeholder-induced false positives). Gate is-S warning; findings print inaction.ymlcoordinates with the step name; inline# shellcheck disable=directives survive extraction.shsteps getset -eand--shell sh;python/pwsh/powershell/cmd/nodeanduses:steps and non-composite actions are skipped; any other unrecognisedshell:value is skipped with a stderr note so a typo cannot quietly unlint a body (review finding).The
filesregex(^|/)\.github/actions/[^/]+/action\.ya?ml$covers both trees with one pattern (the scaffold's copy is.github/actions/once scaffolded), so the same hook serves devkit, the scaffold copy and consumers unchanged. The Nixcheckandconsumerfragments pin both the vig-utils binary andshellcheckby store path; the portable YAML entry stays store-path free like its siblings.First run over the seven composites: one real finding, exactly as triage predicted — an unquoted
$(id -u)in the podman socket URI oftest-integration(SC2046). Fixed, not suppressed. The$TEST_ARGSSC2086 the issue cites is info-level and does not fire at-S warning(a test pins that--severity infosurfaces it), so acceptance criterion 2 needs no suppression.Type of Change
feat-- New featurefix-- Bug fixdocs-- Documentation onlychore-- Maintenance task (deps, config, etc.)refactor-- Code restructuring (no behavior change)test-- Adding or updating testsci-- CI/CD pipeline changesbuild-- Build system or dependency changesrevert-- Reverts a previous commitstyle-- Code style (formatting, whitespace)Modifiers
!) -- This change breaks backward compatibilityChanges Made
packages/vig-utils/src/vig_utils/shellcheck_composite_actions.py(new),pyproject.toml,uv.lock,nix/vig-utils.nixshellcheck-composite-actions; YAML composed with marks so block-scalar findings map to file line/column; exit 0 / 1 (findings) / 2 (tool error);--shellcheck PATHandSHELLCHECK;-S/--severitydefaultwarning.pyyamladded to vig-utils (already pinned at the root, no new lock entry) and to the Nix buildnix/hooks.nix,.pre-commit-config.yaml,assets/workspace/.pre-commit-config.yamlcompositeActionFilesregex; hook afteractionlintwithscaffold = true,pass_filenames = true,checkandconsumerfragments pinning${pkgs.shellcheck}/bin/shellcheck; both rendered configs hand-synced (no render recipe) and matchingnix eval .#lib.hooksPortable.github/actions/test-integration/action.yml"unix:///run/user/$(id -u)/podman/podman.sock"packages/vig-utils/tests/test_shellcheck_composite_actions.py(new, 21 tests),tests/test_flake_hooks.py(+4)${{ }}inside[ … ]not flagged;shell: pythonandruns.using: node20skipped; inline disable honoured; same-length neutralisation; exact line+column mapping; severity gate both ways; tool errors → 2. Hook-shape pins: portable entries, consumer entry pins both store paths, regex covers both trees and nothing else, every committed composite in scope. RED before the hook:KeyError: 'shellcheck-composite-actions'CHANGELOG.md,assets/workspace/.devcontainer/CHANGELOG.md### Addedentry, identical in bothChangelog Entry
Added
run:bodies are shellchecked(#1704)
actionlintrefuses a composite action outright (unexpected key "runs" for "workflow" section) and has no composite mode, so everyrun:body thatmoved out of a workflow and into
.github/actions/*/action.ymlsilently lostits shellcheck pass — locally and in CI
shellcheck-composite-actionshook reproduces actionlint's ownrecipe over those bodies: each
${{ … }}blanked to same-length underscores(so findings still point at the real line and column), GitHub's shell prelude
prepended, and actionlint's exclude list passed verbatim — one lint, not two
dialects of one. Inline
# shellcheck disable=directives keep workingcomposites from this release; a consumer with a preserved
.pre-commit-config.yamlreceives the hook on the release that adds itsinsert row. Findings are reported in
action.ymlcoordinates. The firstpass caught one real defect: an unquoted
$(id -u)in the podman socketURI of
test-integrationTesting
just test)Manual Testing Details
test-integration/action.yml:151:57: SC2046 (warning): Quote this to prevent word splitting. [step: Start podman socket], exit 1; GREEN after the one-character fix, exit 0. Column 57 lands exactly on the$(uv run pytest packages/vig-utils/tests tests/test_flake_hooks.py tests/test_changelog_unreleased_typos.py tests/test_scaffold_lint.py→ 744 passednix buildof vig-utils with pyyaml succeeds and its storebin/shellcheck-composite-actionsruns the 7 composites to exit 0;nix build .#checks.x86_64-linux.pre-commitgreen (the sandbox fragment runs hermetically over both trees)prek run --all-files→ 55 hooks passed in both roots, the new hook among themactionlint .github/workflows/*.ymlunaffectedChecklist
docs/templates/, then runjust docs)CHANGELOG.mdin the[Unreleased]section (and pasted the entry above)Additional Notes
.pre-commit-config.yamlis preserved on upgrade, so an existing consumer only receives a new hook through aninserted_hook_blocks()row, which needs the version of the first release that ships it — not yet fixed. Filed as [CHORE] Insert the shellcheck-composite-actions hook into existing consumer configs on upgrade #1717 to be done on the release branch, never speculatively ondev. New scaffolds get the hook immediately.PYTHONPATHpoints at the previous store-built vig-utils shadows the editable install and makesuv run shellcheck-composite-actionsfail withModuleNotFoundError; re-entering the shell fixes it. Nothing in the repo changes for that..pre-commit-config.yamlcomment on theactionlinthook still says "Devkit-only: not scaffolded" (stale since [FEATURE] Ship actionlint to consumers: the workflow-lint hook plus a managed actionlint.yaml config #1660); left alone as out of scope.Refs: #1704