M1I09: SocketFactory (fallback chain)#66
Merged
Conversation
s2x
commented
May 2, 2026
Contributor
Author
s2x
left a comment
There was a problem hiding this comment.
Review Summary — Round 1
| # | Severity | File:Line | Finding |
|---|---|---|---|
| 1 | MEDIUM | tests/Server/Socket/SocketFactoryTest.php:35 |
Fallback test assertion is too weak — doesn't validate fallback logic |
Follow-up Observations
SocketFactory::create()accepts$portand$protocolbut never passes them to proxy constructors — this is a known decision perwatpliwosci.md#6 ("params not needed in proxy constructors —createSocket()receives them at call time"). Consider documenting this in a PHPDoc@paramtag to clarify intent.- Static factory with hardcoded
newcalls prevents mocking/stubbing in unit tests — consider making the factory instantiable with overridable methods for future testability. - Consider adding a
@throwsdocblock to document potential\UnhandledMatchErrorif newProxyTypeenum values are added without corresponding factory cases.
What's Fine ✔️
- All acceptance criteria satisfied:
MASTER→MasterProxy,FORK_SHARED→ForkSharedProxy,REUSE_PORT→ReusePortProxy/ForkSharedProxy - All tests pass (3/3, 3 assertions)
- No security issues: no leaked credentials, PII, injection vectors, or insecure crypto
matchexpression is exhaustive for currentProxyTypeenum values- Code follows the milestone spec and plan exactly
s2x
commented
May 2, 2026
Contributor
Author
s2x
left a comment
There was a problem hiding this comment.
Review Summary — Round 2
| # | Severity | Finding | Status |
|---|---|---|---|
| — | MEDIUM | Unused $port/$protocol params in create() |
Known decision — watpliwosci.md #6, accepted by design |
Previous Finding Resolved
- ✅ Fallback test split into
testCreateReusePortReturnsReusePortWhenSupported+testCreateReusePortFallsBackToForkSharedWhenNotSupported— each path now explicitly tested withmarkTestSkippedfor the inverse condition.
Follow-up Observations
- Missing class-level PHPDoc on
SocketFactory—MasterProxyhas one but the main entry point for proxy selection doesn't. Consider adding a short description of the fallback chain. (effort: low)
What's Fine ✅
- All 4 acceptance criteria met —
MASTER→MasterProxy,FORK_SHARED→ForkSharedProxy,REUSE_PORT→ReusePortProxy(supported) /ForkSharedProxy(unsupported) - 4 tests (3 pass + 1 skipped per platform), lint + CI green on PHP 8.2–8.5
- No security issues, no secrets, no PII
- Signature and fallback logic match the milestone doc exactly
matchexpression is exhaustive — PHP enforces allProxyTypecases handled
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
src/Server/Socket/SocketFactory.php,tests/Server/Socket/SocketFactoryTest.phpAcceptance criteria
create(MASTER)returnsMasterProxycreate(FORK_SHARED)returnsForkSharedProxycreate(REUSE_PORT)returnsReusePortProxyif supported, elseForkSharedProxyCloses #11