Skip to content

fix(wbfy): stage and rename the global package-manager configs - #1185

Merged
exKAZUu merged 7 commits into
mainfrom
fix/atomic-release-age-gate-writes
Aug 7, 2026
Merged

fix(wbfy): stage and rename the global package-manager configs#1185
exKAZUu merged 7 commits into
mainfrom
fix/atomic-release-age-gate-writes

Conversation

@exKAZUu

@exKAZUu exKAZUu commented Aug 7, 2026

Copy link
Copy Markdown
Member

Follow-up to #1182.

applyReleaseAgeGate.sh wrote each global config with a > redirect, which truncates the file before the new content lands. self-host-utils runs the script on machines that execute jobs concurrently, so a package manager resolving packages at that moment could read a truncated ~/.npmrc and install ungated or straight from the default registry, bypassing the Takumi Guard proxy — the reason the previous self-host-utils script staged its writes and renamed them into place.

Each write now stages under a mktemp name and renames it into place:

  • The unique name keeps two concurrent runs from publishing each other's half-written file (six concurrent runs now all succeed).
  • A single EXIT trap removes the staging file — which carries the credentials kept from the existing config — when a run fails, and explicit INT/TERM traps make a cancelled run exit 130/143 instead of finishing and reporting success.
  • A destination that is (or resolves to) a directory is rejected, because mv would move the staging file inside it and report success.

The documented Yarn floor also moves to 4.10.3: 4.9.4 has no npmMinimalAgeGate, 4.10.1 admits a version missing from the packument's publish times, 4.10.2 fixed that, and 4.10.3 no longer resolves a prerelease in place of a quarantined latest. docs/expected-repository-rules.md records these floors alongside the machine-managed global configs.

self-host-utils rewrites these files on machines that run jobs concurrently, so
a `>` redirect let a package manager read a truncated config and resolve
packages ungated or straight from the default registry.

Co-authored-by: WillBooster (Claude Code) <agent@willbooster.com>
@gemini-code-assist

Copy link
Copy Markdown
Contributor

Warning

You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again!

exKAZUu and others added 6 commits August 8, 2026 02:19
… floor

A fixed `.staging` name let two concurrent runs publish each other's
half-written file and abort on the missing rename target (reproduced with six
concurrent runs, which now all succeed). Yarn Berry 4.10.3 enforces
npmMinimalAgeGate and npmPreapprovedPackages while 4.9.4 ignores both, so the
documented floor is 4.10, not 4.11.

Co-authored-by: WillBooster (Claude Code) <agent@willbooster.com>
It holds the credentials kept from the existing config, so a failed rename must
not leave a copy behind. The documented Yarn floor also moves to 4.10.2, the
first release whose gate quarantines a version missing from the packument's
publish times instead of admitting it.

Co-authored-by: WillBooster (Claude Code) <agent@willbooster.com>
…on a signal

`mv` moves the staging file INTO a destination directory and reports success,
which would leave the config unwritten while the run claims the policy was
applied. A single EXIT/INT/TERM trap now also removes the staging file when the
run is interrupted, replacing the failure-only cleanup.

Co-authored-by: WillBooster (Claude Code) <agent@willbooster.com>
A cleanup-only INT/TERM trap swallowed the signal, so a cancelled run went on to
write every config and report success; it now exits 130/143 while the EXIT trap
still removes the staging file. The documented Yarn floor also moves to 4.10.3,
whose resolver no longer picks a prerelease in place of a quarantined `latest`.

Co-authored-by: WillBooster (Claude Code) <agent@willbooster.com>
Co-authored-by: WillBooster (Claude Code) <agent@willbooster.com>
@exKAZUu
exKAZUu merged commit d70ba01 into main Aug 7, 2026
6 checks passed
@exKAZUu
exKAZUu deleted the fix/atomic-release-age-gate-writes branch August 7, 2026 18:04
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.

1 participant