chore(review): delegate diffFilePriority's lockfile match to the canonical isLockfile#8427
Conversation
|
Superagent didn't find any vulnerabilities or security issues in this PR. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #8427 +/- ##
=======================================
Coverage 92.42% 92.42%
=======================================
Files 791 791
Lines 79294 79294
Branches 23950 23951 +1
=======================================
Hits 73291 73291
Misses 4866 4866
Partials 1137 1137
Flags with carried forward coverage won't be shown. Click here to find out more.
|
c2f1bdf to
eac57ad
Compare
…nical isLockfile diffFilePriority hand-rolled a 31-name lockfile regex duplicating the canonical LOCKFILE_NAMES set, so any future ecosystem addition to the shared set would silently not be reflected here and the new format would rank as SOURCE(0) instead of GENERATED(4) -- surviving budget trimming ahead of real source. This is the same drift class this function's header documents already fixing once for test-file detection. Delegates the lockfile-name portion to isLockfile via the src/signals re-export shim, matching how isTestPath is consumed. The suffix-based .min.js/.min.css/.map/.snap matching stays inline. Closes JSONbored#8357
…get the parity marker CI's check-engine-parity gate failed: diffFilePriority is duplicated by FUNCTION across three copies (review-diff.ts, review-grounding.ts, and the engine's diff-file-priority.ts), and the named twin-pair guard asserts a literal cartfile\.resolved marker in both twins. Delegating only review-diff.ts removed that literal and left the other copies still hand-rolling the list. Delegates all three to the canonical isLockfile and retargets the marker to isLockfile(path). That guards the JSONbored#4605 Finding 1 regression at its root: the bug was a hand-rolled name list drifting, and no copy owns one now, so asserting the delegation is strictly stronger than asserting one name inside a private regex. Updates the marker test's synthetic host body to match.
|
Tip ✅ LoopOver review result - approve/merge recommendedReview updated: 2026-07-24 13:35:17 UTC
Review summary Nits — 4 non-blocking
Decision drivers
Context & advisory signals — never blocks the verdict
Linked issue satisfactionAddressed Review context
Contributor next steps
Signal definitions
🧪 Chat with LoopOverAsk LoopOver a question about this PR directly in a comment — grounded only in the same cached, public-safe facts shown above, never a new claim.
Full command reference: https://loopover.ai/docs/loopover-commands 🧪 Experimental — new and may change. 🟩 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 LoopOver, a quiet PR intelligence layer for OSS maintainers.
|
Summary
diffFilePriority(src/review/review-diff.ts) hand-rolled a 31-alternative lockfile-name regex duplicating the canonicalLOCKFILE_NAMESset exported bypackages/loopover-engine/src/signals/path-matchers.ts. Any future ecosystem addition to the canonical set (which has been extended in batches before —cartfile.resolved/gopkg.lock/shard.lock/rebar.lock/renv.lock/chart.locklanded together) would silently not be reflected here, ranking the new format as SOURCE(0) — highest priority, survives budget trimming — instead of GENERATED(4), dropped first.isTestPath), and a prior real instance of it in this same function is fix(engine): diffFilePriority's vendored-directory pattern misses vendored/third_party/third-party/bower_components/jspm_packages #7526.isLockfile, imported through thesrc/signals/path-matchersre-export shim — the same engine-consumption convention this file already uses forisTestPathviasrc/signals/test-evidence..min.js/.min.css/.map/.snap) is preserved inline, as required; only the name list moved.Behavior-change check (as the issue requires): I diffed the two lists programmatically — the canonical
LOCKFILE_NAMESset and the inline regex alternation are identical, 31 entries each, zero differences in either direction. Case-insensitivity is also preserved: the old regex used/i, andisLockfilematches the basename afternormalize(), which lowercases. So this is a pure behavior-preserving delegation, and no existing test relies on a lockfile nameisLockfiledoes not recognize —test/unit/review-diff.test.ts's lockfile cases (package-lock.json, plus thebun.lock/uv.lock/deno.lock/flake.lock/mix.lock/chart.locksweep) all pass unchanged.Closes #8357
Scope
type(scope): short summaryConventional Commit format, for examplefix(api): restore profile access checks.CONTRIBUTING.mdand does not reintroduce GitHub Pages, VitePress,site/, orCNAME.Closes #123) — a linked open issue is required for every contributor PR.Validation
git diff --checknpm run actionlintnpm run typechecknpm run test:coveragelocally;codecov/patchrequires ≥99% coverage of the lines AND branches you changed (aim for 100% on your diff so CI variance does not fail near the threshold). Global coverage is a non-blocking trend with a loose 90% backstop, not the gate.npm run test:workersnpm run build:mcpnpm run test:mcp-packnpm run ui:openapi:checknpm run ui:lintnpm run ui:typechecknpm run ui:buildnpm audit --audit-level=moderateIf any required check was skipped, explain why:
diffFilePrioritycopies, the engine-parity marker, and that marker's test (see the scope note above), soactionlint(no workflow change),build:mcp/test:mcp-pack(no MCP change),ui:*(no UI/OpenAPI change),test:workers(no worker change), andnpm audit(no dependency change) are not exercised by it.test/unit/review-diff.test.ts, 23 tests, including the dedicated "ranks every path-matchers lockfile as noise(4)" sweep, which is exactly the test that now protects the delegation).vitest run --coverage --coverage.all=false): the changed condition's branches are all exercised by existing tests —isLockfiletrue (short-circuit),isLockfilefalse with the suffix regex true (.map/.snap/.min.js), and both false (source files). Roottsc --noEmitis clean.Safety
UI Evidencesection below with JPG/JPEG or PNG screenshots arranged as organized, captioned, clickable thumbnails. SVG screenshots are not used as review evidence. Review-only screenshots or recordings are not committed to the repository.UI Evidence
Not applicable — backend refactor in
src/review/; no visible UI, frontend, docs, or extension change.Scope note — why this touches more than
review-diff.ts(CI-driven)The issue scoped the change to
review-diff.tsline 24. That alone fails CI, and finding out why changed the shape of the fix, so flagging it explicitly:diffFilePriorityis duplicated by function, not by file — three copies:src/review/review-diff.ts,src/review/review-grounding.ts(byte-identical host copy), andpackages/loopover-engine/src/review/diff-file-priority.ts.scripts/check-engine-parity.tsregisters the first and third as a named twin pair and asserts both contain the literal markercartfile\.resolved— a deliberate regression guard for #4605 Finding 1, where the engine copy's Carthage regex had silently drifted tocartfile\.lock(not a real filename).Delegating only
review-diff.tsdeletes that literal from one twin (validate-codefails: "missing expected twin-pair marker") and leaves the other two copies still hand-rolling the very list the issue wants de-duplicated — a worse state than before. So this PR:isLockfilein all three copies.cartfile\.resolvedtoisLockfile(path).This strengthens the guard rather than weakening it. #4605 was caused by a copy owning a private, hand-maintained name list that could drift. After this change no copy owns one, so that drift is structurally impossible instead of merely detected for one sampled filename — and the marker now asserts the delegation itself, which is what actually prevents the bug class. I deliberately did not simply delete the marker or park the literal in a comment to make the gate pass.
Verification:
npx tsx scripts/check-engine-parity.tsreports zero marker failures (both twins carry both markers). The script's other output — 25"drifted apart (normalized comparison)"lines across unrelated pairs (slop.ts,test-evidence.ts, …) — reproduces identically on cleanorigin/mainon my Windows checkout (a CRLF artifact of the normalized compare), as doescheck-engine-parity-script.test.ts(8 failed / 33 passed on both baseline and this branch). So this PR introduces no new parity failure.review-diff.test.ts+review-grounding.test.tspass in full (73 tests) and roottsc --noEmitis clean.Notes
packages/loopover-engine/src/signals/path-matchers.tsis untouched — it is the canonical source this now defers to.src/signals/path-matchers.ts(the thin re-export shim) rather than the engine'sdist/, matching that shim's own documented rationale: the built output is not guaranteed to exist whentypecheck/test:coveragerun in CI.