Skip to content

test: close remaining 1% coverage gap — 6 modules to 100% - #100

Merged
cschanhniem merged 1 commit into
mainfrom
feat/coverage-gap-tests
Jun 28, 2026
Merged

cschanhniem merged 1 commit into
mainfrom
feat/coverage-gap-tests

Conversation

@cschanhniem

Copy link
Copy Markdown
Collaborator

Summary

  • Adds targeted tests for all 8 remaining testable uncovered lines across 6 modules
  • Every non-CLI source file now has 100% branch coverage (1321 tests)
  • Only 6 structural CLI guard lines remain uncovered — these are argparse/if __name__ == \"__main__\" guards that cannot be hit by pytest without spawning a subprocess

Modules covered

Module Line(s) covered Test
benchmark/evaluate.py enrichment_factor(k=0) guard TestEnrichmentFactorEdgeCases
benchmark/retrospective.py _bootstrap_auroc_ci empty-pos/neg early return TestBootstrapAurocCi
generators/template_mutator.py _conservative_substitutes unknown AA; single-AA guards in double/aggregation generators 3 new tests
analysis/diversity.py cluster_panel inner-loop skip for already-assigned j TestClusterPanelAlreadyAssignedSkip
selection/pilot.py Phase 3 fill from per-seed overflow remainder TestPilotPhase3FillFromRemainder
pipeline.py build_run_manifest non-existent input → "N/A" hash test_manifest_missing_input_gets_na_hash

Test plan

  • pytest --tb=short -q → 1321 passed, 0 failed
  • pytest --cov=src/openamp_foundry --cov-report=term-missing → 99% total (6 unreachable CLI lines only)
  • Code review completed — HIGH issue with _c() helper fixed (uses correct source and scores fields)
  • Pre-push hook ran full suite and passed

🤖 Generated with Claude Code

Adds targeted tests for 8 previously untested defensive guards across 6
modules, bringing all non-CLI source files to 100% branch coverage:

- evaluate.py: enrichment_factor(k=0) → 0.0 guard
- retrospective.py: _bootstrap_auroc_ci with empty pos or neg → chance return
- template_mutator.py: _conservative_substitutes(unknown AA) → [];
  single-AA guard in generate_double_substitution_variants and
  generate_aggregation_safe_double_variants
- diversity.py: cluster_panel inner-loop skip when j already has a cluster
- pilot.py:173: Phase 3 fill from per-seed overflow remainder
- pipeline.py:105: build_run_manifest non-existent input → "N/A" hash

Only 6 lines remain uncovered: structural CLI argparse/main guards that
cannot be exercised by pytest without spawning a subprocess.
@cschanhniem
cschanhniem merged commit 039bcfd into main Jun 28, 2026
1 of 2 checks passed
@cschanhniem
cschanhniem deleted the feat/coverage-gap-tests branch June 28, 2026 19:11
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