Skip to content

fix: keep an absent DriftScore null instead of 0 - #330

Closed
vibgrate-team wants to merge 1 commit into
mainfrom
cursor/absent-drift-score-52bc
Closed

vibgrate-team wants to merge 1 commit into
mainfrom
cursor/absent-drift-score-52bc

Conversation

@vibgrate-team

Copy link
Copy Markdown
Contributor

Summary

An unscored scan used to report DriftScore 0 and low risk — the same result as a fully current tree. A missing score now stays absent:

  • JSON (vg scan --format json and .vibgrate/scan_result.json) stores "score": null and null component fields. riskLevel is none, not low.
  • The text and Markdown summaries print n/a for the overall score, the risk level, and any component that was not measured.
  • A score that was actually computed is unchanged, including a real 0 (current runtime) and a runtime lag of 4 or more (health 0, reported as drift 100).
  • --drift-budget and a configured drift budget skip the comparison when the score is absent and do not fail the scan. The CLI says the score is absent. A measured score over budget still fails.

Fixes #160

Commands exercised

Before the change, computeDriftScore([]) returned score: 0 and riskLevel: "low", and each component was drift 0 because a missing health value was filled in as 100 and inverted.

After the change:

  • pnpm dev scan /tmp/absent-scan --format json --no-graph --no-local-artifacts --offline --quiet on an empty directory prints "score": null, null components, "measured": [], and "riskLevel": "none". The progress line is Computing drift score · absent.
  • pnpm dev scan /tmp/empty-pkg --format text --no-graph --no-local-artifacts --offline --drift-budget 0 on a package.json with no runtime and no dependencies prints DriftScore: n/a and Runtime/Frameworks/Dependencies/EOL Risk: n/a, exits 0, and writes DriftScore is absent; --drift-budget was not applied.

Checklist

  • pnpm test passes (4906 tests)
  • pnpm lint is clean (no new warnings)
  • pnpm typecheck is clean
  • Docs updated (README / DOCS / ARCHITECTURE) where behavior changed
  • Determinism preserved — identical input still produces identical graph.json / report output (content-hashed IDs, stable sorts; no time, randomness, or filesystem-order dependence)
  • No proprietary or internal references — public, Apache-2.0 content only
  • Commits use Conventional Commits and are signed off (git commit -s, DCO)

Notes for reviewers

Weights and the health-to-drift inversion are unchanged for components that were measured. Only the absent path changed: null stays null instead of being stored as drift 0.

Open in Web Open in Cursor 

An unscored scan stored DriftScore 0, which reads as no drift. Unmeasured
components and an overall score with nothing to measure now stay null in
the report and JSON. A computed score, including a real 0, is unchanged,
and --drift-budget skips the comparison when the score is absent.

Fixes #160

Signed-off-by: Cursor Agent <cursoragent@cursor.com>

Co-authored-by: vibgrate-team <vibgrate-team@users.noreply.github.com>
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.

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

2 participants