Skip to content

feat(engine): extract computeLocalScorerTokens to gittensory-engine - #4371

Merged
loopover-orb[bot] merged 1 commit into
JSONbored:mainfrom
reyanthony062001-ops:feat/engine-local-scorer-tokens
Jul 9, 2026
Merged

feat(engine): extract computeLocalScorerTokens to gittensory-engine#4371
loopover-orb[bot] merged 1 commit into
JSONbored:mainfrom
reyanthony062001-ops:feat/engine-local-scorer-tokens

Conversation

@reyanthony062001-ops

Copy link
Copy Markdown
Contributor

What

computeLocalScorerTokens (#782) is a pure ~35-line token scorer over changed-file metadata (paths + line counts, never source content), documented as needing to run "in every surface (stdio package AND hosted Worker)" — but it lived in src/signals/local-scorer.ts where the published gittensory-mcp/gittensory-miner CLIs cannot import it. This extracts it to packages/gittensory-engine/src/local-scorer.ts, with src/signals/local-scorer.ts becoming a thin re-export shim — the same layout as the #2278 duplicate-winner, #2282 scoring, and #4254 issue-rag-query extractions.

Its only dependencies are the already-portable isCodeFile/isTestPath (engine signals/test-evidence.ts) plus 3 narrow type shapes. Per the issue's guidance ("Lift or narrowly duplicate ... do not attempt to move local-branch.ts itself"), those 3 shapes are narrowly duplicated into the engine module (structurally identical to local-branch.ts's), leaving the large, Node-coupled local-branch.ts untouched in the backend.

Deliverables

  • computeLocalScorerTokens extracted to packages/gittensory-engine/src/local-scorer.ts
  • The 3 dependent type shapes narrowly duplicated into the engine module (not moving local-branch.ts)
  • src/signals/local-scorer.ts is a thin re-export shim (relative source path, matching prior extraction shims)
  • Exported from the package public entrypoint (index.ts)
  • Existing tests pass unmodified: test/unit/local-scorer.test.ts (+ local-scorer-adapter + mcp-run-local-scorer) green through the shim; plus a new engine-side barrel test

Validation

  • npm run test --workspace @jsonbored/gittensory-engine (build + 277 tests, 0 fail)
  • npm run typecheck (0 errors)
  • npx vitest run test/unit/local-scorer.test.ts test/unit/local-scorer-adapter.test.ts test/unit/mcp-run-local-scorer.test.ts (15 tests)
  • npm run test:engine-parity
  • git diff --check

Closes #4253

computeLocalScorerTokens (JSONbored#782) is a pure, ~35-line token scorer over
changed-file metadata that is documented as needing to run in every
surface (the published gittensory-mcp/gittensory-miner CLIs and the
hosted Worker), but it lived in src/signals/local-scorer.ts where the
CLIs cannot import it. This moves it to
packages/gittensory-engine/src/local-scorer.ts and turns the src module
into a thin re-export shim, following the same layout as the JSONbored#2278
duplicate-winner, JSONbored#2282 scoring, and JSONbored#4254 issue-rag-query extractions.

Its only dependencies are the already-portable isCodeFile/isTestPath
(engine signals/test-evidence.ts) plus 3 narrow type shapes. Per the
issue, those shapes are narrowly duplicated into the engine module
(structurally identical to local-branch.ts's) rather than moving the
large, Node-coupled local-branch.ts itself, which stays in the backend.

Exported from the package entrypoint, covered by an engine-side barrel
test, and the existing test/unit/local-scorer.test.ts (+ adapter + mcp
run-local-scorer tests) pass unmodified through the shim.

Closes JSONbored#4253
@superagent-security

Copy link
Copy Markdown
Contributor

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

@codecov

codecov Bot commented Jul 9, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.95%. Comparing base (c823f9c) to head (df0ce0f).
⚠️ Report is 44 commits behind head on main.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #4371   +/-   ##
=======================================
  Coverage   93.95%   93.95%           
=======================================
  Files         400      400           
  Lines       36817    36817           
  Branches    13451    13451           
=======================================
  Hits        34592    34592           
  Misses       1569     1569           
  Partials      656      656           
Files with missing lines Coverage Δ
packages/gittensory-engine/src/local-scorer.ts 100.00% <100.00%> (ø)
🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@reyanthony062001-ops
reyanthony062001-ops force-pushed the feat/engine-local-scorer-tokens branch from 8ddced7 to df0ce0f Compare July 9, 2026 10:02
@loopover-orb loopover-orb Bot added the gittensor:feature Gittensor-scored feature linked to a feature issue — scores a 0.25x multiplier. label Jul 9, 2026
@loopover-orb

loopover-orb Bot commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Tip

🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩

✅ Gittensory review result - approve/merge recommended

Review updated: 2026-07-09 17:15:42 UTC

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

✅ Suggested Action - Approve/Merge

  • safe to merge

Review summary
Clean, faithful extraction of the pure computeLocalScorerTokens token scorer into packages/gittensory-engine, matching the established shim pattern from #2278/#2282/#4254. The logic itself is byte-identical to the pre-diff src/signals/local-scorer.ts implementation, and the three dependent type shapes are narrowly duplicated as the issue instructs rather than dragging in local-branch.ts. The one substantive change is swapping the test classifier from isTestFile (local-branch.ts) to isTestPath (signals/test-evidence.ts) in the shimmed path — CI is green across the full engine test suite plus the three pre-existing local-scorer/adapter/mcp test files, so behavioral parity is verified in practice even though it isn't visible from the diff alone.

Nits — 4 non-blocking
  • The isTestFile → isTestPath swap in the re-implemented function (packages/gittensory-engine/src/local-scorer.ts) is a real dependency change, not a pure move — worth a one-line note in the PR description confirming isTestFile in local-branch.ts is itself just an alias for isTestPath, since that's the crux of why parity holds.
  • The large header comment block is duplicated near-verbatim between src/signals/local-scorer.ts's shim comment and packages/gittensory-engine/src/local-scorer.ts's file-level comment — fine for now but will drift if one is updated and not the other.
  • packages/gittensory-engine/test/local-scorer.test.ts imports from ../dist/index.js, so the new test is only meaningful after a build step; make sure the workspace test script (already validated per the PR) is the one CI actually runs, not a bare vitest invocation that would silently skip a stale dist.
  • Consider a short comment in the 3 duplicated type definitions pointing back to local-branch.ts's canonical versions so a future contributor knows to keep them in sync (or add a lightweight structural-equality test between the two, similar to the engine-parity test already run for this PR).
Signal Result Evidence
Code review ✅ No blockers 1 reviewer
Linked issue ✅ Linked #4253
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: 13 registered-repo PR(s), 6 merged, 0 issue(s).
Contributor context ✅ Confirmed Gittensor contributor reyanthony062001-ops; Gittensor profile; 13 PR(s), 0 issue(s).
Gate result ✅ Passing No configured blocker found.
Linked issue satisfaction

Addressed
The PR extracts computeLocalScorerTokens verbatim into packages/gittensory-engine/src/local-scorer.ts, narrowly duplicates the 3 dependent type shapes from local-branch.ts (rather than moving that file), turns src/signals/local-scorer.ts into a thin re-export shim, and exports the function/types from the engine package's index.ts — matching every deliverable in the issue and the referenced extract

Review context
  • Author: reyanthony062001-ops
  • Role context: outside_contributor
  • Public audience mode: oss maintainer
  • Lane context: Repository is configured for direct PR review.
  • Public profile languages: HTML, Python
  • Official Gittensor activity: 13 PR(s), 0 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.

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

  • Re-run Gittensory 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.

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

@loopover-orb
loopover-orb Bot merged commit d276cde into JSONbored:main Jul 9, 2026
15 checks passed
@loopover-orb loopover-orb Bot added gittensor:bug Gittensor-scored bug fix — scores a 0.05x multiplier. and removed gittensor:feature Gittensor-scored feature linked to a feature issue — scores a 0.25x multiplier. labels Jul 9, 2026
@JSONbored JSONbored added gittensor:feature Gittensor-scored feature linked to a feature issue — scores a 0.25x multiplier. and removed gittensor:bug Gittensor-scored bug fix — scores a 0.05x multiplier. labels Jul 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gittensor:feature Gittensor-scored feature linked to a feature issue — scores a 0.25x multiplier.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(engine): extract local-scorer.ts's computeLocalScorerTokens to gittensory-engine

2 participants