mirror of
https://github.com/Jeuners/ECC.git
synced 2026-09-09 15:02:30 +02:00
Two regression tests pin down the previous two commits' atomic-rename fixes: 1. **concurrent writes don't throw ENOENT or corrupt the file** — spawns two child Node processes (`tests/__tmp_bridge_writer.js` created in-test, cleaned up in finally) that each call `writeBridgeAtomic(sid, …)` 200 times against the same session ID with independent payloads. Asserts both subprocesses exit 0 (the previous implementation produced ENOENT on roughly 50% of rename calls, all swallowed by the in-test catch) and the final bridge file is parseable JSON belonging to one of the two writers (last-writer-wins is fine; the contract is *no corruption* and *no rename ENOENT*, not data preservation). 2. **tmp file cleanup on rename failure** — pre-creates a directory at the target bridge path so `renameSync(tmp, target)` fails, calls `writeBridgeAtomic`, asserts the call throws AND that no tmp file with the writer's `pid.<nonce>.tmp` prefix is left behind in `os.tmpdir()`. The previous code had no cleanup; the fix's `try/catch + unlinkSync` keeps tmpdir from accumulating orphan files across repeated rename failures. The first test deliberately writes independent payloads from each subprocess so this regression doesn't try to claim a property the fix doesn't actually deliver (read-modify-write race in the caller is a separate issue and out of scope per PR body). Test count: 12 → 14 in `tests/lib/session-bridge.test.js`; `npm test` green; `npm run lint` clean. |
||
|---|---|---|
| .. | ||
| ci | ||
| commands | ||
| docs | ||
| hooks | ||
| integration | ||
| lib | ||
| scripts | ||
| __init__.py | ||
| codex-config.test.js | ||
| conftest.py | ||
| opencode-config.test.js | ||
| opencode-plugin-hooks.test.js | ||
| plugin-manifest.test.js | ||
| run-all.js | ||
| test_astraflow_provider.py | ||
| test_builder.py | ||
| test_claude_provider.py | ||
| test_executor.py | ||
| test_provider_tools.py | ||
| test_resolver.py | ||
| test_templates.py | ||
| test_types.py | ||