diff --git a/fleetd/src/test/java/dev/ltms/fleet/lead/LeadContextGaugeTest.java b/fleetd/src/test/java/dev/ltms/fleet/lead/LeadContextGaugeTest.java index 3eb41be..6d89a65 100644 --- a/fleetd/src/test/java/dev/ltms/fleet/lead/LeadContextGaugeTest.java +++ b/fleetd/src/test/java/dev/ltms/fleet/lead/LeadContextGaugeTest.java @@ -14,6 +14,7 @@ import java.util.concurrent.atomic.AtomicLong; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNull; import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.api.Assumptions.assumeFalse; /** * Ticket "lead context gauge" — fleetd could not see how full a lead's own Claude Code context @@ -137,6 +138,15 @@ class LeadContextGaugeTest { Path file = tmp.resolve("projects").resolve("some-project-slug").resolve(SESSION_ID + ".jsonl"); assertTrue(file.toFile().setReadable(false), "test setup: must be able to revoke read permission"); try { + // setReadable(false) really did clear the read bit (asserted above), but that alone + // does not prove the file is UNREADABLE: running as root (e.g. a CI container) ignores + // the read bit and opens the file anyway. Files.isReadable checks what actually happens + // on open, not the bit. When it still reports readable, this test cannot create the + // condition it needs on this machine, so it skips honestly instead of asserting on a + // state that was never reached. A skip here means "I could not set up the case", NOT + // "the UNKNOWN behaviour is fine" -- it is not evidence either way. + assumeFalse(Files.isReadable(file), + "runs as root (CI container): the read bit does not stop root, so this case cannot be set up here"); LeadContextGauge gauge = new LeadContextGauge(); LeadContextGauge.Reading reading = gauge.read(configDir, SESSION_ID, "claude"); assertEquals(LeadContextGauge.State.UNKNOWN, reading.state());