Skip to content

fix(miner): keep discover --dry-run off the contribution-profile cache - #10255

Merged
loopover-orb[bot] merged 2 commits into
JSONbored:mainfrom
andriypolanski:fix/10000-dry-run-contribution-profile-cache-v2
Jul 31, 2026
Merged

fix(miner): keep discover --dry-run off the contribution-profile cache#10255
loopover-orb[bot] merged 2 commits into
JSONbored:mainfrom
andriypolanski:fix/10000-dry-run-contribution-profile-cache-v2

Conversation

@andriypolanski

Copy link
Copy Markdown
Contributor

Closes #10000

Summary

Validation

  • git diff --check
  • npm run actionlint
  • npm run typecheck
  • npm run test:coverage
  • npm run test:workers
  • npm run build:mcp
  • npm run test:mcp-pack
  • npm run ui:openapi:check
  • npm run ui:lint
  • npm run ui:typecheck
  • npm run ui:build
  • npm audit --audit-level=moderate
  • New or changed behavior has unit/integration tests for new branches, fallback paths, and sanitizer boundaries

andriypolanski and others added 2 commits July 31, 2026 14:26
JSONbored#10000)

Thread caller env into the profile-cache path and skip open/put on dry-run
when the SQLite file is missing, matching the event-ledger zero-write guard.

Co-authored-by: Cursor <cursoragent@cursor.com>
…ed#10000)

Give the vi.fn two parameters so mock.calls[0][1] is a valid tuple index
under root typecheck.

Co-authored-by: Cursor <cursoragent@cursor.com>
@andriypolanski andriypolanski changed the title fix(miner): keep discover --dry-run off the contribution-profile cach fix(miner): keep discover --dry-run off the contribution-profile cache Jul 31, 2026
@loopover-orb

loopover-orb Bot commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

Tip

✅ LoopOver review result - approve/merge recommended

Review updated: 2026-07-31 14:37:13 UTC

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

✅ Suggested Action - Approve/Merge

  • safe to merge

Review summary
This closes #10000 by applying the same dry-run write-discipline pattern used for the event ledger (#9679) to the contribution-profile cache: it resolves the cache DB path from `ctx.env` instead of always defaulting to `process.env`, and only opens the cache on a dry run when the file already exists, skipping `put()` entirely during a dry run. The change is small, well-scoped to the linked issue, and is backed by real (non-fabricated) tests that exercise the actual SQLite-backed cache and the real `runDiscover` flow with a stubbed fetch rather than mocked internals. The logic correctly preserves prior behavior for non-dry-run callers (`openCache` defaults to true when `dryRun` is unset) and for dry runs against an existing cache file (reads still happen, writes never do).

Nits — 4 non-blocking

Decision drivers

  • ✅ Code review — No blockers (1 reviewer)
  • ✅ Gate result — Passing (No configured blocker found.)
Context & advisory signals — never blocks the verdict
Signal Result Evidence
Linked issue ✅ Linked #10000
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: 162 registered-repo PR(s), 106 merged, 22 issue(s).
Contributor context ✅ Confirmed Gittensor contributor andriypolanski; Gittensor profile; 162 PR(s), 22 issue(s).
Improvement ✅ Minor risk: clean · value: minor · LLM: moderate
Linked issue satisfaction

Addressed
The diff makes resolveContributionProfilesForDiscover accept env/dryRun, resolves the cache path via resolveContributionProfileCacheDbPath(env), skips opening the cache file on dry-run when it doesn't exist, and suppresses put() during dry-run while still permitting reads and running the eligibility filter; both dry-run and real-run call sites in runDiscover thread options.env ?? process.env, and

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: Python, TypeScript, Rust, Cuda, JavaScript, Kotlin, MDX, Scala
  • Official Gittensor activity: 162 PR(s), 22 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.
🧪 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

@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 31, 2026
@codecov

codecov Bot commented Jul 31, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 80.67%. Comparing base (ee1b86e) to head (be9648f).
⚠️ Report is 7 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff             @@
##             main   #10255       +/-   ##
===========================================
- Coverage   92.25%   80.67%   -11.59%     
===========================================
  Files         938      284      -654     
  Lines      114702    59362    -55340     
  Branches    27698     7097    -20601     
===========================================
- Hits       105821    47889    -57932     
- Misses       7575    11168     +3593     
+ Partials     1306      305     -1001     
Flag Coverage Δ
backend 95.01% <100.00%> (-0.67%) ⬇️

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

Files with missing lines Coverage Δ
packages/loopover-miner/lib/discover-cli.ts 95.01% <100.00%> (-4.99%) ⬇️

... and 786 files with indirect coverage changes

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

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

@loopover-orb
loopover-orb Bot merged commit e8c5200 into JSONbored:main Jul 31, 2026
8 checks passed
@github-actions github-actions Bot mentioned this pull request Jul 31, 2026
7 tasks
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.

miner(discover): --dry-run still creates and writes the contribution-profile cache

1 participant