Skip to content

ci: get CI running again - #1043

Closed
sirtimid wants to merge 3 commits into
mainfrom
sirtimid/pin-workflow-actions
Closed

ci: get CI running again#1043
sirtimid wants to merge 3 commits into
mainfrom
sirtimid/pin-workflow-actions

Conversation

@sirtimid

@sirtimid sirtimid commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

CI has been red on every PR since the org move. Last green run was #1042 on 2026-09-03. Three things were wrong; this fixes all three.

1. Actions must be pinned to a SHA

Consensys-Incorporated requires it, MetaMask didn't. It fails at job setup, before anything runs:

The action actions/checkout@v7 is not allowed ... must be pinned to a full-length commit SHA

Merging main doesn't help — main is broken the same way. All 35 references now name a commit, with the version in a trailing comment so Dependabot keeps working. No version changes.

2. The policy applies to nested actions too

Pinning ours wasn't enough: the MetaMask composite actions we call reach mutable tags one layer down, and they're on their latest releases, so there's no upgrade that fixes it.

We now own those steps instead:

  • action-checkout-and-setupactions/checkout + a local setup-environment action (Node, Corepack, Yarn cache, install)
  • check-changelog → a local job: every package you touch that has a CHANGELOG.md needs it in the diff. no-changelog still opts out
  • check-skip-merge-queue → ported as-is onto a pinned actions/github-script

The release path still uses action-npm-publish and action-is-release, which have the same problem. Both only run on push, so they block releases, not PRs. Better fixed upstream than rewritten here.

3. better-sqlite3 crashes on Node 24.20

Once CI actually ran, tests aborted:

Assertion failed: (env) != nullptr
  Statement::~Statement() [better_sqlite3.node]

Not a missing close() — a plain script, a vitest worker holding an open database, and one with a live worker thread are all fine on 24.20.0. It takes the whole kernel to provoke, and the same code is clean on 24.18.0.

Our matrix floats on 24.x, which resolved to 24.19.0 in September and 24.20.0 now. Bumping to better-sqlite3 13.0.3 fixes it. The major touches none of the API this driver uses, and its Node floor is the one kernel-store already declares.

Checked

  • actionlint 1.6.25 (same version CI uses) clean; no unpinned external uses: left
  • On Node 24.20.0: unit suite 53/53, integration suite clean, kernel-node-runtime e2e went from 9 failures + abort to running
  • kernel-store passes on Node 22.23.2
  • The changelog check was tested against real history, including a case that should fail

One flaky test to be aware of: remote-comms.test.ts > handles remote intentional disconnect without reconnecting fails locally for me on 24.18.0, 24.19.0 and 24.20.0 alike, with and without the bump. Unrelated to this PR, but worth watching.

Nothing else can go green until this merges.

🤖 Generated with Claude Code


Note

Medium Risk
Broad CI workflow changes gate every PR and merge queue; kernel-store’s major native dependency bump affects runtime behavior on supported Node versions, while release still depends on upstream MetaMask actions (SHA-pinned only at the call site).

Overview
Restores CI for the org’s full SHA pinning policy by replacing every mutable uses: tag with a commit SHA (version kept in comments for Dependabot).

MetaMask composite actions that still pulled unpinned checkout / setup-node / cache / github-script internally are replaced with local steps: pinned actions/checkout plus setup-environment (Node, Corepack, Yarn download cache, yarn install --immutable every run—no node_modules cache), an inlined changelog job (merge-base diff, per-package CHANGELOG.md, no-changelog label), and a ported check-skip-merge-queue action. Release workflows still call pinned MetaMask publish/is-release actions; publish jobs pass cache: false on setup where credentials matter.

Separately, @metamask/kernel-store bumps better-sqlite3 ^12.4.1^13.0.3 (documented as breaking for consumers on Node < 22) to stop process aborts on Node 24.20 during native teardown in CI tests.

Reviewed by Cursor Bugbot for commit 905a499. Bugbot is set up for automated code reviews on this repo. Configure here.

The org now refuses any action referenced by tag:

    The action actions/checkout@v7 is not allowed in
    Consensys-Incorporated/ocap-kernel because all actions must be pinned
    to a full-length commit SHA.

That is a setup-job failure, so it takes down every job that references
one before a step runs. Nothing has run green in this repository since
2026-09-03; the policy was turned on after the last commit that touched
CI, which is why merging main does not help.

Each tag is replaced by the commit it currently resolves to, with the
release it names in a trailing comment. Dependabot reads that comment,
so `github-actions` updates keep working and arrive as a SHA bump.

Local `./.github/...` references are exempt and left alone.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@sirtimid
sirtimid marked this pull request as draft September 8, 2026 13:55
…g out for them

Pinning our own references was necessary but not sufficient. The policy
resolves actions transitively, and the MetaMask actions we call reach mutable
tags one layer down:

    action-checkout-and-setup  -> cache/restore@v6, checkout@v7, setup-node@v6,
                                  action-retry-command@v1, cache/save@v6
    github-tools/check-changelog        -> checkout@v6 x2, setup-node@v6
    github-tools/check-skip-merge-queue -> github-script@v9 x2

All three are on their latest releases, so no upgrade reaches them, and they
live in an organization we no longer belong to. A pin one layer deep is no pin
at all, so the only way to make the chain true is to hold it.

`action-checkout-and-setup` becomes an explicit `actions/checkout` plus a local
`setup-environment` action -- Node, Corepack, Yarn's download cache, install.
Checkout cannot live inside it: `uses: ./...` resolves against the workspace,
so the repository has to be on disk before the runner can find the file.

The local action is narrower than the one it replaces. It drops the
node_modules cache and the lookup-only fast path, keeping only Yarn's download
cache, because those turn on a cache key that has to account for the native
rebuilds `postinstall` runs. `yarn install` runs every job now, which costs
time and buys the guarantee that what is on disk matches the lockfile.

`check-changelog` cloned github-tools to run a script over the diff. The local
job asks the same question directly: every package with a CHANGELOG that this
pull request touches must have that changelog in the diff too. It compares
against the merge base rather than the base tip, so commits landing on main
afterwards are not read as this branch's. `no-changelog` still opts out.

`check-skip-merge-queue` is ported as-is, its two scripts unchanged, onto a
pinned `actions/github-script`.

The release path still calls `action-npm-publish` and `action-is-release`,
which have the same defect. Both are gated on `push`, so they block releases
rather than pull requests, and neither is part of the `all-jobs-complete` gate.
Publishing is where a mistake is expensive and OIDC permissions were only just
fixed in #1041, so they are better handled upstream than rewritten here.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@sirtimid sirtimid changed the title ci: pin every third-party action to a full-length commit SHA ci: pin every action, and own the steps that cannot be pinned from outside Sep 8, 2026
… on Node 24.20

On Node 24.20.0, `better-sqlite3` 12.x aborts the process while it is shutting
down:

    node::RemoveEnvironmentCleanupHook(Isolate*, CleanupHook, void*)
      at ../src/api/hooks.cc:142
    Assertion failed: (env) != nullptr
    Statement::~Statement() [better_sqlite3.node]

The destructor runs after the environment is gone and asserts on the way out.
Everything it kills has already passed, so it reads as a worker dying rather
than as a test failure, and vitest reports only that the fork exited.

Not a missing `close`. The suites that hit it close their databases; a plain
script, a vitest worker holding an open database, and one holding an open
database plus a live worker thread are all clean on 24.20.0. It takes the whole
kernel to provoke, and the same code on 24.18.0 is clean, which places it
between the two Node releases rather than in this repository.

The tests never ran into it because CI floats on `24.x` and had not run since
2026-09-03, when the runner still resolved that to 24.19.0.

13.x is a major, but it moves none of the surface this driver uses -- `prepare`,
`run`, `get`, `all`, `iterate`, `pluck`, `transaction`, `exec`, `close` -- and
its Node floor is the one this package already sets. Verified on 24.20.0: the
unit suite, the integration suite, and the `kernel-node-runtime` e2e all run
without the abort, and kernel-store passes on 22.23.2.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@socket-security

Copy link
Copy Markdown

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Updatedbetter-sqlite3@​12.4.6 ⏵ 13.0.3100 +1210010090100

View full report

@sirtimid sirtimid changed the title ci: pin every action, and own the steps that cannot be pinned from outside ci: get CI running again Sep 8, 2026
@sirtimid
sirtimid marked this pull request as ready for review September 8, 2026 16:04
@github-actions

github-actions Bot commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

Coverage Report

Status Category Percentage Covered / Total
🔵 Lines 73.05%
🟰 ±0%
9790 / 13401
🔵 Statements 72.9%
🟰 ±0%
9954 / 13653
🔵 Functions 73.6%
🟰 ±0%
2301 / 3126
🔵 Branches 67.27%
🟰 ±0%
4023 / 5980
File CoverageNo changed files found.
Generated in workflow #4731 for commit 905a499 by the Vitest Coverage Report Action

@rekmarks-consensys-1 rekmarks-consensys-1 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Let me see if we can fix this at the policy level before proceeding.

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