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
fix: serialize wire fields at top level from every entry point (0.5.1)
The v0.5.0 contract defines model, provider, input_tokens, output_tokens,
total_tokens, duration_ms, ttft_ms, and cost as top-level Event properties
so the ingest server writes them into typed Postgres columns. Two SDK paths
leaked them into metadata instead, silently bypassing the typed-column
path once the server started reading them from the top of the payload:
- Generation.event() took only (type, metadata) so wire fields passed
via metadata stayed inside metadata rather than surfacing top-level.
- Feature.generation() passed model top-level via the merged spread AND
injected baseMetadata.model = this.defaults.model, duplicating it
into metadata. It also didn't accept per-call tokens/cost/latency.
- Feature.track() never forwarded model/provider defaults to TrackEvent
top-level, only into metadata.feature.
Fix: Generation.event() now types wire keys explicitly on the metadata
param and destructures them out before sending (they land at the top of
TrackEvent, not metadata). Feature.generation() accepts per-call wire
fields and no longer duplicates model into baseMetadata. Feature.track()
forwards model/provider defaults top-level.
Added "wire-level fields" regression block in tests/tracking.test.ts
covering track(), generation(), gen.event(), feature.generation(),
feature.track(), feature-default, and per-call override paths. Updated
the test that asserted metadata.model == "gpt-4o" to assert top-level
and absence from metadata.
0 commit comments