From d7390ccd37b20a3b75b5f5cee93ea8c616c4a658 Mon Sep 17 00:00:00 2001 From: Dai Ha Date: Sun, 20 Sep 2026 17:20:48 +0700 Subject: [PATCH] fleetd #609 review: repair a garbled comment carried over from the brief The brief's sentence about a null token count at HIGH was broken, and the worker copied it into the source verbatim. The code was already right; only the comment was unreadable. Says what is actually true: a HIGH reading always carries a non-null token count today, because LeadContextGauge only reaches HIGH by comparing a number against HIGH_THRESHOLD_TOKENS. That invariant lives in another class and nothing asserts it, so the branch stays. --- .../src/main/java/dev/ltms/fleet/msg/LeadHeartbeatLoop.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/fleetd/src/main/java/dev/ltms/fleet/msg/LeadHeartbeatLoop.java b/fleetd/src/main/java/dev/ltms/fleet/msg/LeadHeartbeatLoop.java index fd987f1..42df198 100644 --- a/fleetd/src/main/java/dev/ltms/fleet/msg/LeadHeartbeatLoop.java +++ b/fleetd/src/main/java/dev/ltms/fleet/msg/LeadHeartbeatLoop.java @@ -360,8 +360,10 @@ public final class LeadHeartbeatLoop { sb.append(": ").append(reading.tokens()).append(" tokens used, ") .append(reading.compactions()).append(' ').append(compactionWord).append(" so far."); } else { - // tokens() can be null even at HIGH is not true today, but do not assume it — leave the - // token clause out rather than print "null tokens". + // A HIGH reading always carries a non-null token count today: LeadContextGauge only + // reaches HIGH by comparing a number against HIGH_THRESHOLD_TOKENS. That invariant + // lives in another class and nothing asserts it, so this branch does not rely on it — + // it drops the token clause rather than printing "null tokens". sb.append(" (").append(reading.compactions()).append(' ').append(compactionWord) .append(" so far)."); }