Repository navigation
Fix numeric WireCodec aliases, expose all listener failures, docs refresh - #31
Conversation
Reviewer's GuideAPIExpose multi-listener termination failures through the new public exception while preserving the existing message and previous-exception chain.
Accept numeric aliases in the public WireCodec configuration and retain them as strings for encoding and decoding.
ConfigurationRaise the Infection development dependency to the version used by the updated mutation-testing setup.
DocumentationRefresh release notes and English and Russian documentation for the new exception, numeric aliases, cancelled-context budgets, adapters, and examples.
TestsVerify aggregation and propagation of listener failures, cancelled-context budget reporting, and numeric-alias round trips.
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars.
|
Linked issuesChecked at commit ab35250 #21 Termination listener failures are lost: only the last error survives aggregation · 1 of 1 met
#22 WireCodec throws TypeError on a numeric alias · 1 of 2 met
#27 Document `remainingMs()` for a cancelled context and pin it with a test · 1 of 1 met
#30 README is out of date: database support, sibling packages, examples table · 4 of 4 met
|
There was a problem hiding this comment.
Hey - I've found 2 issues
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location path="src/WireCodec.php" line_range="68" />
<code_context>
$values = [];
- foreach ($this->aliases as $alias => $class) {
+ foreach ($this->aliases as [$alias, $class]) {
$value = $context->value($class);
if ($value instanceof WireValue) {
</code_context>
<issue_to_address>
**Numeric aliases lose their names**
When the codec accepts a numeric alias and the encoded values are JSON-serialized, `encode()` assigns `$values[$alias]`, and PHP coerces numeric-string aliases to integer keys; JSON encoding then emits a list for sequential keys, while `WireFormat` promises string-keyed aliases. Consumers cannot resolve the alias names.
Preserve numeric aliases as JSON object properties and make `WireFormat` accurately describe the encoded values, or reject aliases that PHP coerces to integers.
Also at `src/WireCodec.php:39`, `src/WireCodec.php:48`.
</issue_to_address>
### Comment 2
<location path="src/ListenerFailuresException.php" line_range="20" />
<code_context>
+ /**
+ * @param non-empty-list<\Throwable> $errors
+ */
+ public function __construct(private readonly array $errors)
+ {
+ $chain = $this->errors[\count($this->errors) - 1];
</code_context>
<issue_to_address>
**Empty failure lists create invalid exceptions**
When a caller directly constructs `ListenerFailuresException` with an empty array, `__construct()` indexes the last element of the empty array, emitting an undefined-key warning, and `errors()` then returns an empty array despite its non-empty-list contract; warning-to-exception handlers abort construction.
Reject an empty errors array before indexing it.
</issue_to_address>Sourcery assessment
Approval pending. 2 findings to address first.
Blocking findings: src/WireCodec.php:68, src/ListenerFailuresException.php:20
|
Review follow-up: an empty failure list is now rejected with |
Fixes #21
Fixes #22
Fixes #27
Fixes #30
ListenerFailuresException(new@api, extendsRuntimeException) witherrors(): every failure of a multi-listener termination is reachable; message andpreviouschain unchanged, socatch (\RuntimeException)and the existing chain test keep working (Termination listener failures are lost: only the last error survives aggregation #21).WireCodec: a numeric alias ('1'→ int key) no longer throwsTypeError; it is validated and round-trips (WireCodec throws TypeError on a numeric alias #22). TheBaggage::merge()part lives incontext-http.remainingMs()of a cancelled context documented in both READMEs and pinned by a test, value unchanged (DocumentremainingMs()for a cancelled context and pin it with a test #27).context-db, examples table listsderivations.php;llms.txtmentionsUsleepSleeper,ListenerFailuresException;infection/infection^0.35(README is out of date: database support, sibling packages, examples table #30).Release header:
## 0.4.0 — 2026-11-20(new public class → minor).Local:
composer buildgreen,composer rectorclean, mutation (--with-uncovered, assertions off) MSI 3.24 pp overminMsi90.Summary by Sourcery
Improve listener failure reporting and numeric wire-alias compatibility while refreshing documentation and release metadata.
New Features:
ListenerFailuresExceptionAPI.WireCodecaliases and preserve them through encode/decode and JSON round trips.Bug Fixes:
Build:
^0.35.Documentation:
UsleepSleeperinllms.txt.Tests:
Chores: