Repository navigation
Test the utils and factory packages - #213
Merged
Merged
Conversation
Both were the thinnest packages in the codebase - utils at 57.8% line
coverage and factory at 56.2% - and HexUtil had no tests at all.
HexUtil 11 tests: round trips, 0x prefix handling, odd-length and
non-hex rejection, negative bytes not sign-extending, and
a round trip across all 256 byte values
Bech32Util 7 tests: the accepting side, which nothing covered. Real
mainnet stake addresses, pool ids and drep ids validate,
and a corrupted checksum that still passes the charset
check is rejected
Tuple 3 tests
BackendFactory 8 tests: every overload resolves to the expected base
URL, all ten services are wired, and the utility class
cannot be instantiated
Coverage on the same measurement basis:
utils 57.8% -> 92.2%
factory 56.2% -> 90.6%
overall 76.9% -> 81.5% lines, 63.4% -> 70.6% branches
All 29 run offline in under a second, so they add nothing to CI time and
cannot flake on a live Koios instance.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #213 +/- ##
============================================
- Coverage 69.39% 68.67% -0.72%
- Complexity 246 248 +2
============================================
Files 37 37
Lines 941 961 +20
Branches 73 79 +6
============================================
+ Hits 653 660 +7
- Misses 249 256 +7
- Partials 39 45 +6 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This was referenced Sep 13, 2026
edridudi
added a commit
that referenced
this pull request
Sep 13, 2026
* Authenticate the Codecov upload
Uploads have been failing since 2026-09-12:
429 - {"message":"Rate limit reached. Please upload with the Codecov
repository upload token to resolve issue."}
Tokenless uploads from public repos are rate limited. codecov-action exits
0 on upload errors, so the job kept reporting success while Codecov's data
went stale - the badge has been showing coverage from two days and several
merges ago, including none of the work in #213 or #214.
Passes CODECOV_TOKEN, and sets fail_ci_if_error so a failed upload is
visible rather than silent. The silence is what let this go unnoticed.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
* Upgrade codecov-action to v5 for the current token format
The v3 action bundles uploader 0.8.0, which only accepts the legacy 36
character UUID token and rejects today's 50 character tokens:
Token found by environment variables with length 50 did not pass validation
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
---------
Co-authored-by: dudiedri <dudi.edri@ox.security>
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
utilsandfactorywere the two thinnest packages in the codebase, andHexUtilhad no tests at all.Coverage
Measured on the same basis before and after (the preview suite plus the offline tests, which is what the Codecov job runs):
rest.koios.client.utilsrest.koios.client.backend.factoryBranch coverage gaining 7 points is the part that matters — those are untested decisions, not untested getters.
What the 29 tests actually assert
HexUtil(11) — had zero coverage. Round trips,0xprefix handling, odd-length and non-hex rejection with the expected messages, and negative bytes not sign-extending (Byte.MIN_VALUE→80,-1→ff). Plus a round trip across all 256 byte values, which would catch any sign or masking regression in one assertion.Bech32Util(7) — the existing test only proves malformed input is rejected; nothing proved valid input is accepted. These validate real mainnet stake addresses, pool ids and drep ids, and reject a deliberately corrupted checksum that still passes the charset check — the case that separates checksum verification from character validation.Tuple(3) — values, nulls, mixed types.BackendFactory(8) — every overload resolves to the expected base URL (https://api.koios.rest/api/v1/and the guild/preview/preprod equivalents) rather than merely returning non-null, custom RPC honours the given URL, all ten services are wired, and the utility class cannot be instantiated.Cost
All 29 run offline in under a second. No CI time, and nothing that can flake on a live Koios instance.
Note on the target
This does not chase 100%, deliberately. Lombok-generated code is already excluded by JaCoCo, and the remaining gap is mostly the seven
System.getenvbranches in theBaseServiceconstructor —getenvis immutable in-process, so covering those needs either subprocesses per permutation or a seam added to production code purely for tests. Not worth it for the number.🤖 Generated with Claude Code