Conversation
Signed-off-by: Kenny Pflug <[email protected]>
Signed-off-by: Kenny Pflug <[email protected]>
Signed-off-by: Kenny Pflug <[email protected]>
…ibute handling Signed-off-by: Kenny Pflug <[email protected]>
Signed-off-by: Kenny Pflug <[email protected]>
Signed-off-by: Kenny Pflug <[email protected]>
Signed-off-by: Kenny Pflug <[email protected]>
Signed-off-by: Kenny Pflug <[email protected]>
Signed-off-by: Kenny Pflug <[email protected]>
Signed-off-by: Kenny Pflug <[email protected]>
Signed-off-by: Kenny Pflug <[email protected]>
…oudEventExtensions Signed-off-by: Kenny Pflug <[email protected]>
Signed-off-by: Kenny Pflug <[email protected]>
…entReadOptions Signed-off-by: Kenny Pflug <[email protected]>
Signed-off-by: Kenny Pflug <[email protected]>
Signed-off-by: Kenny Pflug <[email protected]>
… data Signed-off-by: Kenny Pflug <[email protected]>
Signed-off-by: Kenny Pflug <[email protected]>
Signed-off-by: Kenny Pflug <[email protected]>
Signed-off-by: Kenny Pflug <[email protected]>
Signed-off-by: Kenny Pflug <[email protected]>
Signed-off-by: Kenny Pflug <[email protected]>
Signed-off-by: Kenny Pflug <[email protected]>
Signed-off-by: Kenny Pflug <[email protected]>
… and return rented arrays Signed-off-by: Kenny Pflug <[email protected]>
…calling Should() several times on properties of the SUT Signed-off-by: Kenny Pflug <[email protected]>
Signed-off-by: Kenny Pflug <[email protected]>
Signed-off-by: Kenny Pflug <[email protected]>
Signed-off-by: Kenny Pflug <[email protected]>
Signed-off-by: Kenny Pflug <[email protected]>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 112 out of 119 changed files in this pull request and generated 5 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Signed-off-by: Kenny Pflug <[email protected]>
…ith invariant culture and rountrip kind Signed-off-by: Kenny Pflug <[email protected]>
… it is always application/json Signed-off-by: Kenny Pflug <[email protected]>
…sion attributes across the codebase Signed-off-by: Kenny Pflug <[email protected]>
Signed-off-by: Kenny Pflug <[email protected]>
Signed-off-by: Kenny Pflug <[email protected]>
Signed-off-by: Kenny Pflug <[email protected]>
… 'CloudEvent' Signed-off-by: Kenny Pflug <[email protected]>
Signed-off-by: Kenny Pflug <[email protected]>
Signed-off-by: Kenny Pflug <[email protected]>
Signed-off-by: Kenny Pflug <[email protected]>
Signed-off-by: Kenny Pflug <[email protected]>
… attributes Signed-off-by: Kenny Pflug <[email protected]>
Signed-off-by: Kenny Pflug <[email protected]>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 134 out of 141 changed files in this pull request and generated 5 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Signed-off-by: Kenny Pflug <[email protected]>
…an be safely downcast to int Signed-off-by: Kenny Pflug <[email protected]>
Signed-off-by: Kenny Pflug <[email protected]>
Signed-off-by: Kenny Pflug <[email protected]>
Signed-off-by: Kenny Pflug <[email protected]>
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.
Closes #15
Deviations from original issue.
1. Reading Performance Optimization (Zero-Copy Architecture)
Reference:
0015-cloud-events-reading-performance-optimization.mdOriginal Plan:
The original plan implied parsing the
dataproperty of the CloudEvent envelope into aJsonDocumentand serializing it back to abyte[]for later deserialization into the actual payload type.Deviation:
To eliminate unnecessary allocations (
JsonDocument, internal buffers,byte[]copy), a zero-copy architecture was implemented.CloudEventEnvelopePayloadwas changed to store position-based tracking (DataStart,DataLength) instead of abyte[]for the data segment.CloudEventEnvelopeJsonReader.ReadEnvelopetracks byte positions usingUtf8JsonReader.BytesConsumedand skips the data subtree without parsing it into aJsonDocument.ReadOnlyMemoryCloudEventExtensionsslices the originalReadOnlyMemory<byte>buffer using the tracked positions after deserialization completes, and passes this slice directly to the payload parser.2. Writing Optimization and STJ Integration
Reference:
0015-cloud-events-write-optimization.mdOriginal Plan:
The original plan specified
ToCloudEventandWriteCloudEventextension methods that directly wrote toUtf8JsonWriter, bypassing the STJ pipeline for the envelope itself. It also usedMemoryStreamfor byte array generation.Deviation:
To align with the HTTP integration pattern and reduce memory pressure:
ToCloudEventwas updated to usePooledByteBufferWriter(anIBufferWriter<byte>) instead ofMemoryStreamto avoid double-copy allocations.WriteCloudEvent(this Result result, IBufferWriter<byte> bufferWriter, ...)was added for zero-copy scenarios.MetadataObjectinstances where possible.3. Writing Streamlining (Unified Envelope Converter)
Reference:
0015-cloud-events-write-streamlining.mdOriginal Plan / Intermediate State:
The intermediate optimization plan introduced
CloudEventWriteResultJsonConverterwhich required constructor injection ofLightResultsCloudEventWriteOptions. This complicated DI scenarios and prevented stateless converters. The logic was also monolithic and tightly coupled in extension methods.Deviation:
To enable full STJ pipeline integration, stateless converters, and clean separation of concerns:
ResolvedCloudEventWriteOptionsreadonly record struct to capture frozen serialization options (e.g.,MetadataSerializationMode).CloudEventEnvelopeForWriting<T>(and non-generic) readonly record struct to carry resolved Cloud Events attributes and the frozen options.CloudEventEnvelopeForWritingJsonConverterthat serializes this envelope struct, handling both envelope attributes and Result data inline.ToCloudEventextension methods now construct this envelope struct and callJsonSerializer.Serialize(), delegating the actual writing entirely to the STJ pipeline.CloudEventWriteResultJsonConverter,CloudEventWriteResultJsonConverterFactory) were removed.4. Shared JSON Serialization Location
Reference:
0015-cloud-events-serialization.mdOriginal Plan:
The plan stated that transport-agnostic JSON serialization helpers would be extracted from
Http/into aSharedJsonSerialization/folder at the same level.Deviation:
While the
SharedJsonSerializationfolder was created, the helpers were placed inSharedJsonSerialization/Reading/andSharedJsonSerialization/Writing/subfolders to better organize the code by concern, rather than keeping them all at the root ofSharedJsonSerialization/.5. Success Payload Wrapping
Reference:
0015-cloud-events-write-streamlining.mdOriginal Plan:
For successful
Result<T>, thedatapayload was supposed to contain the serialized value ofTdirectly when success metadata is not included. It would only wrap the value in{ "value": <T>, "metadata": { ... } }if metadata was included.Deviation:
As documented in the streamlining plan, the implementation now always wraps the success payload in an object. If no metadata exists, it writes
{ "value": <T> }. This simplifies the JSON schema for consumers, as the payload is always an object with avalueproperty, rather than sometimes being a primitive and sometimes an object.6. CloudEvent ID Generation
Reference:
0015-cloud-events-serialization.mdOriginal Plan:
The original plan implied using
Guid.NewGuid()(UUIDv4) to generate unique identifiers for CloudEvents when an ID is not explicitly provided.Deviation:
To improve sortability and database insertion performance for consumers of these events, the implementation was updated to use the
Ulidpackage. It now generates a UUIDv7 viaUlid.NewUlid().ToGuid().ToString()instead of a standard UUIDv4.Summary
The core requirements of the original plan (CloudEvents v1.0 compliance, attribute resolution, data payload formatting) remain fulfilled. The deviations are purely architectural improvements focused on:
System.Text.Jsonpipeline, allowing callers to customize serialization via standard STJ mechanisms.