Repository navigation
fix(installer): resolve repo root correctly in scripts under installer/ - #1326
Conversation
Both installer/scripts/start-agent-ui.ps1 and installer/scripts/build-ui-installer.ps1 used parent-traversal depth matching their old location at scripts/. After the R097 rename in #731, both stopped one level short at installer/, causing \/\ to point at the non-existent installer/src/... Closes #1325
|
The fix is correct — both PowerShell scripts now traverse two parent directories instead of one, so SummaryAccurate diagnosis, clean fix. The root cause (both PS1 scripts were only climbing one level from Two items worth addressing — one is a follow-up bug in the bash siblings, one is a description inaccuracy that's worth correcting before merge. Issues Found🟡 Bash counterparts have the identical off-by-one bug (
|
…taller/ (amd#1332) ## Why this matters On a fresh Linux/macOS checkout, `start-agent-ui.sh --frontend-only` and `build-ui-installer.sh` were running `npm`/`electron-forge` against the non-existent `installer/src/gaia/apps/webui` instead of the real `src/gaia/apps/webui`, silently producing a broken installer or failing prerequisite checks. These are the bash counterparts to the two PowerShell scripts fixed in amd#1326 — flagged in that PR's review as having the identical off-by-one bug, deliberately deferred to this follow-up. Both scripts live at `installer/scripts/`, so the correct traversal is `$SCRIPT_DIR/../..` (two levels up to repo root), not `$SCRIPT_DIR/..` (one level, stopping at `installer/`). Follow-up to amd#1326. ## Test plan - [x] `bash -n` parses both scripts with no errors. - [x] Path resolution: `cd "$SCRIPT_DIR/../.."` from `installer/scripts/` resolves to repo root, and `src/gaia/apps/webui/package.json` is found there. - [x] `git diff` is scope-clean: only the two `.sh` files, 2 insertions / 2 deletions. - [ ] Manual (Linux reviewer, optional): `./installer/scripts/start-agent-ui.sh --frontend-only` runs `npm` in the correct directory; `./installer/scripts/build-ui-installer.sh --browser` builds against the real `src/gaia/apps/webui`. Co-authored-by: Ovtcharov <[email protected]>
…md#1395) ## Why this matters amd#1332 fixed the off-by-one repo-root bug in `start-agent-ui.sh` and `build-ui-installer.sh` (the bash counterparts to the PowerShell fix in amd#1326), but shipped with only a manual `bash -n` test plan — nothing in CI stops the `$SCRIPT_DIR/..` → `installer/` regression from creeping back in if either script is moved or edited again. amd#1328 is still open precisely because the fix was never pinned. This adds the regression coverage: a pure-stdlib test that parses both scripts and asserts the two-levels-up traversal resolves to the real repo root, that `$WEBUI_DIR`/`$ELECTRON_DIR` point at `src/gaia/apps/webui` and `src/gaia/electron` (which exist on a fresh checkout), and that the old one-level traversal would have landed on `installer/`. No production code changes — the fix is already on `main`. Closes amd#1328. ## Test plan - [x] `python -m pytest tests/unit/installer/test_bash_script_paths.py` — 3 passed against the current (fixed) scripts. - [x] Sanity: temporarily reverting either script to `$SCRIPT_DIR/..` makes the corresponding test fail (the guard actually guards). - [x] `black --check` and `isort --check-only` clean on the new file. ## Out of scope - The script fix itself (already merged in amd#1332). - PowerShell counterparts (amd#1326). --------- Co-authored-by: martin <[email protected]>
Summary
Fix repo-root resolution in the two PowerShell scripts under
installer/scripts/- both climbed one parent directory too few after the R097 rename in #731, causing downstream paths ($WebUIDir,$WEBUI_DIR) to point one level short atinstaller/src/...instead of the real<repo>/src/....Why
On a fresh Windows checkout:
start-agent-ui.ps1 -FrontendOnlyinvokesnpm install/npm run devagainst the non-existentinstaller\src\gaia\apps\webuiinstead ofsrc\gaia\apps\webui.build-ui-installer.ps1runs itsnpm ci,npm run build,electron-forge package/makeagainst the same wrong tree, silently producing a broken installer or failing prerequisite checks at lines 77, 97, 106-108, 132, 149, 158, 166.Both files live at
installer/scripts/, so the correct traversal is$PSScriptRoot\..\..(two levels up -> repo root), not$PSScriptRoot\..(one level ->installer/).Scope note: The bash counterparts (
start-agent-ui.sh,build-ui-installer.sh) have the identical off-by-one bug on Linux/macOS. They are deliberately out of scope for this PR (separate platform) and will be addressed in a follow-up.Linked issue
Closes #1325
Changes
installer/scripts/start-agent-ui.ps1: replace the two-lineSplit-Path -Parentchain (plus the intermediate$ScriptDirvariable) with(Resolve-Path "$PSScriptRoot\..\..").Path.$ProjectRootname is preserved.installer/scripts/build-ui-installer.ps1: change$REPO_ROOT = (Resolve-Path "$PSScriptRoot\..").Pathto use..\..(same one-character fix).$WEBUI_DIR/$ELECTRON_DIRderive from it, so they get corrected transitively.Test plan
Automated (cross-platform, no Windows required):
[System.Management.Automation.Language.Parser]::ParseFile(...)returns no errors for both files.git diffis scope-clean: only the two.ps1files, 3 insertions / 3 deletions.Manual (Windows reviewer, optional):
.\installer\scripts\start-agent-ui.ps1 -FrontendOnlyand confirmnpm installruns in the correct directory andnpm run devstarts..\installer\scripts\build-ui-installer.ps1 -Mode browserand confirm the build completes against the realsrc\gaia\apps\webui.Checklist