Skip to content

ci: Node 24 actions + tighten trunk vs pre-commit lint ownership#182

Merged
helly25 merged 5 commits into
mainfrom
chore/20260517_bump_gha_actions_to_node24
May 18, 2026
Merged

ci: Node 24 actions + tighten trunk vs pre-commit lint ownership#182
helly25 merged 5 commits into
mainfrom
chore/20260517_bump_gha_actions_to_node24

Conversation

@helly25
Copy link
Copy Markdown
Owner

@helly25 helly25 commented May 16, 2026

Summary

Three connected housekeeping changes from a trunk check -a sweep on the fresh meta-linter setup.

1. Node 24 GHA action bumps

GitHub will force JavaScript actions to Node 24 by default on 2026-06-02 and remove Node 20 from runners on 2026-09-16. Each CI job was emitting a deprecation warning. Bumped:

  • actions/checkout@v4v6
  • actions/cache/restore@v4v5
  • actions/cache/save@v4v5

bazelbuild/setup-bazelisk@v3 left as-is — no Node 24 release upstream yet.

2. Split trunk vs pre-commit lint ownership

After #180 enabled trunk as a meta-linter, four tools ran in both pre-commit and trunk. That caused a real conflict (shfmt: pre-commit formats to 2-space indent, trunk reverted to tabs because its custom definition omitted -i=2) and noisy duplicate diagnostics elsewhere. Trunk is brand new in this repo; pre-commit had been working — bias toward leaving pre-commit alone unless trunk adds clear value.

Tool Owner Why
shfmt pre-commit Project pins -bn -ci -i=2 -w; trunk's custom def had only -w (→ tabs by default)
actionlint pre-commit Pre-commit pins -shellcheck "" to suppress nested shellcheck noise
shellcheck pre-commit .shellcheckrc moved from .trunk/configs/ to repo root so pre-commit auto-discovers it; enable=all dropped (would have silently raised strictness); disable=SC2154 kept and documented
buildifier trunk Trunk's custom def splits --lint=fix (formatter) from --lint=warn (diagnostic) with a JSON parser; newer version (8.5.1 vs 8.2.0)
check-yaml / yamllint both check-yaml is a cheap parse-only sanity check; yamllint adds style

Trunk-only (no pre-commit equivalent): checkov, clang-tidy, git-diff-check, markdownlint, prettier, trivy, trufflehog, yamllint.
Pre-commit-only (no trunk equivalent or custom checks): check-added-large-files, check-merge-conflict, check-yaml, end-of-file-fixer, trailing-whitespace, and the seven local custom hooks (mope-*, *-patch-applies, compare-versions, no-do-not-merge, no-todos-without-context). Pre-commit cannot be dropped — those local hooks have no portable equivalent.

3. Clear trunk check -a findings (50 → 0 CI-blocking)

A full-repo trunk scan surfaced 50 findings. Resolved as follows.

Policy edits:

  • .trunk/trunk.yaml: override clang-tidy's run_when from [cli, monitor, ci] to [cli, monitor]. clang-tidy is useless without compile_commands.json; local devs generate it via bazel run @hedron_compile_commands//:refresh_all but CI does not. Even with a compile DB present, trunk's hermetic clang-tidy@16.0.3 binary cannot resolve C++ stdlib headers (the install ships only bin/clang-tidy + clang-builtin headers, no libc++/libstdc++). Gating to local-only avoids ~20 spurious "<header> file not found" diagnostics per CI run.
  • .trunk/configs/.yamllint.yaml: disable quoted-strings. The only-when-needed setting collides with prettier (which prefers double quotes for many YAML strings); the rule is purely stylistic. yamllint's other useful checks remain.
  • .github/workflows/{cache_cleanup,release,test}.yml: declare workflow-level permissions: read-all to satisfy checkov CKV2_GHA_1. cache_cleanup uses secrets.CACHE_ACCESS (a custom PAT), so the default GITHUB_TOKEN does not need write scopes; release.yml's existing job-level contents: write override is preserved.

Auto-fix sweep (one-time, applied now that trunk owns the relevant formatters):

  • .bcr/metadata.template.json, .bcr/presubmit.yml: prettier reformatted JSON/YAML.
  • CODE_OF_CONDUCT.md, CONTRIBUTING.md, README.md, RULES.md: markdownlint fixes (MD040 missing language tags, MD026 trailing punctuation, MD041 top-level heading placement, MD045 image alt text). Two affected headings hand-edited to shorter forms with descriptive text moved to body prose.

4. Restrict pre-commit clang-format to C/C++/CUDA

After the auto-fix sweep, CI surfaced a new fight: mirrors-clang-format@v19.1.6's default types_or includes json (clang-format 14+ added JSON support), and pre-commit's clang-format reformatted .bcr/metadata.template.json back to multi-line — undoing trunk-prettier's compaction. Override types_or: [c, c++, cuda] so JSON stays prettier's job.

Test plan

  • bazel test //mbo/testing:matchers_test (covered by parallel feat(testing): add IsElementOf / IsKeyOf / IsValueOf matchers #181)
  • CI green
  • trunk check -a reports zero CI-visible findings on this branch (the 25 remaining are clang-tidy diagnostics now gated to local-only)
  • Node 20 deprecation warning reduced to only bazelbuild/setup-bazelisk@v3

Out of scope

  • clang-tidy CI integration. The extractor (hedron_compile_commands) itself runs clean — no patches needed. The blocker is that trunk's hermetic clang-tidy binary ships no C++ stdlib; resolving that means either (a) wrapping with the Bazel-built clang-tidy, (b) injecting --extra-arg=-isysroot=... per platform, or (c) dropping clang-tidy from trunk entirely. Tracked separately.

🤖 Generated with Claude Code

helly25 and others added 3 commits May 17, 2026 00:10
GitHub will force javascript actions to Node 24 by default on
2026-06-02 and remove Node 20 from runners on 2026-09-16. Current CI
runs emit a deprecation warning on every job for:
  - actions/checkout@v4         -> bump to v6 (Node 24)
  - actions/cache/restore@v4    -> bump to v5 (Node 24)
  - actions/cache/save@v4       -> bump to v5 (Node 24)

bazelbuild/setup-bazelisk only has v3.0.0 and no Node 24 release yet,
so it is intentionally left at v3; the warning for that one will
clear once upstream cuts a new tag (or once we move past it).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
After PR #180 enabled trunk as a meta-linter, four tools ran in both
pre-commit and trunk. That caused real conflicts (shfmt: pre-commit
formats to 2-space indent, trunk reformatted to tabs because its
custom definition omitted -i=2) and noisy duplicate diagnostics for
the rest. Decide ownership per tool, bias toward leaving pre-commit
alone since it has been working and trunk is brand new.

Decisions:

  * shfmt:      pre-commit owns it. The project pins -bn -ci -i=2 -w
                in .pre-commit-config.yaml; trunk's custom definition
                had only -w and defaulted to tabs. Drop from trunk.
  * actionlint: pre-commit owns it. Pre-commit pins -shellcheck '' to
                suppress nested shellcheck noise; trunk would have to
                replicate the flag for parity. Drop from trunk.
  * shellcheck: pre-commit owns it. Move the project config from
                .trunk/configs/.shellcheckrc to a repo-root
                .shellcheckrc so pre-commit's shellcheck picks it up
                automatically (shellcheck auto-discovers up from the
                target). Drop `enable=all` because pre-commit's
                shellcheck didn't have it before and the move would
                otherwise silently raise strictness. Keep
                `disable=SC2154` with a comment explaining why
                (Bazel sh_test + GitHub Actions runner env vars).
                Drop shellcheck from trunk.
  * buildifier: trunk owns it. Trunk's custom definition cleanly
                splits --lint=fix (formatter) from --lint=warn
                (diagnostic) with a JSON output parser and pins a
                newer version (8.5.1 vs pre-commit's 8.2.0). Drop the
                keith/pre-commit-buildifier repo from
                .pre-commit-config.yaml.

  * check-yaml and yamllint stay as-is — they overlap on syntax but
    yamllint adds style coverage; cost is ~1s.

Tools that stay trunk-only (no pre-commit equivalent in the repo):
checkov, clang-tidy, git-diff-check, markdownlint, prettier, trivy,
trufflehog, yamllint.

Tools that stay pre-commit-only (no trunk equivalent or custom
checks): check-added-large-files, check-merge-conflict, check-yaml,
end-of-file-fixer, trailing-whitespace, and the seven local custom
hooks (mope-*, *-patch-applies, compare-versions, no-do-not-merge,
no-todos-without-context). Pre-commit cannot be dropped.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@helly25 helly25 changed the title ci: bump checkout to v6 and cache to v5 for Node 24 readiness ci: Node 24 action bumps + split trunk vs pre-commit lint ownership May 17, 2026
helly25 and others added 2 commits May 17, 2026 12:03
After enabling trunk as a meta-linter in #180, a full-repo scan
surfaced 50 latent findings. This commit clears them.

Policy edits:

  * .trunk/trunk.yaml: override clang-tidy's `run_when` from the
    plugin's `[cli, monitor, ci]` to `[cli, monitor]`. clang-tidy is
    fundamentally useless without compile_commands.json; local devs
    generate it via `bazel run @hedron_compile_commands//:refresh_all`
    but CI does not. The CI sandbox would otherwise emit ~20
    "<header> file not found" diagnostics on every run.
  * .trunk/configs/.yamllint.yaml: disable `quoted-strings`. The
    `only-when-needed` setting collides with prettier (which prefers
    double quotes for many YAML strings) and the rule is purely
    stylistic — yamllint's other useful checks remain.
  * .github/workflows/{cache_cleanup,release,test}.yml: declare
    `permissions: read-all` at the workflow level to satisfy checkov
    CKV2_GHA_1. cache_cleanup uses secrets.CACHE_ACCESS (a custom
    PAT) so the default GITHUB_TOKEN does not need write scopes;
    release.yml's existing job-level `contents: write` override is
    preserved.

Auto-fix sweep (applied once now that trunk owns the relevant
formatters):

  * .bcr/metadata.template.json, .bcr/presubmit.yml: prettier
    reformatted JSON and YAML indentation.
  * CODE_OF_CONDUCT.md, CONTRIBUTING.md: prettier/markdownlint
    reformatted bullets and added language tags to fenced code
    blocks (MD040).
  * README.md, RULES.md: markdownlint trailing-punctuation fixes
    (MD026), missing language tags (MD040), top-level heading
    placement (MD041), and image alt text (MD045). The two affected
    section headings were edited by hand to shorter forms with the
    descriptive sentence moved to body prose.

After this commit `trunk check -a` reports zero CI-visible
findings; the remaining 25 are all clang-tidy diagnostics now gated
to local-only via `run_when: [cli, monitor]`.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
mirrors-clang-format v19.1.6's default `types_or` includes `json`,
because clang-format 14+ added JSON formatting support. trunk's
prettier also formats JSON, and the two disagree on array layout:
prettier compacts short arrays to a single line, clang-format
expands them. The `.bcr/metadata.template.json` change pushed in
the previous commit went through trunk-fmt-pre-commit (prettier) but
CI's pre-commit then ran clang-format which reverted it, causing
the hook to report "files were modified by this hook" and fail.

Override `types_or: [c, c++, cuda]` so clang-format only touches
actual C/C++/CUDA sources. JSON formatting stays trunk-prettier's
job.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@helly25 helly25 changed the title ci: Node 24 action bumps + split trunk vs pre-commit lint ownership ci: Node 24 actions + tighten trunk vs pre-commit lint ownership May 17, 2026
@helly25 helly25 enabled auto-merge (squash) May 17, 2026 11:45
@helly25 helly25 disabled auto-merge May 18, 2026 19:08
@helly25 helly25 merged commit fb2a911 into main May 18, 2026
20 checks passed
@helly25 helly25 deleted the chore/20260517_bump_gha_actions_to_node24 branch May 18, 2026 19:20
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.

2 participants