Skip to content

fix(audit): recompute status in merged render instead of serving stored verdict - #136

Merged
CybotTM merged 1 commit into
mainfrom
fix/recompute-status-in-merged-render
Jul 30, 2026
Merged

fix(audit): recompute status in merged render instead of serving stored verdict#136
CybotTM merged 1 commit into
mainfrom
fix/recompute-status-in-merged-render

Conversation

@CybotTM

@CybotTM CybotTM commented Jul 30, 2026

Copy link
Copy Markdown
Member

Problem

Real field output from make upgrade:

==> ✅ bwrap
    installed: 0.9.0 via apt
    target:    0.11.2 (same)
    up-to-date; skipping.

0.9.0 reported as "(same)" as 0.11.2. Root cause chain, each step verified live:

  1. compute_status("0.9.0", "0.11.2") is correct (OUTDATED) — comparison logic is not at fault.
  2. merge_for_display (cli_audit/local_state.py) built display rows with "status": loc.status — the verdict stored in local_state.json at collect time — while joining latest_version fresh from the upstream baseline.
  3. When the committed baseline moves without a local re-collect, the row pairs the new latest with the stale verdict. The stale pairing was baked into tools_snapshot.json (row contained latest_version: 0.11.2 + status: UP-TO-DATE simultaneously), audit.py derived is_up_to_date from it, and guide.sh printed "(same) / up-to-date; skipping".

Fix

_display_status() recomputes the verdict from the current (installed_version, latest_version) pair at merge time — directional like compute_status (installed ≥ latest is UP-TO-DATE, handles installed-ahead-of-stale-baseline). CONFLICT passes through; a missing side keeps the stored status (best available information). A stored derived value is only valid for the inputs it was computed from.

Test plan

  • 4 new tests (written first, watched fail): stale UP-TO-DATE → OUTDATED (the bwrap case), installed-ahead → UP-TO-DATE, stored status preserved without upstream data, CONFLICT passthrough.
  • Full suite: 793 passed, 1 skipped; smoke test OK; pre-commit green.
  • Real-machine end-to-end: after audit.py --update-local, the snapshot row and CLI_AUDIT_JSON=1 audit.py bwrap both report OUTDATED / is_up_to_date: false for 0.9.0 vs 0.11.2.

https://claude.ai/code/session_01MH3EaniXCnJdwqNvrMB4Ym

…ed verdict

local_state.json stores the status computed at collect time. merge_for_display
served it verbatim while joining latest_version fresh from the upstream
baseline — so when the committed baseline moved without a local re-collect,
the row paired the new latest with a stale verdict. Field case: bwrap
rendered "installed 0.9.0 / latest 0.11.2 / UP-TO-DATE", and guide.sh
printed "target: 0.11.2 (same); up-to-date; skipping.".

Recompute the status from the current (installed_version, latest_version)
pair at merge time, directional like compute_status (installed >= latest is
UP-TO-DATE). CONFLICT passes through; missing either side keeps the stored
status. The legacy tools_snapshot.json picks up correct verdicts on the
next update/update-local rebuild.

Claude-Session: https://claude.ai/code/session_01MH3EaniXCnJdwqNvrMB4Ym
Signed-off-by: Sebastian Mendel <github@sebastianmendel.de>
Copilot AI review requested due to automatic review settings July 30, 2026 12:02
@github-actions

Copy link
Copy Markdown
Contributor

Dependency Review

✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.

Scanned Files

None

@sonarqubecloud

Copy link
Copy Markdown

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@CybotTM
CybotTM merged commit 7faaeff into main Jul 30, 2026
24 of 25 checks passed
@CybotTM
CybotTM deleted the fix/recompute-status-in-merged-render branch July 30, 2026 12:06
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.

2 participants