fix: keep branch follower reuse status compact
This commit is contained in:
@@ -166,16 +166,18 @@ function compactReuseConfig(reuseConfig) {
|
||||
stageRef: stringOrNull(value.stageRef),
|
||||
sha256: stringOrNull(value.sha256),
|
||||
serviceCount: numberOrNull(value.serviceCount),
|
||||
services: arrayRecords(value.services).slice(0, 8).map((service) => ({
|
||||
id: stringOrNull(service.id),
|
||||
runtimeReuse: recordOrNull(service.runtimeReuse),
|
||||
envReuse: recordOrNull(service.envReuse),
|
||||
})),
|
||||
serviceIds: compactReuseServiceIds(value),
|
||||
errors: arrayStrings(value.errors).slice(0, 5),
|
||||
valuesRedacted: true,
|
||||
};
|
||||
}
|
||||
|
||||
function compactReuseServiceIds(value) {
|
||||
const explicit = arrayStrings(value.serviceIds);
|
||||
if (explicit.length > 0) return explicit.slice(0, 16);
|
||||
return arrayRecords(value.services).map((service) => stringOrNull(service.id)).filter(Boolean).slice(0, 16);
|
||||
}
|
||||
|
||||
function compactGitMirror(gitMirror) {
|
||||
const value = recordOrNull(gitMirror);
|
||||
if (value === null) return null;
|
||||
|
||||
@@ -2140,16 +2140,20 @@ function summarizeRuntimeReuseConfigFromRecord(value: Record<string, unknown> |
|
||||
stageRef: stringOrNull(value.stageRef),
|
||||
sha256: stringOrNull(value.sha256),
|
||||
serviceCount: numberOrNull(value.serviceCount),
|
||||
services: arrayRecords(value.services).slice(0, 8).map((service) => ({
|
||||
id: stringOrNull(service.id),
|
||||
runtimeReuse: asOptionalRecord(service.runtimeReuse),
|
||||
envReuse: asOptionalRecord(service.envReuse),
|
||||
})),
|
||||
serviceIds: compactReuseServiceIds(value),
|
||||
errors: Array.isArray(value.errors) ? value.errors.map(String).slice(0, 5) : [],
|
||||
valuesRedacted: true,
|
||||
};
|
||||
}
|
||||
|
||||
function compactReuseServiceIds(value: Record<string, unknown>): string[] {
|
||||
if (Array.isArray(value.serviceIds)) return value.serviceIds.map(String).slice(0, 16);
|
||||
return arrayRecords(value.services).flatMap((service) => {
|
||||
const id = stringOrNull(service.id);
|
||||
return id === null ? [] : [id];
|
||||
}).slice(0, 16);
|
||||
}
|
||||
|
||||
function compactSourceSyncPayload(value: Record<string, unknown> | null): Record<string, unknown> | null {
|
||||
if (value === null) return null;
|
||||
return {
|
||||
|
||||
@@ -393,6 +393,7 @@ function compactStatusGates(payload: Record<string, unknown> | null): Record<str
|
||||
stageRef: stringOrNull(reuseConfig.stageRef),
|
||||
sha256: stringOrNull(reuseConfig.sha256),
|
||||
serviceCount: numberOrNull(reuseConfig.serviceCount),
|
||||
serviceIds: arrayStrings(reuseConfig.serviceIds).slice(0, 16),
|
||||
errors: Array.isArray(reuseConfig.errors) ? reuseConfig.errors.map(String).slice(0, 5) : [],
|
||||
},
|
||||
tekton: tekton === null ? null : {
|
||||
@@ -439,6 +440,10 @@ function arrayRecords(value: unknown): Record<string, unknown>[] {
|
||||
return Array.isArray(value) ? value.filter((item): item is Record<string, unknown> => typeof item === "object" && item !== null && !Array.isArray(item)) : [];
|
||||
}
|
||||
|
||||
function arrayStrings(value: unknown): string[] {
|
||||
return Array.isArray(value) ? value.map(String) : [];
|
||||
}
|
||||
|
||||
function compactFollowerDecision(state: FollowerState): Record<string, unknown> {
|
||||
return {
|
||||
phase: state.phase,
|
||||
|
||||
@@ -102,21 +102,7 @@ export function summarizeRuntimeReuseConfig(config: RuntimeReuseConfig | null):
|
||||
stageRef: config.stageRef,
|
||||
sha256: config.sha256,
|
||||
serviceCount: config.serviceCount,
|
||||
services: config.services.map((service) => ({
|
||||
id: service.id,
|
||||
runtimeReuse: service.runtimeReuse === null ? null : {
|
||||
enabled: service.runtimeReuse.enabled,
|
||||
codeIdentityPathCount: service.runtimeReuse.codeIdentityPaths.length,
|
||||
envIdentityPathCount: service.runtimeReuse.envIdentityPaths.length,
|
||||
},
|
||||
envReuse: service.envReuse === null ? null : {
|
||||
enabled: service.envReuse.enabled,
|
||||
mode: service.envReuse.mode,
|
||||
nodeDepsPath: service.envReuse.nodeDepsPath,
|
||||
envIdentityFileCount: service.envReuse.envIdentityFiles.length,
|
||||
buildArgNames: Object.keys(service.envReuse.buildArgs).sort(),
|
||||
},
|
||||
})),
|
||||
serviceIds: config.services.map((service) => service.id).sort(),
|
||||
errors: config.errors.slice(0, 5),
|
||||
valuesRedacted: true,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user