You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Micro Runtime Cleanup 1: Slim the public Request API #71
The public micro request API currently exposes raw response machinery via RequestInterface::msg() and internal bookkeeping via RequestInterface::hasResponded(). That leaks core Message behavior into the micro layer and forces lifecycle workarounds higher up in Service.
Goal
Make Request the only public micro reply surface. Handlers should keep the legitimate inbound metadata they need (data(), headers(), subject(), replyTo()), but should not be able to bypass micro reply semantics through a raw mutable Message.
Preferred direction
remove msg() from RequestInterface
remove hasResponded() from the public interface
keep any duplicate-reply bookkeeping as an internal detail of the concrete Request
if raw inbound inspection is still needed, prefer a read-only DTO rather than exposing core Message
Scope
src/Micro/RequestInterface.php
src/Micro/Request.php
tests/Integration/Micro/ServiceExtendedTest.php
any micro tests/docs that assert msg() / hasResponded()
Out of scope
graceful Service::stop() work
control-subject hardening
docs refresh beyond minimal compile/test fallout
Deliverables
narrowed public RequestInterface
updated tests that prove legitimate handler use-cases still work without msg()
no new coupling added to core Message
Acceptance criteria
public micro handlers can reply only through Request
no public RequestInterface escape hatch exposes a core Message with respond()
duplicate-reply state is not part of the public handler contract
micro integration tests pass after the API cleanup
Parallelism
Can run in parallel with the config cleanup and the initial service error-tracking work.
Blocks the duplicate-reply enforcement issue and the final docs refresh.
Activity
matkomat commentedon Mar 31, 2026
Implementation plan for whoever picks this up:
Goal
mainand implement the smaller boundary directly.Target API after this issue
RequestInterfaceshould expose only:respond(string $data, ?Headers $headers = null): voidrespondJson(mixed $data, ?Headers $headers = null): voiderror(string $code, string $description, string $data = ''): voiddata(): stringheaders(): ?Headerssubject(): stringreplyTo(): ?stringExplicitly remove from the public micro API:
msg()hasResponded()Request.phpshould no longer expose those methods publicly either.File scope
Touch only what is needed for this boundary cleanup:
src/Micro/RequestInterface.phpsrc/Micro/Request.phptests/Integration/Micro/ServiceExtendedTest.phpmsg()/hasResponded()on your working branchAvoid folding in unrelated runtime/lifecycle work from:
lastError()/ shared error pathTest changes
Replace
testRequestMsg()with a test that proves handlers still have enough inbound context without a rawMessage.Preferred shape:
data()subject()replyTo()headers()?->get(...)Request::respond()If your branch already contains a
hasResponded()test, remove it rather than preserving that API.Explicit non-goals / forbidden changes
src/Message.phpsrc/Micro/Service.phphere beyond trivial compile fallout, if anyAcceptance checklist
RequestInterfaceno longer imports or returnsMessagedata(),headers(),subject(), andreplyTo()msg()/hasResponded()Suggested verification
vendor/bin/phpunit tests/Integration/Micro/ServiceExtendedTest.phpvendor/bin/phpunit tests/Integration/Micro/ServiceTest.phpif touchedReview notes
The review for this issue will check specifically for:
src/Message.phpchangesService.phpruntime changes folded into the same PRfix: slim public micro request API (#71)
fix: slim public micro request API (#71) (#79)