From 5255cdce06bf632b47b03b9679d4d39ff05a208e Mon Sep 17 00:00:00 2001 From: Claude Fable 5 Date: Sun, 19 Jul 2026 06:12:55 +0200 Subject: [PATCH] Fix latenten Flake in links.service.db.test (Phantom-Sortierung) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit pondGraph-Test sortierte die EMPFANGENEN Phantom-Slugs, verglich aber gegen ein UNsortiertes Literal. Da beide Slugs (ghost-, ghost-secret-) den Zufalls-Suffix teilen, kippt ihre Sortierreihen- folge auf ~1/5 der Suffixe (wenn sfx[0] > 's') → nicht-deterministischer Fehlschlag. In CI-Lauf 372 traf es zu (Suffix „vpxwe…"). Fix: beide Seiten sortieren. Vorbestehender Bug, unabhängig von M17–M19. Co-Authored-By: Claude Fable 5 Claude-Session: https://claude.ai/code/session_0155v2aT8AG1kZDQEZiCLBWC --- apps/api/src/links/links.service.db.test.ts | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/apps/api/src/links/links.service.db.test.ts b/apps/api/src/links/links.service.db.test.ts index cc77b21..5114db0 100644 --- a/apps/api/src/links/links.service.db.test.ts +++ b/apps/api/src/links/links.service.db.test.ts @@ -277,10 +277,12 @@ describe.skipIf(!hasTestDb)('LinksService.pondGraph (db, issue #111)', () => { { from: a, to: secret }, ].sort((x, y) => x.to.localeCompare(y.to)), ); - expect(graph.phantoms.map((p) => p.targetSlug).sort()).toEqual([ - `ghost-${suffix}`, - `ghost-secret-${suffix}`, - ]); + // Sort BOTH sides: phantom order is not guaranteed, and the two slugs share + // the random suffix so their sort order flips on ~1/5 of suffixes (the + // expected array was previously left unsorted — a latent flake). + expect(graph.phantoms.map((p) => p.targetSlug).sort()).toEqual( + [`ghost-${suffix}`, `ghost-secret-${suffix}`].sort(), + ); }); it('slices every collection to the reader — no hidden page leaks anywhere', async () => {