Skip to content

feat(ci): run a rendered-consumer variant matrix in PR CI - #1803

Merged
c-vigo merged 7 commits into
devfrom
feature/1762-consumer-matrix
Oct 1, 2026
Merged

c-vigo merged 7 commits into
devfrom
feature/1762-consumer-matrix

Conversation

@c-vigo

@c-vigo c-vigo commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor

Description

render_actionlint_optout (assets/init-workspace.sh) deletes the
# >>> devkit:actionlint … # <<< devkit:actionlint range from a rendered
.pre-commit-config.yaml when DEVKIT_FEATURES_DISABLED=actionlint, but left
the blank lines flanking the block in place. The two now-adjacent blanks fail
the scaffold's own yamllint (empty-lines: max: 1) with
too many blank lines (2 > 1).

Type of Change

  • fix -- Bug fix

Changes Made

  • render_actionlint_optout now does the range-delete via awk instead of
    sed, deferring each blank line's print by one line so it can drop the one
    immediately before the opening sentinel instead of emitting it. Blank-line
    runs elsewhere in the file pass through unchanged -- this is scoped to the
    one seam the excision creates, not a file-wide collapse. Still a no-op when
    the sentinels are absent (the existing grep guard is unchanged) and
    idempotent. The temp-file-then-cat write preserves the consumer file's
    mode/inode, same as splice_lines.
  • Checked every other sentinel-excision render (grep '# >>> devkit:'):
    render_release_optout (.devcontainer/justfile.gh) is the only other one,
    and it already drops its trailing blank line with a dedicated
    sed -i '${/^$/d}' pass -- it does not share this defect. No change needed
    there.
  • Preserved-config case: a consumer who already hit the bug on a prior
    render is not repaired by a later upgrade. The excision is gated on the
    sentinels still being present (grep -q '# >>> devkit:actionlint'), and an
    already-excised file has none left, so there is nothing for a later run to
    act on. This is noted here rather than pinned by a test: a test asserting
    "not repaired" would pin the gap itself as a contract, turning red the day
    someone closes it. No fold machinery added for a cosmetic blank-line defect
    (unlike Upgrade can't fold hook fixes into a preserved .pre-commit-config.yaml — warn on the pre-#1170 jackdewinter/pymarkdown block #1652's structural folds) -- if you already hit the bug, delete the
    one extra blank line by hand; there is nothing else to clean up.

Changelog Entry

Fixed

  • Actionlint opt-out left a double blank line that failed yamllint
    (#1800)
    • DEVKIT_FEATURES_DISABLED=actionlint excised the # >>> devkit:actionlint
      … # <<< devkit:actionlint block from a rendered .pre-commit-config.yaml
      but left the blank lines flanking it, so the two ends met as two adjacent
      blank lines — too many blank lines (2 > 1) under the scaffold's own
      .yamllint (empty-lines: max: 1). The excision now also drops the blank
      line immediately before the block, scoped to that one seam
    • A consumer who already hit the bug on a prior render is not repaired by a
      later upgrade: the excision is sentinel-gated and the sentinels are
      already gone from an already-excised file, so there is nothing new to
      trigger on. Fixing the double blank line by hand (or re-adding the hook
      and re-running the opt-out) clears it

Testing

  • Tests pass locally (tests/bats/init-workspace.bats, run by name --
    never the full tests/bats/ directory or worktree.bats, per repo
    convention)
  • Manual testing performed (describe below)

Manual Testing Details

  • RED: added the actionlint opt-out leaves no double blank line behind (#1800) to tests/bats/init-workspace.bats; confirmed it failed against
    the pre-fix code (bats --filter '#1800' tests/bats/init-workspace.bats).
  • GREEN: implemented the fix; the new test passes, and the full existing
    #1660 actionlint-opt-out suite (7 tests) and the entire
    tests/bats/init-workspace.bats file (313 tests) pass.
  • The blank-line assertion is the primary check (always runs); the new test
    also runs yamllint -c "$ws/.yamllint" "$ws/.pre-commit-config.yaml"
    opportunistically when yamllint happens to be on PATH -- it is a
    prek-managed hook (fetched into prek's own cache), not part of the devkit
    dev shell, so it was not available in this run and that branch did not
    execute. The blank-line-shape assertion directly encodes the rule
    yamllint's empty-lines: max: 1 enforces.
  • just precommit (prek run --all-files) is green end to end.

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) -- no doc describes this internal rendering detail
  • 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 -- n/a

Additional Notes

None.

Refs: #1800

c-vigo added 5 commits October 1, 2026 16:04
The serial loop took 221 s and put the job level with the BATS and flake
lanes on the critical path. Also defuse the language-guard cell's expected
::error:: lines so they no longer surface as PR annotations.

Refs: #1762
@c-vigo
c-vigo enabled auto-merge October 1, 2026 16:36
@c-vigo
c-vigo merged commit 7b77f3f into dev Oct 1, 2026
16 checks passed
@c-vigo
c-vigo deleted the feature/1762-consumer-matrix branch October 1, 2026 16:42
c-vigo added a commit that referenced this pull request Oct 1, 2026
…1807)

## Description

**Part 2 of 2 for #1762.** This PR is stacked on #1803 (part 1) and
targets `feature/1762-consumer-matrix`. **It will be retargeted to `dev`
once #1803 merges.**

It adds language cells and a flake-evaluation cell to the `Consumer
Matrix` job from part 1.

**Expected reds:** only the #1800/#1801 cells, as on #1803, until those
fixes land on `dev`.

**`rust` is a strict expected-fail on #1496.** A scaffolded Rust
consumer gets the stock Python `justfile.project`, so `just test` exits
0 without compiling anything. The cell still runs every gate, and is
accepted only when:
- `test` is its sole failed gate, and
- that gate failed with the silent-no-op signal ("`just test` exited 0
but the rust fixture suite never ran").

If the cell passes, it fails ("rust now passes — remove the #1496
expected-fail marker"). If it fails in any other way, it fails. The
marker is one entry, `EXPECTED_FAIL[rust]="test #1496"`, next to the
cell list, and the summary shows `expected-fail (#1496)`. #1496 now has
a comment saying this cell is its acceptance test and that its fix must
remove the marker.

CI run: https://github.com/vig-os/devkit/actions/runs/36880846330. The
only failing cells are `devcontainer`, `trunk`, `ci-runner`,
`tag-prefix`, `language-guard` and `features-disabled` (#1801 `exceeds
500 KB`, plus #1800 `too many blank lines` on `features-disabled`).
`rust` is `expected-fail (#1496)`. `direnv`, `bare`, `python`, `node`
and `direnv-flake` pass. Every other job is green. An earlier run,
https://github.com/vig-os/devkit/actions/runs/36878543444, gave the same
verdicts.

## Type of Change

- [x] `feat` -- New feature
- [x] `test` -- Adding or updating tests
- [x] `ci` -- CI/CD pipeline changes

## Changes Made

- **Fixtures** in `tests/fixtures/consumer/{python,node,rust}/`: a
zero-dependency hello world plus one test each. Python uses pytest from
a `dev` dependency group. Node uses `node --test` and ships a
dependency-free `package-lock.json` so `npm ci` works. Rust uses a
`#[test]` in `src/lib.rs`. Each test writes `$CONSUMER_MATRIX_SENTINEL`
when it is set.
- **Language cells** `python`, `node`, `rust`:
- The fixture is copied in as the marker files, then rendered in `bare`
mode with `--force`. That is the adoption path for an existing project:
no `.vig-os` yet, so nothing is upgraded, and without `--force`
init-workspace.sh refuses a non-empty directory. `bare` ships the
scaffolded hook config with no mode-specific files, so the result
reflects the language and not the mode.
- New gates `sync` (`just sync`) and `test` (`just test`), as the
consumer's CI runs them. These apply to every cell.
- A fixture cell's `test` gate fails if the sentinel was not written.
`seed` also checks that the scaffold detected the language into
`DEVKIT_LANGUAGES`.
- **`direnv-flake` cell:**
- `nix flake check` on the rendered flake with `--override-input vigos
"path:$ROOT"` (same approach as test-project's "Check downstream flake
stub") and `--no-write-lock-file`.
- It then builds the dev shell into a profile, and every later gate runs
inside it. The shell hook installs the flake-generated
`.pre-commit-config.yaml`, so `first-commit` and `precommit` exercise
the direnv hooks for the first time. The plain `direnv` cell still skips
them.
- **Toolchains:**
  - uv and npm come from the devkit dev shell.
  - Python is fetched by uv, the same way setup-env provides it.
  - nix comes from setup-env.
- cargo is not in the devkit dev shell, and the rendered Rust recipe
never calls it (#1496). Stubbing cargo would hide the defect.
- `pyproject.toml`: added `fixtures` to `norecursedirs` so devkit's own
pytest does not collect the fixture suite.

## Changelog Entry

Two sub-bullets added to the existing `Consumer matrix in devkit PR CI`
entry under Added:

```
  - Language cells for python, node and rust adopt a zero-dependency hello
    world (`tests/fixtures/consumer/`) and run `just sync` and `just test`; the
    fixture test must prove it ran, so a `just test` that silently skips fails
  - A `direnv-flake` cell runs `nix flake check` on the rendered flake against
    the PR's own devkit and runs the direnv cell's gates inside its dev shell,
    so the flake-generated hooks are exercised too
```

## Testing

- [x] TDD: `tests/bats/consumer-matrix.bats` extended first (later also
the strict expected-fail verdict: exact match accepted, a passing cell
refused, any other failure refused) (cell list, fixture detection, node
npm-mapped recipes, the sentinel contract, direnv-flake render shape).
It was committed red, then made green by the implementation.
- [x] `just precommit` green.
- [x] Local run: `python` 6 s, `node` 6 s and `direnv-flake` 22 s, all
passing. `rust` red on #1496.

### CI timing

Each cell's summary now lists the time of every gate, because the cells
run concurrently and their logs are printed afterwards.

| | part 1 (#1803, 8 cells) | this PR (12 cells) |
| --- | --- | --- |
| setup-env | 44 s | 35 s |
| cells step | 130 s | 176 s |
| Consumer Matrix job | 182 s | 219 s |
| slowest other lane | 267 s (BATS) | 284 s (Flake Gates) |
| run wall clock | 5m39s | 5m14s |

The job still finishes about 65 s before the slowest lane, so **the
critical path does not change**, and the flake cell stays in the same
job (no separate job is needed). Per-cell times under 12-way concurrency
on the 4-vCPU runner: `direnv-flake` 163 s, the both-mode cells 163–176
s, `python`/`node`/`rust` 67–70 s, `bare` 65 s, `direnv` 5 s. The flake
cell is not the outlier: the `nix flake check` and dev-shell build reuse
the closure setup-env already pulled. Locally, with a warm store and no
contention, it takes 22 s.

Refs: #1762
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