Skip to content

fix(guide): refresh installed state at startup so installed: matches before:#95

Merged
CybotTM merged 2 commits into
mainfrom
fix/guide-installed-freshness
Jun 20, 2026
Merged

fix(guide): refresh installed state at startup so installed: matches before:#95
CybotTM merged 2 commits into
mainfrom
fix/guide-installed-freshness

Conversation

@CybotTM

@CybotTM CybotTM commented Jun 20, 2026

Copy link
Copy Markdown
Member

Summary

In make upgrade, the installed: line (from the cached snapshot) could disagree with the installer's live before: line — e.g. installed: not installed directly above before: v10.5.0, or installed: 11.12.1 above before: 11.17.0. They describe the same thing (the version present before the upgrade), so they must match.

Root cause: the guide renders installed: from tools_snapshot.json, which goes stale (e.g. after tools change outside the tool), while the installers detect live.

Fix

The guide now refreshes the snapshot's installed state at startup (network-free) so installed: matches before:.

Crucially, the full audit.py --update-local path now refreshes installed_version + status from live detection but PRESERVES each tool's existing latest_version — instead of rebuilding latest from the older committed baseline (which would show a target lower than installed and re-open the make update vs make upgrade divergence fixed in #94). Status is recomputed with the directional compute_status from #94.

Multi-version cycles (node@24, python@3.12, …) are left to make update / the per-cycle re-audit, since --update-local has no per-cycle local-only data.

Verified

tool before (stale snapshot) after refresh live before:
npm installed 11.12.1, latest 11.17.0 installed 11.17.0, latest 11.17.0 (preserved) → UP-TO-DATE 11.17.0
prettier installed , latest 3.8.4 installed 3.8.4, latest 3.8.4 (preserved) → UP-TO-DATE 3.8.4
eslint installed 10.5.0, latest 10.5.0 unchanged → UP-TO-DATE v10.5.0

Behavioral test added (--update-local preserves a seeded latest while refreshing installed). Full suite 630 passed; flake8/shellcheck clean on changed lines.

Trade-off: adds a ~5s network-free local detection at guide startup — the accepted cost of an accurate installed: before modifying the system.

The guide rendered "installed:" from a cached snapshot while the installers
detect "before:" live, so a stale snapshot showed e.g. "installed: not
installed" directly above "before: 10.5.0" (and "installed: 11.12.1" above
"before: 11.17.0"). Refresh the snapshot's installed state, network-free, at
guide startup so the two agree.

The full `audit.py --update-local` path now refreshes installed_version + status
from live detection but PRESERVES each tool's existing latest_version instead of
rebuilding it from the older committed baseline. This keeps the refresh offline,
avoids showing a target lower than installed, and keeps make-update and
make-upgrade in agreement. Multi-version cycles are left to make update /
per-cycle re-audit (no per-cycle local-only data).

Signed-off-by: Sebastian Mendel <info@sebastianmendel.de>
Copilot AI review requested due to automatic review settings June 20, 2026 22:42
@github-actions

github-actions Bot commented Jun 20, 2026

Copy link
Copy Markdown
Contributor

Dependency Review

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

Scanned Files

None

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.

@codecov

codecov Bot commented Jun 20, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 69.68%. Comparing base (30336cb) to head (9c597a2).

Additional details and impacted files
@@           Coverage Diff           @@
##             main      #95   +/-   ##
=======================================
  Coverage   69.68%   69.68%           
=======================================
  Files          22       22           
  Lines        3345     3345           
=======================================
  Hits         2331     2331           
  Misses       1014     1014           
Flag Coverage Δ
unittests 69.68% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@gemini-code-assist gemini-code-assist Bot 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.

Code Review

This pull request modifies the upgrade process to perform a network-free refresh of the local tools' installed state while preserving their cached latest_version in the snapshot. This ensures consistency between make update and make upgrade without clobbering upstream data. The changes include updates to audit.py, scripts/guide.sh, and the addition of a corresponding test suite. Feedback on the changes suggests safeguarding against potential None values when updating snapshot attributes to prevent serializing null into the JSON, which could cause downstream parsing issues.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread audit.py Outdated
…e (review)

Coerce installed_version/method/path and latest to '' with 'or ""' so they
never serialize as null (which guide.sh's json_field would render as the literal
'None'). Addresses gemini-code-assist review feedback.

Signed-off-by: Sebastian Mendel <info@sebastianmendel.de>
@CybotTM CybotTM merged commit cc5ec56 into main Jun 20, 2026
6 checks passed
@CybotTM CybotTM deleted the fix/guide-installed-freshness branch June 20, 2026 22:52
@sonarqubecloud

Copy link
Copy Markdown

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