fix(tui): rebuild runtime assets during update#32227
Conversation
austinpickett
left a comment
There was a problem hiding this comment.
✅ Approved (pending CI run)
Real P2 bug: After hermes update, TUI assets were never rebuilt — npm ci updated JS dependencies but npm run build was never called, leaving the running TUI with stale bundles.
-592 deletions are lockfile normalization (not dead code removal): The ui-tui/package-lock.json was using "link": true (workspace symlink) for @hermes/ink, with npm having inlined transitive deps as top-level nodes. The new lockfile correctly scopes them under node_modules/@hermes/ink/node_modules/. This makes npm ci (deterministic installs) actually work instead of failing.
Fix: Two new helpers _run_tui_build_step() / _build_tui_runtime_assets() in hermes_cli/main.py; wired into _update_node_dependencies(). Clean, no shell interpolation, no security concerns. Test extension asserts build steps called in correct order.
One blocker: No CI has run on this branch — please rebase on main to trigger checks.
Summary
@hermes/inkand the top-level TUI bundle duringhermes updateafterui-tuidependencies refreshui-tui/package-lock.jsonsonpm cisucceeds instead of falling back to lockfile-mutatingnpm installWhy
A git/ZIP update can refresh the TUI source tree while leaving local runtime artifacts missing or stale. In particular,
@hermes/inkexposesindex.js -> dist/entry-exports.js, but thatdist/file is an untracked build artifact. The documented local recovery is:cd ui-tui npm run build --prefix packages/hermes-ink npm run buildThe updater should perform those steps itself after refreshing
ui-tuidependencies, rather than reporting a successful update while the TUI may still be broken.The lockfile part is also reproducible on current
main:npm ci --dry-runfails because the committed lockfile is out of sync withui-tui/packages/hermes-ink/package.json. That causes the updater's deterministic install path to fall back tonpm install, which rewritesui-tui/package-lock.jsonand leaves the checkout dirty for the next update.Related:
Verification
python -m pytest tests/hermes_cli/test_cmd_update.py tests/hermes_cli/test_tui_resume_flow.py::test_make_tui_argv_dev_prebuilds_hermes_ink -q -o 'addopts='python -m ruff check hermes_cli/main.py tests/hermes_cli/test_cmd_update.pygit diff --checkcd ui-tui && npm ci --dry-run --no-fund --no-audit --progress=falsecd ui-tui && npm ci --no-fund --no-audit --progress=falsecd ui-tui && npm run build --prefix packages/hermes-ink && npm run build