Skip to content

Commit e10e322

Browse files
test: update #930 release-validation for resilient version fetch
The #952 release-validation suite asserted the latest path hard-fails with "Failed to fetch version information" (>=2) and that exit 1 appears >=3 times. This PR makes the latest path retry then degrade gracefully instead of aborting, so update those assertions: the latest path no longer hard-fails (the unsupported -arch and pinned-404 paths still exit 1, hence >=2). (This test never ran on this PR until it was retargeted from the merged feat/windows-powershell-installer branch to main.) Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_019M7GkS3bYZaFhEbBhVTecG
1 parent 5f9cf45 commit e10e322

1 file changed

Lines changed: 10 additions & 3 deletions

File tree

‎packages/opencode/test/release-validation/windows-installer-930-codex.test.ts‎

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,13 +51,17 @@ describe("PR #930 install.ps1 release URL construction", () => {
5151
expect(versionBlock).toContain("exit 1")
5252
})
5353

54-
test("latest-version resolution requires a nonblank GitHub release tag", () => {
54+
test("latest-version resolution retries then degrades instead of hard-failing", () => {
5555
const versionBlock = scriptBlock("# Resolve version (once)", "# Skip if the requested version")
5656
expect(versionBlock).toContain("[string]::IsNullOrWhiteSpace($Version)")
5757
expect(versionBlock).toContain('"User-Agent" = "altimate-install"')
5858
expect(versionBlock).toContain("$specificVersion = ($rel.tag_name -replace '^v', '')")
5959
expect(versionBlock).toContain("[string]::IsNullOrWhiteSpace($specificVersion)")
60-
expect(versionBlock.match(/Failed to fetch version information/g)?.length).toBeGreaterThanOrEqual(2)
60+
// A transient releases/latest API blip must not abort the install: retry a few
61+
// times, then degrade gracefully (the download resolves "latest" server-side).
62+
expect(versionBlock).toContain("for ($attempt = 1; $attempt -le 3; $attempt++)")
63+
expect(versionBlock).toContain("installing the latest release anyway")
64+
expect(versionBlock).not.toContain("Failed to fetch version information")
6165
})
6266
})
6367

@@ -102,7 +106,10 @@ describe("PR #930 install.ps1 error handling and idempotency", () => {
102106
expect(INSTALL_PS1).toContain('$ErrorActionPreference = "Stop"')
103107
expect(INSTALL_PS1.match(/\btry\s*\{/g)?.length).toBeGreaterThanOrEqual(4)
104108
expect(INSTALL_PS1.match(/\bcatch\s*\{/g)?.length).toBeGreaterThanOrEqual(4)
105-
expect(INSTALL_PS1.match(/exit 1/g)?.length).toBeGreaterThanOrEqual(3)
109+
// The unsupported-arch and pinned-version-not-found paths still hard-fail
110+
// (exit 1). The latest-version path no longer does: it degrades gracefully on
111+
// a transient API blip rather than aborting the install.
112+
expect(INSTALL_PS1.match(/exit 1/g)?.length).toBeGreaterThanOrEqual(2)
106113
})
107114

108115
test("skips reinstall when altimate or altimate-code already reports the target version", () => {

0 commit comments

Comments
 (0)