Repository navigation
release-age: track npm policy in a file, pnpm 12 config.yaml - #187
Conversation
| `~/.npmrc` is the pointer to the tracked one; put any further npm policy in | ||
| `npmrc`, not in setup. The user file still wins on precedence, so `setup.sh` | ||
| removes the copy of the key an earlier revision wrote there and fails if some | ||
| other value shadows the tracked one. `npm config set -g` now edits the |
There was a problem hiding this comment.
P3: docs. npm config set -g does edit the tracked file through the link, but it serialises the whole file and drops every comment. Checked on a copy: after npm config set -g fund=false, the file is just min-release-age=7 and fund=false, so the header explaining why pnpm's key must stay out is gone. Since the line just above says to put further policy in npmrc, maybe say to edit the file by hand, or warn that config set -g strips its comments.
Review Summary#187 was already merged when the review ran, so the fix went into a follow-up PR, #189, instead of this branch. The core design checks out against the real tools in a throwaway HOME: npm honours a
Observation (P4): a host that ran #185 under pnpm 12 already has a real Verified: Verdict: approve |
- F1 (P2, fixed): release-age.test.sh put /usr/bin on run_setup's PATH, so on a host with a system npm (NodeSource, Debian's npm) the real npm answered the no-npm case and the suite failed; it runs unconditionally as a pre-commit hook, so every commit on such a host was blocked. The sandbox now gets a filtered system bin dir without npm/npx/pnpm/pnpx/ corepack. Origin: f7a6cc7 (#185). - F2 (P3, left for the author): README presents npm config set -g as the way to edit the tracked npmrc, but npm rewrites it without its comments.
uv records the user-level exclude-newer in uv.lock ([options] exclude-newer-span), so the gate invalidates locks made without it (`--locked` fails, `uv run` re-resolves) and locks re-made under it fail `--locked` elsewhere. The README's "Lockfiles win" and uv.toml's "versions already in uv.lock are kept" said otherwise. The test-isolation fix originally in this change (PATH without the system npm, sandboxed HOME) landed independently in #187; main's version of tests/release-age.test.sh is kept.
uv records the user-level exclude-newer in uv.lock ([options] exclude-newer-span), so the gate invalidates locks made without it (`--locked` fails, `uv run` re-resolves) and locks re-made under it fail `--locked` elsewhere. The README's "Lockfiles win" and uv.toml's "versions already in uv.lock are kept" said otherwise. The test-isolation fix originally in this change (PATH without the system npm, sandboxed HOME) landed independently in #187; main's version of tests/release-age.test.sh is kept.
What
Follow-up to #185. npm's policy now lives in a tracked file instead of being written into
~/.npmrcbysetup.sh, so tokens stay in the untracked user file and further npm policy is a file edit.modules/release-age/npmrc(min-release-age=7) is linked to~/.config/npm/npmrc. The only linesetup.shwrites into~/.npmrcisglobalconfig=<that path>, which makes npm read the tracked file as its global config layer. The user file still wins on precedence, sosetup.shalso removes themin-release-age=7line the first revision wrote there, and fails with an explanation if the effective value is not 7 (link missing, or a different user-level value shadowing the policy).pnpm config set -gpath; pnpm 12 ignores the pointer and readsconfig.yaml, so a trackedpnpm-config.yaml(minimumReleaseAge: 10080) is linked to~/.config/pnpm/config.yamland~/Library/Preferences/pnpm/config.yaml. On pnpm 12config set -gfinds the value already present and writes nothing.Verification
tests/release-age.test.sh(53 checks): the npm stub now resolves keys through the user file and then the file itsglobalconfig=names. Fresh host writes the pointer once and never the key; rerun writes nothing; a first-revision host loses the in-place line and keeps its token line; a different user-level value is kept and the run fails naming the override; an unlinked policy file fails naming the link; old npm / old pnpm / missing npm as before;npmrccarries only npm-known keys; every tracked file carries 7 days in its unit.npm config get min-release-ageandpnpm config get minimum-release-age(pnpm 10.32) read 7 and 10080, the second run made no writes, andnpmemits no warnings with the pointer in place.globalconfig=set in the user file with user precedence intact andprefixunaffected; pnpm 10.32 resolves a week-oldtypescript@nextthrough the pointer; pnpm 12.10 ignores the pointer, readsconfig.yaml, and resolves the same week-old build; npm warnsUnknown global config "minimum-release-age"when pnpm's key is placed in the shared file.via claude