fix: compact branch follower timing list
This commit is contained in:
@@ -1818,6 +1818,7 @@ function mergeFollowerStatus(
|
||||
const targetSha = live?.targetSha ?? stringOrNull(storedTarget?.targetSha);
|
||||
const lastTriggeredSha = live?.lastTriggeredSha ?? stringOrNull(stored.lastTriggeredSha);
|
||||
const lastSucceededSha = live?.lastSucceededSha ?? stringOrNull(stored.lastSucceededSha);
|
||||
const timings = live === null ? storedFollowerTimingsForStatus(follower, asOptionalRecord(stored.timings), phase, observedSha) : buildFollowerTimings(follower, live, undefined, asOptionalRecord(stored.timings), phase);
|
||||
const summary: Record<string, unknown> = {
|
||||
ok: live === null ? true : live.ok,
|
||||
id: follower.id,
|
||||
@@ -1843,7 +1844,7 @@ function mergeFollowerStatus(
|
||||
updatedAt: stringOrNull(stored.updatedAt),
|
||||
live: liveRequested,
|
||||
message: live?.message ?? stringOrNull(stored.decision) ?? "no controller state yet",
|
||||
timings: live === null ? storedFollowerTimingsForStatus(follower, asOptionalRecord(stored.timings), phase, observedSha) : buildFollowerTimings(follower, live, undefined, asOptionalRecord(stored.timings), phase),
|
||||
timings: detailed ? timings : compactListTimings(timings),
|
||||
drilldown: `bun scripts/cli.ts cicd branch-follower status --follower ${follower.id} --live`,
|
||||
};
|
||||
if (!detailed) return summary;
|
||||
@@ -1860,6 +1861,21 @@ function mergeFollowerStatus(
|
||||
};
|
||||
}
|
||||
|
||||
function compactListTimings(timings: FollowerState["timings"]): Record<string, unknown> {
|
||||
return {
|
||||
budgetSeconds: timings.budgetSeconds,
|
||||
totalSeconds: timings.totalSeconds,
|
||||
totalStatus: timings.totalStatus,
|
||||
sourceCommit: timings.sourceCommit,
|
||||
overBudget: timings.overBudget,
|
||||
stages: timings.stages.slice(0, 4).map((stage) => ({
|
||||
stage: stage.stage,
|
||||
status: stage.status,
|
||||
seconds: stage.seconds,
|
||||
})),
|
||||
};
|
||||
}
|
||||
|
||||
function readK8sState(registry: BranchFollowerRegistry, options: ParsedOptions): K8sStateRead {
|
||||
const errors: string[] = [];
|
||||
const stateResult = kubeConfigMapFollowerState(registry, options);
|
||||
|
||||
Reference in New Issue
Block a user