ECC/tests
Jamkris 5acb01a276 test(lib): concurrent writeBridgeAtomic + tmp-cleanup regression
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.
2026-05-19 04:57:10 -04:00
..
ci security: scope release oidc publishing 2026-05-18 13:41:10 -04:00
commands fix: accept crlf command frontmatter 2026-04-30 03:41:18 -04:00
docs docs: refresh rc1 publication evidence 2026-05-18 16:12:37 -04:00
hooks fix: treat MCP HTTP 406 probes as reachable 2026-05-18 12:48:52 -04:00
integration fix: port continuous-learning observer fixes 2026-05-11 03:35:42 -04:00
lib test(lib): concurrent writeBridgeAtomic + tmp-cleanup regression 2026-05-19 04:57:10 -04:00
scripts test(ci): regression coverage for newly-covered invisible code points 2026-05-18 21:20:36 -04:00
__init__.py Small changes 2026-04-12 12:34:45 +05:30
codex-config.test.js fix(codex): broaden context7 config checks 2026-03-29 00:26:16 -04:00
conftest.py docs: salvage focused stale PR contributions 2026-05-11 05:31:12 -04:00
opencode-config.test.js fix: namespace opencode command agents 2026-04-05 14:21:57 -07:00
opencode-plugin-hooks.test.js fix: harden opencode project file probes 2026-05-11 22:40:19 -04:00
plugin-manifest.test.js docs: verify Codex marketplace readiness (#1931) 2026-05-15 12:30:26 -04:00
run-all.js fix: narrow unicode cleanup scope 2026-03-29 21:21:18 -04:00
test_astraflow_provider.py feat: add Astraflow provider support 2026-05-11 23:21:46 -04:00
test_builder.py docs: salvage focused stale PR contributions 2026-05-11 05:31:12 -04:00
test_claude_provider.py docs: salvage focused stale PR contributions 2026-05-11 05:31:12 -04:00
test_executor.py Small changes 2026-04-12 12:34:45 +05:30
test_provider_tools.py fix: harden openai-compatible provider responses 2026-05-18 01:04:28 -04:00
test_resolver.py feat: add Astraflow provider support 2026-05-11 23:21:46 -04:00
test_templates.py docs: salvage focused stale PR contributions 2026-05-11 05:31:12 -04:00
test_types.py feat: add Astraflow provider support 2026-05-11 23:21:46 -04:00