From 3c727ced5aff685fe000a613745352a27fcf42c5 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Thu, 12 Nov 2026 08:12:29 +0700 Subject: [PATCH 1/4] Reject stale alpha candidate if it omits current main before paid Windows build --- scripts/release_ci_dispatch.mjs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/scripts/release_ci_dispatch.mjs b/scripts/release_ci_dispatch.mjs index 7d3a9ccaa..ee916110f 100644 --- a/scripts/release_ci_dispatch.mjs +++ b/scripts/release_ci_dispatch.mjs @@ -37,6 +37,13 @@ export async function releaseDispatch({event,api}) { const ref=await api('/git/ref/heads/'+cmd.branch); if (ref?.ref!=='refs/heads/'+cmd.branch || ref?.object?.sha!==cmd.sha) throw Error('RELEASE_STALE_SHA_OR_BRANCH'); + // A correct release-branch SHA can still omit recent merged GUI/audio fixes. + // Fail BEFORE allocating Windows runners unless this immutable commit contains + // the complete current main history. Never treat an old release branch as RC. + const ancestry=await api('/compare/main...'+cmd.sha); + if (!ancestry || !['identical','ahead'].includes(ancestry.status) || + ancestry.behind_by!==0 || !Number.isSafeInteger(ancestry.ahead_by)) + throw Error('RELEASE_CANDIDATE_MISSING_MAIN_PROGRESS'); const older=[]; for(let page=1;page<=10;page++) { const chunk=await api('/issues/'+CONTROL_ISSUE+'/comments?per_page=100&page='+page); From d60f15a4ad123a51731b41507be6cff4f254afa8 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Thu, 12 Nov 2026 08:12:50 +0700 Subject: [PATCH 2/4] Test stale and diverged release source refusal before costly CI --- tests/release_ci_dispatch_contract.test.mjs | 22 ++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/tests/release_ci_dispatch_contract.test.mjs b/tests/release_ci_dispatch_contract.test.mjs index eb0ee3515..f21189b55 100644 --- a/tests/release_ci_dispatch_contract.test.mjs +++ b/tests/release_ci_dispatch_contract.test.mjs @@ -8,12 +8,13 @@ const ev=(body='/arsonmix-release '+TAG+' '+SHA)=>({ repository:{full_name:'masarray/arsonmix'},issue:{number:450}, comment:{id:100,body,author_association:'OWNER',user:{login:'masarray'}} }); -function fakeApi({refSha=SHA,comments=[],runs=[],released=false,notesReady=true,notesSize=200,nativeVersion='0.5.0'}={}) { +function fakeApi({refSha=SHA,comments=[],runs=[],released=false,notesReady=true,notesSize=200,nativeVersion='0.5.0',compareStatus='ahead',compareBehind=0,compareAhead=1}={}) { const calls=[]; const api=async(path,method='GET',data)=>{ calls.push({path,method,data}); if(path==='/git/ref/heads/'+BRANCH) return {ref:'refs/heads/'+BRANCH,object:{sha:refSha}}; + if(path==='/compare/main...'+SHA) return {status:compareStatus,behind_by:compareBehind,ahead_by:compareAhead}; if(path.startsWith('/issues/450/comments'))return comments; if(path==='/releases/tags/'+TAG){ if(released)return {tag_name:TAG}; @@ -105,6 +106,25 @@ test('Stale SHA rejects without costly workflow dispatch',async()=>{ await assert.rejects(releaseDispatch({event:ev(),api:x.api}),/RELEASE_STALE_SHA/); assert.equal(x.calls.filter(c=>c.method==='POST').length,0); }); +test('Release must include all of current main, not just match a valid release-branch SHA',async()=>{ + // The old public alpha had a valid tag/SHA but omitted newly merged GUI/audio. + for(const stale of [ + {compareStatus:'behind',compareBehind:63,compareAhead:0}, + {compareStatus:'diverged',compareBehind:2,compareAhead:1}, + {compareStatus:'ahead',compareBehind:1,compareAhead:1}, + {compareStatus:'unknown',compareBehind:0,compareAhead:0} + ]) { + const x=fakeApi(stale); + await assert.rejects(releaseDispatch({event:ev(),api:x.api}), + /RELEASE_CANDIDATE_MISSING_MAIN_PROGRESS/); + assert.equal(x.calls.some(t=>t.method==='POST'),false, + 'stale candidate must not allocate the Windows builder'); + } + const current=fakeApi({compareStatus:'identical',compareBehind:0,compareAhead:0}); + assert.equal((await releaseDispatch({event:ev(),api:current.api})).kind,'dispatched'); + assert.equal(current.calls.filter(t=>t.method==='POST').length,1); +}); + test('Duplicate owner comment and already-published tag are no-op',async()=>{ const comments=[{id:88,body:ev().comment.body,user:{login:'masarray'},author_association:'OWNER'}]; for(const input of [{comments},{released:true}]){ From df9de82e438cd8d9c9fe681f71ae4e40a4661b42 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Thu, 12 Nov 2026 08:13:25 +0700 Subject: [PATCH 3/4] Recheck latest main at final Windows public release promotion --- .github/workflows/alpha-preview-publish.yml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/.github/workflows/alpha-preview-publish.yml b/.github/workflows/alpha-preview-publish.yml index cb4218f19..784c48dbf 100644 --- a/.github/workflows/alpha-preview-publish.yml +++ b/.github/workflows/alpha-preview-publish.yml @@ -219,6 +219,21 @@ jobs: if ($LASTEXITCODE -ne 0 -or -not $remote -or ($remote -split '\s+')[0] -ne $env:GITHUB_SHA) { throw "Release branch advanced during qualification; stale promotion rejected" } + # A release that was current at dispatch can become stale while the + # Windows compiler runs. Never publish without the latest merged main. + $mainRemote = & git ls-remote origin 'refs/heads/main' + if ($LASTEXITCODE -ne 0 -or -not $mainRemote) { + throw "Cannot verify current main before public promotion" + } + $mainSha = ($mainRemote -split '\s+')[0] + & git fetch --no-tags origin $mainSha + if ($LASTEXITCODE -ne 0) { + throw "Cannot fetch current main for release ancestry gate" + } + & git merge-base --is-ancestor $mainSha $env:GITHUB_SHA + if ($LASTEXITCODE -ne 0) { + throw "RELEASE_MISSING_LATEST_MAIN_PROGRESS: reconcile and requalify a new SHA" + } & gh release create $tag @assets --repo $env:GITHUB_REPOSITORY --target $env:GITHUB_SHA --title "ArSonMix $tag — Alpha Preview" --notes-file $env:ARMIX_RELEASE_NOTES --prerelease --latest=false if ($LASTEXITCODE -ne 0) { throw "GitHub Release publication failed" } & gh release view $tag --repo $env:GITHUB_REPOSITORY --json url,isPrerelease,assets From 28823c4347cc91df5116b02561f85daff161f639 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Thu, 12 Nov 2026 08:13:57 +0700 Subject: [PATCH 4/4] Contract-test release source ancestry checks at dispatch and final promotion --- tests/release_ci_dispatch_contract.test.mjs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/tests/release_ci_dispatch_contract.test.mjs b/tests/release_ci_dispatch_contract.test.mjs index f21189b55..854e9623c 100644 --- a/tests/release_ci_dispatch_contract.test.mjs +++ b/tests/release_ci_dispatch_contract.test.mjs @@ -296,6 +296,18 @@ test('Public port workflow includes no commercial signing or push-triggered buil assert.match(workflow,/SHA256SUMS-Linux.txt/); }); +test('Windows release publisher checks latest main again at promotion, not just at start',()=>{ + const workflow=readFileSync(new URL('../.github/workflows/alpha-preview-publish.yml',import.meta.url),'utf8'); + const publish=workflow.split(' - name: Publish verified GitHub prerelease and its Windows binaries')[1] + ?.split(' - name: Refresh official landing catalog')[0]||''; + assert.match(publish,/git ls-remote origin 'refs\/heads\/main'/); + assert.match(publish,/git fetch --no-tags origin \$mainSha/); + assert.match(publish,/git merge-base --is-ancestor \$mainSha \$env:GITHUB_SHA/); + assert.match(publish,/RELEASE_MISSING_LATEST_MAIN_PROGRESS/); + assert.ok(publish.indexOf('git merge-base --is-ancestor') < publish.indexOf('gh release create'), + 'main ancestry must fail closed before the public release API call'); +}); + test('Windows public release ZIP is a verifiable wrapper of the same exact Inno EXE',()=>{ const publish=readFileSync(new URL('../.github/workflows/alpha-preview-publish.yml',import.meta.url),'utf8'); assert.match(publish,/Windows-x64-Setup\.zip/);