fix: skip current v03 mirror pre-sync

This commit is contained in:
Codex
2026-06-08 17:05:26 +00:00
parent d9e6f70e72
commit 710b1cf3e0
2 changed files with 42 additions and 9 deletions
+30 -8
View File
@@ -4151,14 +4151,25 @@ function runRuntimeLaneControlPlane(spec: HwlabRuntimeLaneSpec, options: G14Cont
sourceCommit,
pipelineRun,
});
const gitMirrorSync = runGitMirrorSync({
action: "sync",
lane: spec.lane,
confirm: true,
dryRun: false,
wait: true,
timeoutSeconds: options.timeoutSeconds,
});
const gitMirrorPreSyncStatus = runGitMirrorStatus();
const gitMirrorSourceAlreadyCurrent = runtimeLaneGitMirrorSourceInSync(spec, sourceCommit, gitMirrorPreSyncStatus);
const gitMirrorSync = gitMirrorSourceAlreadyCurrent
? {
ok: true,
command: "hwlab nodes git-mirror sync",
mode: "skipped-source-already-current",
skipped: true,
reason: "local-mirror-source-current",
status: gitMirrorPreSyncStatus,
}
: runGitMirrorSync({
action: "sync",
lane: spec.lane,
confirm: true,
dryRun: false,
wait: true,
timeoutSeconds: options.timeoutSeconds,
});
printRuntimeLaneTriggerProgress(spec, {
stage: "git-mirror-sync",
status: gitMirrorSync.ok === true ? "succeeded" : "failed",
@@ -5241,10 +5252,19 @@ export function gitMirrorV02SyncRequirement(sourceCommit: string, rawStatus: str
};
}
export function runtimeLaneGitMirrorSourceInSyncForTest(lane: string, sourceCommit: string, summary: Record<string, unknown>): boolean {
const localKey = lane === "v02" ? "localV02" : lane === "v03" ? "localV03" : null;
return localKey !== null && typeof summary[localKey] === "string" && summary[localKey] === sourceCommit;
}
function gitMirrorStatusCacheRaw(status: Record<string, unknown>): string {
return String(nested(status, ["cache", "raw"]) ?? "");
}
function runtimeLaneGitMirrorSourceInSync(spec: HwlabRuntimeLaneSpec, sourceCommit: string, status: Record<string, unknown>): boolean {
return runtimeLaneGitMirrorSourceInSyncForTest(spec.lane, sourceCommit, record(nested(status, ["cache", "summary"])));
}
function compactGitMirrorStatus(status: Record<string, unknown>, sourceCommit: string): Record<string, unknown> {
const requirement = gitMirrorV02SyncRequirement(sourceCommit, gitMirrorStatusCacheRaw(status));
return {
@@ -5271,6 +5291,8 @@ function compactGitMirrorSync(sync: Record<string, unknown>): Record<string, unk
ok: sync.ok === true,
command: sync.command ?? "hwlab g14 git-mirror sync",
mode: sync.mode ?? null,
skipped: sync.skipped === true,
reason: sync.reason ?? null,
namespace: sync.namespace ?? GIT_MIRROR_NAMESPACE,
jobName: sync.jobName ?? null,
elapsedMs: sync.elapsedMs ?? null,