Skip to content

Commit 66a15a7

Browse files
dean0xDean Sharon
andauthored
fix(hud): version badge cache ignores post-install version changes (#159)
## Summary - Version badge cached both `current` and `latest` versions with 24h TTL - After upgrading DevFlow, the stale cached `current` caused the upgrade notice to persist - Fix: cache only stores `latest` (npm registry result); installed version is always read live from `manifest.json` ## Test plan - [x] `npm run build` passes - [x] `npm test` — all 362 tests pass - [ ] Manual: write stale cache with `current: 1.8.1, latest: 1.8.2` while manifest says `1.8.2` → badge should NOT appear Co-authored-by: Dean Sharon <deanshrn@gmain.com>
1 parent ffa6200 commit 66a15a7

2 files changed

Lines changed: 6 additions & 4 deletions

File tree

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
### Fixed
11+
- **HUD**: version upgrade notice persists after install — cache now stores only npm `latest`, reads installed version live
12+
1013
---
1114

1215
## [1.8.2] - 2026-03-22

src/cli/hud/components/version-badge.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ const VERSION_CACHE_KEY = 'version-check';
99
const VERSION_CACHE_TTL = 24 * 60 * 60 * 1000; // 24 hours
1010

1111
interface VersionInfo {
12-
current: string;
1312
latest: string;
1413
}
1514

@@ -80,17 +79,17 @@ export default async function versionBadge(
8079
const current = getCurrentVersion(ctx.devflowDir);
8180
if (!current) return null;
8281

83-
// Check cache
82+
// Cache only the npm registry result (expensive); current is always live
8483
let info = readCache<VersionInfo>(VERSION_CACHE_KEY);
8584
if (!info) {
8685
const latest = await fetchLatestVersion();
8786
if (latest) {
88-
info = { current, latest };
87+
info = { latest };
8988
writeCache(VERSION_CACHE_KEY, info, VERSION_CACHE_TTL);
9089
}
9190
}
9291

93-
if (info && compareVersions(info.current, info.latest) < 0) {
92+
if (info && compareVersions(current, info.latest) < 0) {
9493
const badge = `\u2726 Devflow v${info.latest} \u00B7 update: npx devflow-kit init`;
9594
return { text: yellow(badge), raw: badge };
9695
}

0 commit comments

Comments
 (0)