Skip to content

feat(miner-foundation): extract scoring preview/model into gittensory-engine (#2282)#3849

Merged
JSONbored merged 3 commits into
JSONbored:mainfrom
jimcody1995:feat/scoring-engine-extraction-2282
Jul 6, 2026
Merged

feat(miner-foundation): extract scoring preview/model into gittensory-engine (#2282)#3849
JSONbored merged 3 commits into
JSONbored:mainfrom
jimcody1995:feat/scoring-engine-extraction-2282

Conversation

@jimcody1995

Copy link
Copy Markdown
Contributor

Summary

  • Moves src/scoring/preview.ts, model.ts, and pending-pr-scenarios.ts into packages/gittensory-engine/src/scoring/ with thin src/scoring/* re-export shims so existing imports and tests stay unchanged.
  • Re-exports scoring modules from the engine barrel (scoringPreview, scoringModel, scoringPendingPrScenarios) and adds ./scoring/* package subpath exports for the miner.
  • Adds targeted unit tests for barrel exports, **/ label globs, branch-eligibility failure branches, draft PR detection, and missing review/check map paths so patch coverage meets the 99% codecov gate.

Fixes #2282

Test plan

  • npm run typecheck
  • npm run test:coverage (project thresholds pass; engine scoring modules at 100% line/branch coverage)
  • CI validate-code + codecov/patch

Made with Cursor

claytonlin1110 and others added 3 commits July 6, 2026 10:36
…-engine

Ports the deterministic parts of src/scoring/{preview,model,pending-pr-scenarios}.ts
into packages/gittensory-engine/src/scoring/, giving the miner the same
score-preview machinery the gittensory_preview_local_pr_score MCP tool already
calls server-side, so a miner can preview its own PR score fully locally (JSONbored#2282).

The D1/GitHub-fetching halves of model.ts and pending-pr-scenarios.ts stay in
src/, which now imports its pure constants/classifiers back from the engine;
those functions have no use to a local miner (no D1/App-token access) and
depend on Cloudflare-specific bindings the engine package's isolated tsconfig
cannot resolve. src/scoring/preview.ts is now a full re-export shim since the
whole file was already side-effect-free. Every existing scoring test suite
passes unmodified against the new shims.
…ored#2282)

Add barrel, branch-eligibility, wildcard, draft, and timestamp edge-case
tests so the scoring engine extraction meets the 99% patch coverage gate.

Co-authored-by: Cursor <cursoragent@cursor.com>
@jimcody1995
jimcody1995 requested a review from JSONbored as a code owner July 6, 2026 16:36
@superagent-security

Copy link
Copy Markdown
Contributor

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

@codecov

codecov Bot commented Jul 6, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.49%. Comparing base (ceeb905) to head (0cf9ef3).
⚠️ Report is 10 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3849      +/-   ##
==========================================
+ Coverage   93.47%   93.49%   +0.02%     
==========================================
  Files         332      334       +2     
  Lines       33110    33125      +15     
  Branches    12116    12121       +5     
==========================================
+ Hits        30948    30971      +23     
+ Misses       1530     1528       -2     
+ Partials      632      626       -6     
Files with missing lines Coverage Δ
packages/gittensory-engine/src/scoring/model.ts 100.00% <100.00%> (ø)
...tensory-engine/src/scoring/pending-pr-scenarios.ts 100.00% <100.00%> (ø)
packages/gittensory-engine/src/scoring/preview.ts 100.00% <100.00%> (ø)
src/scoring/model.ts 97.14% <ø> (-0.86%) ⬇️
src/scoring/pending-pr-scenarios.ts 100.00% <ø> (+6.09%) ⬆️
🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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

loopover-orb Bot commented Jul 6, 2026

Copy link
Copy Markdown

Warning

🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨

⏸️ Gittensory review result - manual review recommended

Review updated: 2026-07-06 16:45:06 UTC

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

⏸️ Suggested Action - Manual Review

  • Touches a guarded path — held for manual review: This PR changes guardrail-protected path(s): packages/gittensory-engine/package.json (matched **/package.json).

Review summary
This PR extracts scoring preview/model/pending-pr-scenario logic into a new packages/gittensory-engine/src/scoring/ module with thin re-export shims left in src/scoring/*, adds package subpath exports and barrel re-exports, and adds a handful of targeted unit tests to hit the 99% patch-coverage gate. The ported logic is described as verbatim (plus two small helpers duplicated across the package boundary, and several already-landed bugfixes with #-referenced rationale baked into comments), and CI (typecheck, tests, codecov/patch, codecov/project) all passed on this commit. The change is fundamentally a mechanical move plus wiring; the main risk is verifying the src/scoring/*.ts shim files (not shown in full) correctly re-export without altering behavior, which passing CI/tests supports but this review couldn't directly inspect.

Nits — 6 non-blocking
  • packages/gittensory-engine/src/scoring/preview.ts and pending-pr-scenarios.ts duplicate hand-copied logic from src/utils/json.ts, src/signals/change-guardrail.ts, and src/github/commands.ts (hasUnsafeWildcardCount, MAINTAINER_ASSOCIATIONS) — the comments acknowledge this but it's a real drift risk if the source-of-truth changes and the copy isn't updated.
  • packages/gittensory-engine/src/scoring/preview.ts is ~1494 lines in one file — consider splitting gate/scenario/label-matching logic into separate modules for maintainability now that it lives in its own package.
  • The src/scoring/preview.ts, model.ts, and pending-pr-scenarios.ts shim files aren't shown in the provided diff content — worth confirming they're pure re-exports with no behavior drift from the ported engine versions.
  • New test coverage added (98 lines) is thin relative to the ported source (2070 lines), relying mostly on pre-existing tests against the re-exported shims rather than new tests against the package directly.
  • pending-pr-scenarios.ts:170 and preview.ts:1009 introduce nesting depth of 5 (flagged by static analysis) — consider extracting helper functions to flatten the conditional branches.
  • Touches a guarded path — held for manual review — A maintainer must review and merge this change.
Signal Result Evidence
Code review ✅ No blockers 1 reviewer
Linked issue ✅ Linked #2282
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: 140 registered-repo PR(s), 92 merged, 0 issue(s).
Contributor context ✅ Confirmed Gittensor contributor jimcody1995; Gittensor profile; 140 PR(s), 0 issue(s).
Gate result ⚠️ Not blocking Advisory; not blocking this PR.
Review context
  • Author: jimcody1995
  • Role context: outside_contributor
  • Public audience mode: oss maintainer
  • Lane context: Repository is configured for direct PR review.
  • Public profile languages: TypeScript, JavaScript
  • Official Gittensor activity: 140 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 added the manual-review Gittensor contributor context label Jul 6, 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 6, 2026
@JSONbored
JSONbored merged commit 48f0943 into JSONbored:main Jul 6, 2026
9 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 6, 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 6, 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. manual-review Gittensor contributor context

Development

Successfully merging this pull request may close these issues.

feat(miner-foundation): extract scoring preview/model modules into gittensory-engine

3 participants