fix: type properties as record on events list schema (untested)#86
fix: type properties as record on events list schema (untested)#86kylegrahammatzen wants to merge 1 commit into
Conversation
|
@kylegrahammatzen is attempting to deploy a commit to the Autumn Team on Vercel. A member of the Team first needs to authorize it. |
EntelligenceAI PR SummaryRelaxes the
Confidence Score: 4/5 - Mostly SafeSafe to merge — the change in Key Findings:
Files requiring special attention
|
WalkthroughThis update relaxes the Changes
Sequence DiagramThis diagram shows the interactions between components: sequenceDiagram
participant Client
participant EventsListItemSchema as "EventsListItemSchema (Zod)"
participant Consumer as "Schema Consumer"
Client->>EventsListItemSchema: Parse event data
Note over EventsListItemSchema: Validates fields:<br/>feature_id, customer_id,<br/>value, properties
alt properties is flexible map (new behavior)
EventsListItemSchema-->>Client: Accepts any string-keyed properties
Note over EventsListItemSchema: z.record(z.string(), z.unknown())<br/>allows dynamic JSONB fields
else properties was empty object (old behavior)
EventsListItemSchema-->>Client: Rejected unknown property keys
Note over EventsListItemSchema: z.object({}) blocked<br/>dynamic JSONB fields
end
Client->>Consumer: Pass validated EventsListItem
Note over Consumer: EventsListItem type now includes<br/>properties: Record<string, unknown>
🔗 Cross-Repository Impact AnalysisEnable automatic detection of breaking changes across your dependent repositories. → Set up now Learn more about Cross-Repository AnalysisWhat It Does
How to Enable
Benefits
|
Summary
Fixes the SDK events list schema so
propertiessupports arbitrary JSON values.Related Issues
Fixes an issue where
propertieswas not being returned correctly in the SDK.Type of Change
Checklist
Screenshots (if applicable)
N/A
Additional Context
Changes
propertiesfrom an empty object schema to a record in the SDK.Summary by cubic
Fixes the events list schema so
propertiessupports arbitrary JSON and returns correctly in the SDK. Replacesz.object({})withz.record(z.string(), z.unknown())to match JSONB storage.Written for commit 51e86c1. Summary will update on new commits.
Greptile Summary
This PR corrects the Zod schema for
EventsListItemSchema.properties, replacing the semantically incorrectz.object({})withz.record(z.string(), z.unknown()), which properly represents arbitrary JSONB key-value data returned by the events list API.Key changes:
propertiesinEventsListItemSchemawas typed asz.object({}), which in Zod validates only an empty object and strips or rejects all actual properties at runtime — incorrect for a JSONB column that holds arbitrary data.EventsListItem.propertieschanges from{}toRecord<string, unknown>, now accurately reflecting the data shape returned by the API. Existing consumers (Object.keys()andJSON.stringify()inevent-list-viewer.tsx) are fully compatible with this new type.Confidence Score: 4/5
Safe to merge — targeted, correct fix for an incorrect Zod schema type with no breaking consumers
Single-line change is logically correct: z.record(z.string(), z.unknown()) properly represents JSONB data. No existing code is broken by the type change (only usages are Object.keys() and JSON.stringify()). Minor concern is that the author self-flagged the change as untested.
No files require special attention; the change is minimal and isolated to a single schema definition.
Important Files Changed
propertiesschema from restrictive empty object toRecord<string, unknown>, correctly representing arbitrary JSONB dataSequence Diagram
sequenceDiagram participant C as Client participant SDK as Autumn SDK participant API as Autumn API C->>SDK: events.list(params) SDK->>API: GET /events (paginated) API-->>SDK: JSON response with properties (JSONB) SDK->>SDK: Parse via EventsListItemSchema Note over SDK: properties: z.record(z.string(), z.unknown())<br/>Previously: z.object({}) — stripped all props SDK-->>C: EventsListItem[] with full propertiesReviews (1): Last reviewed commit: "fix: type properties as record on events..." | Re-trigger Greptile
Context used: