Remove stack of envelope classes from message metadata#289
Conversation
vjik
commented
May 21, 2026
| Q | A |
|---|---|
| Is bugfix? | ❌ |
| New feature? | ❌ |
| Breaks BC? | ✔️ |
| Tests pass? | ✔️ |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #289 +/- ##
========================================
Coverage 0.00% 0.00%
+ Complexity 326 318 -8
========================================
Files 48 48
Lines 892 872 -20
========================================
+ Misses 892 872 -20 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
This PR removes the “envelope stack” concept from message metadata and stops JSON deserialization from reconstructing envelope wrappers based on metadata, aligning message handling around plain messages + explicit metadata keys (BC-breaking change as noted in the PR description).
Changes:
- Removed envelope stack tracking from
Envelopemetadata (no moreenvelopeskey management). - Simplified
JsonMessageSerializer::unserialize()to return the message class directly without rebuilding envelope wrappers. - Updated unit tests to reflect the new serialization/unserialization behavior.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
src/Message/Envelope.php |
Stops injecting/maintaining an “envelope stack” in metadata; now only merges base + envelope metadata. |
src/Message/JsonMessageSerializer.php |
Removes logic that read an envelope stack from metadata and re-wrapped messages during unserialize(). |
tests/Unit/Message/JsonMessageSerializerTest.php |
Updates expectations so unserialization returns plain Message and metadata no longer includes an envelope stack. |
tests/Unit/Message/EnvelopeTest.php |
Removes tests that validated envelope stack normalization/behavior. |
tests/Unit/EnvelopeTest.php |
Removes assertions that depended on the envelope stack metadata key. |
Comments suppressed due to low confidence (1)
tests/Unit/Message/JsonMessageSerializerTest.php:141
- Outdated type annotation: the docblock claims
$messageisIdEnvelope, but the test now asserts it is aMessage. This can mislead static analysis and readers; update or remove the annotation.
/** @var IdEnvelope $message */
$message = $serializer->unserialize(json_encode($payload, JSON_THROW_ON_ERROR));
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.