Skip to content

test(miner-plan): dedicated branch coverage for the feasibility-gate composer (#2313) - #4065

Merged
loopover-orb[bot] merged 2 commits into
JSONbored:mainfrom
andriypolanski:test/feasibility-gate-branches-2313-v2
Jul 7, 2026
Merged

test(miner-plan): dedicated branch coverage for the feasibility-gate composer (#2313)#4065
loopover-orb[bot] merged 2 commits into
JSONbored:mainfrom
andriypolanski:test/feasibility-gate-branches-2313-v2

Conversation

@andriypolanski

Copy link
Copy Markdown
Contributor

Summary

  • Add packages/gittensory-engine/src/feasibility.ts — pure buildFeasibilityVerdict composer over claimStatus × duplicateClusterRisk × issue status, collecting every avoid trigger independently (no ??/|| collapse).
  • Add test/unit/feasibility-gate-branches.test.ts — 29 focused branch tests: each avoid/raise discriminant, simultaneous avoid signals, happy-path go, full enum sweeps, and parity against buildPreStartCheck via feasibilityInputFromPreStartCheck.
  • Export the composer from @jsonbored/gittensory-engine barrel.

Closes #2313

Scope

  • Every claimStatus × duplicateClusterRisk × issue-status branch the composer actually uses
  • Explicit two (and three) simultaneous avoid-trigger test
  • All-clear happy path → go
  • repo/issue/pr builders mirror test/unit/signals-coverage.test.ts for pre-start parity cases
  • Composer prerequisite included — feasibility.ts was not on main yet

Changed files

File Change
packages/gittensory-engine/src/feasibility.ts buildFeasibilityVerdict, feasibilityInputFromPreStartCheck, gate types
packages/gittensory-engine/src/index.ts Barrel exports
test/unit/feasibility-gate-branches.test.ts Dedicated branch-coverage suite (29 tests)

Validation

git diff --check
./node_modules/.bin/vitest run test/unit/feasibility-gate-branches.test.ts
npm run build:miner
npm run test:ci
npm audit --audit-level=moderate

@andriypolanski
andriypolanski requested a review from JSONbored as a code owner July 7, 2026 21:10
@superagent-security

Copy link
Copy Markdown
Contributor

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

@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

Tip

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

✅ Gittensory review result - approve/merge recommended

Review updated: 2026-07-07 21:20:08 UTC

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

✅ Suggested Action - Approve/Merge

  • safe to merge

Review summary
Adds a pure buildFeasibilityVerdict composer (feasibility.ts) plus a feasibilityInputFromPreStartCheck mapper, exported from the barrel, backed by 29 branch tests. The avoid/raise triggers are collected independently (no ??/|| collapse), correctly prioritize avoid > raise > go, and — critically — the parity test calls the real buildPreStartCheck function and asserts the composer's verdict matches its actual .recommendation output, so this isn't a fabricated-payload test; it's a genuine cross-check against the production gate logic. Scope matches the description (one new module, its barrel export, one test file) and closes #2313 as claimed.

Nits — 5 non-blocking
  • packages/gittensory-engine/src/feasibility.ts:39-46 — collectRaiseReasons collapses `needs_proof` and `hold` into the same `issue_quality_uncertain` reason string, losing which one fired; consider two distinct reason codes if downstream consumers ever need to distinguish them.
  • test/unit/feasibility-gate-branches.test.ts:9 — imports feasibility.ts without the `.js` extension while src/index.ts uses `.js` specifiers throughout; confirm this matches the existing test-import convention rather than being an inconsistency.
  • packages/gittensory-engine/src/feasibility.ts — only the `found` field on FeasibilityGateInput has a doc comment; the other three fields (claimStatus, duplicateClusterRisk, issueStatus) have none, which is a minor inconsistency given the file's otherwise careful documentation style.
  • Consider exporting the two lower-level helpers (collectAvoidReasons/collectRaiseReasons) or at least keeping their reason-string constants centralized somewhere shared, since predicted-gate.ts and other gate composers in this package likely want the same vocabulary — worth a follow-up issue if not already covered.
  • The parity test in feasibility-gate-branches.test.ts is the strongest part of this PR; it'd be worth adding one more parity scenario where `duplicateClusterRisk` is 'medium' or 'high' via buildPreStartCheck directly (all five current scenarios appear to exercise claim/issue-status paths, not the duplicate-cluster raise/avoid paths) to fully close the loop between the two implementations.
Signal Result Evidence
Code review ✅ No blockers 1 reviewer
Linked issue ✅ Linked #2313
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: 144 registered-repo PR(s), 82 merged, 23 issue(s).
Contributor context ✅ Confirmed Gittensor contributor andriypolanski; Gittensor profile; 144 PR(s), 23 issue(s).
Gate result ✅ Passing No configured blocker found.
Review context
  • Author: andriypolanski
  • Role context: outside_contributor
  • Public audience mode: oss maintainer
  • Lane context: Repository is configured for direct PR review.
  • Public profile languages: TypeScript, JavaScript, Python, Rust, Cuda, Kotlin, MDX, Scala
  • Official Gittensor activity: 144 PR(s), 23 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

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.60%. Comparing base (1deb96c) to head (fcd4cdd).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #4065   +/-   ##
=======================================
  Coverage   93.59%   93.60%           
=======================================
  Files         380      381    +1     
  Lines       35596    35626   +30     
  Branches    13050    13069   +19     
=======================================
+ Hits        33316    33346   +30     
  Misses       1618     1618           
  Partials      662      662           
Files with missing lines Coverage Δ
packages/gittensory-engine/src/feasibility.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.

@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 80e8de4 into JSONbored:main Jul 7, 2026
9 checks passed
@andriypolanski
andriypolanski deleted the test/feasibility-gate-branches-2313-v2 branch July 16, 2026 15:13
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.

test(miner-plan): dedicated branch coverage for the feasibility-gate composer

1 participant