Skip to content

fix(tests): isolate loopback gateway fixture caches - #8013

Merged
Lightheartdevs merged 1 commit into
Osmantic:mainfrom
0xacee:test/loopback-fixture-cache-isolation-20261023
Oct 23, 2026
Merged

Lightheartdevs merged 1 commit into
Osmantic:mainfrom
0xacee:test/loopback-fixture-cache-isolation-20261023

Conversation

@0xacee

@0xacee 0xacee commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

Summary

The real IPv4 and IPv6 gateway socket fixtures share a five-second address-family cache keyed by port. If the kernel reuses the IPv4 fixture's port for the IPv6 fixture, the latter sends its POST to the deliberately resetting IPv4 listener and fails with ECONNRESET.

Give each real socket fixture its own createLoopbackGatewayFetch(). Both still use the default production HTTP transport and retain their health, family-selection, request and cleanup assertions. No production source changes.

Closes #8012. Credit to roshangupta00750's diagnosis, which identified the collision in #7883's integration-smoke failure.

Why this matters

An unrelated PR can fail required CI depending on ephemeral-port allocation. Fixture-owned caches remove that cross-test state while preserving the real network behavior under test.

AI Assistance

0xacee leads this contribution, its scope and quality requirements, collaborating with Codex on reproduction, implementation, tests and review. The validation commands below were agent-executed.

Release Lane

  • Mainline change targeting main

Changed Surface

  • Tests only

Risk And Validation

Low risk. Base 6513ad2e0e205525f148b68fffd095cb1b347e2c; candidate 43a79de3346eb8c1af837f04a93a51b6afc701db.

  • Deterministic old-code failure: a reproduction-only Node import hook forces the second socket fixture to reuse the first fixture's released port. It changes only the server's port allocation; HTTP, the production transport and every assertion remain real. Exact main: 9 passed, 1 failed with the hosted IPv6 socket hang up / ECONNRESET. Candidate: 10 passed, zero skips on Ubuntu WSL / Node 22.23.3.
  • Independent replay: a separate source copy reproduced the same old failure and all ten candidate passes. Independent static review found no blocking issue.
  • Windows: normal suite 10 passed, zero skips, Node 24.21.0.
  • Complete Pixel Node suite: node --test --test-concurrency=2 extensions/services/pixel-agent/tests/*.test.mjs — 4,920 passed, 52 conditional skips, zero failures in a private exact-tree Linux export.
  • An initial default-concurrency broad run had four failing timing assertions in other test files. The exact-main default-concurrency control also failed in unrelated fixtures. Those results are retained separately; the complete candidate pass above explicitly used two workers.
  • CI inventory: 1,341 tests, 1,322 executed in CI, 19 documented exclusions. Identity gate: 1 commit passed. git diff --check and Gitleaks 8.30.1 on the complete added range passed.

The existing test-linux.yml integration job executes node --test extensions/services/pixel-agent/tests/*.test.mjs, including this file. No additional test file or CI exclusion is introduced.

Operational Change Check

  • This is not an operational change.

The scoped network tests establish fixture isolation. Runtime caching, authentication, transport discovery and mutation replay policy are unchanged.

Overlap check

The current 610-open-PR file inventory, including all 14 larger file lists, has no other change to this test file. All-state IPv6, gateway/cache and ECONNRESET searches found the original runtime coverage and the #7883 failure report, with no equivalent fixture-isolation PR. #7883 changes n8n workflow resolution; this PR repairs the independent CI test defect.

Hosted validation on the published head

The current-head integration-smoke job passed the unchanged workflow command with 4,920 Node tests passed, 52 conditional skips and zero failures. Its log explicitly records both real IPv4 and IPv6 fixtures passing. This complements the independently replayed forced-port-reuse regression and the local two-worker run.

Final current-head readback: 73/73 checks passed, with zero failed or pending checks. The PR is Ready for review and conflict-free. Hosted status is tied to candidate 43a79de3346eb8c1af837f04a93a51b6afc701db.

@Lightheartdevs

Copy link
Copy Markdown
Collaborator

Thanks for isolating the loopback fixtures while keeping the real socket coverage intact.

Advisory status: looks merge-ready

What looks good:

  • Each real-socket fixture now owns its discovery cache in ods/extensions/services/pixel-agent/tests/gateway_loopback.test.mjs, so ephemeral-port reuse cannot carry the first fixture's address-family choice into the second.
  • The default production HTTP transport, health probes, request assertions, and cleanup remain exercised; production code is unchanged.

What I checked:

  • Reviewed the diff against main and the cache/transport implementation in host/pixel_ingress.mjs.
  • Ran node --test ods/extensions/services/pixel-agent/tests/gateway_loopback.test.mjs: 10 passed, zero skips, including both real IPv4/IPv6 cases.
  • Exact-head GitHub checks: 73 successful, no pending or failed checks; no merge conflict. Normal maintainer review requirements still apply.

@roshangupta00750

Copy link
Copy Markdown
Contributor

Confirmed: this is the same change I'd prepared for the collision (a fresh createLoopbackGatewayFetch() per real-socket fixture), and gateway_loopback.test.mjs passes 10/10 here five times in a row. Thanks for picking it up. I'll drop my own branch for it.

@Lightheartdevs
Lightheartdevs merged commit e320a41 into Osmantic:main Oct 23, 2026
73 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Pixel loopback socket tests share cached address families across reused ports

3 participants