fix: scope branch follower state summaries

This commit is contained in:
Codex
2026-07-03 18:53:00 +00:00
parent 4df3d5d8bd
commit 9b158e2595
2 changed files with 7 additions and 3 deletions
+5 -3
View File
@@ -1881,6 +1881,8 @@ function readK8sState(registry: BranchFollowerRegistry, options: ParsedOptions):
}
function kubeConfigMapFollowerState(registry: BranchFollowerRegistry, options: ParsedOptions): K8sFollowerStateRead {
const followers = options.followerId === null ? registry.followers : registry.followers.filter((follower) => follower.id === options.followerId);
const maxTimingStages = options.followerId === null ? 8 : 16;
const script = [
"set -eu",
"tmpdir=$(mktemp -d)",
@@ -1889,8 +1891,8 @@ function kubeConfigMapFollowerState(registry: BranchFollowerRegistry, options: P
nativeCicdScriptLoadShell(["read-state-summary.mjs"]),
`NAMESPACE=${shQuote(registry.controller.namespace)}`,
`CONFIGMAP=${shQuote(registry.controller.stateConfigMapName)}`,
`FOLLOWERS_JSON=${shQuote(JSON.stringify(registry.followers.map((follower) => follower.id)))}`,
"MAX_TIMING_STAGES=24",
`FOLLOWERS_JSON=${shQuote(JSON.stringify(followers.map((follower) => follower.id)))}`,
`MAX_TIMING_STAGES=${maxTimingStages}`,
"export NAMESPACE CONFIGMAP FOLLOWERS_JSON MAX_TIMING_STAGES",
"node \"$tmpdir/read-state-summary.mjs\"",
].join("\n");
@@ -1905,7 +1907,7 @@ function kubeConfigMapFollowerState(registry: BranchFollowerRegistry, options: P
const parsedValueBytes = asOptionalRecord(parsed.valueBytes) ?? {};
const stateByFollower: Record<string, Record<string, unknown>> = {};
const valueBytes: Record<string, number> = {};
for (const follower of registry.followers) {
for (const follower of followers) {
const state = asOptionalRecord(parsedStates[follower.id]);
if (state !== null) stateByFollower[follower.id] = state;
const bytes = numberOrNull(parsedValueBytes[follower.id]);