You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Get to 100% line, branch and method coverage - #781
This gets line, branch and method coverage to 100% and turns on kettle-soup-cover's new strict mode to keep it there. A run below 100% on any of the three fails, locally and in the coverage workflow.
Coverage was already close. Line coverage went from 98.48% to 100%, branch from 93.53% to 100%, and method from 98.99% to 100%. Most of the gap was SanitizedLogFormatter, so most of the 13 new specs log real requests and responses through it: redacting code= in a logged URL without touching the actual request, string bodies shaped like Hash#inspect, non-string bodies, nil values, cyclic arrays, and envs without a URL or body. The rest cover Response#parser memoization and protocol-relative redirects for a location without query= or fragment=. Three branches can't be reached in any single run, so they're excluded with inline simplecov:disable branch comments saying why. Two only take their else arm on Faraday 0.x, and the MultiXML/MultiXml choice depends on which multi_xml release is installed. Nothing else in lib/ changed.
The config is now just K_SOUP_COV_MIN_STRICT=true in mise.toml, .envrc and coverage.yml, from kettle-dev/kettle-soup-cover#33, with K_SOUP_COV_MIN_LINE and K_SOUP_COV_MIN_BRANCH at 100 everywhere, so nothing says 76/92 or 78/97 anymore. An earlier version of this PR loaded SimpleCov's strict profile itself and needed a couple of workarounds to stop kettle-soup-cover from overwriting it. Those are all gone. Strict mode, and the fix that keeps method coverage on in turbo_tests2 workers, shipped in kettle-soup-cover 3.0.15, so coverage.gemfile now requires it. With it, plain RSpec and turbo_tests2 both pass the full suite at 100% line, branch and method coverage, and both fail on a single uncovered method.
This pull request raises line, branch, and method coverage enforcement to 100% using SimpleCov’s strict profile, adds targeted coverage tests, and aligns local and CI test settings.
Changes:
Adds coverage specs for sanitized logging, parser memoization, and protocol-relative redirects.
Loads SimpleCov’s strict profile and synchronizes coverage thresholds.
Switches coverage runs to plain RSpec and documents unreachable compatibility branches.
Updates the gradual RuboCop lock.
File
Description
spec/spec_helper.rb
Restores strict SimpleCov thresholds after kettle-soup-cover configuration.
spec/oauth2/sanitized_log_formatter_spec.rb
Adds formatter edge-case and request/response logging coverage.
spec/oauth2/response_spec.rb
Tests response parser memoization.
spec/oauth2/client_spec.rb
Covers redirects without query and fragment writers.
mise.toml
Sets local coverage thresholds and the RSpec runner.
lib/oauth2/sanitized_log_formatter.rb
Excludes the Faraday 0.x compatibility branch.
lib/oauth2/response.rb
Excludes the version-dependent XML parser branch.
lib/oauth2/client.rb
Excludes the Faraday 0.x formatter branch.
.simplecov
Loads the strict coverage profile when hard enforcement is enabled.
.rubocop_gradual.lock
Updates recorded lint locations after spec additions.
.github/workflows/coverage.yml
Sets CI coverage thresholds and the RSpec runner.
.envrc
Aligns environment coverage thresholds and runner settings.
The reason will be displayed to describe this comment to others. Learn more.
🔵 Needs a closer look
Protect the template-managed coverage settings in .envrc and mise.toml from being overwritten by future template updates.
No open issues 🎉
1 previously missed issue
In code that hasn't changed since last review
Protect local coverage settings from template overwrites
.envrc:32
These new local coverage settings are outside a kettle-jem:freeze block, but .structuredmerge/kettle-jem.lock identifies .envrc as a generated template file and the default merge preference is template (.structuredmerge/kettle-jem.yml:583-587). A future template pass can therefore replace these values—including KETTLE_TEST_RUNNER=rspec—with the template defaults, so local runs silently return to turbo_tests2 and no longer enforce method coverage. Wrap this block in freeze markers or add an explicit destination-preferred merge rule for .envrc.
Add specs for the code the suite never reached:
- SanitizedLogFormatter: logging of requests and responses through a
real logger, redaction of the code query parameter in a logged URL,
Hash#inspect-shaped string bodies, other body types, nil values,
cyclic arrays, and envs without a URL or body.
- Response#parser memoization.
- Client protocol-relative redirect resolution for a location object
without query and fragment writers.
Three branches cannot be taken in a single coverage run, so they are
excluded with simplecov:disable directives that say why. Two only take
their else arm on Faraday 0.x, and the MultiXML or MultiXml choice in
the XML parser depends on the installed multi_xml release.
The .rubocop_gradual.lock change only moves two existing entries for
client_spec.rb to their new line numbers.
Turn on K_SOUP_COV_MIN_STRICT in mise.toml, .envrc and the coverage
workflow, so kettle-soup-cover enables method coverage and holds line,
branch and method coverage to 100%, in plain RSpec runs and in
turbo_tests2's collated result. K_SOUP_COV_MIN_LINE and
K_SOUP_COV_MIN_BRANCH go to 100 as well, so nothing still says 76/92
or 78/97, and the coverage summary step agrees.
Strict mode, and the fix that keeps method coverage on in turbo_tests2
workers, are in kettle-soup-cover 3.0.15, so require it.
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
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.
This gets line, branch and method coverage to 100% and turns on kettle-soup-cover's new strict mode to keep it there. A run below 100% on any of the three fails, locally and in the coverage workflow.
Coverage was already close. Line coverage went from 98.48% to 100%, branch from 93.53% to 100%, and method from 98.99% to 100%. Most of the gap was
SanitizedLogFormatter, so most of the 13 new specs log real requests and responses through it: redactingcode=in a logged URL without touching the actual request, string bodies shaped likeHash#inspect, non-string bodies, nil values, cyclic arrays, and envs without a URL or body. The rest coverResponse#parsermemoization and protocol-relative redirects for a location withoutquery=orfragment=. Three branches can't be reached in any single run, so they're excluded with inlinesimplecov:disable branchcomments saying why. Two only take their else arm on Faraday 0.x, and theMultiXML/MultiXmlchoice depends on which multi_xml release is installed. Nothing else inlib/changed.The config is now just
K_SOUP_COV_MIN_STRICT=trueinmise.toml,.envrcandcoverage.yml, from kettle-dev/kettle-soup-cover#33, withK_SOUP_COV_MIN_LINEandK_SOUP_COV_MIN_BRANCHat 100 everywhere, so nothing says 76/92 or 78/97 anymore. An earlier version of this PR loaded SimpleCov'sstrictprofile itself and needed a couple of workarounds to stop kettle-soup-cover from overwriting it. Those are all gone. Strict mode, and the fix that keeps method coverage on in turbo_tests2 workers, shipped in kettle-soup-cover 3.0.15, socoverage.gemfilenow requires it. With it, plain RSpec and turbo_tests2 both pass the full suite at 100% line, branch and method coverage, and both fail on a single uncovered method.