Skip to content

test: synchronize parallel hooks and helper diagnostics - #1625

Merged
skevetter merged 1 commit into
mainfrom
fix/deterministic-unit-fixtures-20261020
Oct 21, 2026
Merged

skevetter merged 1 commit into
mainfrom
fix/deterministic-unit-fixtures-20261020

Conversation

@skevetter

@skevetter skevetter commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

What and why

Two macOS unit tests failed on main despite successful hook execution and helper cleanup: the initialize-command test required two subprocesses to finish within 900 ms, and the trace test read diagnostics before go-plugin’s independent stdio receive loop finished.

Replace the timing assertion with a subprocess barrier: both initialize hooks must connect before either is released. Keep the synchronous process-exit assertion and wait for the asynchronous stdio EOF diagnostic. Production code is unchanged.

Issue: none. Observed failure: https://github.com/devsy-org/devsy/actions/runs/39441933403/job/118695354484

Type of change

  • Bug fix (unit-test reliability)

AI assistance

  • AI tools were used
Field Answer
Tool and model Codex, gpt-6.1-sol
Used for Failure-log audit, test changes, validation, PR description, and review follow-up
Share of change Mostly generated; every changed line inspected by the agent
  • The implementing agent read and understands every changed line; human review remains pending.
  • The agent ran the tests and verified that the barrier rejects sequential execution through a synthetic negative control.

Testing

  • Added or updated unit tests.
  • No new integration test needed: only unit-test synchronization changes; production CLI, provider, agent, workspace, and desktop behavior is unchanged. The complete existing hosted integration matrix passed.

Verification:

  • go test -race ./pkg/devcontainer -run '^TestRunInitializeCommand_Parallel$' -count=10: passed.
  • External debug/trace/secrecy tests with -race -count=20: passed.
  • go test -race ./pkg/devcontainer ./pkg/driver/external -count=1: passed, 35.995 s / 121.016 s.
  • Synthetic Go-overlay negative control: sequential hook execution fails the barrier at its 3-second deadlock guard; repository sources remain unchanged.
  • GOMAXPROCS=4 mise run cli:lint:ci: zero issues. Exact-file repository formatting and remaining scoped pre-commit hooks passed. The initial broad hook run timed out and flagged the subsequently documented test-helper G704 false positive; its redundant whole-repository formatter was interrupted.
  • Hosted run https://github.com/devsy-org/devsy/actions/runs/39463236413: all applicable CI passed on daeb75a279e6da8619083d96729de2a1e3d7508b, including full Linux/macOS race suites, Windows transport/provider tests, builds, license check, pre-commit, integration matrix, and CI Success.

The first hosted attempt hit a zero-finding pre-commit lint timeout and the separate process-group fixture flake covered by #1608. One unchanged-head retry passed; both packages changed here also passed the first macOS attempt.

Checklist

  • CI-parity lint passes; desktop changes are not applicable.
  • Full unit-test package selection passed under the hosted race-enabled Linux/macOS jobs; focused local race suites passed.
  • No user-visible change requiring site documentation.
  • No secrets, tokens, or personal paths added to the change.
  • CLA and commit-signature checks passed.

Notes for reviewers

Greptile reviewed the final commit at 5/5 with no actionable findings. Local CodeRabbit found zero issues; hosted CodeRabbit completed full review of both changed files at the final commit with no actionable code comments.

The CodeRabbit docstring-coverage warning needs no source change: these are descriptively named unit tests and a test subprocess helper, with comments explaining the synchronization contract. Adding comments solely to satisfy a documentation percentage would repeat the code. Its PR-description warning is addressed by the completed template above.

External gate status: the PR is out of draft, but Entire Gates check 118768150463 still reports PR #1625 is a draft. All implementation CI and both completed final-commit reviews passed. This app-owned stale check remains pending; no merge or auto-merge has been enabled.

@netlify

netlify Bot commented Oct 20, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for devsydev canceled.

Name Link
🔨 Latest commit daeb75a
🔍 Latest deploy log https://app.netlify.com/projects/devsydev/deploys/6ad79fb410583ca0e0e1bebd

@netlify

netlify Bot commented Oct 20, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for images-devsy-sh canceled.

Name Link
🔨 Latest commit daeb75a
🔍 Latest deploy log https://app.netlify.com/projects/images-devsy-sh/deploys/6ad79fb44b0387c219cfaaaf

@coderabbitai

coderabbitai Bot commented Oct 20, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 725f1f39-7486-4d04-86d6-676c84e1313f
📥 Commits

Reviewing files that changed from the base of the PR and between 0e4f3b1 and daeb75a.

📒 Files selected for processing: 2
  • pkg/devcontainer/run_test.go
  • pkg/driver/external/session_logging_test.go

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

📝 Walkthrough

The devcontainer initialization test now synchronizes two subprocesses through a loopback barrier instead of comparing elapsed times. The session logging test polls for an asynchronous EOF diagnostic while still requiring the plugin-exit diagnostic.

Changes: Devcontainer initialization test

Layer / File(s) Summary
Synchronize parallel initialization commands
pkg/devcontainer/run_test.go
The test starts two initialization commands and waits for both to connect to a loopback barrier before releasing either. A subprocess helper connects to the barrier and waits for the release byte.

Session logging test

Layer / File(s) Summary
Wait for asynchronous trace diagnostic
pkg/driver/external/session_logging_test.go
The test polls for up to five seconds for the receive-loop EOF diagnostic. It continues to require the plugin-exit diagnostic.

Priority: ⬇️ Low

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

Change: Other

Merge Risk: ⚪ Minimal · up to daeb7

The updated tests have no identified merge-blocking issue and are ready to merge after normal checks.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 2 functions across 2 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Title check Passed The title clearly and concisely describes the main test changes: synchronizing parallel hooks and helper diagnostics.
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.
Description check Passed The pull request description is complete and follows the repository template. It explains the failure and fix, identifies the change as a unit-test bug fix, discloses AI assistance, documents testing …
Full details: Description check

Explanation

The pull request description is complete and follows the repository template. It explains the failure and fix, identifies the change as a unit-test bug fix, discloses AI assistance, documents testing and verification commands, and addresses the checklist and reviewer notes. The issue reference is provided as none, and the integration-test exception is justified because production behavior is unchanged.

✨ Finishing Touches
✨ Simplify code
  • 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.

@skevetter

Copy link
Copy Markdown
Contributor Author

@greptileai review

@greptile-apps

greptile-apps Bot commented Oct 20, 2026 •

Copy link
Copy Markdown

RetriggerView in GreptileConfidence Score: 5/5

[Low impact] The PR appears safe to merge.

Summary

This PR removes two timing-sensitive test checks without changing production code.

  • The initialize-hook test waits for both commands to start.
  • The trace test waits for the helper’s stdio EOF message.

No actionable issues found.

Reviews (1) · Last reviewed commit: "test: synchronize parallel hooks and hel..." · Reviewed by Greptile

@skevetter

Copy link
Copy Markdown
Contributor Author

@coderabbitai full review

@coderabbitai

coderabbitai Bot commented Oct 20, 2026 •

Copy link
Copy Markdown
✅ Action performed

Full review finished.

@skevetter
skevetter marked this pull request as ready for review October 20, 2026 19:03
@mergify

mergify Bot commented Oct 20, 2026 •

Copy link
Copy Markdown

This pull request does not currently match the merge queue conditions, so it cannot be queued from here. The box comes back if it matches again.

@skevetter
skevetter merged commit 75855e7 into main Oct 21, 2026
125 of 129 checks passed
@skevetter
skevetter deleted the fix/deterministic-unit-fixtures-20261020 branch October 21, 2026 14:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant