mirror of
https://github.com/Jeuners/ECC.git
synced 2026-09-09 23:12: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. |
||
|---|---|---|
| .. | ||
| agent-compress.test.js | ||
| changed-files-store.test.js | ||
| command-plugin-root.test.js | ||
| cost-estimate.test.js | ||
| inspection.test.js | ||
| install-config.test.js | ||
| install-executor.test.js | ||
| install-lifecycle.test.js | ||
| install-manifests.test.js | ||
| install-request.test.js | ||
| install-state.test.js | ||
| install-targets.test.js | ||
| locale-install.test.js | ||
| mcp-config.test.js | ||
| observer-sessions.test.js | ||
| orchestration-session.test.js | ||
| package-manager.test.js | ||
| project-detect.test.js | ||
| resolve-ecc-root.test.js | ||
| resolve-formatter.test.js | ||
| selective-install.test.js | ||
| session-adapters.test.js | ||
| session-aliases.test.js | ||
| session-bridge.test.js | ||
| session-manager.test.js | ||
| shell-split.test.js | ||
| skill-dashboard.test.js | ||
| skill-evolution.test.js | ||
| skill-improvement.test.js | ||
| state-store.test.js | ||
| tmux-worktree-orchestrator.test.js | ||
| utils.test.js | ||