Skip to content

Write the fake adb from a child process so no test's fork holds it open - #145

Open
LucaCappelletti94 wants to merge 1 commit into
mainfrom
fix/fake-adb-text-file-busy
Open

LucaCappelletti94 wants to merge 1 commit into
mainfrom
fix/fake-adb-text-file-busy

Conversation

@LucaCappelletti94

@LucaCappelletti94 LucaCappelletti94 commented Oct 9, 2026 •

Copy link
Copy Markdown
Owner

The Android proof tool's adb retry tests failed now and then with "Text file busy". Each test writes a stand-in adb script and runs it at once. Another test thread could fork while the script was still open for writing, and the child kept that descriptor until its own exec, so running the script failed. Measured on main, 16 of 60 runs of the proof tool's tests failed this way.

The helper now has a child sh write the script, so no descriptor open for writing it ever exists in the test process. 200 runs in a row passed afterwards.

Parallel Android proof tests could fail with “Text file busy” when a fork inherited an open descriptor for the fake adb script. The test helper now delegates script creation and executable permissions to a child shell process, so the test process does not hold the script open for writing.

The change addresses the reported intermittent failure. The author reports that 200 consecutive runs passed after the fix.

@coderabbitai

coderabbitai Bot commented Oct 9, 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: Repository: LucaCappelletti94/coderabbit/.coderabbit.yaml
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: 50faa12c-eaba-4661-9fd8-aad8c6fa86f7

📥 Commits

Reviewing files that changed from the base of the PR and between f84efe8 and c23091c.


📒 Files selected for processing (1)
  • crates/connetto-test-harness/src/bin/connetto-android-proof.rs

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



📝 Walkthrough

Walkthrough

The fake_adb helper now creates its mock executable through a child shell process. It streams the script to the child and asserts that the child completes successfully.

Changes

Mock ADB script creation

Layer / File(s) Summary
Child shell script creation
crates/connetto-test-harness/src/bin/connetto-android-proof.rs
fake_adb streams the script to a spawned shell, which writes the executable and applies executable permissions. The helper asserts that the child starts and exits successfully.

Priority: ⬇️ Low

Estimated code review effort: 1 (Trivial) | ~5 minutes

Change: Bug fix


Merge Risk: ⚪ Minimal · up to c2309

The helper writes the fake adb script in a child process and closes its input before waiting for completion. No actionable merge-blocking risk is established.

🚥 Pre-merge checks | ✅ 11 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Title check Warning The title accurately describes the change and uses the imperative, but it is 71 characters and exceeds the 70-character limit. Shorten the title to 70 characters or fewer, for example: "Write fake adb from a child process"
✅ Passed checks (11 passed)
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 1 files.
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.
No Placeholder Implementations Passed No added line introduces a prohibited placeholder or deferral marker. The diff adds the child-process writer and related comments, and the added-line scan found no TODO, FIXME, HACK, XXX, unimplemente…
No Blanket Diagnostic Suppression Passed The pull request adds no blanket diagnostic suppression. The added lines only import Write, build the script, spawn sh, write through stdin, and assert process success. No Rust allow/deny attr…
Behavior Change Carries A Test Passed The only changed file is crates/connetto-test-harness/src/bin/connetto-android-proof.rs. The changed code is inside the existing #[cfg(test)] mod tests and updates the fake_adb test helper. This…
Git Dependency Pin Stays Out Of Commits Passed Cargo.lock is unchanged in the reviewed range. The failure condition requires the pull request to add or modify Cargo.lock, so the manifest git dependencies do not trigger this check.
Crate Readme Is The Crate Documentation Passed The check is inapplicable. The pull request changes only crates/connetto-test-harness/src/bin/connetto-android-proof.rs; it does not change README.md, and the repository root has no src/lib.rs.
Pre-Alpha Has No Deployments Passed The workspace version is 0.0.0, so the check applies. The added lines only implement child-process writing for the fake adb script. They mention none of the prohibited deployment or migration topics.
Prose Punctuation Passed The added prose contains no semicolons, dash punctuation, curly quotes, or ellipsis glyphs. Semicolons in the added shell script are code, which the check permits.


  • Fix all pre-merge checks with AI
✨ 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.

@sonarqubecloud

sonarqubecloud Bot commented Oct 9, 2026

Copy link
Copy Markdown

@codecov

codecov Bot commented Oct 9, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 86.40%. Comparing base (f84efe8) to head (c23091c).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #145   +/-   ##
=======================================
  Coverage   86.40%   86.40%           
=======================================
  Files         163      163           
  Lines       39726    39726           
  Branches    39726    39726           
=======================================
+ Hits        34325    34326    +1     
+ Misses       3525     3524    -1     
  Partials     1876     1876           
Flag Coverage Δ
client 55.58% <ø> (+0.01%) ⬆️
rest 51.66% <ø> (-0.36%) ⬇️
server 55.20% <ø> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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.

1 participant