Skip to content

test: tolerate delayed desktop compatibility fixture port release - #7897

Merged
lidge-jun merged 1 commit into
devfrom
fix/desktop-compatibility-port-release
Oct 28, 2026
Merged

lidge-jun merged 1 commit into
devfrom
fix/desktop-compatibility-port-release

Conversation

@lidge-jun

@lidge-jun lidge-jun commented Oct 28, 2026 •

Copy link
Copy Markdown
Owner

Summary

  • Stabilize the desktop compatibility runtime's reused-port conflict test without changing product code. Only the recovery start after both TCP fixture close callbacks have completed retries desktop_compatibility_connection_unavailable, at 10 ms intervals with a one-second deadline. Other errors and a persistent bind failure still fail the test.
  • Preserve the immediate startup rejection while each port is occupied, cached identity, inactive ownership, released sibling listener, and original PAC URL assertions. Also assert that recovery leaves the cached identity unchanged. Production cleanup already awaits PAC, CONNECT proxy, and relay shutdown; this investigation found no evidence requiring a production lifecycle change.
  • Confirmed the reported failure in PR #7507's test 2/4 job, head 01fa48af0004117e75c58dcc3460067ec8df7203: error: desktop_compatibility_connection_unavailable, at src/codex/desktop-compatibility/runtime.ts:150:33, called from the post-conflict restart at tests/clients/desktop-compatibility-runtime.test.ts:495:24. The log wraps the underlying bind error, so it does not independently establish the OS-level cause.
  • Branched from freshly fetched origin/dev at 1f840573466667fc97e881d11c2bba7d5828b737.

Verification

Windows, Bun 1.4.4. All Bun test invocations ran sequentially with $env:OCX_TEST_NO_QUEUE = '1'.

  • Before patch: bun test tests/clients/desktop-compatibility-runtime.test.ts --test-name-pattern 'a reused port conflict' --rerun-each 100 — 100 pass, 0 fail, 1,000 assertions. The CI flake was not locally reproducible; no local red-before-green claim. An earlier attempt could not load missing zod/v4; bun install --frozen-lockfile installed the locked dependencies without a tracked change before this baseline run.
  • After patch: the same 100-repetition command — 100 pass, 0 fail, 1,200 assertions.
  • bun test tests/clients/desktop-compatibility-runtime.test.ts tests/ci-workflows/file-size-ratchet.test.ts tests/test-layout.test.ts tests/test-layout-tooling.test.ts — 105 pass, 0 fail, 1,086 assertions.
  • bun run typecheck — no type errors in 2,227 files.
  • bun run privacy:scan — passed.
  • git diff --check — passed.

The test no longer requires port reuse to succeed on the first scheduling turn after fixture closure: it requires an actual successful start within the bounded release window, followed by the original PAC URL and identity checks. The intentionally occupied-port starts are never retried. The adjacent cached-PAC restart test still requires immediate stop/start without this retry. This handles a transient release delay while retaining failure for unavailable ports and unrelated lifecycle errors.

NOT RUN: full local suite (disproportionate for this one-test harness edit amid concurrent worktrees; focused runtime coverage and all requested guards ran), local Linux/macOS reproduction, and native desktop application smoke. Broader PR validation is left to normal CI; no CI rerun or manual workflow dispatch was requested.

Checklist

  • Scope stays focused and avoids unrelated cleanup.
  • Docs or release notes were updated when needed (not needed: test-only change, no product behavior change).
  • Security-sensitive changes were reviewed for secrets, auth, and unsafe defaults (diff contains only test recovery timing and an additional identity assertion).

Summary by CodeRabbit

  • Tests
    • Improved coverage of reused-port startup timing in the desktop compatibility runtime test. The test now retries temporary connection-unavailable errors and continues to verify that the PAC URL and connection identity remain unchanged.

@lidge-jun
lidge-jun requested a review from Ingwannu as a code owner October 28, 2026 10:57
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 28, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-28T10:59:01.862567Z 314950e PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@github-actions

Copy link
Copy Markdown
Contributor

✅ Deterministic PR hygiene checks passed.

@github-actions github-actions Bot added the chore Maintenance, CI, tests, refactors, or build changes (not a user-facing bug or feature). label Oct 28, 2026
@coderabbitai

coderabbitai Bot commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review.

Recent review info
Run configuration
Commits

Reviewing files that changed from the base of the PR and between 1f84057 and 314950e.

Files selected for processing: 1
  • tests/clients/desktop-compatibility-runtime.test.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 2 remain after this review.

Walkthrough

The desktop compatibility runtime test now retries startup after fixture listeners close. It retries only for desktop_compatibility_connection_unavailable, with 10 ms intervals and a one-second deadline. After startup, the test checks the PAC URL and stored connection identity.

Changes: Desktop compatibility test

Layer / File(s) Summary
Retry runtime startup
tests/clients/desktop-compatibility-runtime.test.ts
After fixture listeners close, the test retries startup every 10 ms for up to one second when it receives the specified connection-unavailable error. It then checks the original PAC URL and stored connection identity, and stops the runtime.

Priority: Low

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Other

Possibly related PRs

Suggested labels: chore

Suggested reviewers: luvs01

Merge Risk: Minimal · up to 31495

This test-only change adds bounded recovery retries without introducing a confirmed merge-blocking risk.

Pre-merge checks: Passed 5
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly and concisely describes the main change: updating the desktop compatibility test to tolerate delayed fixture port release.
Docstring Coverage Passed No eligible functions found in the changed files. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentat…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

No eligible functions found in the changed files. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 0 functions across 1 files.

Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@lidge-jun
lidge-jun merged commit 5b70174 into dev Oct 28, 2026
30 checks passed
@lidge-jun
lidge-jun deleted the fix/desktop-compatibility-port-release branch October 28, 2026 11:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

chore Maintenance, CI, tests, refactors, or build changes (not a user-facing bug or feature).

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant