refactor: decompose BuildContractCoverageFunc + dedup utilities#192
Merged
yvonnedevlinrh merged 1 commit intoJul 16, 2026
Merged
Conversation
Extract 3 helpers from BuildContractCoverageFunc (complexity 22 → 7, CRAP 506 → <30): - computeCoverageReason: pure function for coverage reason computation - buildEffectsSet: effects discovery with DI for testability - buildCoverageMap: coverage pipeline with DI for testability Deduplicate 2 cross-package utility functions: - Export loadTestPackage as goprovider.LoadTestPackage (fixes missing pkg.Errors validation in aireport copy) - Add config.LoadFromDir to replace both loadGazeConfigBestEffort copies +16 new tests (13 helper tests + 3 config tests), -4 duplicate tests. All new tests run without testing.Short() guard for CRAPload visibility. Phase 2a of issue unbound-force#166. Assisted-by: OpenCode (claude-opus-4-6) Signed-off-by: Yvonne Devlin <ydevlin@redhat.com>
yvonnedevlinrh
force-pushed
the
opsx/crapload-decompose-pr2a
branch
from
July 15, 2026 13:51
2025e14 to
aec6554
Compare
jflowers
approved these changes
Jul 15, 2026
jflowers
left a comment
Collaborator
There was a problem hiding this comment.
Clean refactoring PR that achieves its stated goal: decomposing the worst CRAPload offender (BuildContractCoverageFunc, CRAP 506 → <30) into three independently testable helpers, while consolidating two duplicated utility functions. The pkg.Errors validation bug fix in the aireport copy of loadTestPackage is a legitimate side-effect improvement.
- All 5 CI checks pass (MegaLinter, unit/integration on Go 1.24+1.25, E2E on Go 1.24+1.25)
- Spec artifacts comprehensive (proposal, design, specs with 17 Given/When/Then scenarios, 9 tasks all checked)
- Constitution compliance verified (Accuracy, Testability improved; Minimal Assumptions, Actionable Output N/A)
- No security concerns — no new inputs, no path construction changes, no dependency additions
- Net +12 tests (16 added, 4 removed), all new helper tests run without
testing.Short()guard
This review was generated by /review-pr (AI-assisted).
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.
Summary
Phase 2a of CRAPload fragility reduction (#166). Decomposes
BuildContractCoverageFunc— the single worst CRAPload offender (CRAP 506, complexity 22) — into 3 independently testable helpers. Eliminates 2 duplicated utility functions acrossgoproviderandaireport, fixing a latentpkg.Errorsvalidation bug in the process.Changes
Decomposition
Extracted 3 helpers from
BuildContractCoverageFunc(complexity 22 → 7):computeCoverageReasonbuildEffectsSetmap[string]boolloadAndAnalyzeFnparameterbuildCoverageMapcontractCoverageDepsDeduplication
loadTestPackageForQuality(aireport)goprovider.LoadTestPackage(exported)pkg.Errorsvalidation in aireport copyloadGazeConfigBestEffort(goprovider + aireport)config.LoadFromDir(new)Files changed (6 source + 5 spec + 3 learnings)
Metrics
BuildContractCoverageFunccomplexityBuildContractCoverageFuncCRAPVerification
Spec artifacts
Full OpenSpec change at
openspec/changes/crapload-decompose-pr2a/:proposal.md— motivation + constitution alignmentdesign.md— 5 design decisions with alternatives rejectedspecs/decompose-dedup.md— 5 ADDED, 3 MODIFIED, 2 REMOVED requirements with 17 Given/When/Then scenariostasks.md— 9 tasks in 4 groups, all checked offReview council