fix: xdist-aware CI recorder — controller merges worker files instead of overwriting
With pytest-xdist (-n N), workers write deps_by_file.json correctly but the
controller process (which has no PYTEST_XDIST_WORKER env var set) was taking the
non-xdist path and overwriting the merged output with an empty {}.
Root cause: PYTEST_XDIST_TESTRUNUID is only set on workers, not the controller,
so it cannot be used to detect the controller process.
Fix: detect the controller by checking whether worker gw*.json files already exist
on disk at sessionfinish time — workers always finish before the controller, so
their files are guaranteed to be present. Controller then merges them.
All three record functions (deps_by_file, deps_chain, deps_by_sys_module) are now
xdist-aware: workers write per-worker shards, controller merges; non-xdist writes
directly as before.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>