From a95681ea3a74ad668539d88d5f2081ebb3d6b5dd Mon Sep 17 00:00:00 2001 From: john Date: Mon, 27 Jul 2026 22:36:40 +0800 Subject: [PATCH] fix: treat pending Gitea CI as acceptable on synced main Normal Portal releases should not block when commit status stays pending after the candidate is already pushed to origin/main. Co-authored-by: Cursor --- docs/release-gate-automation.md | 3 ++- release-gate/ci-status.mjs | 12 +++++++++--- release-gate/ci-status.test.mjs | 8 ++++++-- 3 files changed, 17 insertions(+), 6 deletions(-) diff --git a/docs/release-gate-automation.md b/docs/release-gate-automation.md index a6b0a91..de7ae66 100644 --- a/docs/release-gate-automation.md +++ b/docs/release-gate-automation.md @@ -54,7 +54,8 @@ Gate 只为自动选中的场景生成结果,所有选中项都必须执行并 在隔离本地 Portal、390×844 移动视口和公开页 fixture 上运行;COMP-09 由独立执行器 要求 active 脱敏回归 manifest 并逐条回放。没有 manifest 时 COMP-09 明确 `failed`, 不会因“没有用例”而通过。`REL-02` 在候选不落后 `origin/main` 且 Gitea commit status 为 -`success` 时通过;若仓库未接入 commit status,候选 SHA 已等于 `origin/main` 时也视为通过。 +`success` 时通过;若仓库未接入 commit status 或状态仍为 pending,候选 SHA 已等于 +`origin/main` 时也视为通过。 仍可用 `MEMIND_RELEASE_CI_STATUS=success` 显式注入。`REL-01` 会忽略 `.release-gate/` 与 `.runtime/` 下的本地构建产物,避免 Gate 前构建 runtime 误报工作区脏。 diff --git a/release-gate/ci-status.mjs b/release-gate/ci-status.mjs index d5674a8..61deb84 100644 --- a/release-gate/ci-status.mjs +++ b/release-gate/ci-status.mjs @@ -60,8 +60,14 @@ export function isReleaseCiAcceptable(ciStatus, { headSha, remoteSha } = {}) { const normalized = String(ciStatus ?? 'missing').trim().toLowerCase(); if (normalized === 'success') return true; if (normalized === 'failure' || normalized === 'error') return false; - // Self-hosted releases often have no Gitea commit status integration. Once the - // candidate is fully pushed to origin/main, treat missing CI as acceptable. - if (normalized === 'missing' && remoteSha && headSha === remoteSha) return true; + // Self-hosted releases often have no meaningful Gitea commit status. Once the + // candidate is fully pushed to origin/main, treat missing/pending CI as acceptable. + if ( + (normalized === 'missing' || normalized === 'pending') + && remoteSha + && headSha === remoteSha + ) { + return true; + } return false; } diff --git a/release-gate/ci-status.test.mjs b/release-gate/ci-status.test.mjs index 1202038..7ed79ee 100644 --- a/release-gate/ci-status.test.mjs +++ b/release-gate/ci-status.test.mjs @@ -20,18 +20,22 @@ test('release CI accepts explicit success and rejects explicit failure', () => { ); }); -test('release CI accepts missing status when candidate equals origin/main', () => { +test('release CI accepts missing or pending status when candidate equals origin/main', () => { const sha = 'c7718c683b216f08865e04edc67f4217f6abc3c1'; assert.equal( isReleaseCiAcceptable('missing', { headSha: sha, remoteSha: sha }), true, ); + assert.equal( + isReleaseCiAcceptable('pending', { headSha: sha, remoteSha: sha }), + true, + ); assert.equal( isReleaseCiAcceptable('missing', { headSha: sha, remoteSha: 'other' }), false, ); assert.equal( - isReleaseCiAcceptable('pending', { headSha: sha, remoteSha: sha }), + isReleaseCiAcceptable('pending', { headSha: sha, remoteSha: 'other' }), false, ); });