Skip to content

docs(release): re-check inserted_hook_blocks rows before cutting a train - #1723

Merged
c-vigo merged 1 commit into
devfrom
feature/1717-hook-row-prerequisite
Sep 25, 2026
Merged

c-vigo merged 1 commit into
devfrom
feature/1717-hook-row-prerequisite

Conversation

@c-vigo

@c-vigo c-vigo commented Sep 25, 2026

Copy link
Copy Markdown
Contributor

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
  • 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

  • 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

  • My code follows the project's style guidelines
  • I have performed a self-review of my code
  • 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)
  • My changes generate no new warnings or errors
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • 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

A new scaffolded hook reaches a consumer's preserved pre-commit config
only through that table, keyed on the first release that ships it. The
version is a literal nothing else checks, so it goes on the Phase 1
prerequisites rather than in memory.

Refs: #1717
@c-vigo
c-vigo merged commit 6d4a489 into dev Sep 25, 2026
15 checks passed
@c-vigo
c-vigo deleted the feature/1717-hook-row-prerequisite branch September 25, 2026 18:08
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
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
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.

1 participant