Skip to content

fix(arborist): allow registry bundle inspection in dry runs - #9818

Merged
martinrrm merged 7 commits into
npm:latestfrom
yszgj-30:agent/fix-registry-tarball-dry-run
Dec 1, 2026
Merged

martinrrm merged 7 commits into
npm:latestfrom
yszgj-30:agent/fix-registry-tarball-dry-run

Conversation

@yszgj-30

Copy link
Copy Markdown
Contributor

Summary

  • share the existing registry-resolved tarball validation between reification and ideal-tree building
  • apply the registry tarball exemption when a complete ideal tree inspects bundled dependencies
  • add a regression test for allowRemote=none

Root cause

Complete ideal-tree builds crack open tarballs for packages with bundled dependencies. That path passed the registry tarball URL directly to pacote.extract(), which classified it as a remote dependency and rejected it under the default allowRemote=none policy.

The fix only overrides that policy after the existing origin and registry-path checks confirm that the effective URL is registry-mediated.

Validation

  • reproduced npm install --dry-run [email protected] --allow-remote=none failing with EALLOWREMOTE before the fix
  • verified the same command exits 0 after the fix
  • passed the focused ideal-tree regression test
  • passed the existing 18-test registry URL and allowRemote reify group
  • passed node . run lint -w @npmcli/arborist

Fixes #9800

@yszgj-30
yszgj-30 marked this pull request as ready for review July 29, 2026 13:44
@yszgj-30
yszgj-30 requested review from a team as code owners July 29, 2026 13:44
ervwalter added a commit to twistymaze/trendweight that referenced this pull request Aug 24, 2026
npm 12's allow-remote=none default misclassifies registry tarballs of
bundleDependencies packages as remote (npm/cli#9800), which breaks lock
file maintenance on @tailwindcss/oxide-wasm32-wasi. Scope allow-remote=all
to Renovate's own npm runs via the npmrc config option; local dev and CI
keep npm 12 defaults. Remove once npm/cli#9818 ships.
@martinrrm martinrrm self-assigned this Sep 3, 2026
@MikeMcC399

Copy link
Copy Markdown
Contributor

@martinrrm

Could this be prioritized? Recent updates to the widely used Renovate bot have caused the underlying issue to be triggered which causes Renovate failures - see #9800 (comment)

Renovate updates to an out-of-the-box installation created with npx create-next-app@latest for Next.js (see https://nextjs.org/docs/app/getting-started/installation) fail because of the related issue.

@martinrrm

Copy link
Copy Markdown
Contributor

@yszgj-30 Thanks for opening the PR, I left some comments, but this looks great! Let us know if you can continue working on this fix.

theangryangel added a commit to theangryangel/lfspla.net that referenced this pull request Sep 25, 2026
martinrrm
martinrrm previously approved these changes Sep 28, 2026

@martinrrm martinrrm 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.

The requested URL-rewrite fix and regression coverage are now included in 9dff1f1. Three independent npm-specific reviews covered the complete diff; two had no findings, and the remaining consistency finding was fixed. Focused Arborist build-ideal-tree and registry-resolved tests plus Arborist eslint pass.

@martinrrm

Copy link
Copy Markdown
Contributor

Fixed the CI coverage failure in 12c29a9. The full Arborist suite was failing the 100% branch-coverage gate because the new complete-tree allowRemote branch lacked a remote-tarball case. Added that regression test; full Arborist tests, lint, and diff checks pass locally.

nkolev92
nkolev92 previously approved these changes Sep 30, 2026

@nkolev92 nkolev92 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.

Changes look good.
My only feedback is really comment related.

min-0-max added a commit to polyspec/hyper that referenced this pull request Oct 7, 2026
Consumers ran scripts/build-server.mjs and scripts/build-assets.mjs
from a checkout of this repository, and no release asset held them.
The new npm package @polyspec/hyper-build publishes the bins
hyper-build-server and hyper-build-assets and requires
@polyspec/hyper, the template packages, esbuild and Tailwind CSS at
exact versions. The scripts and their helpers moved into the package
once; the Makefile runs the bins by their files and the repository
scripts import its modules. The builds read checkManifest, routeReads
and the new export @polyspec/hyper/data-template.json of the published
browser package. make release-assets writes the new tarball, and the
npm consumer fixture builds a sample application with both bins.

npm 12.2.0 refuses the bundled-dependency tarball of
@tailwindcss/oxide-wasm32-wasi under allow-remote=root while it writes
a lock (npm/cli#9818), so make release-fixtures writes the fixture
lock with allow-remote=all until the pinned npm has the fix; the
bypass is H13.5-14.

The release install test failed before the change because the build
package tarball was not a built asset, and passes after it.
min-0-max added a commit to polyspec/hyper that referenced this pull request Oct 8, 2026
Replace scripts/release.mjs and scripts/release-fixtures.mjs and their
tests with scripts/kit/release.mjs and scripts/kit/release-consumer.mjs,
configured by config/release.json.

An archive is named <package>-<language>-<version>.<ext>. The Python
package is consumed by git tag and its version is checked by
release-versions. release.yml requires the check run ci-passed of the
tagged commit.

release-consumer installs the archives in the consumer projects of
tests/release-install and runs a smoke command for each package,
which replaces the sample application build of the removed install
test. release-consumer-lock writes their locks with
npm_config_allow_remote=all, because npm 12.2.0 refuses the lock under
allow-remote=root (npm/cli#9818).

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>

Copilot AI 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.

🟡 Changes recommended

Valid shared alias slots can fail normal installs with EALLOWREMOTE under allowRemote=none, while repeated bundle-status checks incur avoidable quadratic dependency-graph traversal.

2 open issues
4 resolved since last review

Review effort: Max

martinrrm and others added 2 commits November 7, 2026 00:05
Keep trusted registry selections through linked installs and check them against the current options. Read bundle status once per lookup.

Co-authored-by: Copilot <[email protected]>
Copilot-Session: 1b052141-348c-4c8a-a99d-a5c7a97e2b9c
Use the native path format for the local-file fixture so its strict
extraction assertions also work on Windows.

Co-authored-by: Copilot <[email protected]>
Copilot-Session: 1b052141-348c-4c8a-a99d-a5c7a97e2b9c

Copilot AI 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.

🔵 Needs a closer look

The test fixture lacks a valid incoming URL dependency edge, so the helper rejects it before checking registry eligibility, leaving accidental registry exemptions for declared remote URLs untested.

No open issues 🎉

1 previously missed issue

In code that hasn't changed since last review

Medium severity Fixture lacks a dependency edge, so it never tests registry exemption

workspaces/​arborist/​test/​registry-resolved.js:91

This fixture has no edgesIn, so the helper rejects it before checking whether the dependency was declared as a registry spec; isRegistryDependency is no longer consulted. The test therefore misses the policy boundary where a declared remote URL is rewritten into the configured registry. Construct the node with a valid URL dependency edge so the assertion detects an accidental registry exemption.

2 resolved since last review

Review effort: Max

axiomoth added a commit to splrad/steward that referenced this pull request Nov 11, 2026
## 摘要

修复维护 npm 工具链更新在托管端缺少配套锁文件的问题。真实 PR #341 更新两项 npm 声明到 12.2.2,但 `npm
install --package-lock-only` 报 EALLOWREMOTE,随后维护 CI 正确拒绝清单与锁不一致。

## 变更原因

npm 12.2.2 在完整 ideal tree 检查 bundled dependencies 时,将 registry 自身
tarball 当作 remote 处理;准确 Node 24.22.0/npm 12.2.2 隔离复现与 Mend job
`af5b9cae-0d6a-40ca-b33b-b7bd36b7c4c6` 一致。官方
[npm/cli#9800](npm/cli#9800) 已记录
package-lock-only 路径,[修复 #9818](npm/cli#9818)
当前尚未合并发布。

## 主要改动

仅为现有准确维护 npm 工具组增加 `skipInstalls: false`,采用 Renovate
[官方支持的安装模式](https://docs.renovatebot.com/configuration-options/#skipinstalls),生成锁时运行普通安装。范围保持
`maintenance/legacy-runtime-e990eda`、npm manager、根 package.json、npm 的
packageManager/devDependencies 两字段。

## 关联事项

关联 #324、#341。正式目标 npm 12.2.2 来自实际 registry 与托管发现,不固定旧 major,也不手工填写 #341
的锁来替代托管事务。

## 验证结果

- 准确 Node 24.22.0/npm 12.2.2:lock-only 原命令复现 EALLOWREMOTE;普通 `install
--no-audit --ignore-scripts` 成功,90 项锁变化仅根/npm 子树,根声明与实际包版本均为 12.2.2。
- 新锁在同一准确版本下 `npm ci --ignore-scripts --no-audit --no-fund` 成功。
- 官方 Renovate 有效规则 18 个针对性案例通过,仅准确维护 npm 两字段命中;strict schema
通过,Windows已有 RE2 回落警告保留,未修改任何正则。
- 官方 Renovate 44.222.5 源码确认普通安装与 ignoreScripts 独立;全局 ignoreScripts=true
保持。
- 本 PR 最终 head 的 CI/AI 按实际结果验收;采用后仍须观察真实 Mend 对 #341 的重建、锁一致性、artifacts
和 required 终态。

## 影响分析

普通安装会在该组托管临时目录安装整个锁对应的依赖树,增加下载与磁盘工作。安装脚本仍禁用,npm 默认 allow-remote
限制保持;其他分组、默认分支行为、版本发现和原有限流保持。

## 发布与迁移

通过最终检查和审查后按中央协调窗口正常采用。随后对既有 #341 通过 Mend
原生重试/重建核查实际结果;人工请求来源单独记录。配置采用不等于 npm 托管事务通过。

## 回退方式

通过正常 PR 撤回这一属性,恢复原安装策略;原失败事务与检查记录保留。

## AI 使用声明

本次由 AI 编程助手在已授权 R1 范围内实施与验证。服务部署、维护版本合并不属于本配置修正操作。
madic-creates added a commit to madic-creates/td-gui that referenced this pull request Nov 15, 2026
npm 12 defaults allow-remote to none and misclassifies registry tarballs of packages with bundleDependencies as remote (npm/cli#9800). Any lockfile update touching @tailwindcss/oxide-wasm32-wasi therefore failed with EALLOWREMOTE and left PR #83 with a stale package-lock.json. Set allow-remote=all for Renovate's own npm runs only; remove once npm/cli#9818 ships in Renovate's image.
martinrrm
martinrrm previously approved these changes Nov 30, 2026
One installed alias can satisfy edges that name different alias
targets. Rejecting every such node made its registry tarball fail with
EALLOWREMOTE under allow-remote=none. Keep all alias targets and grant
the exemption only when they resolve to the same registry origin and
path.

Also give the non-registry remote test a valid URL dependency edge so
it exercises the registry-spec guard.

Co-authored-by: Copilot <[email protected]>
Copilot-Session: 0d19c4f9-e55e-447a-b4fe-4d908fbee4c6

Copilot AI 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.

🟢 Approval recommended

No active review issues were identified for the changes applying registry-tarball exemptions during ideal-tree bundle inspection.

No open issues 🎉

Review effort: Balanced

@martinrrm
martinrrm merged commit 084a431 into npm:latest Dec 1, 2026
22 checks passed
@github-actions

github-actions Bot commented Dec 1, 2026

Copy link
Copy Markdown
Contributor

🎉 Backport to release/v11 created: #10395

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] --dry-run fails with EALLOWREMOTE on registry tarballs for packages that declare bundleDependencies

5 participants