Skip to content

feat: wire runner restart counters (RestartCount/RestartTime) (step 2) - #1333

Merged
eminwux merged 1 commit into
mainfrom
feat/runner-restart-counters
Jun 17, 2026
Merged

feat: wire runner restart counters (RestartCount/RestartTime) (step 2)#1333
eminwux merged 1 commit into
mainfrom
feat/runner-restart-counters

Conversation

@eminwux

@eminwux eminwux commented Jun 17, 2026

Copy link
Copy Markdown
Owner

Summary

Premise-rot note (salvageable — flagged per dev CLAUDE.md)

The issue's Proposal says to "Replace the TODO(#1146) markers (helpers.go:864-865)". Those markers no longer exist: #1303 (the #1146 marker-documentation chore) landed first and replaced them with intentionally-zero comments, which had since shifted to ~helpers.go:1057-1070. Per the issue's own "Ordering vs #1146" note ("if #1146's marker-documentation chore lands first, this step supersedes its comments"), I superseded the current intentionally-zero block rather than the original TODO(#1146) text. Intent unchanged — these are the same lines, just relabeled and relocated by the intervening chore.

Test plan

  • make test (full CI suite, test-root + test-kukebuild) — green, MAKE-TEST-EXIT=0, no FAIL lines.
  • GOWORK=off go build ./internal/controller/runner/ and go vet — clean.
  • New colocated unit tests in internal/controller/runner/restart_on_exit_test.go:
    • TestMaybeRestartExitedContainers_BumpsRestartCounterByOne — increment-by-one + RestartTime stamp on a fired restart; root container untouched (AC 1, 2).
    • TestMaybeRestartExitedContainers_RestartCounterMonotonic — prior 4 → 5, no reset (AC 4).
    • TestMaybeRestartExitedContainers_NoBumpWhenNoRestartFires — sole-writer contract: a no-fire tick leaves the counters exactly as preserved.
    • TestPopulateCellContainerStatuses_PreservesRestartCounters — populate preserves across two passes, never increments (AC 3, 5).

Acceptance criteria

  • RestartCount increments by exactly one per reconciler-driven restart and survives subsequent reconciliation passes (increment in the restart pass + populate preserve).
  • RestartTime reflects the wall-clock time of the most recent restart and survives subsequent passes.
  • populateCellContainerStatuses never increments — pure preserver; the intentionally-zero block (the relabeled TODO(#1146) markers — see premise-rot note) is gone.
  • Counters are monotonic (no reset while the container record lives).
  • Unit coverage colocated with runner tests: counter increment on restart, preservation across populate passes.

Closes #1234

@eminwux eminwux added ready-for-review PR is handed off to the reviewer agent in-review Reviewer agent is actively reading this PR and removed ready-for-review PR is handed off to the reviewer agent labels Jun 17, 2026
@eminwux

eminwux commented Jun 17, 2026

Copy link
Copy Markdown
Owner Author

PR #1333 Review — feat: wire runner restart counters (RestartCount/RestartTime) (step 2)

LGTM — makes maybeRestartExitedContainers the sole writer of the user-visible restart counters via stampContainerRestart (bump-by-one after a successful relaunch) and turns populateCellContainerStatuses into a pure preserver under the same observe-and-preserve contract as CreatedAt/ExitCode. The increment lands on the preserved prior and the restartFired branch persists it with no intervening populate, so the count is exact and monotonic across ticks. Tests cover both halves (increment + monotonic + no-fire, and two-pass preserve), all commits verified, full CI green including make e2e.

@eminwux eminwux added ready-to-merge Reviewed and ready to merge and removed in-review Reviewer agent is actively reading this PR labels Jun 17, 2026
@eminwux
eminwux merged commit 25efe88 into main Jun 17, 2026
5 checks passed
@eminwux
eminwux deleted the feat/runner-restart-counters branch June 17, 2026 14:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-to-merge Reviewed and ready to merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

runner: restart counters (RestartCount/RestartTime) (step 2)

1 participant