Symptom
In full-suite runs, tests immediately after a describe('Logout') block fail with socket hang up or 401s. Example from downstream (trawl_node):
```
historys.integration.tests.js:199
describe('Logout')
should be able to get historys stats → socket hang up
```
Running the file alone passes; the failure only surfaces when a prior inner `describe` exercised logout paths.
Root cause
The shared `agent` instance holds a cookie scoped to a user who gets invalidated inside the inner `describe('Logout')` — typically via `afterAll(() => UserService.remove(user))`. The next outer `describe` reuses the same `agent` but the cookie now points to a deleted/logged-out user.
Scope
Pattern identified in 3 devkit/Node test files (source of truth) that propagate to 6+ downstream files via `/update-all-projects`:
Repro
```bash
From any downstream project (trawl_node, comes_node, etc.)
NODE_ENV=trawl npm run test:unit -- --runInBand --testPathPattern=historys.integration
Passes in isolation
NODE_ENV=trawl npm run test:unit -- --runInBand
Fails: historys.integration.tests.js:199
```
Priority
P2 — not failing CI (fresh Mongo container per run masks it), but causes noise in local full-suite runs and makes debugging downstream harder. Fix propagates via devkit update.
Symptom
In full-suite runs, tests immediately after a
describe('Logout')block fail withsocket hang upor 401s. Example from downstream (trawl_node):```
historys.integration.tests.js:199
describe('Logout')
should be able to get historys stats → socket hang up
```
Running the file alone passes; the failure only surfaces when a prior inner `describe` exercised logout paths.
Root cause
The shared `agent` instance holds a cookie scoped to a user who gets invalidated inside the inner `describe('Logout')` — typically via `afterAll(() => UserService.remove(user))`. The next outer `describe` reuses the same `agent` but the cookie now points to a deleted/logged-out user.
Scope
Pattern identified in 3 devkit/Node test files (source of truth) that propagate to 6+ downstream files via `/update-all-projects`:
Repro
```bash
From any downstream project (trawl_node, comes_node, etc.)
NODE_ENV=trawl npm run test:unit -- --runInBand --testPathPattern=historys.integration
Passes in isolation
NODE_ENV=trawl npm run test:unit -- --runInBand
Fails: historys.integration.tests.js:199
```
Priority
P2 — not failing CI (fresh Mongo container per run masks it), but causes noise in local full-suite runs and makes debugging downstream harder. Fix propagates via devkit update.