Skip to content

95% coverage thresholds are configured but CI runs plain npm run test, so they never gate anything #431

Open

Description

@Jagadeeshftw

Priority: Medium  ·  Area: CI / test coverage  ·  Est. effort: 5–8 h

📌 Problem

vitest.config.ts:17-21 configures coverage thresholds of 95% for branches and lines. package.json provides a test:coverage script.

.github/workflows/ci.yml:31 runs npm run test — the plain runner. grep -c 'test:coverage' .github/workflows/ci.yml returns 0.

So the thresholds have never gated anything across 59 test files, and actual coverage is unknown. There is already evidence of real gaps: src/hooks/useAsync.ts and src/lib/wallet.ts are the only modules in their directories with no test file at all (each tracked separately), so the true figure is very likely below 95%.

🎯 Design decision required

State and defend:

  1. What is the current coverage? Run it and report per-metric numbers against the configured 95%. Everything else follows from that figure.
  2. Gate scope. If the repo misses the threshold, do you gate globally at the current level as a ratchet that may only rise, or gate only changed files? Argue which will actually stay enabled — a gate that blocks every PR on pre-existing debt gets removed.
  3. Which metrics block. Branch coverage is the one that catches untested error paths; say whether you weight it differently from lines.

🧩 Requirements and context

  • Do not lower the configured 95% thresholds to make the gate pass. If they are unreachable today, keep them and narrow what is gated, then say so explicitly.
  • The coverage run must replace or supplement the existing test step without losing the plain test signal.
  • Report the added CI wall-clock cost — coverage instrumentation is slower.
  • Coordinate with the useAsync and wallet.ts test issues: if those land first, the baseline improves. Say how you sequenced.
  • All 59 test files must pass.

🛠️ Suggested execution

  1. Run npm run test:coverage; paste the full per-metric report.
  2. Identify the least-covered modules and list them — that inventory is useful beyond this PR.
  3. Implement your gating decision.
  4. Prove it fires — delete a test on a scratch branch, show coverage dropping below the floor and the job failing, revert.
  5. Report runtime cost.

✅ Acceptance criteria

  • The PR reports current coverage per metric against the configured 95%.
  • The least-covered modules are listed.
  • Coverage is enforced in CI, with the ratchet floor documented if the target is not yet met.
  • The gate is proven to fail when coverage drops (link the run).
  • The configured thresholds were not lowered.
  • Added CI wall-clock time is reported.
  • All 59 test files pass.

🚫 Out of scope

  • Writing tests for useAsync or wallet.ts — separate issues.
  • Adding the typecheck gate — separate issue.
  • Changing threshold values.

🧪 Verification

npm ci
npm run test:coverage
npm run lint && npm run build

📤 What your PR must include

  1. The full per-metric coverage report.
  2. The least-covered module inventory.
  3. Your gate-scope and metric-weighting decisions.
  4. A link to a run failing on a coverage drop, plus runtime cost.
  5. Closes #<n>.

🔒 Security notes

Branch coverage is the metric that tracks untested error paths — the code that runs when a wallet call is rejected, an API request fails, or data is missing. On a financial interface those are the paths where an untested regression becomes user-visible fastest, and they are exactly the branches an unenforced threshold lets erode.

📋 Guidelines

  • Minimum 95% test coverage on changed lines
  • Clear documentation
  • Timeframe: 96 hours from assignment
  • One logical change per commit; no merge commits

💬 Join our community

Working on this, or want to sanity-check your approach before you start? Come and ask — the maintainers are there and happy to help.

Telegram: https://t.me/Grainlify

Activity

  1. added
    Maybe RewardedGrantFox: potentially rewarded contribution
    GrantFox OSSGrantFox open-source program
    priority:mediumMedium difficulty / self-contained but non-trivial
    Third CampaignGrantFox third campaign issue
    on Aug 20, 2026
  2. Mitch5000 commented on Aug 21, 2026

    @Mitch5000
    Contributor

    Can i work on this?

  3. shobhamerabacha-star commented on Sep 12, 2026

    @shobhamerabacha-star

    Hello! I'd like to work on this issue.

    I would like to resolve this issue. Here is my proposed execution plan:

    • Implementation: Build 95% coverage thresholds are configured but CI runs plain npm run test, so they never gate anything with clean React/Next.js components, responsive styling, and proper loading/error boundaries.
    • Testing & Verification: Add component unit tests and ensure zero TypeScript/ESLint warnings.
    • Delivery: Ready to ship a thoroughly tested PR within 12–24 hours with passing CI.

    Looking forward to contributing—please feel free to assign!

  4. guptakumarranjeet150 commented on Sep 13, 2026

    @guptakumarranjeet150

    Hi maintainers,

    I would love to take this on. My planned approach:

    • Build 95% coverage thresholds are configured but CI runs plain npm run test, so they never gate anything with clean React/Next.js components, responsive styling, and proper loading/error boundaries.
    • Add component unit tests and ensure zero TypeScript/ESLint warnings.

    I am ready to start immediately—please assign this to me!

  5. ranjeet150 commented on Oct 3, 2026

    @ranjeet150

    Hi,

    I have experience with similar implementations and would like to take this on.

    Plan:

    1. Audit authorization boundaries and enforce defensive validation barriers.
    2. Implement multi-role permission checks and invocation validation.
    3. Write adversarial unit tests simulating edge failure modes and invalid callers.
    4. Ensure zero regressions across existing test suites and CI workflows.

    Let me know if this aligns with the repository guidelines and assign when convenient.

  6. ravimahatonp commented on Oct 3, 2026

    @ravimahatonp

    Hello maintainers,

    I am interested in taking up 95% coverage thresholds are configured but CI runs plain npm run test, so they never gate anything.

    Technical outline:

    1. Audit authorization boundaries and enforce defensive validation barriers.
    2. Implement multi-role permission checks and invocation validation.
    3. Write adversarial unit tests simulating edge failure modes and invalid callers.
    4. Ensure zero regressions across existing test suites and CI workflows.

    I can deliver a clean, tested PR within 24 hours. Please assign!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    GrantFox OSSGrantFox open-source programMaybe RewardedGrantFox: potentially rewarded contributionThird CampaignGrantFox third campaign issuepriority:mediumMedium difficulty / self-contained but non-trivial

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions