Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

fix(llma): guard undefined condition.properties in evaluations table (#57651)

Andrew Maguire3cf5a1a22ed4
diff --git a/products/llm_analytics/frontend/evaluations/LLMAnalyticsEvaluationsScene.tsx b/products/llm_analytics/frontend/evaluations/LLMAnalyticsEvaluationsScene.tsx
index 92abb2e29be0..b3bbefc4f789 100644
--- a/products/llm_analytics/frontend/evaluations/LLMAnalyticsEvaluationsScene.tsx
+++ b/products/llm_analytics/frontend/evaluations/LLMAnalyticsEvaluationsScene.tsx
@@ -199,13 +199,16 @@ function LLMAnalyticsEvaluationsContent({ tabId }: { tabId?: string }): JSX.Elem
key: 'conditions',
render: (_, evaluation) => (
<div className="flex flex-wrap gap-1">
- {evaluation.conditions.map((condition) => (
- <LemonTag key={condition.id} type="option">
- {parseFloat((condition.rollout_percentage ?? 0).toFixed(2))}%
- {condition.properties.length > 0 &&
- ` when ${condition.properties.length} condition${condition.properties.length !== 1 ? 's' : ''}`}
- </LemonTag>
- ))}
+ {evaluation.conditions.map((condition) => {
+ const propertyCount = condition.properties?.length ?? 0
+ return (
+ <LemonTag key={condition.id} type="option">
+ {parseFloat((condition.rollout_percentage ?? 0).toFixed(2))}%
+ {propertyCount > 0 &&
+ ` when ${propertyCount} condition${propertyCount !== 1 ? 's' : ''}`}
+ </LemonTag>
+ )
+ })}
{evaluation.conditions.length === 0 && <span className="text-muted text-sm">No triggers</span>}
</div>
),
diff --git a/products/llm_analytics/frontend/evaluations/types.ts b/products/llm_analytics/frontend/evaluations/types.ts
index 7105f4f55dd8..35c37929b301 100644
--- a/products/llm_analytics/frontend/evaluations/types.ts
+++ b/products/llm_analytics/frontend/evaluations/types.ts
@@ -62,7 +62,9 @@ export interface EvaluationConditionSet {
// Optional because the backend serializer has `default=100` (not `required=True`), so legacy
// condition rows stored in the JSONField before the field existed read back without the key.
rollout_percentage?: number
- properties: AnyPropertyFilter[]
+ // Optional for the same reason: conditions live in a free-form JSONField and the inner shape
+ // isn't validated, so legacy rows can come back without a `properties` key.
+ properties?: AnyPropertyFilter[]
}
export interface EvaluationRun {