Skip to content

Commit 1ecf6ae

Browse files
test: update #930 release-validation for the checksum URL refactor
The #952 release-validation suite asserted the exact #930 URL literals. This PR builds the archive and checksums.txt from a shared $base (so they always come from the same release), so update those assertions to the $base/$url form, and convert the now-obsolete "verification deferred" test.todo into a real assertion that Test-Checksum verifies SHA256 before extraction. (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) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019M7GkS3bYZaFhEbBhVTecG
1 parent ab14d6b commit 1ecf6ae

1 file changed

Lines changed: 13 additions & 5 deletions

File tree

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

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,12 @@ function upgradePowershellBlock() {
2424

2525
describe("PR #930 install.ps1 release URL construction", () => {
2626
test("uses only HTTPS GitHub release URLs for Windows zip assets", () => {
27-
expect(INSTALL_PS1).toContain('"https://github.com/AltimateAI/altimate-code/releases/latest/download/$filename"')
28-
expect(INSTALL_PS1).toContain('"https://github.com/AltimateAI/altimate-code/releases/download/v$specificVersion/$filename"')
27+
// The archive and checksums.txt share one $base so they always resolve to the
28+
// same release (see verify_checksum / Test-Checksum). $base is the latest
29+
// download path or the pinned release tag; $url and $checksumsUrl derive from it.
30+
expect(INSTALL_PS1).toContain('$base = "https://github.com/AltimateAI/altimate-code/releases/latest/download"')
31+
expect(INSTALL_PS1).toContain('$base = "https://github.com/AltimateAI/altimate-code/releases/download/v$specificVersion"')
32+
expect(INSTALL_PS1).toContain('$url = "$base/$filename"')
2933
expect(INSTALL_PS1).toContain('"https://api.github.com/repos/AltimateAI/altimate-code/releases/latest"')
3034
expect(INSTALL_PS1).not.toMatch(/http:\/\/(?:github\.com|api\.github\.com|www\.altimate\.sh)/)
3135
})
@@ -62,9 +66,13 @@ describe("PR #930 install.ps1 release URL construction", () => {
6266
})
6367

6468
describe("PR #930 install.ps1 download and archive safety", () => {
65-
// BUG: install.ps1 currently documents that SHA256/signature verification is deferred
66-
// and relies only on HTTPS. Release assets should be verified before extraction.
67-
test.todo("verifies downloaded archive integrity with SHA256 or a signature before extraction", () => {})
69+
test("verifies downloaded archive integrity with SHA256 before extraction", () => {
70+
// Closed by the checksum-verification work: Test-Checksum fetches checksums.txt
71+
// and compares SHA256, and the verify call precedes the actual extraction.
72+
expect(INSTALL_PS1).toContain("Test-Checksum -Path $zipPath")
73+
expect(INSTALL_PS1).toContain("Get-FileHash -Path $Path -Algorithm SHA256")
74+
expect(INSTALL_PS1.indexOf("Test-Checksum -Path")).toBeLessThan(INSTALL_PS1.indexOf("Expand-Archive -Path"))
75+
})
6876

6977
test("fails curl.exe downloads on HTTP errors and checks curl exit status", () => {
7078
const installTarget = scriptBlock("function Install-Target", "$needsBaseline")

0 commit comments

Comments
 (0)