diff --git a/.agents/skills/unidesk-cicd/references/branch-follower.md b/.agents/skills/unidesk-cicd/references/branch-follower.md index 45356752..a6610e95 100644 --- a/.agents/skills/unidesk-cicd/references/branch-follower.md +++ b/.agents/skills/unidesk-cicd/references/branch-follower.md @@ -40,6 +40,8 @@ Bounded JSON means the operator-facing `--json` payload must remain below the YA Target-side state summaries used by `status`, `events`, `logs` and `debug-step state-read` must also remain below the transport stdout limit. When exposing stored native payloads, return gate summaries only: git-mirror, Tekton, Argo, runtime and short errors. Do not include full source objects, TaskRun item arrays, plan-artifact arrays, report payloads or full command payloads in the default state summary; a truncated state summary is a visibility defect because the operator can no longer parse the follower state. +Follower-scoped commands such as `status --follower`, `events --follower`, `logs --follower` and `debug-step --follower` must ask the target summary helper for only that follower's state. Do not fetch every follower and filter locally at the operator side; multi-follower summaries have different size budgets and should use lower per-follower stage limits. + `scripts/src/cicd.ts` should stay a thin branch-follower route/orchestration entry, not a catch-all implementation file. Rendering, debug steps, controller manifests, native K8s helpers, adapter-specific trigger/status logic and large data compactors must live in responsibility-specific modules before `cicd.ts` approaches the 3000-line hard split point. `status-read`, `events`, `logs` and debug summaries must expose compact closeout gate details when a follower is not aligned: git-mirror readiness, Tekton PipelineRun condition, Argo sync/health, runtime target sha/readiness and short errors. Repeating only phase/observed/target/message is a visibility defect and must be fixed before further rollout tuning. diff --git a/scripts/src/cicd.ts b/scripts/src/cicd.ts index f25484d8..3e913168 100644 --- a/scripts/src/cicd.ts +++ b/scripts/src/cicd.ts @@ -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> = {}; const valueBytes: Record = {}; - 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]);