镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content

Commit 5bae68a

Browse files
committed
fix(ci): validate declarations before frozen Pantry installs
1 parent f632cb7 commit 5bae68a

2 files changed

Lines changed: 21 additions & 20 deletions

File tree

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import { readFileSync } from 'node:fs'
2+
import { resolve } from 'node:path'
3+
import { pantryLockViolations } from '../../storage/framework/core/actions/src/pantry-lock'
4+
5+
// Keep declaration validation independent of a platform's registry resolution.
6+
const root = resolve(import.meta.dir, '../..')
7+
const lock = readFileSync(resolve(root, 'pantry.lock'), 'utf8')
8+
const bun = Bun.JSONC.parse(readFileSync(resolve(root, 'bun.lock'), 'utf8'))
9+
const violations = pantryLockViolations(lock, null, bun.workspaces)
10+
if (violations.length)
11+
throw new Error(`Pantry lock does not describe this workspace:\n${violations.join('\n')}`)
12+
console.log('Pantry lock matches every current workspace declaration')

‎.github/workflows/ci.yml‎

Lines changed: 9 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -456,13 +456,15 @@ jobs:
456456
- name: Install Dependencies
457457
run: bun install --frozen-lockfile
458458

459-
# The release job resolves through `pantry/`, not `node_modules`, and the
460-
# two lockfiles pin different versions — the first attempt at this check
461-
# passed here while the release still failed on a package `pantry.lock`
462-
# held back. Install the same dependency tree without app setup,
463-
# migrations or seeding, matching the normal release lock refresh.
459+
# Validate declarations before a frozen install: a build consumes the
460+
# committed graph, while the dependency-locks job generates updates.
461+
# Registry changes to system dependencies must not rewrite build inputs.
462+
- name: Validate the Pantry workspace lock
463+
working-directory: .github/scripts
464+
run: bun --no-env-file check-pantry-lock.ts
465+
464466
- name: Install the pantry tree
465-
run: pantry install --ignore-scripts --quiet
467+
run: pantry install --frozen-lockfile --ignore-scripts --quiet
466468

467469
- name: Retain the dependency lockfiles generated by the normal installers
468470
if: always()
@@ -474,20 +476,7 @@ jobs:
474476
pantry.lock
475477
if-no-files-found: error
476478

477-
# An install must not change the lockfile that describes it, so this
478-
# installs the way a lock refresh does and asks git whether either
479-
# lockfile moved.
480-
#
481-
# `pantry.lock` used to be compared structurally here. A Linux install
482-
# rewrote a macOS-written lock until four fixes landed (pantry-pm/pantry#231,
483-
# #232 and #233, and this repository's own lock in f21708e705), and after
484-
# them it still added a GCC toolchain closure that macOS never resolves
485-
# (stacksjs/stacks#2899). The committed lock now records that closure, and
486-
# a Linux install and a macOS one both leave it byte-identical, so the
487-
# comparison is strict again (stacksjs/stacks#2905).
488-
#
489-
# It does still go red when a declared range gains a release upstream,
490-
# because pantry resolves past the pin the lock holds (pantry-pm/pantry#260).
479+
# The frozen install must still leave both committed lockfiles untouched.
491480
- name: Check the lockfiles still describe this workspace
492481
run: |
493482
if ! git diff --exit-code -- bun.lock pantry.lock; then

0 commit comments

Comments
 (0)