Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -545,8 +545,10 @@ jobs:

# REQUIRED BY `version:` BELOW, and nothing in this file says so without
# this comment — which is why there is also a test. `pnpm run version` is
# `changeset version && node scripts/sync-skill-pins.mjs && node
# scripts/sync-lockstep-versions.mjs`, and that last script ends in
# `node scripts/with-lockstep-peers-hidden.mjs changeset version && node
# scripts/sync-skill-pins.mjs && node scripts/sync-lockstep-versions.mjs`
# (the first script runs `changeset version` itself; without it a minor
# of @cipherstash/auth is versioned as a major), and that last script ends in
# `execFileSync('mise', ['run',
# 'release:prepare_bindings_assets', …])`, which reaches
# `packages/eql/tasks/build.sh` and two `cargo run -p eql-codegen` calls.
Expand Down
20 changes: 20 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -646,6 +646,26 @@ monorepo, which is where the silent failures are.
tracked files the wrapper publishes, so a reformat does not ride along with
an auth release.

**A minor of `@cipherstash/auth` needs `scripts/with-lockstep-peers-hidden.mjs`
to come out as a minor.** The wrapper pins its six platform packages as
exact-version optional `peerDependencies` (`workspace:*`). They are peers
and not `optionalDependencies` on purpose: Deno's resolver, and Supabase
Edge Runtime with it, treats a missing optional platform package as a fatal
graph error. Changesets gives a dependent a MAJOR bump when a peer leaves
its range on a minor, and reads `workspace:*` as "exactly the current
version", so a `minor` changeset planned 0.44.1 -> 1.0.0 for all seven
packages with no changeset asking for a major. A patch is exempt from that
rule, which is how 0.44.1 went out unnoticed. Inside a fixed group the rule
is a false positive, because the range and the version move together, so
the root `version` script runs `changeset version` through that wrapper: it
takes a fixed group's own `workspace:` peers out of the manifest while
Changesets plans, and puts them back. The committed and published manifests
are unchanged. `scripts/__tests__/with-lockstep-peers-hidden.test.mjs`
drives the real CLI both ways. `changeset status`, and so anything that
reads its plan, is NOT wrapped and still reports the major; the Version
Packages PR is what shows the real number, so read the auth version there
before merging it.

**Check 3 is the one worth understanding before you touch a frozen package.**
For a package this repo publishes, in-tree bytes differing from npm is an
unreleased change — every pull request. For a frozen one it is a
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"lint:typecheck-scope": "node scripts/lint-typecheck-scope.mjs",
"lint:workflow-cache": "node scripts/lint-no-workflow-caching.mjs",
"release:gate": "node scripts/release-gate.mjs",
"version": "changeset version && node scripts/sync-skill-pins.mjs && node scripts/sync-lockstep-versions.mjs",
"version": "node scripts/with-lockstep-peers-hidden.mjs changeset version && node scripts/sync-skill-pins.mjs && node scripts/sync-lockstep-versions.mjs",
"release": "pnpm run build && changeset publish",
"test": "turbo test --filter './languages/typescript/packages/**' --filter './packages/**'",
"test:e2e": "turbo run test:e2e",
Expand Down
23 changes: 23 additions & 0 deletions scripts/__tests__/release-version-hook.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ import { readWorkflow } from './lib/workflows.mjs'
const RELEASE_WORKFLOW = '.github/workflows/release.yml'
const CHANGESETS_ACTION = 'changesets/action'
const VERSION_SCRIPT = 'sync-lockstep-versions.mjs'
const PEERS_WRAPPER = 'with-lockstep-peers-hidden.mjs'

/** Every step in a workflow, flattened across jobs, with its job name. */
function steps(workflow) {
Expand Down Expand Up @@ -159,6 +160,28 @@ describe('no root script invokes a bare changesets command', () => {
).toEqual([])
})

it('runs every `changeset version` with the lockstep peers hidden', () => {
// `@cipherstash/auth` pins its platform packages as exact-version peers in
// one fixed group. Run bare, `changeset version` reads that as a peer
// leaving its range and turns a minor changeset into 1.0.0 for all seven
// packages. The wrapper is what stops it; see
// `with-lockstep-peers-hidden.test.mjs`, which drives the real CLI both
// ways.
const offenders = invoking('version')

@cipherstash-agent cipherstash-agent Nov 18, 2026 •

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.

minor The root "changeset": "changeset" alias (package.json:25) makes pnpm changeset version run the bare CLI, which skips this wrapper. Forwarding reproduced with pnpm 10.33.2. This check can't see the alias, because the subcommand comes from argv, not the script body. The gap existed before this PR, but the comment above (lines 119-120) says the rule covers "a second convenience alias added later", and a pass-through alias gets around it. Route the alias through a small dispatcher that sends version to pnpm run version, and fail on any root script whose body is a bare changeset.

Source: code-review · claude-opus-5-5


Generated by Claude Code

.filter(
([, body]) =>
!new RegExp(`${PEERS_WRAPPER}\\s+changeset\\s+version\\b`).test(body),
)
.map(([name, body]) => `${name}: ${body}`)
expect(
offenders,
`A root script runs \`changeset version\` without scripts/${PEERS_WRAPPER}. A minor ` +
'changeset on @cipherstash/auth would then be versioned as a major. Run it as ' +
`\`node scripts/${PEERS_WRAPPER} changeset version\`, or route the alias through ` +
'`pnpm run version`.',
).toEqual([])
})

it('builds before every `changeset publish`', () => {
const offenders = invoking('publish')
.filter(([, body]) => !/\brun build\b/.test(body))
Expand Down
Loading
Loading