fix: make hwlab v02 cd latest-only

This commit is contained in:
Codex
2026-06-04 14:44:02 +00:00
parent e19c77fd86
commit 08da0805bb
4 changed files with 103 additions and 121 deletions
+26 -3
View File
@@ -1,4 +1,4 @@
import { gitMirrorFlushJobManifest, gitMirrorStatusSummary, gitMirrorSyncJobManifest, gitMirrorV02SyncRequirement, hwlabG14Help, hwlabG14MonitorStateFileName, parseGitMirrorStatusRefs, parsePipelineTaskRunMetrics, rolloutRecordBody, semanticChangelogBullets, v02CommitAlignment, v02ControlPlaneRenderScript, v02FalseGreenGuard, v02PipelineServiceIds, v02PrAutomationCommentBody, v02TaskRunPerformanceSummary } from "./src/hwlab-g14";
import { gitMirrorFlushJobManifest, gitMirrorStatusSummary, gitMirrorSyncJobManifest, gitMirrorV02SyncRequirement, hwlabG14Help, hwlabG14MonitorStateFileName, parseGitMirrorStatusRefs, parsePipelineTaskRunMetrics, rolloutRecordBody, semanticChangelogBullets, v02CommitAlignment, v02ControlPlaneRenderScript, v02FalseGreenGuard, v02LatestOnlyTargetValidation, v02PipelineServiceIds, v02PrAutomationCommentBody, v02TaskRunPerformanceSummary } from "./src/hwlab-g14";
function assertCondition(condition: unknown, message: string, detail: unknown = {}): void {
if (!condition) throw new Error(`${message}: ${JSON.stringify(detail)}`);
@@ -40,8 +40,9 @@ assertCondition(
);
assertCondition(
hwlabHelpUsage.some((line) => line.includes("monitor-prs --lane v02"))
&& JSON.stringify(hwlabG14Help()).includes("v02-pr-comment-signatures.json"),
"v0.2 PR monitor help must expose the auto CI/CD lane and dedupe comment state",
&& JSON.stringify(hwlabG14Help()).includes("v02-pr-comment-signatures.json")
&& JSON.stringify(hwlabG14Help()).includes("latest-only"),
"v0.2 PR monitor help must expose the auto CI/CD lane, latest-only CD, and dedupe comment state",
hwlabG14Help(),
);
@@ -182,6 +183,28 @@ assertCondition(
staleSuccessAlignment,
);
const latestOnlySuperseded = v02LatestOnlyTargetValidation({
targetMode: "source-commit",
sourceCommit: "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
pipelineRun: { exists: true, status: "True", pipelineRun: "hwlab-v02-ci-poll-aaaaaaaaaaaa" },
commitAlignment: { staleReasons: ["origin-head-mismatch"], originHead: "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb" },
targetValidation: {
ok: false,
state: "failed",
failures: [{ reason: "runtime-service-source-mismatch", serviceId: "hwlab-cloud-api" }],
},
});
assertCondition(
latestOnlySuperseded.ok === true
&& latestOnlySuperseded.state === "superseded"
&& latestOnlySuperseded.latestOnlySuperseded === true
&& Array.isArray(latestOnlySuperseded.failures)
&& latestOnlySuperseded.failures.length === 0
&& JSON.stringify(latestOnlySuperseded.supersededFailures).includes("runtime-service-source-mismatch"),
"v0.2 latest-only target validation must close a succeeded stale source commit as superseded instead of failing runtime mismatch",
latestOnlySuperseded,
);
const falseGreenPassed = v02FalseGreenGuard({
sourceCommit: "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
pipelineRun: { exists: true, status: "True" },