fix(review): stop false-positiving on transitive bumps and workspace links - #2692
Conversation
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
gittensory-ui | 0160d04 | Commit Preview URL Branch Preview URL |
Jul 03 2026, 06:28 AM |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2692 +/- ##
==========================================
- Coverage 96.13% 96.13% -0.01%
==========================================
Files 241 241
Lines 27033 27032 -1
Branches 9822 9816 -6
==========================================
- Hits 25988 25987 -1
Misses 433 433
Partials 612 612
🚀 New features to boost your workflow:
|
|
Caution 🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥 🛑 Gittensory review result - fixes requiredReview updated: 2026-07-03 06:51:04 UTC
🛑 Suggested Action - Manual Review
Review summary Blockers
Nits — 5 non-blocking
Why this is blocked
CI checks failing
Review context
Contributor next steps
Signal definitions
🟩 Safe / merged · 🟦 Advisory · 🟨 Held for review · 🟥 Blocked / closed 💰 Earn for open-source contributions like this. Gittensor lets GitHub contributors earn for the work they already do — register to start earning →. Checked by Gittensory, a quiet PR intelligence layer for OSS maintainers.
|
…links Fixes two confirmed false-positive bugs in the already-merged #2676 (issue #2563): packagesWithManifestVersionChange only saw package.json's DIRECT dependency blocks, so a transitive dependency's resolved/ integrity bump -- the vast majority of any real lockfile diff -- was always misclassified as tamper risk. Replaced it with a signal comparing a lockfile entry's resolved/integrity change against that SAME entry's own "version" line within the same diff, which a genuine install/update always bumps together for both direct and transitive entries. Also exempts non-http(s) resolved values (npm workspace-local relative paths, e.g. "packages/gittensory-mcp") from the off-registry check -- they were never resolved from a registry, so they can't be off-registry. Addresses gate-review findings on #2676.
removed !== added already evaluates to false when both are undefined, so the guard was unreachable dead code (codecov/patch flagged it).
…are name Two distinct package-lock.json entries can share the same bare package name at different node_modules nesting depths (npm nests a second copy when dependents need incompatible versions). Keying candidates by bare name merged those entries into one shared record, so a legitimate version bump on one entry could mask an unbumped, tampered resolved/integrity edit on the other. The full node_modules/... path is unique per entry and is now used as the map key instead. Addresses gate-review findings on #2692.
6c8fc8a to
9471412
Compare
|
Both findings investigated:
All 30 tests in |
Summary
Adversarial review of the already-merged #2676 (issue #2563) found two confirmed, empirically-reproduced false-positive bugs that directly violate the issue's own acceptance criterion ("a normal npm install-driven lockfile update does not false-positive"):
packagesWithManifestVersionChange()only scannedpackage.json's own dependency blocks (direct dependencies). The vast majority of any realpackage-lock.json's entries are transitive dependencies, which never appear in anypackage.jsonat all — so the check misfired on nearly every ordinarynpm install/npm update.NPM_REGISTRY_HOST_RErequired an exacthttps://registry.npmjs.org/prefix. A workspace's own local packages (e.g. this repo'spackages/gittensory-mcp,apps/gittensory-ui) have aresolvedfield that's a relative filesystem path, not a URL at all — it failed the registry-host check trivially and got flagged the moment that entry's resolved line changed (entirely routine).Fix: replaced the package.json cross-reference with a self-contained signal — every package-lock.json entry (direct AND transitive) carries its own
version/resolved/integritytrio, and a genuine install/update always bumps all three together. The tamper signal now compares aresolved/integritychange against that SAME entry's own"version"line within the same diff, which covers transitive and direct dependencies uniformly and is a more specific, self-contained tamper tell (a hand-edited resolved/integrity with the version left unchanged) than the old cross-file check. Also exempted non-http(s)://resolved values from the off-registry check.Addresses gate-review findings on #2676.
Test plan
npm run typechecknpx vitest run test/unit/lockfile-tamper.test.ts test/unit/lockfile-tamper-wiring.test.ts test/unit/queue.test.ts— 417/417 pass, including 3 new regression tests (transitive-only bump does not trigger, workspace-local resolved path does not trigger, a genuine off-registry URL still triggers) and one existing test updated to reflect the new, more accurate design (a changed integrity with no version bump is now correctly flagged even when the package is also being dropped from package.json — previously silently ignored)