Skip to content

Commit 1f13b35

Browse files
committed
test(state): force the grace-boundary ages in the moved lock property
The moved property is named for the grace boundary but drew ageMs and graceMs as two independent durations, so ageMs === graceMs was almost never sampled and the >= boundary went untested. Relaxing the classifier from >= to > at mcp-lifecycle-lock-identity.ts:210 still passed 15/15 before this change. Test ages graceMs - 1, graceMs, and graceMs + 1 alongside the random age, which keeps the broad coverage the random draw gave. The >= mutation now fails. Reported by CodeRabbit on #8436. Refs: #8356 Signed-off-by: harjoth <harjoth.khara@gmail.com>
1 parent 7e586eb commit 1f13b35

1 file changed

Lines changed: 13 additions & 9 deletions

File tree

src/lib/state/mcp-lifecycle-lock-identity.test.ts

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -399,15 +399,19 @@ describe("MCP lifecycle lock identity properties", () => {
399399
},
400400
});
401401

402-
expect(
403-
classifyMcpLifecycleLock(
404-
observation(lockOwner, 0),
405-
SANDBOX_NAME,
406-
ageMs,
407-
graceMs,
408-
localProbes,
409-
),
410-
).toBe(ageMs >= graceMs ? "stale" : "wait");
402+
// Two independent durations almost never land on ageMs === graceMs, so
403+
// the boundary this property is named for needs the exact ages forced.
404+
for (const boundaryAgeMs of [graceMs - 1, graceMs, graceMs + 1, ageMs]) {
405+
expect(
406+
classifyMcpLifecycleLock(
407+
observation(lockOwner, 0),
408+
SANDBOX_NAME,
409+
boundaryAgeMs,
410+
graceMs,
411+
localProbes,
412+
),
413+
).toBe(boundaryAgeMs >= graceMs ? "stale" : "wait");
414+
}
411415
},
412416
),
413417
SEEDED_PROPERTY_PARAMETERS,

0 commit comments

Comments
 (0)