fix(sidecar): persist host bridges across CLI upgrades (#148)#150
Merged
Conversation
…rades (#148) Bridges installed via `aware sidecar install` were placed next to the running `aware` binary — for npm that's the package's own dir, which `npm install -g` wipes wholesale on every upgrade, silently dropping every bridge and resurfacing the #136 `spawn aware-<host>: program not found` failure. - bridge_install_dir now resolves to ~/.aware/bridges (persistent, version- independent), removing the volatile exe-adjacent location. - Since bridges are no longer on PATH, the CLI invoker resolves a known bridge binary to its absolute path via find_bridge_by_binary before spawning; non-bridge binaries (and legacy on-PATH bridges) fall back to bare-name PATH resolution, so existing setups keep working through the transition.
…review) install()'s "already installed?" check delegated to find_bridge, which also scans PATH — so a legacy on-PATH bridge (e.g. the pre-upgrade npm copy) made install skip writing to ~/.aware/bridges, leaving the bridge unmigrated and still vulnerable to the next npm wipe. Added find_bridge_in_dir (managed dir + extracted subdir, no PATH); install and uninstall now use it. Runtime resolution (find_bridge / the invoker) keeps the PATH fallback for transition. Found by Codex review.
…notes (#148 review) Two regressions from persisting bridges: - Version staleness: install no-op'd on any existing file, so after a CLI upgrade the version-matched release asset was never re-fetched and the runtime spawned a stale bridge. Now a `<binary>.version` marker records the installing CLI version; install refreshes when it's missing/mismatched (bridge_is_current). uninstall clears the marker too. - Off-PATH notes: the SketchUp/Revit post-install notes told users to run `aware-sketchup --install-bridge` / `install-addin.ps1`, which aren't on PATH now. Notes carry a `{dir}` placeholder resolved to the install dir so the printed command is runnable. Found by Codex review.
… paths (#148 review) `aware sidecar list` used find_bridge (PATH-inclusive) and printed b.note raw: - A legacy PATH-only bridge showed a clean ✓, hiding that it still lives outside ~/.aware/bridges and will be wiped on the next npm upgrade. list now reports four states: ✓ current (managed dir + matching version), ↻ other-version (managed dir, refresh), ⚠ legacy-on-PATH (prompt migration), ✗ missing. - Notes printed the literal `{dir}` placeholder; list now resolves them via note_message like the install path does. Found by Codex review.
review) Runtime resolution returned a managed-dir bridge regardless of its version marker, so `app run` could spawn a sidecar installed by an older CLI. The invoker now warns (and prompts `aware sidecar install <host>`) when the resolved managed bridge's version marker doesn't match the CLI — warn rather than refuse, so cross-version-compatible bridges keep working and a patch bump doesn't force a redownload; a truly incompatible bridge still fails the run with a clear error. Adds sidecar::managed_bridge_is_stale.
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
Host bridges installed via
aware sidecar installwere placed next to the runningawarebinary — for npm that's the package's own dir, whichnpm install -gwipes wholesale on every upgrade, silently dropping every bridge and resurfacing the #136spawn aware-<host>: program not foundfailure. Closes #148.~/.aware/bridges/(version-independent, survives upgrades).find_bridge_by_binary) before spawning; non-bridge binaries and legacy on-PATH copies fall back to bare-name PATH resolution, so existing setups keep working through the transition.install/uninstallcheck the managed dir only (find_bridge_in_dir), so a legacy on-PATH copy can't block migration or be deleted by us.<binary>.versionmarker records the installing CLI release;installrefreshes when missing/mismatched, and the invoker warns (promptingaware sidecar install <host>) before spawning a version-stale managed bridge.sidecar listnow reports four states — ✓ current, ↻ other-version, ⚠ legacy-on-PATH (prompt migration), ✗ missing — and resolves post-install note paths ({dir}→ install dir) so SketchUp/Revit registration commands are runnable.Review
Primary review by Codex (
codex exec review --base main) — 5 rounds, every finding addressed, final pass clean. Findings fixed: PATH-satisfied install skip, version staleness (install + runtime), off-PATH post-install notes, andlistmasking legacy/placeholder state.Test plan
cargo test --bin awaregreen (378); new sidecar + invoker unit tests for persistence, dir-only/by-binary resolution, version-currency, staleness, and note resolutionrustfmt- andclippy --all-targets -D warnings-clean (pre-existing crate-wide drift in untouched files unchanged; CI builds only)npm install -g @aware-aeco/cli@latest;aware sidecar listprompts migration for a legacy on-PATH copy