fix(engine): anchor objective-anchor's dependency-file regex to exact filenames - #8911
Conversation
… filenames kindsFromPath tagged any path ending in package.json / package-lock.json as a "dependency" change kind via an unanchored /package(?:-lock)?\.json$/, so a differently-prefixed sibling like mock-package.json or sub-package.json was misclassified -- inconsistent with the adjacent config check in the same function, which uses exact-match CONFIG_FILENAMES set membership. Anchor the regex (/^package(?:-lock)?\.json$/) so only the exact filenames package.json and package-lock.json classify as "dependency". Adds a negative test on both the engine's own suite and the Codecov-graded vitest classification suite: package.json/package-lock.json still classify, sub-package.json/mock-package.json no longer do. Closes JSONbored#8874
|
🚨 Contributor flagged. Click here for more info: Superagent Dashboard |
|
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 #8911 +/- ##
=======================================
Coverage 93.84% 93.84%
=======================================
Files 803 803
Lines 80084 80084
Branches 24277 24277
=======================================
+ Hits 75157 75158 +1
+ Misses 3562 3561 -1
Partials 1365 1365
Flags with carried forward coverage won't be shown. Click here to find out more.
|
|
Warning ⏸️ LoopOver review result - manual review recommendedReview updated: 2026-07-26 13:39:03 UTC
Review summary Nits — 3 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.
|
|
Held for manual review: the gate and required CI are green, but GitHub reports this pull request's mergeable state as |
What & why
Closes #8874.
packages/loopover-engine/src/objective-anchor.ts'skindsFromPathclassified any filename endingin
package.json/package-lock.jsonas a"dependency"change kind via an unanchored/package(?:-lock)?\.json$/. A differently-prefixed sibling —mock-package.json,sub-package.json— therefore got tagged"dependency", diluting that change-kind dimension thatscoreObjectiveAnchorrelies on. This is inconsistent with the adjacent config check three linesabove in the same function, which uses exact-match
CONFIG_FILENAMESset membership.Change
Anchor the regex:
/^package(?:-lock)?\.json$/u. Only the exact filenamespackage.jsonandpackage-lock.jsonnow classify as"dependency", matching the exact-match discipline already usedfor the config check.
Validation
sub-package.json/mock-package.jsondo not produce a"dependency"change-kind, whilepackage.json/package-lock.jsonstill do — added on both theengine's own suite (
packages/loopover-engine/test/objective-anchor.test.ts) and the Codecov-gradedvitest suite (
test/unit/engine-objective-anchor-config-classification.test.ts).^anchor fails exactly the new assertion in both runners.