Skip to content

Reporting: ensure absent scores render as absent (null), never as 0 #160

Open

Description

@vibgrate-team

Context

Product/engineering standards treat absent and zero as different: a missing DriftScore/RiskScore must not display as 0 (which reads as perfect). Adjacent scanners also struggle with sentinel values and counting bugs.

What to do

  1. Audit CLI human + machine-readable outputs for DriftScore / RiskScore / related metrics when a scan has not produced a score.
  2. Ensure absent values are null / “n/a” / omitted — never 0 unless the score was actually computed as zero.
  3. Add a regression test for the “unscanned / incomplete” path.

Acceptance

  • Absent vs zero distinguished in at least the primary vg scan summary and one machine-readable format
  • Regression test covers the absent path
  • No change to scoring math beyond presentation/serialization of absence

Mentoring notes

Confirm current behaviour before coding; cite the commands you exercised in the PR.

Activity

  1. added
    enhancement
    on Sep 16, 2026
  2. vibgrate-team commented on Oct 3, 2026

    @vibgrate-team
    ContributorAuthor

    computeDriftScore in src/reporting/scoring/drift-score.ts does not preserve absence. buildComponents() uses toDrift(Math.round(rs ?? 100)) (and the same for framework, dependency, and eol). A component with no input is therefore stored as drift 0, which on the v2 scale means "no drift", not "unmeasured".

    If every component is null, the function returns overall score: 0 and riskLevel: 'low' and omits measured. vg scan prints that via emitDriftScoreLine(artifact.drift.score) and will compare it to --drift-budget.

    Contract:

    • Unmeasured component fields are null (or omitted), never 0.
    • A real zero stays 0 (runtime lag of 4 or more really returns 0 from runtimeScore).
    • When nothing was measured, overall score is null, not 0/low. A null score must not fail --drift-budget; skip the comparison and say the score is absent.
    • Do not change weights or the health-to-drift inversion for components that were measured.
    • Cover projects: [] and a project with empty dependency buckets / no runtime in src/reporting/scoring/drift-score.test.ts.
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

    enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions