Skip to content

fix(review): delegate merge-train low-signal classification to canonical path-matchers (#8647) - #8696

Merged
loopover-orb[bot] merged 1 commit into
JSONbored:mainfrom
RealDiligent:fix/critical-issue-merge-train-lockfile-vendor-8647
Jul 25, 2026
Merged

fix(review): delegate merge-train low-signal classification to canonical path-matchers (#8647)#8696
loopover-orb[bot] merged 1 commit into
JSONbored:mainfrom
RealDiligent:fix/critical-issue-merge-train-lockfile-vendor-8647

Conversation

@RealDiligent

Copy link
Copy Markdown
Contributor

Problem

Closes #8647.

src/review/merge-train.ts:52-53 hand-rolled its own low-signal file/directory detection that had drifted from the canonical pattern its sibling files already use:

  • LOW_SIGNAL_FILENAME_RE matched only package-lock.json|yarn.lock|pnpm-lock.yaml|Cargo.lock (4 names), versus the canonical LOCKFILE_NAMES set (24+ entries incl. npm-shrinkwrap.json, poetry.lock, go.sum, bun.lock, composer.lock, …). Two PRs sharing only, say, a poetry.lock or go.sum were treated as a real overlap and forced into a spurious merge-train wait.
  • LOW_SIGNAL_DIR_RE matched only dist|build|coverage|node_modules, missing out and the vendored-code family (vendor|vendored|third_party|bower_components|jspm_packages).

review-diff.ts and review-grounding.ts already delegate lockfile-name matching to the canonical isLockfile(); merge-train.ts was the holdout, out of a mistaken concern that importing it would pull in a whole review-pipeline module — isLockfile is a dependency-free leaf utility.

Fix

  • Replace the hand-rolled LOW_SIGNAL_FILENAME_RE with the canonical isLockfile() from path-matchers.ts (imported the same way the sibling files do), covering all 24+ lockfile formats and never drifting again.
  • Extend LOW_SIGNAL_DIR_RE to the canonical generated/vendored set: adds out and vendor|vendored|third_party|third-party|bower_components|jspm_packages.

All 4 originals remain covered (cargo.lock is in LOCKFILE_NAMES, matched case-insensitively via normalizeForMatch), so there is no regression.

Tests

Two new tests in test/unit/merge-train.test.ts mirror the existing lockfile/dist case:

  • Two PRs sharing only poetry.lock + go.sum decide {wait: false} (previously {wait: true}).
  • Two PRs sharing only vendor/… + third_party/… decide {wait: false} (previously {wait: true}).

Reverting either source change makes its test fail. All 27 tests pass; git diff --check clean.

@RealDiligent
RealDiligent requested a review from JSONbored as a code owner July 25, 2026 23:46
@superagent-security

Copy link
Copy Markdown
Contributor

Superagent didn't find any vulnerabilities or security issues in this PR.

…cal path-matchers

src/review/merge-train.ts hand-rolled its own low-signal file/dir detection that had drifted from the
canonical set its sibling files already use:

- LOW_SIGNAL_FILENAME_RE matched only package-lock.json/yarn.lock/pnpm-lock.yaml/Cargo.lock (4 names),
  so two PRs sharing only a poetry.lock, go.sum, npm-shrinkwrap.json, etc. were treated as a real
  overlap and forced into a spurious merge-train wait.
- LOW_SIGNAL_DIR_RE matched only dist/build/coverage/node_modules, missing 'out' and the vendored-code
  family (vendor/vendored/third_party/bower_components/jspm_packages).

Replace the filename regex with the canonical isLockfile() helper from path-matchers.ts (the same
dependency-free leaf utility review-diff.ts and review-grounding.ts already delegate to, covering all
24+ lockfile formats), and extend the directory regex to the canonical generated/vendored set. Two
new tests prove PRs sharing only poetry.lock/go.sum or vendor/third_party paths now decide {wait:false}
where they previously decided {wait:true}.
@codecov

codecov Bot commented Jul 25, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.57%. Comparing base (c5cc6c4) to head (13cec51).
⚠️ Report is 6 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #8696      +/-   ##
==========================================
- Coverage   93.76%   90.57%   -3.20%     
==========================================
  Files         797       97     -700     
  Lines       79454    22516   -56938     
  Branches    24070     3893   -20177     
==========================================
- Hits        74504    20393   -54111     
+ Misses       3565     1945    -1620     
+ Partials     1385      178    -1207     
Flag Coverage Δ
backend 100.00% <100.00%> (+4.96%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
src/review/merge-train.ts 100.00% <100.00%> (ø)

... and 700 files with indirect coverage changes

@loopover-orb loopover-orb Bot added the gittensor:bug Gittensor-scored bug fix — scores a 0.05x multiplier. label Jul 25, 2026
@loopover-orb

loopover-orb Bot commented Jul 25, 2026

Copy link
Copy Markdown
Contributor

Tip

✅ LoopOver review result - approve/merge recommended

Review updated: 2026-07-25 23:53:49 UTC

2 files · 1 AI reviewer · no blockers · readiness 100/100 · CI green · clean

✅ Suggested Action - Approve/Merge

  • safe to merge

Review summary
This replaces a hand-rolled 4-name lockfile regex with the canonical `isLockfile()` helper already used by `review-diff.ts`/`review-grounding.ts`, and extends the low-signal directory regex with `out` and the vendored-code family (`vendor`/`third_party`/etc.). The change is narrowly scoped, closes #8647, and is backed by two new tests that fail if either source change is reverted (confirmed via the test file's assertions on `poetry.lock`/`go.sum` and `vendor`/`third_party` paths). The refactor is low-risk: `isMeaningfulPath` still combines a lockfile check and a directory regex check with `&&`, just delegating the lockfile half to a well-tested shared utility.

Nits — 4 non-blocking
  • The brief's 'magic number' flags on `merge-train.ts:51-52` are false positives — those are `24`/`4` appearing inside prose comments, not new numeric literals in code.
  • The updated doc comment references 'fix(orb): merge-train.ts's hand-rolled lockfile/vendor-directory lists have drifted from the canonical path-matchers set #8647' inline; confirm this matches the codebase's existing convention of citing issue/PR numbers in comments (it does, per the surrounding file, so this is just a consistency note).
  • Consider a follow-up test asserting `isMeaningfulPath` treats a path like `NODE_MODULES/x.js` or mixed-case `Vendor/x.go` consistently, since the directory regex is case-insensitive but relies on literal segment names.
  • If `isLockfile` doesn't already normalize path separators (e.g. Windows-style `\`), verify that assumption holds for `backend/go.sum`-style nested paths, since this is the first non-sibling-file caller relying on that behavior for this gate.

Decision drivers

  • ✅ Code review — No blockers (1 reviewer)
  • ✅ Gate result — Passing (No configured blocker found.)
Context & advisory signals — never blocks the verdict
Signal Result Evidence
Linked issue ✅ Linked #8647
Related work ✅ No active overlap found No same-issue or scoped active PR overlap found.
Change scope ✅ 20/20 Low review scope from cached public metadata (1 linked issue).
Validation posture ✅ 25/25 PR body includes validation/test evidence.
Contributor workload ✅ 10/10 Author activity: 327 registered-repo PR(s), 134 merged, 37 issue(s).
Contributor context ✅ Confirmed Gittensor contributor RealDiligent; Gittensor profile; 327 PR(s), 37 issue(s).
Improvement ✅ Minor risk: clean · value: minor · LLM: moderate
Linked issue satisfaction

Addressed
The diff replaces the hand-rolled lockfile regex with the canonical isLockfile() helper, extends LOW_SIGNAL_DIR_RE to include 'out' and the vendored-code family, and adds two new tests exercising a non-npm lockfile (poetry.lock/go.sum) and a vendored directory (vendor/third_party) proving {wait: false} where it previously would have waited.

Review context
  • Author: RealDiligent
  • Role context: outside_contributor
  • Public audience mode: oss maintainer
  • Lane context: Repository is configured for direct PR review.
  • Public profile languages: Python, Ruby, TypeScript, Svelte, Cuda, JavaScript, Markdown, MDX
  • Official Gittensor activity: 327 PR(s), 37 issue(s).
  • PR-specific overlap: none found.
Contributor next steps
  • Keep the PR focused and include validation evidence before maintainer review.
Signal definitions
  • Related work = same linked issue, overlapping active PRs, or title/path similarity.
  • Change scope = cached public metadata such as size labels, draft state, and review-burden hints.
  • Validation posture = whether the PR provides enough public validation/test evidence for maintainer review.
  • Contributor workload = public contributor activity and cleanup pressure, not a repo-wide quality failure.
  • Contributor context = public GitHub/Gittensor identity context; non-Gittensor status is not a blocker.
🧪 Chat with LoopOver

Ask 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.

  • @loopover ask &lt;question&gt; answers contribution-quality Q&A with source citations and freshness.
  • @loopover chat &lt;question&gt; answers in natural prose from cached decision-pack facts via local inference (maintainer/collaborator; read-only).
  • A plain-language @loopover mention with a real question is routed to the closest matching read-only command automatically — no exact syntax required.

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.

  • Re-run LoopOver review

@loopover-orb loopover-orb Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LoopOver approves — the gate is satisfied and CI is green.

@loopover-orb
loopover-orb Bot merged commit b83b78c into JSONbored:main Jul 25, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gittensor:bug Gittensor-scored bug fix — scores a 0.05x multiplier.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(orb): merge-train.ts's hand-rolled lockfile/vendor-directory lists have drifted from the canonical path-matchers set

1 participant