diff --git a/src/agents/pi-hooks/compaction-safeguard.test.ts b/src/agents/pi-hooks/compaction-safeguard.test.ts index a8f3f3755aa..2851adb8033 100644 --- a/src/agents/pi-hooks/compaction-safeguard.test.ts +++ b/src/agents/pi-hooks/compaction-safeguard.test.ts @@ -871,8 +871,12 @@ describe("compaction-safeguard recent-turn preservation", () => { const identifiers = extractOpaqueIdentifiers( "Track id a1b2c3d4e5f6 plus A1B2C3D4E5F6 and URL https://example.com/a and /tmp/x.log plus port host.local:18789", ); - expect(identifiers.length).toBeGreaterThan(0); - expect(identifiers).toContain("A1B2C3D4E5F6"); // pragma: allowlist secret + expect(identifiers).toStrictEqual([ + "A1B2C3D4E5F6", // pragma: allowlist secret + "https://example.com/a", + "/tmp/x.log", + "host.local:18789", + ]); const summary = [ "## Decisions", @@ -940,7 +944,15 @@ describe("compaction-safeguard recent-turn preservation", () => { latestAsk: "Need a status update", }); expect(quality.ok).toBe(false); - expect(quality.reasons.length).toBeGreaterThan(0); + expect(quality.reasons).toStrictEqual([ + "missing_section:## Decisions", + "missing_section:## Open TODOs", + "missing_section:## Constraints/Rules", + "missing_section:## Pending user asks", + "missing_section:## Exact identifiers", + "missing_identifiers:abc12345", + "latest_user_ask_not_reflected", + ]); }); it("requires exact section headings instead of substring matches", () => {