opencode-config/docs/decisions/082-pr-187-e2e-test-beforeall-tmp-race.md
Sergey 3caa83e617
fix(draw-image): per-process output TMP in e2e.test.ts beforeAll race (#187)
* fix(draw-image): per-process output TMP in e2e.test.ts beforeAll

* docs(handoff): add handoff and ADR for e2e.test.ts beforeAll fix

* docs(handoff): set PR number 187

---------

Co-authored-by: opencode-agent <agent@opencode.local>
2026-07-31 22:49:46 +03:00

13 lines
No EOL
1.5 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# ADR-082: per-process output TMP in e2e.test.ts beforeAll race
## Статус
Accepted (2026-07-31)
## Контекст
`tests/e2e.test.ts` использовал общий output-каталог `/tmp/draw-image-e2e`, создаваемый/очищаемый в `beforeAll`. При параллельном запуске нескольких процессов vitest concurrently процессы конкурировали за один каталог: `beforeAll` процесса A удалял `TMP` (вместе с `e2e.png` + `e2e.meta.json` процесса B) → assertion `expected 'skipped' to be 'rendered'` падал. Тот же bug class что и #183, но `e2e.test.ts` не вошёл в список affected-файлов #183.
## Решение
Перевести output-каталог на per-process: `TMP = path.join(os.tmpdir(), \`draw-image-e2e-\${process.pid}\`)`. `process.pid` уникален на параллельный vitest-процесс → каждый процесс пишет в свой каталог, race устранён. Добавлен `afterAll` cleanup для удаления output-каталога после тестов (no leftover).
## Альтернативы
- `fs.mkdtempSync(path.join(os.tmpdir(), "draw-image-e2e-"))` — отклонена: `process.pid` suffixed path обеспечивает консистентность с 7 уже зафиксированными файлами из #186 и достаточен для внешней параллельности.