Skip to content

fix(scripts): only swallow ENOENT in rees-coverage lcov post-process (#7771) - #7815

Merged
loopover-orb[bot] merged 1 commit into
JSONbored:mainfrom
RealDiligent:fix/rees-coverage-enonet-7771
Jul 21, 2026
Merged

fix(scripts): only swallow ENOENT in rees-coverage lcov post-process (#7771)#7815
loopover-orb[bot] merged 1 commit into
JSONbored:mainfrom
RealDiligent:fix/rees-coverage-enonet-7771

Conversation

@RealDiligent

Copy link
Copy Markdown
Contributor

Summary

  • Narrow the bare catch{} in rees-coverage.mjs to only swallow ENOENT on read; re-throw all other errors (e.g. write failures)
  • Export normalizeLcovSfPaths with injectable read/write for unit tests; guard main() behind import.meta.url check
  • Add rees-coverage.d.mts type declarations and unit tests covering ENOENT swallow, write-failure propagation, and backslash normalization

Closes #7771

Test plan

  • npm run typecheck passes locally
  • CI validate-code + validate-tests green
  • codecov/patch >= 99% on changed lines

Made with Cursor

@RealDiligent
RealDiligent requested a review from JSONbored as a code owner July 21, 2026 13:14
@superagent-security

Copy link
Copy Markdown
Contributor

Superagent did not find any vulnerabilities or security issues in this PR.

@codecov

codecov Bot commented Jul 21, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 88.57%. Comparing base (ea7da0c) to head (2218d83).
⚠️ Report is 2 commits behind head on main.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #7815   +/-   ##
=======================================
  Coverage   88.57%   88.57%           
=======================================
  Files         725      725           
  Lines       76409    76409           
  Branches    22762    22760    -2     
=======================================
  Hits        67682    67682           
  Misses       7681     7681           
  Partials     1046     1046           
Flag Coverage Δ
shard-1 55.07% <ø> (-0.34%) ⬇️
shard-2 50.60% <ø> (-1.98%) ⬇️
shard-3 48.42% <ø> (+1.04%) ⬆️

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

@loopover-orb loopover-orb Bot added the gittensor:bug Gittensor-scored bug fix — scores a 0.05x multiplier. label Jul 21, 2026
@loopover-orb

loopover-orb Bot commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

Tip

✅ LoopOver review result - approve/merge recommended

Review updated: 2026-07-21 13:29:05 UTC

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

✅ Suggested Action - Approve/Merge

  • safe to merge

Review summary
This PR narrows a bare `catch{}` in rees-coverage.mjs to only swallow ENOENT on the lcov read, re-throwing any other error (e.g. an EACCES write failure) instead of silently masking it — a legitimate root-cause fix. It also extracts the normalization logic into an exported, dependency-injectable `normalizeLcovSfPaths` function, adds a matching `.d.mts` declaration, and guards `main()` behind an `import.meta.url` check so the script is safely importable for unit tests. The three new tests (ENOENT swallow, write-failure propagation, backslash normalization) exercise the exported function directly as it's actually called in `main()`, so they cover the real path rather than a fabricated one.

Nits — 4 non-blocking
  • scripts/rees-coverage.mjs: the JSDoc comment above `normalizeLcovSfPaths` is fairly long for a small helper — could be trimmed to the ENOENT-swallow rationale alone.
  • The `console.error` at scripts/rees-coverage.mjs:42 for the empty-tests case is pre-existing behavior moved into `main()`, not new logging from this PR — worth confirming reviewers don't misflag it as a new debug leftover.
  • Consider a fourth test asserting `main()` itself is a no-op on import (i.e., the `import.meta.url` guard prevents side effects when the module is required by the test file), since that guard is otherwise untested.
  • scripts/rees-coverage.d.mts could reuse `NodeJS.ErrnoException`-shaped typing for consistency with the test file's error typing, though the current loose signature is fine for this narrow surface.

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 #7771
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: 395 registered-repo PR(s), 185 merged, 36 issue(s).
Contributor context ✅ Confirmed Gittensor contributor RealDiligent; Gittensor profile; 395 PR(s), 36 issue(s).
Improvement ✅ Minor risk: clean · value: minor · LLM: moderate
Linked issue satisfaction

Addressed
The catch block now only swallows errors with error.code === "ENOENT" and re-throws everything else, directly matching the requirement, and the PR adds regression tests covering the ENOENT pass-through, a simulated write failure propagating, and path normalization behavior.

Review context
  • Author: RealDiligent
  • Role context: outside_contributor
  • Public audience mode: oss maintainer
  • Lane context: Repository is configured for direct PR review.
  • Public profile languages: Python, JavaScript, Ruby, Svelte, TypeScript, Markdown, MDX
  • Official Gittensor activity: 395 PR(s), 36 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

@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 2454680 into JSONbored:main Jul 21, 2026
12 checks passed
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.

rees-coverage.mjs's bare catch{} can mask a real lcov write failure as "report missing"

1 participant