Skip to content

feat(infra): rank Kubernetes workloads by replica health and restarts - #1483

Merged
Makisuo merged 7 commits into
mainfrom
feat/k8s-workload-health
Oct 15, 2026
Merged

Makisuo merged 7 commits into
mainfrom
feat/k8s-workload-health

test(infra): build the restart seed's attributes without a conditiona…

0a955d2
Select commit
Loading
Failed to load commit list.
Maple Review Bot / Maple / review succeeded Oct 15, 2026 in 2m 11s

Confidence 8/10 · No issues found

🟢 Confidence 8/10 · likely safe to merge
The head delta is a behaviour-preserving refactor of the seed helper and every e2e assertion recomputed by hand holds; the new suite just never runs in CI.
quality 98/100 · 1 note · tests covered · risk medium

The workload list now ranks by replica shortfall, failed job pods, restarts and the worst pod's peak, and adds Jobs as a fourth workload kind. The delta since the last review is a no-op refactor of the e2e seed helper; the change is safe to merge.

  • listWorkloadsQuery orders by shortfall, failed pods, restarts, peak saturation
  • Restarts are per-container deltas of k8s.container.restarts, not sample sums
  • Jobs join WorkloadKind, the API schema and both workload routes
  • Workload rows drop the avg* fields for replicas, restarts and peaks

Before merge

  • Manual · Wire k8s-workloads.clickhouse.e2e.test.ts into the clickhouse-schema-e2e job in .github/workflows/ci.yml, or nothing runs it in CI

Findings

🔵 Note · F4 · New e2e suite is skipped by every CI job

tests · packages/backend/src/services/warehouse/k8s-workloads.clickhouse.e2e.test.ts:146

The suite is gated on CLICKHOUSE_E2E === "1" (clickhouse-e2e-support.ts:15), the backend test lanes never set it, and the clickhouse-schema-e2e job runs its files by name (.github/workflows/ci.yml:489-529) without this one. So a regression in listWorkloadsQuery passes CI; add the file to that job's bun run --filter=@maple/backend test -- line (and to the root ch:test script) so it actually runs.

What was checked
  • Recomputed the seed by hand: checkout restarts 11 (4+2+0+5), api 9, and each lastTerminatedReason follows the container whose restart counter hit its high-water mark last (infra.ts:1165, 1205)
  • No consumer is left reading the removed avgCpuLimitPct/avgMemoryLimitPct/avgCpuUsage: apps/ai/src/mcp/lib/infra-inspect.ts:459 reads the unchanged workloadDetailSummaryQuery
  • WORKLOAD_ATTR_KEY and workloadAttrKey cover all four kinds, so the job path resolves k8s.job.name (infra.ts:412)

0a955d2 · Updated on every push. Reply "won't fix" to dismiss a finding, or mention @maple-review-bot to ask about one.

Annotations

Check notice on line 146 in packages/backend/src/services/warehouse/k8s-workloads.clickhouse.e2e.test.ts

See this annotation in the file changed.

@maple-review-bot maple-review-bot / Maple / review

tests: New e2e suite is skipped by every CI job

The suite is gated on `CLICKHOUSE_E2E === "1"` (`clickhouse-e2e-support.ts:15`), the backend test lanes never set it, and the `clickhouse-schema-e2e` job runs its files by name (`.github/workflows/ci.yml:489-529`) without this one. So a regression in `listWorkloadsQuery` passes CI; add the file to that job's `bun run --filter=@maple/backend test --` line (and to the root `ch:test` script) so it actually runs.