Skip to content

feat(miner-foundation): extract reward-risk scoring into gittensory-engine (#2281) - #3933

Closed
e11734937-beep wants to merge 1 commit into
JSONbored:mainfrom
e11734937-beep:feat/reward-risk-engine-extract-2281
Closed

feat(miner-foundation): extract reward-risk scoring into gittensory-engine (#2281)#3933
e11734937-beep wants to merge 1 commit into
JSONbored:mainfrom
e11734937-beep:feat/reward-risk-engine-extract-2281

Conversation

@e11734937-beep

Copy link
Copy Markdown
Contributor

Summary

Extracts the deterministic reward/risk reasoning signals out of src/signals/reward-risk.ts into packages/gittensory-engine/src/reward-risk.ts, so the gittensory-miner can rank candidate work locally with the same logic the maintainer-side gate computes. Moves buildRepoRewardRisk, buildContributorRewardRiskStrategy, buildMaintainerNoiseReport, buildPullRequestReviewability, rewardRiskFreshnessInternals, and every public type, and re-exports them from the engine barrel.

src/signals/reward-risk.ts becomes a shim that imports the engine implementation via its relative source path (../../packages/gittensory-engine/src/reward-risk.js) — matching the merged #2276/#2278/#2282 style, not the published @jsonbored/gittensory-engine specifier — so no tsconfig path, vitest alias, or root dependency is introduced.

Closes #2281.

Why a wrapping shim instead of a pure re-export

Unlike the earlier self-contained extractions, reward-risk sits on top of the maintainer signal stack in src/signals/engine.ts (buildRoleContext, buildLaneAdvice, buildCollisionReport, buildQueueHealth, buildRepoFitRecommendation, buildContributorIntakeHealth, buildPullRequestReviewIntelligence) plus isFailingCheckSummary from src/signals/local-branch.ts. Those builders are not extracted yet and are far too large to port under the size cap, and the engine package must never import from src/. So the engine module takes them as an injected RewardRiskEngineDeps, and the shim binds the real src builders and threads them in — every existing importer keeps calling the four builders with their original signatures. Once those builders gain engine homes, a follow-up can drop the injection and collapse the shim back to a plain re-export.

The injected builders bind with no casts: their argument records are wider than (assignable to) the engine's mirror types, and their richer return types are covariantly assignable to the narrowed views the module actually reads. The engine-side types live in packages/gittensory-engine/src/types/reward-risk-types.ts (hand-kept mirrors, same pattern as predicted-gate-types.ts); the record mirrors are full verbatim copies because the reward-risk tests build those records as inline object literals. The real runtime objects pass straight through the injected builders, so behavior is identical to the pre-extraction file.

Size note

+1435 / -906 across 4 files, but ~906 of the insertions are the verbatim relocation of the existing module (offset by the deletions in src/); the genuinely new code is the ~360-line type mirror plus the DI plumbing and the shim. The file count (4) is well under the 10-file guidance.

Test plan

  • npm run typecheck (exit 0) — and again with packages/gittensory-engine/dist/ moved aside (resolves via source, not a stale build)
  • npx vitest run reward-risk-freshness / reward-risk-reports / maintainer-noise / signals-v2 / signals-coverage (127 tests, unmodified)
  • npm run test:coverage (full suite green; shim 100%, engine module 99.45% line)
  • npm run ui:typecheck, npm run ui:lint (0 errors), npm run ui:test (71)
  • npm run rees:test (1186)
  • git diff --check clean

@e11734937-beep
e11734937-beep requested a review from JSONbored as a code owner July 7, 2026 07:05
@superagent-security

Copy link
Copy Markdown
Contributor

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

…ngine (JSONbored#2281)

Move the reward/risk reasoning signals into packages/gittensory-engine/src/reward-risk.ts
so the gittensory-miner can rank candidate work locally with the same logic the
maintainer-side gate computes.

Closes JSONbored#2281.
@e11734937-beep
e11734937-beep force-pushed the feat/reward-risk-engine-extract-2281 branch from 870a4ce to e468fb1 Compare July 7, 2026 07:09
@loopover-orb loopover-orb Bot added the gittensor:bug Gittensor-scored bug fix — scores a 0.05x multiplier. label Jul 7, 2026
@loopover-orb

loopover-orb Bot commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Caution

🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥

🛑 Gittensory review result - fixes required

Review updated: 2026-07-07 07:17:51 UTC

4 files · no blockers · readiness 100/100 · CI failing · unstable

🛑 Suggested Action - Fix Blockers

  • AI review already in progress for this PR head: Another Gittensory pass is already running the AI review for this exact PR head. This pass is skipping to avoid a duplicate LLM call.

Review summary
AI review is already running for this PR head in another Gittensory pass. Gittensory is holding this PR for manual review until that pass completes.

Nits — 2 non-blocking
  • Code changes lack test evidence — Add focused regression tests or explain why existing coverage is sufficient.
  • AI review already in progress for this PR head — The gate is held for a human reviewer rather than passed automatically; it re-evaluates once the in-flight review completes or on the next update.

CI checks failing

  • codecov/patch — 97.26% of diff hit (target 99.00%)
Signal Result Evidence
Code review ✅ No blockers No AI review summary
Linked issue ✅ Linked #2281
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: 61 registered-repo PR(s), 35 merged, 0 issue(s).
Contributor context ✅ Confirmed Gittensor contributor e11734937-beep; Gittensor profile; 61 PR(s), 0 issue(s).
Gate result ⚠️ Not blocking Advisory; not blocking this PR.
Review context
  • Author: e11734937-beep
  • Role context: outside_contributor
  • Public audience mode: oss maintainer
  • Lane context: Repository is configured for direct PR review.
  • Public profile languages: not available
  • Official Gittensor activity: 61 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

@codecov

codecov Bot commented Jul 7, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 97.26562% with 7 lines in your changes missing coverage. Please review.
✅ Project coverage is 93.66%. Comparing base (9ec0782) to head (e468fb1).
⚠️ Report is 8 commits behind head on main.

Files with missing lines Patch % Lines
packages/gittensory-engine/src/reward-risk.ts 97.21% 1 Missing and 6 partials ⚠️

❌ Your patch check has failed because the patch coverage (97.26%) is below the target coverage (99.00%). You can increase the patch coverage or adjust the target coverage.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #3933   +/-   ##
=======================================
  Coverage   93.66%   93.66%           
=======================================
  Files         372      373    +1     
  Lines       34859    34864    +5     
  Branches    12746    12746           
=======================================
+ Hits        32652    32657    +5     
  Misses       1588     1588           
  Partials      619      619           
Files with missing lines Coverage Δ
src/signals/reward-risk.ts 100.00% <100.00%> (+2.78%) ⬆️
packages/gittensory-engine/src/reward-risk.ts 97.21% <97.21%> (ø)
🚀 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 commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Gittensory is closing this pull request on the maintainer's behalf (CI is failing (codecov/patch)). This is an automated maintenance action — to pursue this change, please open a new pull request with the issues resolved. Closed PRs may be analyzed later to improve review accuracy, but they are not automatically reopened or re-reviewed.

@loopover-orb loopover-orb Bot closed this Jul 7, 2026
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.

feat(miner-foundation): extract reward-risk scoring into gittensory-engine

1 participant