feat(ext): show the running dig-node version + out-of-date badge#136
Merged
Conversation
The Updates tab showed only the dig-updater/beacon version (`control.updater.status`), easily conflated with the node's own build. Add a NodeVersionSection that renders unconditionally above the beacon panel (no pairing needed): - The running dig-node version reuses the existing `getNodeLiveStatus` WS status (#239) as ground truth — no new SW plumbing, since that live signal already carries the node's own reported `version`, independent of beacon health. - The latest-available version comes from the public update-feed manifest (updates.dig.net/v1/alpha/manifest.json), read via a new direct-HTTPS RTK Query slice (feedManifestApi.ts, mirroring priceApi.ts) — no CSP change needed (https://*.dig.net already covers the host). - A tolerant semver compare (src/lib/node-version.ts) drives an honest four-state badge: upToDate / updateAvailable (names the version) / nodeOffline / feedUnreachable — never a false "up to date" when the node is down or the feed can't be read. All new copy ships across the 14 supported locales. Minor bump (new capability, no breaking change): 1.99.1 -> 1.100.0. Closes #583 Co-Authored-By: Claude <noreply@anthropic.com>
| if (req.url === '/') filePath = path.join(DIR, 'popup.html'); | ||
| if (!filePath.startsWith(DIR)) filePath = path.join(DIR, 'popup.html'); | ||
|
|
||
| fs.stat(filePath, (err, stat) => { |
| filePath = path.join(filePath, 'index.html'); | ||
| } | ||
|
|
||
| fs.readFile(filePath, (err, content) => { |
…formed version
FIX 1: The feedManifestApi.test.ts makeStore() was missing the autoBatch:{type:'tick'} enhancer override that src/app/store.ts requires to prevent jsdom teardown flakes. Reused the same config.
FIX 2: Regenerated screenshots (fullscreen-updates.png, mobile-updates.png, updates-node-outdated.png) to show v1.100.0.
FIX 3: Added hasValidVersionFormat() guard in nodeVersionBadge() to reject malformed feed versions (e.g. "invalid"). Prevents false "up to date" from garbage feed entries. Now returns feedUnreachable state instead. Added test.
All 253 test files + 2603 tests green, no teardown flakes. Coverage: 96.23%.
Co-Authored-By: Claude <noreply@anthropic.com>
644a819 to
ede796f
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
getNodeLiveStatusWS status (#239) as ground truth — the same live signal the popup's connection pill already reads (state,version), independent of beacon health. No new SW plumbing was needed (see the "already-shipped check" realization below).https://updates.dig.net/v1/alpha/manifest.json), fetched directly over HTTPS via a newfeedManifestApiRTK Query slice (mirrorspriceApi.ts/catMetadataApi.ts— no CSP change needed,https://*.dig.netalready covers the host).src/lib/node-version.ts) drives an honest four-state badge: Up to date / Update available — vX.Y.Z / Node offline / Couldn't check for updates — never a false "up to date" when the node is disconnected or the feed can't be read.Blast radius checked (gitnexus/socraticode)
UpdatesTab.tsx(adds<NodeVersionSection />, no change toUpdaterPanel/UpdaterStatusGate).src/app/store.ts(registers the newfeedManifestApireducer/middleware, mirroring the existingpriceApi/catMetadataApi/feeApidirect-HTTPS slices).nodeApi.ts/getNodeLiveStatus(#239),StatusPill,FourStatepatterns.getNodeLiveStatusand the public feed manifest — already exist).Realizations / follow-ups
/versionHTTP fetch would have DUPLICATED the extension's existinggetNodeLiveStatusWS status (#239), which already carries the node's ownversionfield with no pairing required. Reused it instead — logged inDEVELOPMENT_LOG.mdas a durable "check for an existing live signal before wiring a new one" lesson.control.info-style field name (vs. today'sversionon both/health-style status ANDcontrol.status) would reduce the "which version is this" ambiguity that caused #583 in the first place — worth a small dig-node-side naming pass in a follow-up, but not required (today'sgetNodeLiveStatus.versionis already clean ground truth).Test plan
src/lib/node-version.test.ts(semver compare + badge-state matrix, 15 tests)src/lib/feed-manifest.test.ts(parse + fetch, 9 tests)src/features/updates/feedManifestApi.test.ts(RTK Query endpoint, 3 tests)src/features/updates/NodeVersionSection.test.tsx(4 states: offline / feed-unreachable / up-to-date / update-available)UpdatesTab.test.tsx(+1 integration test proving the node version and beacon version render distinctly)npm run typecheckclean,npm run lint0 errors,npm run test:node32/32,npx vitest run --coverage253 files / 2602 tests passed, overall coverage 96.23% lines (repo floor 80%)app.html, real bundle):e2e/updates-tab.spec.tsextended withgetNodeLiveStatus+ a routed feed-manifest response — 8/8 passing, covering up-to-date, update-available, node-offline, and feed-unreachablefullscreen-updates.png,mobile-updates.png,updates-node-outdated.png,updates-not-installed.pngVersion bump
feat:→ minor:1.99.1→1.100.0(new capability, no breaking change).Co-Authored-By: Claude noreply@anthropic.com