Skip to content

The agent that grows with you

test: drive legacy Desktop updates against staged source with clean install marker

ethernet549541287495
diff --git a/tests-js/update-ui.test.mjs b/tests-js/update-ui.test.mjs
index 8730dccc6e2..2334c1bdd82 100644
--- a/tests-js/update-ui.test.mjs
+++ b/tests-js/update-ui.test.mjs
@@ -71,12 +71,18 @@ test.each([true, false])('reveals the actual update button without applying (det
test('checks the live Desktop bridge against the staged target before opening About', async () => {
const sha = 'a'.repeat(40)
- const f = fixture({ statusOverride: { supported: true, branch: 'main', targetSha: sha, updateAvailable: true } })
+ const f = fixture({ statusOverride: { supported: true, branch: 'main', currentSha: 'b'.repeat(40), targetSha: sha, behind: 1, dirty: false } })
await updateUi.assertStagedBranch(f.page, sha, f.log)
expect(f.log).toHaveBeenCalledWith(expect.stringContaining('"targetSha"'))
+ const current = fixture({ statusOverride: { supported: true, branch: 'main', currentSha: 'b'.repeat(40), targetSha: sha, behind: 1, updateAvailable: true } })
+ await updateUi.assertStagedBranch(current.page, sha, current.log)
for (const statusOverride of [
{ supported: true, error: 'release-unavailable', branch: 'main' },
- { supported: true, branch: 'main', targetSha: 'b'.repeat(40), updateAvailable: true },
+ { supported: true, branch: 'main', targetSha: 'b'.repeat(40), behind: 1, updateAvailable: true },
+ { supported: true, branch: 'main', targetSha: sha, behind: 1, dirty: true },
+ { supported: true, branch: 'main', targetSha: sha, behind: 0 },
+ { supported: true, branch: 'main', currentSha: sha, targetSha: sha, behind: 1 },
+ { supported: true, branch: 'main', targetSha: sha, behind: 1, updateAvailable: false },
]) {
const refused = fixture({ statusOverride })
await expect(updateUi.assertStagedBranch(refused.page, sha, refused.log)).rejects.toThrow(/refusing to click/)
diff --git a/tests/install/e2e-assets/update-ui.cjs b/tests/install/e2e-assets/update-ui.cjs
index 27f8a0aac2b..17d56616641 100644
--- a/tests/install/e2e-assets/update-ui.cjs
+++ b/tests/install/e2e-assets/update-ui.cjs
@@ -81,7 +81,13 @@ async function openAbout(page, { prepare, log, shot, confirmSettings = false, hi
async function assertStagedBranch(page, expectedSha, log) {
const status = await page.evaluate(() => window.hermesDesktop.updates.check({ force: true }))
log(`[source-branch-check] ${JSON.stringify(status)}`)
- if (status.error || status.branch !== 'main' || status.targetSha !== expectedSha || !status.updateAvailable) {
+ // Historical Desktop status has no updateAvailable field: its About/overlay
+ // offers the button when behind > 0. Never accept an explicit false from a
+ // newer checker, a dirty source tree, or merely a matching remote tip.
+ if (status.supported !== true || status.error || status.dirty === true ||
+ status.branch !== 'main' || status.targetSha !== expectedSha ||
+ !Number.isInteger(status.behind) || status.behind <= 0 ||
+ status.currentSha === expectedSha || status.updateAvailable === false) {
throw new Error('Desktop source check did not offer staged Git main; refusing to click an unrelated update')
}
}
diff --git a/tests/install/installer-script-e2e.sh b/tests/install/installer-script-e2e.sh
index 478a41a6435..a00d127eb89 100755
--- a/tests/install/installer-script-e2e.sh
+++ b/tests/install/installer-script-e2e.sh
@@ -452,6 +452,19 @@ case "$UPDATE_METHOD" in
# fixup) runs for real in the installed code.
EXPECT_DESKTOP=present
HERMES="$(source_hermes "$INSTALL_DIR")" || fail "no installed desktop command"
+ # v2026.6.19's installer writes this marker into its checkout without
+ # ignoring it. Its Electron checker reports git status --porcelain verbatim;
+ # teach only this disposable clone that the installer's own state is not
+ # a source edit. Keep the marker for install-method detection and refuse
+ # any other dirty state rather than masking it for the GUI update.
+ marker_status="$(git -C "$INSTALL_DIR" status --porcelain --untracked-files=all)"
+ if [ "$marker_status" = '?? .install_method' ] &&
+ [ "$(cat "$INSTALL_DIR/.install_method")" = git ]; then
+ printf '\n/.install_method\n' >> "$(git -C "$INSTALL_DIR" rev-parse --absolute-git-dir)/info/exclude"
+ ok "ignored only the installer's generated .install_method in local Git exclude"
+ fi
+ [ -z "$(git -C "$INSTALL_DIR" status --porcelain --untracked-files=all)" ] \
+ || fail "installed source has changes other than the generated install marker"
ASSETS="$REPO_ROOT/tests/install/e2e-assets"
SPEC="$WORK_ROOT/launch-spec.json"