Repository navigation
fix(verify): stop lockfile verification from keeping every version's manifest - #16668
Conversation
The verifier projected each packument by walking `versions.iter()`, which hydrates every manifest. On the resolver's shared packument that hydration stays cached for the rest of the install, so checking a 1,400-entry lockfile kept a full manifest of every published version of every checked package. The trust projection also kept a typed manifest per version. - `PackageVersions::iter_uncached` decodes without filling the cache. - The trust check reads a `TrustHistory`; the verifier keeps one evidence rank per version instead of a manifest. - Verifier fetches project the document without hydrating it as a whole. Accept and reject outcomes are unchanged: the projection keeps the same versions and evidence the typed projection did. Closes #16656
Qodo reviews are paused for this user.Troubleshooting steps vary by plan Learn more → On a Teams plan? Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center? |
There was a problem hiding this comment.
Your trial has ended. Reactivate Greptile to resume code reviews.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configuration
📒 Files selected for processing (1)
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 6 remain after this review. 📝 WalkthroughWalkthroughLockfile verification can read policy fields without retaining decoded manifests in version hydration caches. The npm resolver fetches projected metadata for trust and abbreviated metadata checks. It refetches metadata when it detects a damaged mirror fragment. ChangesLockfile verification metadata
Priority: ➖ Normal Estimated code review effort: 3 (Moderate) | ~25 minutes Change: Bug fix · Severity of issue fixed: Medium Sequence Diagram(s)sequenceDiagram
participant VerificationMetadataClient
participant fetch_full_metadata_projected
participant PackageVersions
participant TrustHistoryProjection
VerificationMetadataClient->>fetch_full_metadata_projected: Fetch metadata and apply projection
fetch_full_metadata_projected->>PackageVersions: Check mirror fragments
fetch_full_metadata_projected->>TrustHistoryProjection: Build projected trust history
VerificationMetadataClient->>TrustHistoryProjection: Cache and use projected trust history
Assessment against linked issues
Suggested labels: Merge Risk: ⚪ Minimal · up to No actionable issue is established for this change; it is mergeable after normal checks. ✨ Finishing Touches 💡 1📝 Generate docstrings
🧪 Generate unit tests (beta)
🛠️ Fix failing CI checks 💡
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Copilot review overview
🔵 Needs a closer look
It refactors the supply-chain trust-downgrade verification path across multiple crates with subtle behavior-equivalence claims, so a human should confirm the trust-check parity before merging.
Review effort: Balanced
Findings: None
What changed in this PR
This PR fixes a memory-retention problem in pnpm v12 (pacquet) lockfile verification. Under trustPolicy/minimumReleaseAge, the verifier projected each packument by walking versions.iter(), which hydrated and cached a full typed manifest of every published version on the resolver's shared packument for the rest of the install. The change adds an uncached walk and a compact trust projection so the shared packument stays lazy, cutting peak RSS by ~0.6–0.7 GB in the reported repro. It fits into the resolver's existing verification layer and preserves accept/reject outcomes and error messages.
Changes:
- Add
PackageVersions::iter_uncached(decode without filling the hydration cache) by extracting a reusabledecodehelper. - Introduce a
TrustHistorytrait and a compactTrustHistoryProjection(time map plus one evidence rank per version), generalizingfail_if_trust_downgradedover it; the verifier caches the small projection instead of a fullPackage. - Add
fetch_full_metadata_projectedso verifier fetches project the document instead of hydrating it whole, keeping the damaged-mirror/offline behavior intact.
| File | Description |
|---|---|
pnpm/crates/registry/src/package_versions.rs |
Adds iter_uncached/hydrated_or_decode and extracts decode from hydrate. |
pnpm/crates/registry/src/package_versions/tests.rs |
Tests that iter_uncached reuses hydrated manifests, caches nothing new, and reports damaged fragments. |
pnpm/crates/resolving-npm-resolver/src/trust_checks.rs |
Defines TrustHistory, implements it for Package, and makes the trust-check helpers generic over it. |
pnpm/crates/resolving-npm-resolver/src/lookup_context.rs |
Adds TrustHistoryProjection and changes the trust cache value type. |
pnpm/crates/resolving-npm-resolver/src/lib.rs |
Re-exports TrustHistory. |
pnpm/crates/resolving-npm-resolver/src/fetch_full_metadata_cached.rs |
Adds fetch_full_metadata_projected; extracts refetch_damaged_mirror/has_damaged_fragment. |
pnpm/crates/resolving-npm-resolver/src/fetch_full_metadata_cached/tests.rs |
Imports the new projected-fetch helper for tests. |
pnpm/crates/resolving-npm-resolver/src/fetch_full_metadata_cached/tests/damaged_mirror.rs |
Tests projected fetch over a damaged mirror (offline error, online refetch+project). |
pnpm/crates/resolving-npm-resolver/src/create_npm_resolution_verifier/metadata_projection.rs |
project_trust_meta returns TrustHistoryProjection via iter_uncached; abbreviated projection uses one uncached pass. |
pnpm/crates/resolving-npm-resolver/src/create_npm_resolution_verifier/metadata_fetch.rs |
Projection-based trust fetch, full_meta_options helper, trust cache now holds the projection. |
pnpm/crates/resolving-npm-resolver/src/create_npm_resolution_verifier/trust_check.rs |
Passes the projection via meta.as_ref(). |
pnpm/crates/resolving-npm-resolver/src/create_npm_resolution_verifier/tests/metadata_cache.rs |
New test that policy checks read the shared packument without hydrating it. |
pnpm/crates/resolving-npm-resolver/src/create_npm_resolution_verifier.rs |
Import updates for the new trait/projection/helpers. |
pnpm/crates/resolving-npm-resolver/src/npm_resolver/guarded_pick.rs |
Passes full_meta.as_ref() to the now-generic trust check. |
.changeset/lockfile-verification-memory.md |
Changeset (pacquet patch) describing the memory reduction. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #16668 +/- ##
==========================================
+ Coverage 92.34% 92.36% +0.01%
==========================================
Files 1590 1591 +1
Lines 210054 210200 +146
==========================================
+ Hits 193978 194148 +170
+ Misses 16076 16052 -24 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Micro-Benchmark ResultsLinux |
Same-run regression checkHEAD and main are measured on the same runner. The tolerance is 5% of the main median or 2 ms, whichever is larger. A regression requires both the median slowdown and the gap between the fastest retained HEAD sample and slowest retained main sample to exceed this tolerance, after trimming up to 10% from each tail. Suspected regressions are rerun once with target order reversed and only fail if reproduced. This conservative noise guard is not a statistical confidence interval. Inconclusive rows do not fail the check. They remain visible for performance review. Bencher retains absolute minimum timings for historical tracking; historical alerts do not gate this PR. Sequential measurements can still be affected by runner drift.
Integrated-Benchmark Report (Linux)Commit: Regular scenarios report direct and pnpr installs. The peer-heavy resolver scenario compares current Rust, main Rust, and TypeScript pnpm; the linked-workspace scenario compares current Rust against main Rust. Bencher consumes pacquet@HEAD and pnpr@HEAD. The tables below show mean ± σ. Bencher tracks absolute minimum latency; PR regression checks compare HEAD and main samples from the same runner. Historical timing alerts do not gate PRs. Scenario: Isolated linker: fresh restore, cold cache + cold store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 2.5188930646999994,
"stddev": 0.17180515419335954,
"median": 2.4888060877,
"user": 1.91027062,
"system": 1.8615344,
"min": 2.3380089297,
"max": 2.8310609377
},
{
"command": "pacquet@main",
"mean": 2.7211388048,
"stddev": 0.1591555461179689,
"median": 2.7059768632,
"user": 2.28105842,
"system": 2.2784788999999996,
"min": 2.5326311507,
"max": 3.0598406477
},
{
"command": "pnpr@HEAD",
"mean": 1.5588510073,
"stddev": 0.1341475135685852,
"median": 1.5657392017,
"user": 2.0128166199999997,
"system": 1.901435,
"min": 1.3657313657,
"max": 1.7886536937000002
},
{
"command": "pnpr@main",
"mean": 1.5418216035999999,
"stddev": 0.13862797364339638,
"median": 1.5246038482,
"user": 1.96498402,
"system": 1.8410415999999998,
"min": 1.4064911747,
"max": 1.8548601927
}
]
}Scenario: Isolated linker: fresh restore, hot cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.41762225238,
"stddev": 0.05736390773834877,
"median": 0.43167984868000003,
"user": 0.50566556,
"system": 0.8808107,
"min": 0.30376225118000005,
"max": 0.49393667318000006
},
{
"command": "pacquet@main",
"mean": 0.43623576037999995,
"stddev": 0.17665421604714246,
"median": 0.36261312018,
"user": 0.48070406,
"system": 0.8594306999999999,
"min": 0.29562042118000004,
"max": 0.8588517331800001
},
{
"command": "pnpr@HEAD",
"mean": 0.3995765064800001,
"stddev": 0.0654060964882194,
"median": 0.36143585118000005,
"user": 0.44814466,
"system": 0.7601066999999999,
"min": 0.31929133218000005,
"max": 0.48687677418
},
{
"command": "pnpr@main",
"mean": 0.37327044578000007,
"stddev": 0.04431936965883461,
"median": 0.37232186718000004,
"user": 0.40124806,
"system": 0.7310340999999999,
"min": 0.30400894818,
"max": 0.47380880618000004
}
]
}Scenario: Isolated linker: repeat install, hot cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.012593644823636363,
"stddev": 0.0031132287101450786,
"median": 0.011894752460000001,
"user": 0.006862705454545455,
"system": 0.006998838727272727,
"min": 0.008094776460000001,
"max": 0.025189180460000002
},
{
"command": "pacquet@main",
"mean": 0.013188144242352944,
"stddev": 0.003231069151722003,
"median": 0.012139536460000001,
"user": 0.007750742352941177,
"system": 0.006690541764705882,
"min": 0.008955190460000002,
"max": 0.026180300460000003
},
{
"command": "pnpr@HEAD",
"mean": 0.01200133414644068,
"stddev": 0.002594022911164819,
"median": 0.01142541196,
"user": 0.006888945338983053,
"system": 0.006322988135593222,
"min": 0.008123680460000001,
"max": 0.023797000460000002
},
{
"command": "pnpr@main",
"mean": 0.011590669025656563,
"stddev": 0.001719577202088263,
"median": 0.01141798846,
"user": 0.00650611222222222,
"system": 0.006255214949494946,
"min": 0.008318826460000001,
"max": 0.02104370746
}
]
}Scenario: Isolated linker: repeat install, cold cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.018348278650450457,
"stddev": 0.003953575122483644,
"median": 0.0173157922,
"user": 0.010378369909909908,
"system": 0.009367219639639645,
"min": 0.0126794532,
"max": 0.029489531200000002
},
{
"command": "pacquet@main",
"mean": 0.019723207668749996,
"stddev": 0.004964750126088063,
"median": 0.0190340677,
"user": 0.010645038125000002,
"system": 0.010337480468750004,
"min": 0.0110887772,
"max": 0.0379861702
},
{
"command": "pnpr@HEAD",
"mean": 0.020190398135483862,
"stddev": 0.00423832712183836,
"median": 0.0196934827,
"user": 0.01059513741935484,
"system": 0.01092876467741936,
"min": 0.0125897262,
"max": 0.039281226200000005
},
{
"command": "pnpr@main",
"mean": 0.01610907351782946,
"stddev": 0.0026728126563305378,
"median": 0.015880875200000002,
"user": 0.009235010387596896,
"system": 0.008331293178294574,
"min": 0.0102199272,
"max": 0.0231578702
}
]
}Scenario: Isolated linker: fresh install, cold cache + cold store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 2.80097752342,
"stddev": 0.0761940703920056,
"median": 2.81352913002,
"user": 2.9094416,
"system": 2.17664964,
"min": 2.69312742102,
"max": 2.89029969002
},
{
"command": "pacquet@main",
"mean": 2.79593366482,
"stddev": 0.07434729506389468,
"median": 2.79068771702,
"user": 2.8310982000000005,
"system": 2.22139094,
"min": 2.68574828602,
"max": 2.91228689402
},
{
"command": "pnpr@HEAD",
"mean": 1.73847790042,
"stddev": 0.11082057432253924,
"median": 1.72923849852,
"user": 1.8319828999999999,
"system": 1.8262408399999999,
"min": 1.5496388860199999,
"max": 1.93565796002
},
{
"command": "pnpr@main",
"mean": 1.6675796140200003,
"stddev": 0.10152734725694731,
"median": 1.66913167702,
"user": 1.7413646,
"system": 1.8398859399999996,
"min": 1.50588525502,
"max": 1.8240667960199999
}
]
}Scenario: Isolated linker: fresh install, hot cache + hot store
Confirmation (reversed target order)
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.8071040300400002,
"stddev": 0.08124843871256243,
"median": 0.8012960177400001,
"user": 1.13006816,
"system": 1.13869564,
"min": 0.67528339824,
"max": 0.9511574682400001
},
{
"command": "pacquet@main",
"mean": 0.61340024544,
"stddev": 0.06133794576128982,
"median": 0.59136195024,
"user": 0.8706117600000001,
"system": 0.9086596400000001,
"min": 0.55238032424,
"max": 0.7085800802400001
},
{
"command": "pnpr@HEAD",
"mean": 0.41176609503999995,
"stddev": 0.04979366035012871,
"median": 0.40459006824,
"user": 0.38210575999999996,
"system": 0.76827864,
"min": 0.34616840124,
"max": 0.48174717524
},
{
"command": "pnpr@main",
"mean": 0.49537975094000003,
"stddev": 0.05954489680718471,
"median": 0.49536771974000005,
"user": 0.47756596,
"system": 0.83047524,
"min": 0.41237265824,
"max": 0.6328601422400001
}
],
"confirmation": {
"results": [
{
"command": "pnpr@main",
"mean": 0.40214190984,
"stddev": 0.0894617928284628,
"median": 0.35566355524000004,
"user": 0.3669170600000001,
"system": 0.72378244,
"min": 0.32801457624,
"max": 0.59827426124
},
{
"command": "pnpr@HEAD",
"mean": 0.36427281314000004,
"stddev": 0.023508227214947542,
"median": 0.36044090823999997,
"user": 0.34462226,
"system": 0.67195724,
"min": 0.32903407524,
"max": 0.41230615824
},
{
"command": "pacquet@main",
"mean": 0.7885145765399999,
"stddev": 0.06729979571187583,
"median": 0.79273240324,
"user": 1.12920926,
"system": 1.1669016400000003,
"min": 0.64702784524,
"max": 0.8962495662400001
},
{
"command": "pacquet@HEAD",
"mean": 0.69374306324,
"stddev": 0.07273307383741796,
"median": 0.7076435077400001,
"user": 0.9774798599999999,
"system": 0.97427014,
"min": 0.58548398624,
"max": 0.78901056524
}
]
}
}Scenario: Isolated linker: fresh install, cold cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 1.9670405415999999,
"stddev": 0.07971542130498309,
"median": 1.9586156567,
"user": 1.5262251,
"system": 1.2704460199999998,
"min": 1.8520063037,
"max": 2.1418612866999998
},
{
"command": "pacquet@main",
"mean": 1.8538659497999999,
"stddev": 0.08004859743532274,
"median": 1.8190879246999998,
"user": 1.3902432999999998,
"system": 1.15281952,
"min": 1.7626785517,
"max": 2.0071681687
},
{
"command": "pnpr@HEAD",
"mean": 0.3769747564,
"stddev": 0.020898093805597536,
"median": 0.37574420270000003,
"user": 0.36025460000000004,
"system": 0.7179050199999999,
"min": 0.3532231397,
"max": 0.42848367470000004
},
{
"command": "pnpr@main",
"mean": 0.3919215218,
"stddev": 0.02296019877142362,
"median": 0.3894780147,
"user": 0.39722989999999997,
"system": 0.7317944200000001,
"min": 0.35237159170000004,
"max": 0.43383699970000006
}
]
}Scenario: Isolated linker: fresh resolve, hot cache, offline
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.22911858976545452,
"stddev": 0.014020326683550095,
"median": 0.22774816522,
"user": 0.1989263618181818,
"system": 0.09489616181818182,
"min": 0.20662622222,
"max": 0.25127762322
},
{
"command": "pacquet@main",
"mean": 0.2281618414342857,
"stddev": 0.014953793329574241,
"median": 0.23184191872,
"user": 0.1949125371428571,
"system": 0.08374897999999997,
"min": 0.19560748822000001,
"max": 0.24404774022
},
{
"command": "pnpr@HEAD",
"mean": 0.09151951075125003,
"stddev": 0.0031721956282900307,
"median": 0.09121193172,
"user": 0.03290708625,
"system": 0.014723480625000002,
"min": 0.08611176722000001,
"max": 0.09820888122
},
{
"command": "pnpr@main",
"mean": 0.10436855775333335,
"stddev": 0.008605891634486275,
"median": 0.10303378222000001,
"user": 0.044070979999999996,
"system": 0.017013580000000004,
"min": 0.09136047922000001,
"max": 0.13539774522
}
]
}Scenario: Isolated linker: peer-heavy resolve, hot cache, offline
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.4503082070444445,
"stddev": 0.0722707304773409,
"median": 0.43595571260000004,
"user": 0.44571990000000006,
"system": 0.12483126444444442,
"min": 0.3744953536,
"max": 0.6088714386
},
{
"command": "pacquet@main",
"mean": 0.5816816018222223,
"stddev": 0.03365798384722056,
"median": 0.5779351906000001,
"user": 0.5691959,
"system": 0.13227359777777775,
"min": 0.5200716476000001,
"max": 0.6395487736000001
},
{
"command": "pnpm@HEAD",
"mean": 6.598601813266667,
"stddev": 1.7549409160973286,
"median": 5.6681222116,
"user": 9.426464011111111,
"system": 0.8057873755555556,
"min": 5.3240040676,
"max": 10.2947378396
}
]
}Scenario: Isolated linker: linked-workspace resolve, hot cache, offline
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.26545341501384623,
"stddev": 0.0394944827534366,
"median": 0.27364763186,
"user": 0.20467086153846148,
"system": 0.1088934,
"min": 0.21372807286,
"max": 0.33519636886000004
},
{
"command": "pacquet@main",
"mean": 0.25097573806000006,
"stddev": 0.04212319100438938,
"median": 0.23298825536,
"user": 0.1949045,
"system": 0.10258339999999999,
"min": 0.20838908386000002,
"max": 0.33284805186000005
}
]
}Scenario: Isolated linker: fresh restore, cold cache + cold store + cold pnpr
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 4.634082812640001,
"stddev": 0.07984820897183101,
"median": 4.6348472780400005,
"user": 2.08794436,
"system": 2.17931182,
"min": 4.54360306404,
"max": 4.80833421204
},
{
"command": "pacquet@main",
"mean": 4.805807835040001,
"stddev": 0.15146407300995948,
"median": 4.77840972454,
"user": 2.3001789599999998,
"system": 2.34973062,
"min": 4.66358003604,
"max": 5.09328901804
},
{
"command": "pnpr@HEAD",
"mean": 3.7159872168400008,
"stddev": 0.1521981740592245,
"median": 3.6449060710400003,
"user": 2.0430538599999997,
"system": 2.1264388199999997,
"min": 3.59284573504,
"max": 4.06032711704
},
{
"command": "pnpr@main",
"mean": 3.9465434002400004,
"stddev": 0.16185582809764618,
"median": 3.98723808254,
"user": 2.2819275599999997,
"system": 2.26595362,
"min": 3.62570772204,
"max": 4.17830020104
}
]
}Scenario: GVS linker: fresh restore, hot cache + hot storeSame install as the isolated fresh-restore hot/hot scenario, into the shared virtual store, the layout pnpm 12 installs into by default. Scenarios run on separate machines, so compare main and branch within each table.
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.1701658969541177,
"stddev": 0.013089339590912772,
"median": 0.17246529366000002,
"user": 0.2053007305882353,
"system": 0.19932644705882357,
"min": 0.14893653066,
"max": 0.19324121166000002
},
{
"command": "pacquet@main",
"mean": 0.2058319595933334,
"stddev": 0.036609882700159434,
"median": 0.21384039766000001,
"user": 0.24694439333333335,
"system": 0.23659993333333335,
"min": 0.16077598366,
"max": 0.26043547866000005
},
{
"command": "pnpr@HEAD",
"mean": 0.24852866441000002,
"stddev": 0.02290737482645549,
"median": 0.25221679616000003,
"user": 0.2863885933333333,
"system": 0.2671369666666667,
"min": 0.20423113266000004,
"max": 0.27385129366000005
},
{
"command": "pnpr@main",
"mean": 0.19131703642923079,
"stddev": 0.00983614654484408,
"median": 0.19390348866,
"user": 0.23579687538461538,
"system": 0.18230872307692308,
"min": 0.17556393366000003,
"max": 0.20290647766000003
}
]
} |
This comment has been minimized.
This comment has been minimized.
The verifier's projections walked every version of a packument through `iter_uncached`, decoding each one into a full `PackageVersion` to read two fields. The `#[serde(flatten)]` catch-all on `PackageVersion` makes serde buffer every key of the manifest and copy the unknown ones into `other`, so the walk paid for the whole manifest. `PackageVersions::iter_policy_fields` decodes a probe that keeps every field whose decode can fail, with the same deserializers, and drops the catch-all. A fragment decodes there exactly where it decodes as a `PackageVersion`, so the projections keep the same versions and the policy outcomes are unchanged. A test pins that equivalence over malformed fragments. The walk still reuses a hydrated manifest and still leaves unhydrated versions unhydrated, which `PackageVersions::is_hydrated` lets the shared-packument test assert. Co-Authored-By: Claude Opus 5.5 <[email protected]>
There was a problem hiding this comment.
Your trial has ended. Reactivate Greptile to resume code reviews.
|
I pushed 14f2473 on top of your commit. It replaces Written by an agent (Claude Code, claude-opus-5-5). |
Code Review by Qodo
1.
|
PR Code Suggestions ✨Warning
No code suggestions found for the PR. |
There was a problem hiding this comment.
Copilot review overview
🔵 Needs a closer look
It reworks security-relevant trust/release-age verification and relies on a subtle serde decode-equivalence invariant between the projection and full manifest, which warrants final human review despite no concrete defect being found.
Review effort: Balanced
Findings: None
…age fallback The policy-field probe left out `peerDependenciesMeta`. Its decoder never fails, but serde rejects a duplicated key of any declared field, so a fragment that repeats `peerDependenciesMeta` failed as a `PackageVersion` and passed the probe. The probe now declares every field `PackageVersion` declares. `fetch_full_metadata_cached`, which the minimumReleaseAge fallback uses for the `time` map, checked for damaged mirror fragments by hydrating every version. `PackageVersions::check_mirror_fragments` validates each fragment as JSON without keeping it, which flags the same fragments the hydrating walk did. Co-Authored-By: Claude Opus 5.5 <[email protected]>
There was a problem hiding this comment.
Your trial has ended. Reactivate Greptile to resume code reviews.
|
Both Qodo findings were real and are fixed in 0278d16:
Written by an agent (Claude Code, claude-opus-5-5). |
|
Code review by qodo was updated up to the latest commit 0278d16 |
PR Code Suggestions ✨Warning
No code suggestions found for the PR. |
There was a problem hiding this comment.
Copilot review overview
🔵 Needs a closer look
It refactors security-relevant trust-downgrade/release-age verification and hinges on a serde decode-parity invariant (PolicyFieldsProbe failing exactly where PackageVersion does) that cannot be fully verified by static reading and warrants human review.
Review effort: Balanced
Findings: None
The probe declares `peerDependenciesMeta` only so a duplicated key fails as it does on `PackageVersion`. Its decoder there never fails, so the probe skips the value as `IgnoredAny` instead of building a map it drops. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Qodo's new finding (peer metadata allocated and dropped) is fixed in 6325c05. The probe now skips Written by an agent (Claude Code, claude-opus-5-5). |
There was a problem hiding this comment.
Your trial has ended. Reactivate Greptile to resume code reviews.
That addresses finding 1: using |
|
Code review by qodo was updated up to the latest commit 6325c05 |
PR Code Suggestions ✨Warning
No code suggestions found for the PR. |
There was a problem hiding this comment.
Copilot review overview
🔵 Needs a closer look
It is a broad refactor of security-adjacent trust/release-age verification whose correctness hinges on a subtle serde decode-equivalence and ordering invariant, so it warrants final human review despite strong test coverage.
Review effort: Balanced
Findings: None
|
Found 1 test failure on Blacksmith runners: Failure
|
Summary
Lockfile verification under
trustPolicy/minimumReleaseAgekept a typed manifest of every published version of every checked package for the rest of the install. This drops that retention; peak RSS falls by 0.6 to 0.7 GB in the repro below.Closes #16656
Where the memory went (v12, live-heap profile right after verification, 1,355-entry lockfile):
PackageVersionper version)PackageVersions::iter_policy_fieldswalks versions without filling the hydration cache; both verifier projections use it, so the shared packument stays lazy. It decodes onlydistand_npmUser, plus every other field whose decode can fail, so a version decodes there exactly when it decodes as aPackageVersion. Skipping the#[serde(flatten)]catch-all cuts the verification pass's CPU time from 4.5–5.3 s to 2.5 s user time (1,211-entry lockfile, warm mirror, Linux).fail_if_trust_downgradedreads aTrustHistory;Packageimplements it as before, and the verifier caches a compact projection (time map plus an evidence rank per decodable version).ERR_PNPM_NO_OFFLINE_META.Peak RSS, macOS arm64, cold cache and store,
pnpm install --lockfile-only -r --ignore-scripts --ignore-pnpmfile --no-frozen-lockfileafter bumping one direct dependency (synthetic 2-project workspace from public packages: next, firebase, prisma, aws-sdk, angular, nest, ...):mainpeak RSSmain→ PRtrustPolicyonlyminimumReleaseAgeonlyLive heap came from a counting global allocator in a local build. The gap between live heap (peak about 0.5 to 0.7 GB with this PR) and RSS is transient packument decoding plus macOS malloc not returning freed pages; that part is not addressed here.
npm has no lockfile policy verification pass to compare against.
pnpm v11 is not changed. Its projections hold plain JS objects and never hydrate the shared packuments, so the v12 mechanism does not exist there. In the same repro v11 peaks at 2.3 GB with both policies and 2.0 GB with verification skipped (
trustLockfile); verification retains about 190 MB of post-GC heap and the rest is resolution.Not verified: Linux (glibc) RSS, where Mend runs. RSS varies by up to 0.5 GB between runs on this machine; the table shows one run each.
Squash Commit Body
Checklist
already linked to it solves it.
are implemented in every affected version.
pnpm changeset) if this PR changes any publishedpackage. Keep it short and written for pnpm users — it becomes a release note.
Written by an agent (Claude Code, claude-opus-5-5).
Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.Summary by CodeRabbit