Skip to content

Cover the service implementations offline - #216

Merged
edridudi merged 1 commit into
mainfrom
claude/governance-offline-tests
Sep 13, 2026
Merged

edridudi merged 1 commit into
mainfrom
claude/governance-offline-tests

Conversation

@edridudi

Copy link
Copy Markdown
Collaborator

Governance, account, block and pool had only live integration suites. Two consequences:

  • The mainnet suites are excluded from the coverage job, so GovernanceServiceImpl reported 5.5% despite being exercised nightly. The number was measuring the test selection, not the code.
  • A live suite cannot assert what request was sent — only that something came back. Endpoint wiring, body construction and filter handling were all untested.

Change

MockWebServer suites for all four services, following the pattern from #205.

They assert that each method reaches the endpoint it should, that bulk calls POST their ids in the body, that epoch filters actually reach the query string or body, that a null Options does not NPE, and that invalid input is rejected before any request leaves the client — verified with server.getRequestCount() == 0 rather than assumed.

Coverage

Before After
GovernanceServiceImpl 5.5% 98.2%
Overall lines 81.8% 92.3%
Overall instructions 81.4% 93.1%
Overall branches 71.2% 78.8%
Overall methods 84.4% 95.6%

17 tests, all offline, about 8 seconds added to the suite. Nothing here can flake on a live Koios instance or contribute to rate limiting.

What is deliberately left

BaseService keeps 26 uncovered lines, nearly all of them the seven System.getenv branches in its constructor. getenv is immutable in-process, so covering them means subprocesses per permutation or a seam added to production code purely for tests. The remaining service impls are single-digit gaps not worth the noise.

🤖 Generated with Claude Code

Governance, account, block and pool had only live integration suites. The
mainnet ones are excluded from the coverage job, so GovernanceServiceImpl
reported 5.5% despite being exercised nightly, and none of those suites can
assert what request was actually sent.

Adds MockWebServer suites for all four. They check that each method reaches
the endpoint it should, that bulk calls POST their ids in the body, that
epoch filters reach the query or body, that a null Options does not NPE,
and that invalid input is rejected before any request leaves the client -
asserted with getRequestCount() == 0 rather than assumed.

  GovernanceServiceImpl   5.5% -> 98.2%
  overall lines          81.8% -> 92.3%
  overall branches       71.2% -> 78.8%

17 tests, all offline, adding roughly 8 seconds to the suite.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@codecov

codecov Bot commented Sep 13, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 88.13%. Comparing base (8500249) to head (db6c169).

Additional details and impacted files
@@              Coverage Diff              @@
##               main     #216       +/-   ##
=============================================
+ Coverage     77.83%   88.13%   +10.30%     
- Complexity      298      337       +39     
=============================================
  Files            37       37               
  Lines           961      961               
  Branches         79       79               
=============================================
+ Hits            748      847       +99     
+ Misses          175       74      -101     
- Partials         38       40        +2     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@edridudi
edridudi merged commit 9fc5146 into main Sep 13, 2026
5 checks passed
@edridudi
edridudi deleted the claude/governance-offline-tests branch September 13, 2026 22:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant