emrg: upgrade — make GUI build (npm run dist) unskippable and add app.asar freshness gate - #1043
emrg: upgrade — make GUI build (npm run dist) unskippable and add app.asar freshness gate#1043argszero wants to merge 1 commit into
Conversation
…n dist steps with app.asar freshness gate
how2how2how2-arch
commented
Aug 27, 2026
I tested this PR and it works as described: Validation performed (head 9e6f364):
Observations (non-blocking):
The root-cause analysis matches what I observed in the v0.2.82/v0.2.83 upgrade logs (npm install executed, electron-builder never invoked). |
argszero
commented
Aug 27, 2026
Consolidating: this upgrade_prompt.j2 fix is byte-identical to the change in #1045, and #1045 is the canonical version — it additionally adds Closing this PR in favor of #1045 to keep a single source of truth and avoid a merge conflict (both touch the same line in upgrade_prompt.j2). The reviewer's note about other single-line |
argszero
commented
Aug 27, 2026
Closing as duplicate of #1045 (canonical fix, adds the regression-guard test). |
…2/v0.2.83 stale-GUI regression) (#1045) * emrg: upgrade — split GUI build into unskippable npm install + npm run dist steps with app.asar freshness gate * emrg: test — guard upgrade_prompt.j2 GUI build step structure (v0.2.82/v0.2.83 stale-GUI regression) v0.2.82/v0.2.83 upgrades ran only 'npm install', never 'npm run dist' (electron-builder) — the single-line '&&' chain in upgrade_prompt.j2 was truncated by the upgrade agent, so the GUI stayed on the old build. #1043 fixes the prompt (split steps + app.asar freshness gate); this test pins that structure so the same regression turns red immediately: - npm install and npm run dist must stay on separate lines (no single-line chain), dist step must carry a MUST RUN directive - app.asar mtime freshness gate (stat) must exist and come after dist Negative-state verified against the pre-#1043 prompt (2deb518): all three assertions fire on the old structure. Python tests 1123 -> 1124, Agent.md synced. * emrg: test — guard upgrade_prompt.j2 macOS re-seal chain (rant 2026-08-25T09:18:19) Completes the upgrade_prompt structure guard: #1045 (R2249) pinned the GUI build steps (npm install / npm run dist / app.asar freshness gate); this pins the macOS deployment-safety chain that ships the artifact: - re-seal (codesign --force --deep --sign -) must occur BEFORE the Replace/copy step — copying an unsealed bundle ships the malware-flagged artifact (macOS 26 moves unsealed+xattr copies to Trash) - built-artifact xattr clear must precede the copy (ditto propagates xattrs) - run-copy xattr clear (~/Applications/EMRG.app) must exist - at least 3 codesign --verify --deep --strict checks (pre-copy sanity + install + run copy) Python tests 1124 -> 1125, Agent.md synced. --------- Co-authored-by: EMRG Evolution <emrg@argszero.dev> Co-authored-by: argszero <argszero@gmail.com>
Problem
The upgrade flow's GUI build step is unreliable. The template line:
was written in a single line, but the upgrade agent only ever executed the first command (
npm install), either truncating the&& npm run distchain or rewriting it into a backgroundednpm install 2>&1 | tail -2 &. The result:npm run dist(electron-builder) never ran, so the GUI app was never rebuilt and stayed on the old upstream version with the broken layout — even though the version-printedemrgCLI reported the new version.Evidence: across the v0.2.82 (12:59-13:01) and v0.2.83 (14:34) upgrades, the agent never once invoked
npm run dist/electron-builder; it only ranls -d dist/mac-arm64/EMRG.appagainst the pre-existing stale artifact and concluded the build was done.Fix
Rewrite step 3 of
emrg/server/prompts/upgrade_prompt.j2so the two commands are separate, unskippable steps, and add a freshness gate that proves the artifact was actually rebuilt before copying:npm install(must exit 0 before continuing)npm run dist(marked MUST RUN — a stale dist will not rebuild on its own)stat -f "%m %N" ... <EMRG.app>/Contents/Resources/app.asarmust show an mtime AFTER this build started; if app.asar is missing or its mtime is old, the build did NOT run → do NOT copy, report and roll back.This removes the trigger that let the agent silently reuse a stale app and ships a layout fix that was previously not installed.
Verification
upgrade_workvariable..venv/bin/python -c "from emrg.client.app import run_client"— OK.venv/bin/python -m emrg --help— OKpytest tests/ -q: 1122 passed, 1 skipped (baseline)