8000 pnpm --version check runs before the clone and fetches the wrong pnpm (#33) by simon-inkie · Pull Request #50 · simon-inkie/inkie-deck · GitHub
[go: up one dir, main page]

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
65 changes: 65 additions & 0 deletions .specs/33-pnpm-version-after-clone/SPEC.md
< 8000 tr data-hunk="ac1e933f4595bcff1b6bf6e90aa0d417cc7acab055bcb8995652366a95432e10" class="show-top-border">
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
# #33: pnpm --version check runs before the clone and fetches the wrong pnpm

- Issue: #33
- Branch: 33-pnpm-version-after-clone
- Started: 2026-10-07

## TL;DR

INSTALL.md ran `pnpm --version` in the prerequisites, before any clone. With no
`packageManager` field in reach, corepack fetched the latest pnpm instead of the
pinned one, after a `Y/n` download prompt the document never mentioned. The
check moves to section 2, inside the clone, the prompt is documented, and the
documented steps set `COREPACK_ENABLE_DOWNLOAD_PROMPT=0`.

## Scope

In scope:
- INSTALL.md: `pnpm --version` and its recorded output move after the clone
sentence in section 2; `node --version` stays in section 1.
- INSTALL.md: set `COREPACK_ENABLE_DOWNLOAD_PROMPT=0` after `corepack enable`
and explain the prompt.
- `rig/install-plan.mjs`: the block ids change because section 2 gains a block.

Out of scope (and where it goes instead):
- Adding a clone step to INSTALL.md. Tracked by its own issue; this change only
places the check after the sentence that already assumes a clone.

## Acceptance

- INSTALL.md's `pnpm --version` output matches the pinned version (10.34.5)
on a clean machine, because it runs inside the clone.
- The corepack download prompt is mentioned and avoidable.

## Test plan

- `pnpm install`, `pnpm typecheck`, `pnpm test`, `pnpm check:boundaries`,
`pnpm check:leaks`, `pnpm check:licence`, `pnpm check:lib-version`,
`pnpm -C packages/deck check:dashes`, on a clean tree.
- The rig (Docker) executes the INSTALL.md blocks. Not runnable in this
session, so the block-id update in the plan is checked by reading.

## Decisions log

- Move the check rather than delete it: the pinned output is useful evidence
that corepack honoured `packageManager`.
- Keep `node --version` in section 1: Node is not pinned by the repo, so
checking it before the clone is correct.
- Set the prompt variable in the shell block, not only in prose, so scripted
and rig runs never hang. It is per shell, which the text says.
- New block in section 2 is `sh#1`, so `pnpm install` becomes `sh#2`; the plan's
DEPENDENCIES list is updated to claim both, or the rig fails on an
unclaimed block.

## Follow-ups

- The section 1 apt line list and `corepack enable` run before any clone too,
which is fine, but INSTALL.md still never says how to clone (separate issue).

## Check results

- Passing: install, typecheck, deck tests (2168), boundaries, leaks, licence,
lib-version, dashes.
- Already failing on `main`, unchanged by this work: 4 tests in
`packages/base` (`create-agent` CANNOT VERIFY case, and the `inbox` and
`inbox-push` and `pane-idle` shell suites). Environment-related, not touched.
36 changes: 26 additions & 10 deletions INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ apt-get install -y ca-certificates curl git ripgrep python3 tmux xxd
curl -fsSL https://deb.nodesource.com/setup_22.x | bash -
apt-get install -y nodejs
corepack enable
export COREPACK_ENABLE_DOWNLOAD_PROMPT=0
```

`curl` comes first on purpose. It is absent from a bare Ubuntu image and the
Expand All @@ -97,25 +98,20 @@ and Homebrew has no formula for it. If yours has somehow gone, `brew install
vim` brings it back. This is the belief half of the document, not the observed
half.

Check what you got. Anything on the `22.13` line or above, or 24 and above, is
inside the supported range; pnpm refuses to install on anything else and tells
you why.
Check Node. Anything on the `22.13` line or above, or 24 and above, is inside
the supported range; pnpm refuses to install on anything else and tells you
why. Do not check pnpm yet: that happens in section 2, inside your clone,
because outside it corepack has no `packageManager` field to read and fetches
the latest pnpm instead of the pinned one.

```sh
node --version
pnpm --version
```

```text
v22.23.2
10.34.5
```

The pnpm version is pinned by the repository's `packageManager` field, so
corepack fetches that exact version the first time you run it whatever you
have installed globally. The first `pnpm --version` is therefore slower than
it looks like it should be.

One last thing, and only if your shell has no locale set, which is normal
inside a container and on some minimal server images:

Expand All @@ -136,6 +132,26 @@ already has this and can skip it.

Everything from here runs from the root of your clone.

Check pnpm now, and not earlier. The pnpm version is pinned by the
repository's `packageManager` field, so corepack fetches that exact version the
first time you run it inside the clone, whatever you have installed globally.
Outside the clone there is no pin and corepack fetches the latest release,
which is not the one this repository was measured with. The first run is slower
than it looks like it should be, because of that download.

```sh
pnpm --version
```

```text
10.34.5
```

By default corepack asks `Y/n` before it downloads pnpm, and that prompt hangs a
script or a container. The `COREPACK_ENABLE_DOWNLOAD_PROMPT=0` line in section 1
switches it off, for that shell only. If you open a new terminal, either set it
again or answer `Y` when asked.

```sh
pnpm install
```
Expand Down
2 changes: 1 addition & 1 deletion rig/install-plan.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export const EXECUTABLE_LANGS = ["sh"];
export const KNOWN_LANGS = ["sh", "text", "zsh"];

const PREREQUISITES = ["1-prerequisites/sh#1", "1-prerequisites/sh#2", "1-prerequisites/sh#3"];
const DEPENDENCIES = ["2-install-the-dependencies/sh#1"];
const DEPENDENCIES = ["2-install-the-dependencies/sh#1", "2-install-the-dependencies/sh#2"];
const TRY_IT = ["3-try-it/sh#1", "3-try-it/sh#2"];
const CONFIGURE = [
"4-run-it-for-real/sh#1",
Expand Down
Loading
0