From 64fdce844879526c5ef94c83c28e15de1bbc7461 Mon Sep 17 00:00:00 2001 From: 4gray Date: Sat, 1 Aug 2026 21:07:30 +0200 Subject: [PATCH] test(stalker): restore serial mode for the shared-scenario file Review follow-up (Codex P2), valid: the previous commit removed `mode: 'serial'` while every `beforeEach` still resets all OWNED_MACS, so under fullyParallel one test in this file could clear another's data or session mid-run. Of the two suggested fixes, serialize rather than give each test its own MAC: the tests here are written against scenario fixtures (default, minimal, embedded-series) whose shapes the assertions encode, so a MAC per test would mean inventing a scenario per test and rewriting pre-existing assertions. Cross-file isolation stays with the disjoint sibling MAC range, which is what serial was wrongly standing in for before. The header now states both levels explicitly so the next reader does not undo one of them. Verified: three consecutive runs of stalker + self-hosted + sources-pwa, 26/26 each. Co-Authored-By: Claude Fable 5 --- apps/web-e2e/src/stalker.e2e.ts | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/apps/web-e2e/src/stalker.e2e.ts b/apps/web-e2e/src/stalker.e2e.ts index fec5f11a6..f9c7ee264 100644 --- a/apps/web-e2e/src/stalker.e2e.ts +++ b/apps/web-e2e/src/stalker.e2e.ts @@ -23,15 +23,25 @@ import { * * Tag: @stalker — run only stalker tests with: nx e2e web-e2e --grep "@stalker" * - * ISOLATION: one mock-server process is shared by every spec file, and the - * suite runs under the workspace-wide `fullyParallel` preset. State there is - * keyed by MAC, so isolation comes from ownership rather than serialization: - * `beforeEach` resets only the MACs listed in `OWNED_MACS`, and sibling files - * (self-hosted, sources-pwa) own disjoint MACs of their own. The full-portal - * authentication tests additionally use MACs no other test touches, so their - * portal sessions cannot be cleared mid-assertion. + * ISOLATION works on two levels, because one mock-server process is shared by + * every spec file and its state is keyed by MAC: + * + * - ACROSS FILES: `beforeEach` resets only the MACs in `OWNED_MACS`, and the + * sibling files that touch this server (self-hosted, sources-pwa) own a + * disjoint `00:1A:79:5F:*` range, so neither can clear the other's state. + * - WITHIN THIS FILE: tests deliberately share scenario MACs (`default`, + * `minimal`, `embedded-series` — their fixture shapes are what the + * assertions are written against), and every `beforeEach` resets all of + * them. Under the workspace-wide `fullyParallel` preset that would let one + * test wipe another's data or session mid-run, so the file pins itself to a + * single worker. + * + * Giving each test its own MAC instead would mean inventing a scenario per + * test; serializing one file is the cheaper trade. */ +test.describe.configure({ mode: 'serial' }); + const MOCK_PORT = process.env['MOCK_PORT'] ?? '3210'; const MOCK_SERVER = `http://localhost:${MOCK_PORT}`; const PORTAL_URL = `${MOCK_SERVER}/portal.php`;