Skip to content

bug: SSA degradation data from CRAP step not propagated to report payload summary #168

Closed

Description

@yvonnedevlinrh

Summary

PR #165 (provider-interfaces) refactored runProductionPipeline in internal/aireport/runner.go to pass a ContractCoverageProvider to runCRAPStep instead of calling BuildContractCoverageFunc directly. This changed how SSA degradation data flows into payload.Summary.

Before (pre-#165)

// runner.go — BuildContractCoverageFunc called directly in runProductionPipeline
ccFunc, degradedPkgs := crap.BuildContractCoverageFunc(patterns, moduleDir, stderr)
if len(degradedPkgs) > 0 {
    payload.Summary.SSADegraded = true
    payload.Summary.SSADegradedPackages = append(
        payload.Summary.SSADegradedPackages, degradedPkgs...)
}

SSA degradation from the contract coverage build was written to payload.Summary from two sources:

  1. The BuildContractCoverageFunc call (above) — before the CRAP step
  2. The quality step (Step 2) — via qualRes.SSADegraded

After (#165)

// runner.go — provider passed to runCRAPStep
ccProvider := goprovider.NewContractCoverageProvider(stderr)
// ... passed to steps.crapStep(...)

The provider's Build() is now called inside crap.Analyze(), which writes degradation data to crap.Options.SSADegradedPackages → crap.Summary.SSADegradedPackages → CRAP JSON output. But crapStepResult does not carry SSADegradedPackages, so this data is not propagated back to payload.Summary.

payload.Summary.SSADegraded now only reflects degradation from the quality step (Step 2, runner.go:306-308).

Impact

Low risk in practice: Both the CRAP step (via ContractCoverageProvider.Build) and the quality step analyze the same packages, so the quality step captures the same degraded packages. The SSA degradation data is also present in the CRAP JSON output (crap.Summary.SSADegradedPackages).

Edge case: If a future change causes the two steps to analyze different package sets, or if the quality step fails entirely while the CRAP step succeeds, payload.Summary.SSADegradedPackages could be incomplete compared to the pre-#165 behavior.

Proposed Fix

Add SSADegraded and SSADegradedPackages fields to crapStepResult in internal/aireport/runner_steps.go, populated from rpt.Summary.SSADegradedPackages. Propagate them to payload.Summary in runProductionPipeline (mirroring how qualRes.SSADegraded is already handled at runner.go:306).

Affected Files

  • internal/aireport/runner_steps.go — crapStepResult, runCRAPStep
  • internal/aireport/runner.go — runProductionPipeline (CRAP result handling)
  • internal/aireport/pipeline_internal_test.go — verify propagation

Severity

LOW — no data loss (degradation info exists in CRAP JSON), no user-facing behavior change in the common case. Defensive fix to restore data flow parity with pre-#165 behavior.


Refs: #165, #95

Activity

  1. added 3 commits that reference this issue on Jun 24, 2026
    9b11671
    54d2452
    11a5f54
  2. added a commit that references this issue on Aug 12, 2026
    8b5f93e
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions