Skip to content

Commit 1e2424c

Browse files
nficanocursoragent
andcommitted
fix: align envelope timestamp precision and hide codec helpers (#107 #109)
EnvelopeMetadataCodec encodes the envelope timestamp with DateTimeInterface::RFC3339_EXTENDED (millisecond precision), matching the EventLog row format, and its scope/trace/correlation/endpoint splitter helpers are now private since they are only used internally. Co-authored-by: Cursor <cursoragent@cursor.com>
1 parent 0b34805 commit 1e2424c

2 files changed

Lines changed: 6 additions & 6 deletions

File tree

src/Internal/Json/EnvelopeMetadataCodec.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public function envelopeToArray(Envelope $env): array
3535
'arcp' => $env->arcp,
3636
'id' => (string) $env->id,
3737
'type' => $env->type(),
38-
'timestamp' => $env->timestamp->format('Y-m-d\\TH:i:s.up'),
38+
'timestamp' => $env->timestamp->format(\DateTimeInterface::RFC3339_EXTENDED),
3939
];
4040
if ($env->priority !== Priority::Normal) {
4141
$out['priority'] = $env->priority->value;
@@ -52,7 +52,7 @@ public function envelopeToArray(Envelope $env): array
5252
/**
5353
* @return array<string, string>
5454
*/
55-
public function scopeIdsToArray(Envelope $env): array
55+
private function scopeIdsToArray(Envelope $env): array
5656
{
5757
$out = [];
5858
if ($env->sessionId instanceof SessionId) {
@@ -73,7 +73,7 @@ public function scopeIdsToArray(Envelope $env): array
7373
/**
7474
* @return array<string, string>
7575
*/
76-
public function traceIdsToArray(Envelope $env): array
76+
private function traceIdsToArray(Envelope $env): array
7777
{
7878
$out = [];
7979
if ($env->traceId instanceof TraceId) {
@@ -91,7 +91,7 @@ public function traceIdsToArray(Envelope $env): array
9191
/**
9292
* @return array<string, string>
9393
*/
94-
public function correlationIdsToArray(Envelope $env): array
94+
private function correlationIdsToArray(Envelope $env): array
9595
{
9696
$out = [];
9797
if ($env->correlationId instanceof MessageId) {
@@ -109,7 +109,7 @@ public function correlationIdsToArray(Envelope $env): array
109109
/**
110110
* @return array<string, mixed>
111111
*/
112-
public function endpointsToArray(Envelope $env): array
112+
private function endpointsToArray(Envelope $env): array
113113
{
114114
$out = [];
115115
if ($env->source !== null) {

tests/Unit/fixtures/envelopes/event_emit_full.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"arcp": "1.1",
33
"id": "msg_01JABC",
44
"type": "event.emit",
5-
"timestamp": "2026-05-09T13:00:00.000000Z",
5+
"timestamp": "2026-05-09T13:00:00.000+00:00",
66
"payload": {
77
"type": "subscription.backfill_complete",
88
"attributes": {

0 commit comments

Comments
 (0)