fix: recheck hwlab v02 head before reuse

This commit is contained in:
Codex
2026-06-04 16:44:58 +00:00
parent 570a2412f3
commit 7367488e28
2 changed files with 124 additions and 17 deletions
+27 -1
View File
@@ -1,4 +1,4 @@
import { gitMirrorFlushJobManifest, gitMirrorStatusSummary, gitMirrorSyncJobManifest, gitMirrorV02SyncRequirement, hwlabG14Help, hwlabG14MonitorStateFileName, parseGitMirrorStatusRefs, parsePipelineTaskRunMetrics, rolloutRecordBody, semanticChangelogBullets, v02CommitAlignment, v02ControlPlaneRefreshScriptHash, v02ControlPlaneRenderScript, v02FalseGreenGuard, v02LatestOnlyTargetValidation, v02PipelineServiceIds, v02PrAutomationCommentBody, v02ReusableGitMirrorPreSyncMarker, v02ReusableRefreshMarker, v02TaskRunPerformanceSummary } from "./src/hwlab-g14";
import { gitMirrorFlushJobManifest, gitMirrorStatusSummary, gitMirrorSyncJobManifest, gitMirrorV02SyncRequirement, hwlabG14Help, hwlabG14MonitorStateFileName, parseGitMirrorStatusRefs, parsePipelineTaskRunMetrics, rolloutRecordBody, semanticChangelogBullets, v02CommitAlignment, v02ControlPlaneRefreshScriptHash, v02ControlPlaneRenderScript, v02ExistingPipelineRunReuseDecision, v02FalseGreenGuard, v02LatestOnlyTargetValidation, v02PipelineServiceIds, v02PrAutomationCommentBody, v02ReusableGitMirrorPreSyncMarker, v02ReusableRefreshMarker, v02TaskRunPerformanceSummary } from "./src/hwlab-g14";
function assertCondition(condition: unknown, message: string, detail: unknown = {}): void {
if (!condition) throw new Error(`${message}: ${JSON.stringify(detail)}`);
@@ -208,6 +208,31 @@ assertCondition(
"v0.2 control-plane render must not use the fixed workspace checkout or its clean status",
renderScript,
);
const existingPipelineRunReuse = v02ExistingPipelineRunReuseDecision({
sourceCommit: "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
before: { exists: true, status: "True" },
latestSourceCommit: "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
});
const existingPipelineRunFailed = v02ExistingPipelineRunReuseDecision({
sourceCommit: "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
before: { exists: true, status: "False" },
latestSourceCommit: "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
});
const existingPipelineRunHeadAdvanced = v02ExistingPipelineRunReuseDecision({
sourceCommit: "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
before: { exists: true, status: "True" },
latestSourceCommit: "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb",
});
assertCondition(
existingPipelineRunReuse.reusable === true
&& existingPipelineRunReuse.alreadyUsable === true
&& existingPipelineRunFailed.reusable === true
&& existingPipelineRunFailed.alreadyUsable === false
&& existingPipelineRunHeadAdvanced.reusable === false
&& existingPipelineRunHeadAdvanced.reason === "source-head-advanced-before-existing-pipelinerun-reuse",
"trigger-current must recheck latest v0.2 head before reusing an existing PipelineRun",
{ existingPipelineRunReuse, existingPipelineRunFailed, existingPipelineRunHeadAdvanced },
);
assertCondition(
!v02PipelineServiceIds().includes("hwlab-cli"),
"v0.2 PipelineRun service matrix must not build hwlab-cli because cli is short-connection source tool",
@@ -487,6 +512,7 @@ console.log(JSON.stringify({
"v0.2 control-plane status help exposes targeted PipelineRun/source-commit inspection",
"v0.2 control-plane render uses an isolated temp clone from a CI/CD dedicated bare repo",
"v0.2 control-plane refresh marker only reuses recent same-contract refreshes",
"trigger-current rechecks latest v0.2 head before reusing an existing PipelineRun",
"v0.2 status alignment reports stale-success without coupling CI to dirty workspace state",
"v0.2 PipelineRun service matrix excludes hwlab-cli",
"v0.2 false-green guard checks build TaskRuns, runtime artifact source commits, and reuse provenance",