fix(hud): version resolution fallback to plugin.json (Wave 1-A)#1467
Closed
JeremyDev87 wants to merge 2 commits into
Closed
fix(hud): version resolution fallback to plugin.json (Wave 1-A)#1467JeremyDev87 wants to merge 2 commits into
JeremyDev87 wants to merge 2 commits into
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Resolves the stale version display bug ("shows v5.2.0 when actual is
v5.5.0") by adding a deterministic tier-2 fallback that reads
.claude-plugin/plugin.json via __file__-relative path.
- hud_version.get_fresh_version gains plugin_json_file parameter:
* None (default): tier-2 disabled, preserves backcompat
* "": enables dev-install default path (production)
* non-empty: test override
- _default_plugin_json_path() + _read_local_plugin_json() helpers
- format_status_line accepts plugin_json_file passthrough
- main() passes plugin_json_file="" to enable Wave 1-A in production
- 7 new tests for fallback ordering, malformed files, default path
- 162/162 tests pass (133 Golden Rule + 29 version/Wave 0)
Closes #1466
Part of #1464 (Wave 0 statusbar refactor)
8b5fe76 to
cdf0772
Compare
9ae6b8c to
c5423a0
Compare
7b89e0b to
11c38dd
Compare
Combined Wave 0 polish items from the #1465/#1485 review cycle: 1. Narrow `except Exception` to `except ImportError` in the 3 lib fallback import blocks (qual-1465 HIGH-1). Real logic bugs (SyntaxError, NameError, AttributeError) inside lib modules now surface immediately instead of being silently swallowed by a catch-all. 2. Drop inline stub functions for format_rate_limits and _get_fresh_version (qual-1465 HIGH-2). Eliminates the signature drift between canonical lib definitions and in-file fallback stubs observed on the integrator branch (Wave 1-A plugin_json_file kwarg drift). The outer main() try/except still catches any runtime failure and emits the minimal safe output via the BUDDY_FACE constant. 3. Hoist hud_velocity and hud_cache_savings imports to module top as _format_velocity_segment and _format_cache_savings (perf-1485 H1). Eliminates ~0.47us sys.modules lookup per render. Integrator branch only - no-op on refactor/wave branches where the inline imports don't exist yet. 4. Bump next to 16.2.3 for GHSA-q4gf-8mx6-v5v3 (landing-security-check). Aligns eslint-config-next and updates setup.test.ts assertion. Refs: qual-1465 HIGH-1/2, perf-1485 H1, GHSA-q4gf-8mx6-v5v3
c5423a0 to
2b38912
Compare
Owner
Author
Superseded by #1485This PR was part of a stacked PR structure ( All of this PR's commits have been consolidated into #1485 (now with
EVAL review results from this PR (all reviewers, iter1 converged → Critical=0, High=0) already applied in #1485. Closing as superseded. Use #1485 with GitHub's Rebase and merge button to land all 12 commits linearly on master. |
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.
Closes #1466
Stacked on #1465 (Wave 0 refactor — must merge first)
Summary
Fixes the status bar version display bug ("shows v5.2.0 when actual is v5.5.0") by adding a tier-2
plugin.jsonfallback to the version resolution chain.Root Cause
hud-state.jsonfreezes the version at session-start and is never refreshed when the plugin is updated. Previously onlyinstalled_plugins.jsonwas consulted as the refresh source, which fails in dev installs or when the plugin registry lags the local file.Fix
New resolution chain:
installed_plugins.json(tier 1, global, authoritative after/plugin update)../.claude-plugin/plugin.json(tier 2 NEW, local, authoritative for dev installs,__file__-relative)hud_state.version(tier 3, last resort, may be stale)API Design
get_fresh_version()gainsplugin_json_file: Optional[str] = None:None(default) — tier-2 disabled, preserves backcompat for existing test callers\"\"— use the default dev-install path resolved from__file__format_status_line()passes throughplugin_json_file;main()explicitly enables it withplugin_json_file=\"\"so production always readsplugin.jsonwhile tests remain isolated.Tests
162/162 pass (133 Golden Rule + 29 version + Wave 0 modules)
7 new behavior tests in
test_hud_version.py:test_plugin_json_fallback_when_installed_plugins_missingtest_installed_plugins_wins_over_plugin_jsontest_plugin_json_beats_hud_statetest_all_fallbacks_fail_returns_hud_state_versiontest_plugin_json_malformed_skippedtest_plugin_json_missing_version_key_skippedtest_default_plugin_json_path_resolves_to_real_file— locks that the__file__-derived default path actually points at the repo'splugin.jsonBackwards Compatibility
get_fresh_version()without the new kwarg see zero behavior change (tier 2 disabled)test_hud.pyrequires zero changes becauseformat_status_line()defaults plugin_json_file to Noneformat_status_line()signature gains one keyword-only parameter with a safe default