Skip to content

feat(pm): support packageManager self-pinning - #3299

Merged
elrrrrrrr merged 10 commits into
nextfrom
agent/pm-self-pin
Aug 13, 2026
Merged

feat(pm): support packageManager self-pinning#3299
elrrrrrrr merged 10 commits into
nextfrom
agent/pm-self-pin

Conversation

@fireairforce

@fireairforce fireairforce commented Aug 12, 2026

Copy link
Copy Markdown
Member

Summary

Projects can now pin an exact Utoo package-manager version with "packageManager": "utoo@x.y.z", so contributors and CI use the same implementation instead of whichever global Utoo version happens to be installed.

  • Honor exact packageManager pins for local dependency operations.
  • Provision the matching supported platform package from the configured npm registry.
  • Verify registry SRI/shasum metadata, cache the release in a platform-specific slot under a dedicated self-pin cache root, and revalidate the cached executable and reported version before handoff.
  • Treat invalid cached releases as cache misses: never execute them, and replace only the affected platform slot after a newly downloaded archive passes registry integrity verification.
  • Preserve command arguments, working directory, stdio, exit status, and signals during handoff.
  • Keep scripts, ut x, query commands, and global installs on the current executable.
  • Document the pinning flow and the UTOO_SELF_PIN=0 escape hatch.

Prior art: Nub provides the same project-level version selection through packageManager: "nub@x.y.z", provisioning and handing off to the exact pinned Nub release during install operations.

SchemaStore support is being added in SchemaStore/schemastore#6192. It updates the package.json schema pattern from:

-(npm|pnpm|yarn|bun|aube|nub)@\d+\.\d+\.\d+(-.+)?
+(npm|pnpm|yarn|bun|aube|nub|utoo)@\d+\.\d+\.\d+(-.+)?

The first release containing this feature should be utoo@1.1.8 or newer; older binaries do not understand the recursion/auto-update guard used by the handoff.

Test Plan

  • cargo test -p utoo-pm — 369 unit tests and 28 CLI contract tests passed; 3 network tests ignored by the existing suite.
  • Added regression coverage for platform-specific cache keys, malformed cache metadata, executable integrity mismatches, and self-pin cleanup serialization.
  • Keep the self-pin cache physically isolated from ordinary registry packages while exposing logical _utoo-self-<platform>@<version> entries for exact utoo clean matching. Cleanup acquires the same platform/version lock as handoff and provisioning.
  • On Windows, keep the slot locked through child process creation, then release it before waiting so nested utoo clean invocations cannot deadlock the handoff parent.
  • cargo clippy --all-targets -- -D warnings --no-deps.
  • cargo fmt --all -- --check.
  • npx tombi format --check.
  • typos on changed files.
  • Manual corruption checks confirmed modified cached releases are never executed and fail closed if verified reprovisioning is unavailable.

@fireairforce
fireairforce requested a review from elrrrrrrr August 12, 2026 09:01
@fireairforce
fireairforce marked this pull request as ready for review August 12, 2026 09:13

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 032c9450fb

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread crates/pm/src/helper/self_pin.rs Outdated
Comment thread crates/pm/src/helper/self_pin.rs Outdated

@elrrrrrrr elrrrrrrr left a comment

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.

LGTM

@elrrrrrrr
elrrrrrrr merged commit fa4e502 into next Aug 13, 2026
63 of 71 checks passed
@elrrrrrrr
elrrrrrrr deleted the agent/pm-self-pin branch August 13, 2026 02:35
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.

2 participants