The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
test(install-e2e): every combination also installs HEAD and updates it to a synthetic NEXT
ethernetb1c9d1279afe
diff --git a/.github/workflows/install-e2e-macos-run.yml b/.github/workflows/install-e2e-macos-run.ymlindex 0f4210d413b..ff6b53e308b 100644--- a/.github/workflows/install-e2e-macos-run.yml+++ b/.github/workflows/install-e2e-macos-run.yml@@ -33,6 +33,11 @@ on:required: falsetype: stringdefault: refs/heads/main+ update-ref:+ description: 'What to update TO: HEAD (the commit under test), or NEXT -- a synthetic child of install-ref that the driver mints, so a leg that installs HEAD still has an update to take (HEAD''s own updater).'+ required: false+ type: string+ default: HEADtag-has-desktop:description: "Whether install-ref ships the desktop app (apps/desktop). The caller annotates this from the tag's own tree; desktop-method legs from pre-desktop releases natively skip."required: false@@ -84,6 +89,7 @@ jobs:install-method: ${{ inputs.install-method }}update-method: ${{ inputs.update-method }}install-ref: ${{ inputs.install-ref }}+ update-ref: ${{ inputs.update-ref }}tag-has-desktop: ${{ inputs.tag-has-desktop }}leg-id: ${{ inputs.leg-id }}runner: macos-latest@@ -133,6 +139,7 @@ jobs:tests/install/macos-desktop-e2e.sh --phase stage \--update-method '${{ inputs.update-method }}' \--install-ref '${{ inputs.install-ref }}' \+ --update-ref '${{ inputs.update-ref }}' \--dmg-url '${{ inputs.dmg-url }}'env:HERMES_E2E_LOG_DIR: ${{ runner.temp }}/e2e-logs@@ -147,7 +154,7 @@ jobs:env:HERMES_E2E_LOG_DIR: ${{ runner.temp }}/e2e-logs- - name: Update ${{ inputs.install-ref }} -> HEAD (${{ inputs.update-method }})+ - name: Update ${{ inputs.install-ref }} -> ${{ inputs.update-ref }} (${{ inputs.update-method }})run: |set -euo pipefailtests/install/macos-desktop-e2e.sh --phase update \diff --git a/.github/workflows/install-e2e-run.yml b/.github/workflows/install-e2e-run.ymlindex a5b517a87f1..3d930fe2026 100644--- a/.github/workflows/install-e2e-run.yml+++ b/.github/workflows/install-e2e-run.yml@@ -50,6 +50,11 @@ on:required: falsetype: stringdefault: refs/heads/main+ update-ref:+ description: 'What to update TO: HEAD (the commit under test), or NEXT -- a synthetic child of install-ref that the driver mints, so a leg that installs HEAD still has an update to take (HEAD''s own updater).'+ required: false+ type: string+ default: HEADleg-id:description: 'Artifact-safe matrix leg id (from generate-e2e-matrix.mjs legId). Names this leg''s logs + player artifacts so the report job can link a row to its zip.'required: true@@ -125,7 +130,8 @@ jobs:tests/install/installer-script-e2e.sh \--install-method '${{ inputs.install-method }}' \--update-method '${{ inputs.update-method }}' \- --install-ref '${{ inputs.install-ref }}'+ --install-ref '${{ inputs.install-ref }}' \+ --update-ref '${{ inputs.update-ref }}'env:# Outside the workspace on purpose: logs written into the repo# would trip the driver's own dirty-tree guard.diff --git a/.github/workflows/install-e2e-windows-run.yml b/.github/workflows/install-e2e-windows-run.ymlindex c8cec4084ac..5df45f912e0 100644--- a/.github/workflows/install-e2e-windows-run.yml+++ b/.github/workflows/install-e2e-windows-run.yml@@ -58,6 +58,11 @@ on:required: falsetype: stringdefault: auto+ update-ref:+ description: 'What to update TO: HEAD (the commit under test), or NEXT -- a synthetic child of install-ref that the driver mints, so a leg that installs HEAD still has an update to take (HEAD''s own updater).'+ required: false+ type: string+ default: HEADtag-has-desktop:description: "Whether install-ref ships the desktop app (apps/desktop). The caller annotates this from the tag's own tree; desktop-method legs from pre-desktop releases natively skip."required: false@@ -230,13 +235,13 @@ jobs:- name: Stage serve repo (main -> ${{ inputs.install-ref }})shell: powershell- run: powershell -NoProfile -ExecutionPolicy Bypass -File tests\install\windows-e2e.ps1 -Phase stage -InstallMethod "${{ inputs.install-method }}" -Route "${{ inputs.update-method }}" -InstallRef "${{ inputs.install-ref }}" -SetupExeUrl ${{ inputs.setup-exe-url }}+ run: powershell -NoProfile -ExecutionPolicy Bypass -File tests\install\windows-e2e.ps1 -Phase stage -InstallMethod "${{ inputs.install-method }}" -Route "${{ inputs.update-method }}" -InstallRef "${{ inputs.install-ref }}" -UpdateRef "${{ inputs.update-ref }}" -SetupExeUrl ${{ inputs.setup-exe-url }}- name: Install ${{ inputs.install-ref }} (${{ inputs.install-method }})shell: powershellrun: powershell -NoProfile -ExecutionPolicy Bypass -File tests\install\windows-e2e.ps1 -Phase install -InstallMethod "${{ inputs.install-method }}" -Route "${{ inputs.update-method }}" -InstallRef "${{ inputs.install-ref }}" -SetupExeUrl ${{ inputs.setup-exe-url }}- - name: Update ${{ inputs.install-ref }} -> HEAD (${{ inputs.update-method }})+ - name: Update ${{ inputs.install-ref }} -> ${{ inputs.update-ref }} (${{ inputs.update-method }})id: updateshell: powershellrun: powershell -NoProfile -ExecutionPolicy Bypass -File tests\install\windows-e2e.ps1 -Phase update -InstallMethod "${{ inputs.install-method }}" -Route "${{ inputs.update-method }}" -InstallRef "${{ inputs.install-ref }}" -SetupExeUrl ${{ inputs.setup-exe-url }}diff --git a/.github/workflows/install-e2e.yml b/.github/workflows/install-e2e.ymlindex e8dc86a2d3b..5de0f88274d 100644--- a/.github/workflows/install-e2e.yml+++ b/.github/workflows/install-e2e.yml@@ -289,6 +289,7 @@ jobs:install-method: ${{ matrix.install_method }}update-method: ${{ matrix.update_method }}install-ref: ${{ matrix.install_ref }}+ update-ref: ${{ matrix.update_ref }}tag-has-desktop: ${{ matrix.tag_has_desktop }}leg-id: ${{ matrix.leg_id }}@@ -304,6 +305,7 @@ jobs:install-method: ${{ matrix.install_method }}update-method: ${{ matrix.update_method }}install-ref: ${{ matrix.install_ref }}+ update-ref: ${{ matrix.update_ref }}tag-has-desktop: ${{ matrix.tag_has_desktop }}leg-id: ${{ matrix.leg_id }}@@ -321,6 +323,7 @@ jobs:install-method: ${{ matrix.install_method }}update-method: ${{ matrix.update_method }}install-ref: ${{ matrix.install_ref }}+ update-ref: ${{ matrix.update_ref }}tag-has-desktop: ${{ matrix.tag_has_desktop }}leg-id: ${{ matrix.leg_id }}diff --git a/scripts/sandbox/generate-e2e-matrix.mjs b/scripts/sandbox/generate-e2e-matrix.mjsindex 5c846943113..6f7267bc4ee 100644--- a/scripts/sandbox/generate-e2e-matrix.mjs+++ b/scripts/sandbox/generate-e2e-matrix.mjs@@ -21,9 +21,9 @@** Prints JSON: { linux: {include:[...]}, windows: {include:[...]},* macos: {include:[...]} } -- every entry is {name, install_method,- * update_method, install_ref, tag_has_desktop} (the tag annotation lets- * a run workflow natively skip desktop-surface legs from releases that- * predate the desktop app).+ * update_method, install_ref, update_ref, tag_has_desktop} (the tag+ * annotation lets a run workflow natively skip desktop-surface legs from+ * releases that predate the desktop app).*/import fs from 'node:fs';@@ -74,8 +74,16 @@ import { fileURLToPath } from 'node:url';* A picked release tag plus what its own tree ships (annotated by* pick-releases in install-e2e.yml).*+ * @typedef {'HEAD' | 'NEXT'} UpdateTarget+ * HEAD is the commit under test. NEXT is not a git ref: the drivers mint+ * it as a synthetic child of the install ref, so a leg starting AT HEAD+ * still has an update to take.+ *+ * @typedef {{from: string, to: UpdateTarget, desktop: boolean}} Start+ * One column of the plan: install `from`, update to `to`.+ ** @typedef {{name: string, leg_id: string, install_method: string, update_method: string,- * install_ref: string, tag_has_desktop?: boolean}} MatrixEntry+ * install_ref: string, update_ref: UpdateTarget, tag_has_desktop?: boolean}} MatrixEntry*//**@@ -100,7 +108,33 @@ export function legId(name) {export function bundledMatrix(os, oldTag) {const name = `${os}: packaged-app -> open-app-update (${oldTag} -> HEAD)`;return { include: [{ name, leg_id: legId(name), install_method: 'packaged-app',- update_method: 'open-app-update', install_ref: oldTag, tag_has_desktop: true }] };+ update_method: 'open-app-update', install_ref: oldTag, update_ref: 'HEAD', tag_has_desktop: true }] };+}++/**+ * The starting points every combination runs from: each sampled release+ * tag updating to HEAD, then HEAD itself updating to NEXT. The HEAD start+ * is the only leg whose installer runs against an empty machine with the+ * CURRENT script, and the only one whose updater is the one we ship today+ * (every tag leg exercises the OLD build's updater handing off to HEAD).+ * @param {TagAnnotation[]} tags+ * @returns {Start[]}+ */+export function startsFor(tags) {+ return [+ ...tags.map((t) => /** @type {Start} */ ({ from: t.ref, to: 'HEAD', desktop: t.desktop })),+ { from: 'HEAD', to: 'NEXT', desktop: true },+ ];+}++/**+ * Column label for a start. Tag columns keep their bare tag (every one+ * targets HEAD); the HEAD start spells out its synthetic target.+ * @param {string} from @param {string} to+ * @returns {string}+ */+function startLabel(from, to) {+ return to === 'HEAD' ? from : `${from} -> ${to}`;}/** @type {Record<Os, OsSpec>} */@@ -196,9 +230,9 @@ export function generateEnvironments(spec) {/*** Split the combinations into one matrix per OS.*- * `tags` (the released versions we test updating FROM) is the OUTER axis:- * for each tag, for each combination, one dispatch that installs the tag- * and updates to HEAD. No capability filtering happens here -- every+ * The starts (startsFor: each sampled tag -> HEAD, plus HEAD -> NEXT) are+ * the OUTER axis: for each start, for each combination, one dispatch that+ * installs `from` and updates to `to`. No capability filtering happens here -- every* declared combination is dispatched, and the OS's run workflow natively* skips what its driver cannot run yet. Entry names carry everything (os,* method pair, tag transition) because slash-joined leg names are all the@@ -212,18 +246,20 @@ export function buildMatrices(envs, tags) {/** @type {Record<Os, {include: MatrixEntry[]}>} */const byOs = { linux: { include: [] }, windows: { include: [] }, macos: { include: [] } };for (const env of envs) {- for (const tag of tags) {+ for (const start of startsFor(tags)) {+ const name = `${env.os}: ${env.install} -> ${env.update} (${start.from} -> ${start.to})`;/** @type {MatrixEntry} */const entry = {- name: `${env.os}: ${env.install} -> ${env.update} (${tag.ref} -> HEAD)`,- leg_id: legId(`${env.os}: ${env.install} -> ${env.update} (${tag.ref} -> HEAD)`),+ name,+ leg_id: legId(name),install_method: env.install,update_method: env.update,- install_ref: tag.ref,+ install_ref: start.from,+ update_ref: start.to,// Every OS declares desktop-surface methods (both app-update// variants at minimum), so every leg carries the annotation and// its run workflow can natively skip pre-desktop tags.- tag_has_desktop: tag.desktop,+ tag_has_desktop: start.desktop,};byOs[env.os].include.push(entry);}@@ -256,18 +292,19 @@ export function methodNeedsDesktop(m) {* @returns {string}*/export function renderMarkdownPlan(envs, tags) {+ const starts = startsFor(tags);const lines = ['### Install & Update E2E plan','',- `${envs.length} combinations x ${tags.length} starting tags = ${envs.length * tags.length} legs`,+ `${envs.length} combinations x ${starts.length} starting points = ${envs.length * starts.length} legs`,'',- `| combination | ${tags.map((t) => t.ref).join(' | ')} |`,- `|---|${tags.map(() => '---').join('|')}|`,+ `| combination | ${starts.map((s) => startLabel(s.from, s.to)).join(' | ')} |`,+ `|---|${starts.map(() => '---').join('|')}|`,];for (const env of envs) {- const cells = tags.map((tag) => {+ const cells = starts.map((start) => {if (- !tag.desktop &&+ !start.desktop &&(methodNeedsDesktop(env.install) || methodNeedsDesktop(env.update))) {return 'pre-desktop';@@ -285,7 +322,7 @@ export function renderMarkdownPlan(envs, tags) {* each cell the leg's conclusion. Input is NDJSON {name, conclusion} lines* -- what `gh api --paginate --jq '.jobs[] | {name, conclusion}'` emits --* and legs are recognized by the exact name shape buildMatrices mints- * ("os: install -> update (tag -> HEAD) / ..."), so unrelated jobs+ * ("os: install -> update (from -> HEAD|NEXT) / ..."), so unrelated jobs* (pick-releases, the report job itself) fall out naturally.** @param {{name: string, conclusion: string | null}[]} jobs@@ -309,7 +346,7 @@ export function renderMarkdownResults(jobs, tagAnnotations = [], artifactById =const knownRules = JSON.parse(fs.readFileSync(new URL('../../tests/install/e2e-assets/known-failures.json', import.meta.url), 'utf8'));/** @type {Map<string, {number: number, rule: any}>} */const footnotes = new Map();- const LEG = /^(linux|windows|macos): (\S+) -> (\S+) \(([^)]+) -> HEAD\) \//;+ const LEG = /^(linux|windows|macos): (\S+) -> (\S+) \(([^)]+) -> (HEAD|NEXT)\) \//;/** @type {Map<string, boolean>} */const desktopByTag = new Map(tagAnnotations.map((t) => [t.ref, t.desktop]));/**@@ -345,11 +382,11 @@ export function renderMarkdownResults(jobs, tagAnnotations = [], artifactById =const m = job.name.match(LEG);if (!m) continue;const combo = `${m[1]}: ${m[2]} -> ${m[3]}`;- const tag = m[4];+ const tag = startLabel(m[4], m[5]);if (!tags.includes(tag)) tags.push(tag);if (!rows.has(combo)) rows.set(combo, new Map());const cell = (() => {- const legId2 = legId(`${m[1]}: ${m[2]} -> ${m[3]} (${m[4]} -> HEAD)`);+ const legId2 = legId(`${m[1]}: ${m[2]} -> ${m[3]} (${m[4]} -> ${m[5]})`);// Logs artifacts: `install-e2e-logs-<leg_id>` (windows) or with a// trailing `-<sha>` (posix arms append it at upload). Match by prefix.const logsName = [...artifactById.keys()].find((n) => n.startsWith(`install-e2e-logs-${legId2}`));@@ -375,7 +412,7 @@ export function renderMarkdownResults(jobs, tagAnnotations = [], artifactById =return `known [^${footnotes.get(rule.id)?.number}]${reel}`;}case 'failure': return `❌${reel}`;- case 'skipped': return skipLabel(m[2], m[3], tag);+ case 'skipped': return skipLabel(m[2], m[3], m[4]);case 'cancelled': return 'cancelled';default: return 'running';}diff --git a/tests/install/README.md b/tests/install/README.mdindex 2e3fad2e810..518b62efc32 100644--- a/tests/install/README.md+++ b/tests/install/README.md@@ -34,6 +34,17 @@ script-reinstall update uses the target revision's script. A `hermes-update`leg starts the old release's updater, and app-update legs start its app flow.These paths are intentionally different.+### The HEAD -> NEXT column++Every combination also runs from HEAD itself. The driver installs HEAD, then mints NEXT: a synthetic child of HEAD that adds one marker file (`.hermes-e2e-next`). NEXT exists only in the object store, with no ref, and the bare clone carries it into `serve.git`. The driver then moves `main` to NEXT and applies the update method.++This column tests two things that no tag leg tests:++- HEAD's installer on an empty machine. Tag legs run an old installer, or run HEAD's installer over an existing install.+- HEAD's own updater. Tag legs start the old release's updater.++On Windows, the HEAD leg also takes every `git.exe` directory off PATH and installs no `remote get-url` shim. `install.ps1` uses any git that it finds on PATH, so without this step pinned-git staging never runs. The driver's own git plumbing uses the git path that it captured before the strip. The drivers take NEXT as `--update-ref NEXT` (Windows: `-UpdateRef NEXT`). The run workflows take it as the `update-ref` input.+## What one leg doesEach leg with the script drivers has these phases:@@ -208,7 +219,7 @@ contract and not exercised.`-UpdateRef`), defaulting to HEAD. Pass the next release tag to target astable→stable upgrade through the same serve.git staging; only label a legstable-to-stable when BOTH the install ref and the target ref are release- tags. The workflow matrix itself is unchanged.+ tags. `NEXT` is reserved for the HEAD -> NEXT column (see above).## Manual update rehearsalsdiff --git a/tests/install/e2e-assets/installer-common.sh b/tests/install/e2e-assets/installer-common.shindex 312e3a7593b..b6de00dcbf5 100644--- a/tests/install/e2e-assets/installer-common.sh+++ b/tests/install/e2e-assets/installer-common.sh@@ -45,6 +45,28 @@ EOFok "git transport redirected via $cfg; origin reported by $shim/git"}+# Print the commit an update ref names. NEXT is not a git ref: it mints a+# synthetic child of the install commit, so a leg that starts AT HEAD still+# has an update to take -- the one HEAD's own updater must handle. The child+# adds one marker file (a real tree diff, not an empty fast-forward) and+# lives only in the object store: no ref, no worktree change. A local+# `git clone --bare` copies objects/ wholesale, which is how it reaches+# serve.git; the drivers assert it arrived.+resolve_update_ref() {+ local repo="$1" parent="$2" ref="$3" blob tree+ if [ "$ref" != NEXT ]; then+ git -C "$repo" rev-parse "${ref}^{commit}"+ return+ fi+ blob="$(printf 'synthetic next commit for the HEAD -> NEXT install E2E leg\n' \+ | git -C "$repo" hash-object -w --stdin)" || return+ tree="$( { git -C "$repo" ls-tree -z "$parent"; printf '100644 blob %s\t.hermes-e2e-next\0' "$blob"; } \+ | git -C "$repo" mktree -z)" || return+ GIT_AUTHOR_NAME='Hermes E2E' GIT_AUTHOR_EMAIL='[email protected]' \+ GIT_COMMITTER_NAME='Hermes E2E' GIT_COMMITTER_EMAIL='[email protected]' \+ git -C "$repo" commit-tree "$tree" -p "$parent" -m 'e2e: synthetic next commit'+}+run_source_installer() {local repo="$1" work="$2" logs="$3" ref="$4" label="$5" desktop="${6:-}"local script="$work/install-$label.sh" text rc=0diff --git a/tests/install/e2e-assets/launch-from-spec.mjs b/tests/install/e2e-assets/launch-from-spec.mjsindex 301c2612873..fdd9b3c070b 100644--- a/tests/install/e2e-assets/launch-from-spec.mjs+++ b/tests/install/e2e-assets/launch-from-spec.mjs@@ -239,7 +239,10 @@ async function main() {/** @returns {string} */const headSha = () => {try {- return execFileSync('git', ['-C', /** @type {string} */ (repoDir), 'rev-parse', 'HEAD'], {+ // The driver's real git: a fresh-machine leg takes every git off PATH+ // so the product must provision its own, and an observer that cannot+ // spawn git would read '' forever instead of failing.+ return execFileSync(process.env.HERMES_E2E_REAL_GIT || 'git', ['-C', /** @type {string} */ (repoDir), 'rev-parse', 'HEAD'], {encoding: 'utf8',}).trim();} catch {diff --git a/tests/install/installer-script-e2e.sh b/tests/install/installer-script-e2e.shindex 4fce7fc1eb1..ac2e81e4b1b 100755--- a/tests/install/installer-script-e2e.sh+++ b/tests/install/installer-script-e2e.sh@@ -43,6 +43,9 @@# --update-ref what to update TO. Default: HEAD. Pass the next release# tag for a stable-to-stable leg; only label the leg# stable-to-stable when BOTH refs are release tags.+# NEXT mints a synthetic child of --install-ref (the+# HEAD -> NEXT leg: install HEAD, update with HEAD's+# own updater).## Requires a clean full-history checkout with release tags fetched.@@ -141,25 +144,24 @@ if [ -z "$INSTALL_REF" ]; then[ -n "$INSTALL_REF" ] || fail "no release tags in the checkout to use as OLD"fiOLD_SHA="$(git -C "$REPO_ROOT" rev-parse "${INSTALL_REF}^{commit}")"-HEAD_SHA="$(git -C "$REPO_ROOT" rev-parse HEAD)"# The update target defaults to HEAD; --update-ref selects any other ref so# a stable-to-stable leg can target the next release tag instead of the tip.# Only call this leg stable-to-stable when BOTH refs are release tags.-TARGET_LABEL="HEAD"-TARGET_SHA="$HEAD_SHA"-if [ -n "$UPDATE_REF" ]; then- TARGET_SHA="$(git -C "$REPO_ROOT" rev-parse "${UPDATE_REF}^{commit}")"- TARGET_LABEL="$UPDATE_REF"-fi+# NEXT (the HEAD -> NEXT leg) is minted before the clone so it rides along.+TARGET_LABEL="${UPDATE_REF:-HEAD}"+TARGET_SHA="$(resolve_update_ref "$REPO_ROOT" "$OLD_SHA" "$TARGET_LABEL")" \+ || fail "cannot resolve update ref '$TARGET_LABEL'"[ "$OLD_SHA" != "$TARGET_SHA" ] || fail "OLD ($INSTALL_REF) IS the update target ($TARGET_LABEL); no update would be available"git clone --bare --quiet "$REPO_ROOT" "$SERVE_REPO"+git -C "$SERVE_REPO" cat-file -e "$TARGET_SHA^{commit}" \+ || fail "update target $TARGET_SHA ($TARGET_LABEL) did not reach serve.git"git -C "$SERVE_REPO" update-ref refs/heads/main "$OLD_SHA"git -C "$SERVE_REPO" symbolic-ref HEAD refs/heads/main# The installer may pin a commit that is reachable but not at a ref tip.git -C "$SERVE_REPO" config uploadpack.allowAnySHA1InWant true-ok "serve.git main = $OLD_SHA ($INSTALL_REF), update target $HEAD_SHA"+ok "serve.git main = $OLD_SHA ($INSTALL_REF), update target $TARGET_SHA ($TARGET_LABEL)"diff --git a/tests/install/macos-desktop-e2e.sh b/tests/install/macos-desktop-e2e.shindex 8ff5e82deb5..dda21c5f9fc 100755--- a/tests/install/macos-desktop-e2e.sh+++ b/tests/install/macos-desktop-e2e.sh@@ -32,7 +32,8 @@# [--install-ref REF] [--dmg-url URL]# [--update-ref REF] update target, default HEAD; pass the next# release tag for a stable-to-stable leg (label the-# leg stable-to-stable only when both refs are tags)+# leg stable-to-stable only when both refs are tags);+# NEXT mints a synthetic child of --install-ref## Requires a clean full-history checkout with release tags fetched, on a# macOS host with a window server (the GitHub macos runners qualify).@@ -142,15 +143,15 @@ phase_stage() {# The update target defaults to HEAD; --update-ref selects any other ref# so a stable-to-stable leg can target the next release tag instead of# the tip. Only call this leg stable-to-stable when BOTH refs are tags.- target_label="HEAD"- target_sha="$head_sha"- if [ -n "${UPDATE_REF:-}" ]; then- target_sha="$(git -C "$REPO_ROOT" rev-parse "${UPDATE_REF}^{commit}")"- target_label="$UPDATE_REF"- fi+ # NEXT (the HEAD -> NEXT leg) is minted before the clone so it rides along.+ target_label="${UPDATE_REF:-HEAD}"+ target_sha="$(resolve_update_ref "$REPO_ROOT" "$old_sha" "$target_label")" \+ || fail "cannot resolve update ref '$target_label'"[ "$old_sha" != "$target_sha" ] || fail "OLD ($old_ref) IS the update target ($target_label); no update would be available"git clone --bare --quiet "$REPO_ROOT" "$SERVE_REPO"+ git -C "$SERVE_REPO" cat-file -e "$target_sha^{commit}" \+ || fail "update target $target_sha ($target_label) did not reach serve.git"git -C "$SERVE_REPO" update-ref refs/heads/main "$old_sha"git -C "$SERVE_REPO" symbolic-ref HEAD refs/heads/maingit -C "$SERVE_REPO" config uploadpack.allowAnySHA1InWant truediff --git a/tests/install/windows-e2e.ps1 b/tests/install/windows-e2e.ps1index a9ed4d9c225..a63b502c177 100644--- a/tests/install/windows-e2e.ps1+++ b/tests/install/windows-e2e.ps1@@ -100,7 +100,8 @@ param([string]$InstallRef = "auto",# Update target ref (default HEAD). A stable-to-stable leg passes the# next release tag here; only label the leg stable-to-stable when BOTH- # refs are release tags.+ # refs are release tags. NEXT mints a synthetic child of -InstallRef+ # (the HEAD -> NEXT leg: install HEAD, update with HEAD's own updater).[string]$UpdateRef = "HEAD",# Repo checkout whose HEAD is the update target.@@ -248,12 +249,29 @@ function Set-GitRedirect {# if we didn't do this, we'd need the .skip_upstream_prompt file to prevent a hang in headless,"add the# official repo as upstream?" prompt would hang a headless run. But we don't anymore :D- $realGit = (Get-Command git.exe -ErrorAction Stop).Source+ # The dispatch-time capture, not PATH: a fresh-machine leg has already+ # stripped git from PATH by the time stage re-arms the redirect.+ $realGit = $script:RealGitExe# Export the real git so later checks can observe the TRANSPORT url. Once# the shim below is on PATH, `git` reports the official origin for# `remote get-url origin` (so fork detection sees it); any check that must# see the file:// redirect instead has to bypass the shim via this path.$env:HERMES_E2E_REAL_GIT = $realGit++ if ($script:FreshMachine) {+ # A fresh Windows box has no git. install.ps1's Get-PinnedGit returns+ # ANY git on PATH (the dev shortcut), so the runner's git -- or the+ # shim below -- would skip pinned-git staging entirely. Take every+ # git.exe directory off PATH and install no shim: the product must+ # provision its own. The shim's one job (fork detection seeing the+ # official origin) is covered by .skip_upstream_prompt, same as+ # routes whose detached updater bypasses the shim.+ $kept = @($env:PATH -split ';' | Where-Object { $_ -and -not (Test-Path -LiteralPath (Join-Path $_ 'git.exe')) })+ $env:PATH = $kept -join ';'+ Assert-True (-not (Get-Command git -ErrorAction SilentlyContinue)) "fresh machine: no git resolvable on PATH"+ Write-Host " fresh machine: git removed from PATH, no remote get-url shim"+ return+ }$shimDir = Join-Path $WorkRoot "shim"New-Item -ItemType Directory -Path $shimDir -Force | Out-Null$shimPath = Join-Path $shimDir "git.bat"@@ -640,6 +658,34 @@ function Stop-HermesAppProcesses([string]$Label) {# ----------------------------------------------------------------------------# Phase: stage -- serve.git with `main` at OLD (advanced to HEAD by update-gui)# ----------------------------------------------------------------------------+# Mirror of resolve_update_ref's NEXT arm in e2e-assets/installer-common.sh:+# a synthetic child of $Parent whose tree adds one marker file (a real diff,+# not an empty fast-forward), written to the object store only -- no ref, no+# worktree change. A local `clone --bare` copies objects/ wholesale, which is+# how it reaches serve.git. A throwaway index stands in for mktree so no+# NUL-delimited stdin has to cross PowerShell's native pipe.+function New-NextCommit([string]$Repo, [string]$Parent) {+ $marker = Join-Path $WorkRoot "next-marker.txt"+ Set-Content -LiteralPath $marker -Encoding ASCII -Value "synthetic next commit for the HEAD -> NEXT install E2E leg"+ $blob = Invoke-Git @("-C", $Repo, "hash-object", "-w", "--no-filters", $marker)+ $saved = @{}+ $vars = @{+ GIT_INDEX_FILE = (Join-Path $WorkRoot "next.index")+ GIT_AUTHOR_NAME = "Hermes E2E"; GIT_AUTHOR_EMAIL = "[email protected]"+ GIT_COMMITTER_NAME = "Hermes E2E"; GIT_COMMITTER_EMAIL = "[email protected]"+ }+ foreach ($k in $vars.Keys) { $saved[$k] = [Environment]::GetEnvironmentVariable($k); [Environment]::SetEnvironmentVariable($k, $vars[$k]) }+ try {+ Invoke-Git @("-C", $Repo, "read-tree", $Parent) | Out-Null+ Invoke-Git @("-C", $Repo, "update-index", "--add", "--cacheinfo", "100644,$blob,.hermes-e2e-next") | Out-Null+ $tree = Invoke-Git @("-C", $Repo, "write-tree")+ return Invoke-Git @("-C", $Repo, "commit-tree", $tree, "-p", $Parent, "-m", "e2e: synthetic next commit")+ } finally {+ foreach ($k in $vars.Keys) { [Environment]::SetEnvironmentVariable($k, $saved[$k]) }+ Remove-Item -LiteralPath $vars.GIT_INDEX_FILE -Force -ErrorAction SilentlyContinue+ }+}+function Invoke-PhaseStage {Write-Step "STAGE: bare serve repo, main -> OLD (install base)"@@ -652,10 +698,6 @@ function Invoke-PhaseStage {# bare-clone below (and everything after) sees the redirect file.Set-GitRedirect- $current = Invoke-Git @("-C", $RepoRoot, "rev-parse", "${UpdateRef}^{commit}")- $targetLabel = if ($UpdateRef -eq "HEAD") { "HEAD" } else { $UpdateRef }- Write-Host " HEAD (update target): $current"-# OLD: explicit -InstallRef, or the newest release tag -- the version a# user who installed on release day is on.$oldRef = $InstallRef@@ -668,7 +710,13 @@ function Invoke-PhaseStage {}$old = Invoke-Git @("-C", $RepoRoot, "rev-parse", "$oldRef^{commit}")Write-Host " OLD ($oldRef): $old"- Assert-True ($old -ne $current) "OLD differs from HEAD (an update is genuinely available)"+ # NEXT is minted before the clone so it rides along into serve.git.+ $targetLabel = $UpdateRef+ $current = if ($UpdateRef -eq "NEXT") { New-NextCommit $RepoRoot $old } else {+ Invoke-Git @("-C", $RepoRoot, "rev-parse", "${UpdateRef}^{commit}")+ }+ Write-Host " update target ($targetLabel): $current"+ Assert-True ($old -ne $current) "OLD differs from $targetLabel (an update is genuinely available)"# Bare-clone the checkout: this is the repo the installer and updater# actually talk to. Local-path clone hardlinks objects, so it's fast@@ -677,6 +725,7 @@ function Invoke-PhaseStage {# serves, so staging OLD means parking `main` there; the update phase# advances it to HEAD.Invoke-Git @("clone", "--bare", "--quiet", $RepoRoot, $ServeRepo) | Out-Null+ Invoke-Git @("-C", $ServeRepo, "cat-file", "-e", "$current^{commit}") | Out-NullInvoke-Git @("-C", $ServeRepo, "update-ref", "refs/heads/main", $old) | Out-NullInvoke-Git @("-C", $ServeRepo, "symbolic-ref", "HEAD", "refs/heads/main") | Out-Null@@ -1351,12 +1400,12 @@ function Invoke-PhaseUpdate {if (Test-Path -LiteralPath $bootLog) {Move-Item -LiteralPath $bootLog -Destination "$bootLog.install-phase" -Force}- Invoke-PhaseInstallGui -Mode "update" -ExpectedSha $state.current -ExpectedLabel "HEAD"+ Invoke-PhaseInstallGui -Mode "update" -ExpectedSha $state.current -ExpectedLabel $state.target_labelAssert-DesktopArtifact "HEAD"}}- Assert-True ((Get-InstalledHead) -eq $state.current) "checkout landed on HEAD"+ Assert-True ((Get-InstalledHead) -eq $state.current) "checkout landed on $($state.target_label)"Test-HermesRuns "post-update"Assert-UserShimsInvoke-PreserveVerify@@ -1420,6 +1469,9 @@ Write-Host " repo: $RepoRoot"Write-Host " workroot: $WorkRoot"$script:RealGitExe = (Get-Command git.exe -ErrorAction Stop).Source+# The HEAD start is the fresh-machine leg: HEAD's installer on a box with+# nothing on it, git included (see Set-GitRedirect).+$script:FreshMachine = ($InstallRef -eq "HEAD")Set-GitRedirect