npm_crawler classifies node_modules store children three times, and the copies drifted on store entries and legacy/global stores
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
調査の方向性
Start in crates/socket-patch-core/src/crawlers/npm_crawler.rs, comparing the three store-classification walks: nested_node_modules_of (the find_by_purls resolver), gather_node_modules (the scan) and find_store_peer_variant_copies_reusing. Run crawl_all, find_by_purls and find_store_peer_variant_copies on the existing tests in that file and tests/crawler_npm_e2e.rs to capture current results. Done means a shared StoreKind classifier with the same results on those tests, plus a new test pinning the store-entry rule. Settle the intended store-entry behaviour with maintainers before changing it.
索引モデルが issue の本文から書いたものです。
説明
[agent] Filed by the scheduled architecture audit (audit-core). Register: register comment.
Kind: refactor. Register ID: A41.
Problem
crawlers/npm_crawler.rs decides which child of a node_modules is a package-manager store (pnpm-shaped .pnpm/.store, vlt .vlt, npm-linked .store, .modules.yaml, legacy pnpm store names) in three hand-written copies:
- the
find_by_purlsresolver,nested_node_modules_of: L3166-L3225 - the scan,
gather_node_modules: L3576-L3624 - the peer-variant finder,
find_store_peer_variant_copies_reusing: L4478-L4520
The copies have drifted:
- Store entries. Every arm of the scan is gated on
!store_entry, so a store entry's ownnode_modules/.pnpm(or.vlt,.store,.modules.yaml, a legacy name) is never treated as a store. The resolver has nostore_entryparameter and walks such a child as a store.applycan therefore resolve copies thatscannever reports. This is unexecuted and an edge case. - Missing kinds. The peer finder handles neither legacy pnpm stores nor the pnpm global virtual store.
- Empty
.modules.yamlarm. The resolver's arm pushes an empty entry list (L3207), andvisit_resolver_dirthen has to guard against it (L3037).
The same file also has:
- four shapes for one store entry:
StoreEntryDir,StoreEntry,(String, PathBuf)and(OsString, PathBuf). They are converted at L1751-L1788, L3673, L3692, L4087 and L4131, andlist_npm_store_entriesdecodes each name, discards the result, and decodes it again (L4243, then L4619); - about 7 copies of the "package-dir child" filter (not hidden, not
node_modules, a real dir): L3082, L3226-L3241, L3508, L3772, L4153, L4200, L600. They drift on whetheris_dirfollows symlinks (L4077 vs L4160/L4226) and on whether a scoped child namednode_modulesis excluded (L3238); - 5 copies of the
@scope/nameexpansion: L3088-L3102, L3234-L3245, L3645/L3762, L4213-L4222, L4719.
Proposed change
- Add one
StoreKindenum with aclassify(name, file_type, in_store_entry) -> Option<StoreKind>and use it in all three walks. The resolver passesin_store_entrythe way the scan does. - Keep one store-entry type (
StoreEntryDir), drop the tuple shapes, and decode each name once. - Add one
package_children(dir, listing)iterator that yields unscoped and@scope/namepackage dirs, and use it for the filter and expansion copies.
The peer-variant section (L4391-L4791) can then move to crawlers/npm_crawler/store.rs.
Size: 1 file (plus a new submodule), about −300/+150 lines.
Acceptance criteria
crawl_all,find_by_purlsandfind_store_peer_variant_copiesreturn the same results on every existing test innpm_crawler.rsandtests/crawler_npm_e2e.rs.- A new test pins the store-entry rule: a store entry holding a nested
node_modules/.pnpmis neither reported bycrawl_allnor resolved byfind_by_purls. Alternatively, if both are meant to walk it, the test asserts that both do.
- 主要言語
- Rust
- スター
- 9
- フォーク
- 2
- 平均マージ
- 1日 8時間
- マージ済み PR(30日)
- 309
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
SocketDev/socket-patch のほかの issue
-
Windows unit tests fail on main: pnpm-registry-overrides fixtures are checked out as CRLF (mixes CRLF and LF line endings)対応中かも @mikolalysenko が今日担当しました。 オープンagent:claimed agent:triaged ci-janitor priority:p1
難易度 1/5 1〜3時間 初心者へのやさしさ 85/100
SocketDev/socket-patch#2238 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
agent:triaged arch-audit priority:p3 refactor
難易度 2/5 1〜3時間 初心者へのやさしさ 83/100
SocketDev/socket-patch#1860 ·
メンテナーはふだん 1 日以内に返信
-
agent:triaged arch-audit priority:p3 refactor
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
SocketDev/socket-patch#1838 ·
メンテナーはふだん 1 日以内に返信
-
Nightly: pnpm11_registry_route_is_cleaned_up_when_a_patch_is_not_needed fails on Windows (pnpm records the RUNNER~1 short path as a second importer)対応中かも このイシューにリンクされたプルリクエストがオープン中、またはマージ済みです。 オープンagent:triaged ci-janitor priority:p1
難易度 3/5 半日 初心者へのやさしさ 42/100
SocketDev/socket-patch#2235 ·
メンテナーはふだん 1 日以内に返信
-
Agent mode reports a gem whose installed file was edited as "not installed on this host" / "not found on disk", `apply --check` says to run `apply`, and `rollback` exits 1 with "modified after patching" on every run対応中かも @mikolalysenko が今日担当しました。 オープンagent:claimed agent:triaged bug bughunt pm:bundler priority:p1 ux
難易度 4/5 3〜5日 初心者へのやさしさ 18/100
SocketDev/socket-patch#2231 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
SocketDev/socket-patch の issue をすべて見る
似ている issue
-
area: cli good first issue type: feature
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
-
[Bug] Windows Ghidra provider rejects a PATH-only JDK: bare `java.exe` probe fails with Win32 87オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
メンテナーはふだん 1 日以内に返信
-
renaming a provider to a taken name fails with a raw sql error対応中かも このイシューにリンクされたプルリクエストがオープン中、またはマージ済みです。 オープンarea:storage kind:bug priority:p3 ready
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
メンテナーはふだん 1 日以内に返信
-
bug bugfix
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
storytold/photocraft#16975 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
メンテナーはふだん 1 日以内に返信