#35887 ipc: use std::optional for checkSpawned(), add tests and rename arg -ipcfd to -ipcchild
https://github.com/bitcoin/bitcoin/pull/35887 · · +67/-24 in 6 files, 3 commits · labels: IPC
Goal
- Make internal IPC argument names platform-neutral and modernize process checking interfaces
- Add unit test coverage for IPC child process argument parsing edge cases
Implements follow-up suggestions from the cross-platform IPC support PR (#35084). It changes `ipc::Process::checkSpawned()` to return `std::optional<mp::SocketId>` instead of a boolean with an out-parameter, renames the internal argument `-ipcfd` to `-ipcchild` to reflect non-FD platforms like Windows, and adds unit tests for process argument parsing.
Problem: The `checkSpawned()` method used a pre-C++17 signature with an out-parameter, lacked unit test coverage for argument parsing edge cases, and used the name `-ipcfd` which was misleading on platforms like Windows that use named pipes instead of file descriptors.
Category: IPC / multiprocess (#19 of 20)
P3 · cleanup
- P3 because it is minor cleanup and test coverage for multiprocess support
- Improves argument accuracy on non-UNIX platforms without fixing active bugs
Follows up on merged cross-platform IPC work (#35084) by adopting modern C++ patterns, improving argument naming on Windows, and adding unit tests. It is worthwhile cleanup and test coverage for multiprocess support, but is reasonably deferrable and fixes no active bugs.
Membership: Directly touches IPC interface headers, child process spawning helpers, and IPC test harnesses in src/ipc/.
Factors: security/stability 0, bug 0, performance 0, user value 0, leverage 1
Reviewability: Ready
- Ready for review, clean, and passing CI with all feedback addressed
The PR is clean, passing CI, and has addressed reviewer requests.
Author status: active
Resolved concerns:
- jeanpablojp noted a missing test case covering three arguments where the second is not `-ipcchild`; author added the test case in an updated push.
Agreement: Strong
- Strong support for completing the requested follow-ups from earlier IPC work
- Verified by testing with IPC enabled and checking argument handling (jeanpablojp)
- Approved commit structure and code changes (enirox001)
Strong: two reviewers verified and ACKed the implementation of the requested follow-ups
Multiple contributors reviewed and tested the changes, confirming that the follow-ups requested during #35084 review are satisfied, with all review feedback resolved.
- jeanpablojp confirmed testing with IPC enabled and verified follow-up implementation from #35084, subsequently ACKing head.
- enirox001 utACKed the commit structure and implementation.
Review verdicts (DrahtBot): 2
- ACK: jeanpablojp, enirox001
Files
2 lines under test/bench/ci.
- src/ipc/test/ipc_tests.cpp +41/-0
- src/ipc/process.cpp +16/-16
- src/ipc/interfaces.cpp +4/-3
- src/ipc/process.h +4/-3
- src/bitcoin.cpp +1/-1
- test/lint/check-doc.py +1/-1
Card
This PR refactors `ipc::Process::checkSpawned()` to return `std::optional<mp::SocketId>`, renames `-ipcfd` to `-ipcchild`, and adds unit tests in `ipc_tests.cpp`. It solves minor technical debt and naming inaccuracy on Windows left over from #35084 as requested by reviewers. The change has strong support with tested ACKs and no unresolved concerns. It is self-contained with no remaining dependencies.