Skip to content

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

Closed
andriypolanski wants to merge 1 commit into
JSONbored:mainfrom
andriypolanski:fix/10000-dry-run-contribution-profile-cache
Closed

fix(miner): keep discover --dry-run off the contribution-profile cache#10248
andriypolanski wants to merge 1 commit into
JSONbored:mainfrom
andriypolanski:fix/10000-dry-run-contribution-profile-cache

Conversation

@andriypolanski

Copy link
Copy Markdown
Contributor

Closes #10000

Summary

Validation

  • git diff --check
  • npm run actionlint
  • npm run typecheck
  • npm run test:coverage locally; codecov/patch requires ≥99% coverage of the lines AND branches you changed (aim for 100% on your diff so CI variance does not fail near the threshold). Global coverage is a non-blocking trend with a loose 90% backstop, not the gate.
  • 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

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>
@superagent-security

Copy link
Copy Markdown
Contributor

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

@loopover-orb

loopover-orb Bot commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

Caution

🛑 LoopOver review result - fixes required

Review updated: 2026-07-31 14:18:14 UTC

2 files · 1 AI reviewer · no blockers · CI failing · unstable

🛑 Suggested Action - Fix Blockers

Review summary
This PR extends the existing #9679 event-ledger dry-run discipline to the contribution-profile cache: it threads `ctx.env`/`ctx.dryRun` through `resolveContributionProfilesForDiscover`, only opens the cache DB on a dry run if the file already exists, and never calls `cache.put` when `dryRun` is true. The logic correctly mirrors the established pattern (existsSync gate, optional cache, put guard, close via optional chaining), and the fix is applied consistently at both call sites in `runDiscover` (dry-run and real-run). Test coverage is thorough, including a regression test that would have failed pre-fix by asserting no cache file is created on a dry run.

Nits — 3 non-blocking
  • packages/loopover-miner/lib/discover-cli.ts: the two CI failures (`validate`, `validate-code`) are undetailed and this branch is 15 commits behind the default branch, so per the base-branch note the likely cause is default-branch drift rather than this diff — worth rebasing to confirm.
  • test/unit/miner-discover-cli.test.ts: the added `vi.unstubAllGlobals()` in `afterEach` is a good catch for the new `vi.stubGlobal("fetch", ...)` usage but is easy to miss if more global stubs are added later without matching cleanup.
  • Confirm the PR is rebased onto the current default branch before relying on the `validate`/`validate-code` CI results, since a 15-commit-stale base is a plausible explanation for the undetailed failures.

CI checks failing

  • validate
  • validate-code

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 honor a dryRun flag (never opening a nonexistent cache file, never calling put during dry runs) and resolves the cache DB path from ctx.env via resolveContributionProfileCacheDbPath, with runDiscover threading options.env ?? process.env and dryRun on both call sites, matching the issue's requirements. Extensive new tests directly cover the dry-

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: not available
  • Official Gittensor activity: 162 PR(s), 22 issue(s).
  • PR-specific overlap: none found.
Contributor next steps
  • Start here: Triage stale or unlinked PRs.
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 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.54%. Comparing base (cb3f1ed) to head (f644e3e).
⚠️ Report is 14 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff             @@
##             main   #10248       +/-   ##
===========================================
- Coverage   92.22%   80.54%   -11.69%     
===========================================
  Files         937      283      -654     
  Lines      114392    59117    -55275     
  Branches    27656     8793    -18863     
===========================================
- Hits       105499    47614    -57885     
- Misses       7588    11200     +3612     
+ Partials     1305      303     -1002     
Flag Coverage Δ
backend 95.01% <100.00%> (-0.66%) ⬇️

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 commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

LoopOver is closing this pull request on the maintainer's behalf (CI is failing (validate, validate-code)). 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 31, 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.

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

1 participant