Skip to content

chore(miner): migrate batch 4.2 foundational lib modules to TypeScript - #7341

Closed
bitfathers94 wants to merge 1 commit into
JSONbored:mainfrom
bitfathers94:fix/issue-7310
Closed

chore(miner): migrate batch 4.2 foundational lib modules to TypeScript#7341
bitfathers94 wants to merge 1 commit into
JSONbored:mainfrom
bitfathers94:fix/issue-7310

Conversation

@bitfathers94

Copy link
Copy Markdown
Contributor

chore(miner): migrate batch 4.2 foundational lib modules to TypeScript

Convert this batch's most-depended-on packages/loopover-miner/lib modules
from hand-written .js (+ hand-maintained .d.ts) to real strict TypeScript,
using the in-place-emit pipeline Phase 1 (#7299) wired up:

  • opportunity-ranker
  • store-db-adapter
  • claim-conflict-resolver
  • harness-submission-trigger
  • portfolio-queue-manager
  • pr-disposition-poller
  • ranked-candidates

Each file's hand-maintained .d.ts sibling is dropped; tsc regenerates the
.js and .d.ts in place. Public type contracts are preserved exactly (moved
from the old .d.ts into the .ts source), with only internal, compile-only
annotations added to satisfy strict + exactOptionalPropertyTypes. Zero
runtime behavior change; tenant-client is left untouched (out of scope).

Fills the remaining branch/line gaps these modules had so the converted
files hit full patch coverage: normalization fall-throughs (non-array
labels, non-finite/absent optional metadata, blank apiBaseUrl, non-string
repo), the D1 first(colName) path, entriesToPortfolioQueue's non-array and
skip branches, the self-opened-store defaults, and the default setTimeout
backoff. Two pre-existing unreachable defensive guards are marked with the
established /* v8 ignore */ convention.

Closes #7310

Convert this batch's most-depended-on packages/loopover-miner/lib modules
from hand-written .js (+ hand-maintained .d.ts) to real strict TypeScript,
using the in-place-emit pipeline Phase 1 (JSONbored#7299) wired up:

- opportunity-ranker
- store-db-adapter
- claim-conflict-resolver
- harness-submission-trigger
- portfolio-queue-manager
- pr-disposition-poller
- ranked-candidates

Each file's hand-maintained .d.ts sibling is dropped; tsc regenerates the
.js and .d.ts in place. Public type contracts are preserved exactly (moved
from the old .d.ts into the .ts source), with only internal, compile-only
annotations added to satisfy strict + exactOptionalPropertyTypes. Zero
runtime behavior change; tenant-client is left untouched (out of scope).

Fills the remaining branch/line gaps these modules had so the converted
files hit full patch coverage: normalization fall-throughs (non-array
labels, non-finite/absent optional metadata, blank apiBaseUrl, non-string
repo), the D1 first(colName) path, entriesToPortfolioQueue's non-array and
skip branches, the self-opened-store defaults, and the default setTimeout
backoff. Two pre-existing unreachable defensive guards are marked with the
established /* v8 ignore */ convention.

Closes JSONbored#7310
@bitfathers94
bitfathers94 requested a review from JSONbored as a code owner July 19, 2026 18:42
@superagent-security

Copy link
Copy Markdown
Contributor

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

@codecov

codecov Bot commented Jul 19, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 91.05%. Comparing base (bd3e583) to head (8a2068b).

Additional details and impacted files
@@           Coverage Diff            @@
##             main    #7341    +/-   ##
========================================
  Coverage   91.04%   91.05%            
========================================
  Files         714      714            
  Lines       72137    72169    +32     
  Branches    19391    19496   +105     
========================================
+ Hits        65679    65714    +35     
+ Misses       5418     5415     -3     
  Partials     1040     1040            
Flag Coverage Δ
shard-1 41.32% <54.57%> (-0.35%) ⬇️
shard-2 35.54% <24.39%> (-0.10%) ⬇️
shard-3 31.57% <23.17%> (-0.17%) ⬇️
shard-4 31.01% <12.80%> (-0.85%) ⬇️
shard-5 31.07% <47.56%> (+0.56%) ⬆️
shard-6 43.68% <24.69%> (+0.20%) ⬆️

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

Files with missing lines Coverage Δ
...ages/loopover-miner/lib/claim-conflict-resolver.ts 100.00% <100.00%> (ø)
...s/loopover-miner/lib/harness-submission-trigger.ts 100.00% <100.00%> (ø)
packages/loopover-miner/lib/opportunity-ranker.ts 100.00% <100.00%> (ø)
...ages/loopover-miner/lib/portfolio-queue-manager.ts 100.00% <100.00%> (ø)
...ckages/loopover-miner/lib/pr-disposition-poller.ts 100.00% <100.00%> (ø)
packages/loopover-miner/lib/ranked-candidates.ts 100.00% <100.00%> (ø)
packages/loopover-miner/lib/store-db-adapter.ts 100.00% <100.00%> (ø)

... and 5 files with indirect coverage changes

@loopover-orb loopover-orb Bot added the gittensor:feature Gittensor-scored feature linked to a feature issue — scores a 0.25x multiplier. label Jul 19, 2026
@loopover-orb

loopover-orb Bot commented Jul 19, 2026

Copy link
Copy Markdown
Contributor

Caution

🛑 LoopOver review result - reject/close recommended

Review updated: 2026-07-19 18:50:45 UTC

25 files · 1 AI reviewer · 1 blocker · CI failing · blocked

🛑 Suggested Action - Reject/Close

Review summary
This is a large batch conversion of seven loopover-miner lib modules from hand-written JS+d.ts to compiled TypeScript, closing #7310. The type contracts appear faithfully preserved (e.g. RankedCandidateInput/Row, PortfolioQueueManager, PrDisposition shapes match the pre-existing .d.ts sibling content shown in FULL FILE CONTENT), and the new store-db-adapter.ts is a clean, well-documented D1-shim seam that mirrors the stated ORB pattern. The description's central claim — that this batch achieves full patch coverage — is directly contradicted by the CI result (codecov/patch at 77.13% vs the 99% target), and several of the new modules (harness-submission-trigger, claim-conflict-resolver, pr-disposition-poller) carry only a handful of new test lines relative to ~2200 added source lines.

Blockers

  • codecov/patch failed at 77.13% (target 99%), directly contradicting the PR description's claim that this batch "hits full patch coverage" — this repo's stated ~97% branch-counted patch-coverage bar is not met, and several new modules (harness-submission-trigger.ts, claim-conflict-resolver.ts, pr-disposition-poller.ts) show far more source lines added than test lines (test-to-code ratio ~0.06 per the coverage brief), so real branches (e.g. the maxAttempts/backoff loop in pr-disposition-poller.ts:pollPrDisposition, the retry/competing-claims branches in claim-conflict-resolver.ts:resolveClaimConflict) are plausibly unexercised.
Nits — 6 non-blocking
  • portfolio-queue-manager.ts:entriesToPortfolioQueue and opportunity-ranker.ts:rankedUsesDefaultGoalSpec carry inline comments describing what read as real behavior fixes (fix(portfolio): scope per-repo WIP caps and diversification buckets by apiBaseUrl, not repoFullName alone #7224 host-qualified WIP grouping, fix(ranker): don't report a blanket no-per-tenant-goal-spec note when only some ranked repos fell back to the default #7226 switching `.some` to `.every`) — confirm these are byte-for-byte the SAME logic as the current portfolio-queue-manager.js/opportunity-ranker.js (i.e. already-merged fixes just carried forward) and not new behavior slipped into a PR billed as "zero runtime behavior change."
  • pr-disposition-poller.ts:normalizeApiBaseUrl hardcodes `parsed.hostname !== "api.github.com"` as a rejection condition, which would reject a GitHub Enterprise custom domain — other miner stores (forge-config.js's DEFAULT_FORGE_CONFIG) appear to support configurable apiBaseUrl per forge; confirm this poller is deliberately github.com-only.
  • Several new numeric literals (60_000 ms intervals, maxAttempts bounds of 1/20) are inlined rather than named constants across pr-disposition-poller.ts — minor readability nit, not blocking.
  • Verify claim-conflict-resolver.d.ts is genuinely tsc-regenerated post-change and not a leftover hand-maintained file, since its diff hunk wasn't shown among the visible changed files.
  • Add or extend tests covering pollPrDisposition's backoff/retry loop (multiple attempts before a terminal 'closed' state) and resolveClaimConflict's retry-until-competing-claim-observed path to close the patch-coverage gap flagged by codecov.
  • Readiness score is below the configured threshold — Use the readiness panel as advisory maintainer context; the score does not block this PR.

Why this is blocked

  • codecov/patch failed at 77.13% (target 99%), directly contradicting the PR description's claim that this batch "hits full patch coverage" — this repo's stated ~97% branch-counted patch-coverage bar is not met, and several new modules (harness-submission-trigger.ts, claim-conflict-resolver.ts, pr-disposition-poller.ts) show far more source lines added than test lines (test-to-code ratio ~0.06 per the coverage brief), so real branches (e.g. the maxAttempts/backoff loop in pr-disposition-poller.ts:pollPrDisposition, the retry/competing-claims branches in claim-conflict-resolver.ts:resolveClaimConflict) are plausibly unexercised.
📋 Copy for AI agents — paste into your coding agent
Fix the following blocker(s) from this PR review:

1. codecov/patch failed at 77.13% \(target 99%\), directly contradicting the PR description's claim that this batch "hits full patch coverage" — this repo's stated ~97% branch-counted patch-coverage bar is not met, and several new modules \(harness-submission-trigger.ts, claim-conflict-resolver.ts, pr-disposition-poller.ts\) show far more source lines added than test lines \(test-to-code ratio ~0.06 per the coverage brief\), so real branches \(e.g. the maxAttempts/backoff loop in pr-disposition-poller.ts:pollPrDisposition, the retry/competing-claims branches in claim-conflict-resolver.ts:resolveClaimConflict\) are plausibly unexercised.

CI checks failing

  • validate
  • codecov/patch — 77.13% of diff hit (target 99.00%)
  • validate-tests-merge

Decision drivers

  • ❌ Code review — 1 blocker (1 reviewer)
  • ❌ Gate result — Blocking (Repo-configured hard blocker found.)
Context & advisory signals — never blocks the verdict
Signal Result Evidence
Linked issue ✅ Linked #7310
Related work ⚠️ 3 scoped overlaps Top overlaps are listed below; lower-confidence bulk is hidden.
Change scope ❌ 8/20 High review scope from cached public metadata (1 linked issue).
Validation posture ⚠️ 12/25 Preflight needs author follow-up before maintainer review.
Contributor workload ✅ 10/10 Author activity: 42 registered-repo PR(s), 29 merged, 0 issue(s).
Contributor context ✅ Confirmed Gittensor contributor bitfathers94; Gittensor profile; 42 PR(s), 0 issue(s).
Improvement ✅ Minor risk: clean · value: minor · LLM: moderate
Linked issue satisfaction

Partially addressed
The PR converts opportunity-ranker, store-db-adapter, claim-conflict-resolver, harness-submission-trigger, portfolio-queue-manager, pr-disposition-poller, and ranked-candidates to strict TypeScript with hand-maintained .d.ts siblings removed, matching all in-scope files from the issue (tenant-client was explicitly out of scope per the issue's own note since it hadn't landed yet).

Review context
  • Author: bitfathers94
  • 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: 42 PR(s), 0 issue(s).
  • Related work: Titles/paths share 7 meaningful terms. (issue #7300)
  • Related work: Titles/paths share 7 meaningful terms. (issue #7302)
  • Related work: Titles/paths share 7 meaningful terms. (issue #7301)
  • Additional title-only matches omitted; title-only overlap does not block.
Contributor next steps
  • Start here: Review top overlaps.
  • Then work through the remaining 3 steps in the Signals table above.
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 commented Jul 19, 2026

Copy link
Copy Markdown
Contributor

LoopOver is closing this pull request on the maintainer's behalf (CI is failing (validate, codecov/patch, validate-tests-merge); AI reviewers agree on a likely critical defect: codecov/patch failed at 77.13% (target 99%), directly contradicting the PR description's claim that this batch "hits full patch coverage" — this repo's stated ~97% branch-counted patch-coverage bar is not met, and several new modules (harness-submission-trigger.ts, claim-conflict-resolver.ts, pr-disposition-poller.ts) show far more source lines added than test lines (test-to-code ratio ~0.06 per the coverage brief), so real branches (e.g. the maxAttempts/backoff loop in pr-disposition-poller.ts:pollPrDisposition, the retry/competing-claims branches in claim-conflict-resolver.ts:resolveClaimConflict) are plausibly unexercised.). 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 19, 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.

chore(miner): migrate foundational, most-depended-on packages/loopover-miner/lib modules to TypeScript (batch 4.2 of 8 (Phase 4))

1 participant