Skip to content

LOC-justify cuts: ENI filter via slices and one shutdown drain path - #30

Merged
CMGS merged 2 commits into
mainfrom
cut/loc-justify-2026-09-21
Sep 21, 2026
Merged

CMGS merged 2 commits into
mainfrom
cut/loc-justify-2026-09-21

Conversation

@CMGS

@CMGS CMGS commented Sep 21, 2026

Copy link
Copy Markdown
Contributor

Cuts from the 2026-09-21 LOC-justify pass over the five K8s repos, applied after the report-only round. One commit per row, zero comment lines added, no test edited.

Commits

commit tier net prod why
d7bd0cf selectReusableENIs filters through slices.DeleteFunc 1 −4 slices.DeleteFunc(slices.Clone(enis), …); the clone keeps the caller's slice intact, the [:min(len, count)] tail is unchanged
0b64250 every graceful DHCP shutdown takes the lifecycle drain 3 (fix) −4 Run's <-ctx.Done() arm took lifecycleMu before returning, but the <-controlErrCh arm with a nil error and a canceled ctx returned without it. httpx.Run returns nil after a ctx-driven shutdown, so on SIGTERM both arms can be ready and a queued handler could start a transaction the process cannot finish. The select now folds into one tail: close the listener, cancel the run ctx, drain the control error if it is still owed, then take the drain lock on every clean exit. Error texts become control server: %w and control server: stopped unexpectedly. The linkIndex trailing comment restated the field

Net: −8 prod lines, comment lines +1/−1 (the drain comment moved with the lock).

The shutdown fold changes an edge behavior and is labelled fix:; no test drives Run (Linux-gated, real sockets), so the proof is the linux container run below plus the narrowed control flow.

Gates

  • GOOS=darwin and GOOS=linux make lint: 0 issues / 0 issues each; make fmt-check clean.
  • asl (commit hook, both GOOS): 0 findings.
  • go test -race -count=1 ./...: 7 ok.
  • linux/arm64 golang:1.27 container with --cap-add=NET_ADMIN, go build && go vet && go test -race: 7 ok on 0b64250.

Codex was not run: cut PRs go without it unless asked.

Run's shutdown select had two graceful arms: the ctx arm took lifecycleMu
before returning, the control-server arm did not. httpx.Run returns nil once
its ctx is done, so on SIGTERM both arms could be ready and a scheduler-timed
wake let the process exit without the drain that 5ac5729 installed. The arms
now share one tail; the control error is reported as "control server: %w"
and the linkIndex field drops a comment that restated its use.
@CMGS
CMGS merged commit 0d38adf into main Sep 21, 2026
2 checks passed
@CMGS
CMGS deleted the cut/loc-justify-2026-09-21 branch September 21, 2026 15:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant