Skip to content

feat(customer-analytics): add value suggestions endpoint for account custom properties - #69500

Merged
arthurdedeus merged 5 commits into
masterfrom
posthog-code/custom-property-value-suggestions
Jul 9, 2026
Merged

feat(customer-analytics): add value suggestions endpoint for account custom properties#69500
arthurdedeus merged 5 commits into
masterfrom
posthog-code/custom-property-value-suggestions

Conversation

@arthurdedeus

Copy link
Copy Markdown
Contributor

Problem

Part 1/3 of custom property filters for the accounts list (split from #69415). The filter UI needs value suggestions per custom property, and the lazy join's boolean coalescing breaks typed filtering.

Changes

  • Add GET custom_property_definitions/values/?key=<id>&value=<search>: select → option labels, boolean → true/false, text/numeric → distinct active values (soft-deleted and other teams excluded)
  • Coalesce boolean custom property values to 'true'/'false' in the lazy join (the federated read maps PostgreSQL boolean to UInt8, so toString() yields '1'/'0')
  • Exclude the new endpoint from MCP tools
  • Add query-runner tests proving a WHERE-only reference expands the custom-properties lazy join and that typed predicates round-trip

How did you test this code?

Unit tests: suggestions logic (select labels, soft-delete + team isolation, numeric formatting), endpoint envelope, and query-runner lazy-join/typed round-trip tests — 83 passing.

👉 Stay up-to-date with PostHog coding conventions for a smoother review.

Automatic notifications

  • Publish to changelog?
  • Alert Sales and Marketing teams?

Docs update

No

🤖 Agent context

Autonomy: Human-driven (agent-assisted)

Authored by Claude Code (PostHog Code); split out of #69415 by layer. Skills invoked: /improving-drf-endpoints, /writing-tests. The endpoint response shape ({results: [{name}], refreshing}) matches the shared property-values picker contract on the frontend, which lands in the follow-up PRs.


Created with PostHog Code

…custom properties

Generated-By: PostHog Code
Task-Id: 3faf9d95-024e-4878-bd8b-57e2e9e46724
@arthurdedeus arthurdedeus self-assigned this Jul 8, 2026
@github-actions

github-actions Bot commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

🤖 CI report

Bundle size — 🟢 -6.06 MiB (-8.0%)

Uncompressed size of every built .js bundle, compared against the base branch.

Total: 69.86 MiB · 🟢 -6.06 MiB (-8.0%)

File Size Δ vs base
toolbar/src/toolbar/toolbar.js removed 🟢 -8.20 MiB (-100.0%)
toolbar/src/toolbar/toolbar-app.js 1.72 MiB 🔺 +1.72 MiB (new)
toolbar/_parent/node_modules/.pnpm/@microlink+react-json-view@1.31.18_@types+react@18.3.27_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@microlink/react-json-view/chunk-react-json-view.js 118.1 KiB 🔺 +118.1 KiB (new)
toolbar/_parent/node_modules/.pnpm/@posthog+hedgehog-mode@0.0.52_prop-types@15.8.1_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@posthog/hedgehog-mode/dist/chunk-WebGLRenderer-B9SslEoR.js 66.8 KiB 🔺 +66.8 KiB (new)
toolbar/_parent/node_modules/.pnpm/@posthog+hedgehog-mode@0.0.52_prop-types@15.8.1_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@posthog/hedgehog-mode/dist/chunk-browserAll-B9HUh2ga.js 42.3 KiB 🔺 +42.3 KiB (new)
toolbar/_parent/node_modules/.pnpm/@posthog+hedgehog-mode@0.0.52_prop-types@15.8.1_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@posthog/hedgehog-mode/dist/chunk-WebGPURenderer-CJNmoL9Y.js 37.4 KiB 🔺 +37.4 KiB (new)
toolbar/_parent/node_modules/.pnpm/@posthog+hedgehog-mode@0.0.52_prop-types@15.8.1_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@posthog/hedgehog-mode/dist/chunk-BitmapFont-Kp8dxRC_.js 33.5 KiB 🔺 +33.5 KiB (new)
render-query/src/render-query/render-query.js 24.09 MiB 🔺 +22.6 KiB (+0.1%)
toolbar/_parent/node_modules/.pnpm/@posthog+hedgehog-mode@0.0.52_prop-types@15.8.1_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@posthog/hedgehog-mode/dist/chunk-CanvasRenderer-CA8rr1_L.js 17.5 KiB 🔺 +17.5 KiB (new)
toolbar/_parent/node_modules/.pnpm/@posthog+hedgehog-mode@0.0.52_prop-types@15.8.1_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@posthog/hedgehog-mode/dist/chunk-react-shadow.esm-BW2Z38yN.js 7.3 KiB 🔺 +7.3 KiB (new)
posthog-app/_parent/products/metrics/frontend/MetricsScene.js 31.2 KiB 🔺 +6.7 KiB (+27.3%)
exporter/_parent/products/metrics/frontend/MetricsScene.js 30.1 KiB 🔺 +6.7 KiB (+28.5%)
exporter/_parent/products/replay_vision/frontend/replay_scanners/ReplayScanner.js 70.2 KiB 🔺 +5.6 KiB (+8.6%)
posthog-app/_parent/products/replay_vision/frontend/replay_scanners/ReplayScanner.js 71.8 KiB 🔺 +5.6 KiB (+8.4%)
exporter/_parent/products/tracing/frontend/TracingScene.js 88.9 KiB 🔺 +5.3 KiB (+6.3%)
posthog-app/_parent/products/tracing/frontend/TracingScene.js 89.8 KiB 🔺 +5.3 KiB (+6.2%)
exporter/src/exporter/scenes/ExporterNotebookScene.js 2.87 MiB 🔺 +5.2 KiB (+0.2%)
posthog-app/_parent/products/customer_analytics/frontend/components/AccountRelationshipsInput/CyclotronJobInputAccountRelationships.js 3.8 KiB 🔺 +3.8 KiB (new)
exporter/_parent/products/customer_analytics/frontend/components/AccountRelationshipsInput/CyclotronJobInputAccountRelationships.js 3.7 KiB 🔺 +3.7 KiB (new)
exporter/_parent/products/ai_observability/frontend/prompts/LLMPromptScene.js 37.5 KiB 🔺 +2.4 KiB (+6.9%)
posthog-app/_parent/products/ai_observability/frontend/prompts/LLMPromptScene.js 39.0 KiB 🔺 +2.4 KiB (+6.6%)
posthog-app/src/scenes/inbox/InboxScene.js 635.3 KiB 🔺 +2.1 KiB (+0.3%)
exporter/src/queries/schema.js 977.1 KiB 🔺 +1.8 KiB (+0.2%)
posthog-app/src/queries/schema.js 977.1 KiB 🔺 +1.8 KiB (+0.2%)
exporter/_parent/products/conversations/frontend/scenes/ticket/SupportTicketScene.js 48.8 KiB 🔺 +1.1 KiB (+2.3%)
posthog-app/_parent/products/conversations/frontend/scenes/ticket/SupportTicketScene.js 41.5 KiB 🔺 +1.1 KiB (+2.6%)
exporter/src/exporter/scenes/ExporterHeatmapScene.js 19.0 KiB 🟢 -1.1 KiB (-5.3%)

Posted automatically by build-bundle-size-report · uncompressed bytes from dist-report

Eager graph — within budget

How much code each root ships on the eager path — downloaded and parsed before the surface is interactive. Measured from the esbuild output chunks (post-tree-shake, static imports only); lazy import() / React.lazy chunks are not counted.

Root Eager (shipped) Δ vs base Budget
entry (logged-out pages, app bootstrap)
src/index.tsx
1.20 MiB · 22 files 🔺 +4.2 KiB (+0.3%) ███░░░░░░░ 28.0% of 4.29 MiB
authenticated shell (every logged-in page)
src/scenes/AuthenticatedShell.tsx
8.07 MiB · 2,956 files 🔺 +22.4 KiB (+0.3%) █████████░ 87.2% of 9.25 MiB

🟢 node_modules/monaco-editor/ stays out of src/index.tsx
🟢 src/lib/components/ActivityLog/describers stays out of src/index.tsx
🟢 [object Object] stays out of src/index.tsx
🟢 [object Object] stays out of src/index.tsx
🟢 node_modules/monaco-editor/ stays out of src/scenes/AuthenticatedShell.tsx
🟢 src/lib/components/ActivityLog/describers stays out of src/scenes/AuthenticatedShell.tsx
🟢 [object Object] stays out of src/scenes/AuthenticatedShell.tsx
🟢 [object Object] stays out of src/scenes/AuthenticatedShell.tsx

Largest files eagerly shipped from src/index.tsx
Size File
126.8 KiB ../node_modules/.pnpm/react-dom@18.3.1_react@18.3.1/node_modules/react-dom/cjs/react-dom.production.min.js
24.6 KiB ../node_modules/.pnpm/buffer@6.0.3/node_modules/buffer/index.js
6.3 KiB ../node_modules/.pnpm/react@18.3.1/node_modules/react/cjs/react.production.min.js
4.5 KiB ../node_modules/.pnpm/@jspm+core@2.1.0/node_modules/@jspm/core/nodelibs/browser/process.js
3.9 KiB ../node_modules/.pnpm/scheduler@0.23.2/node_modules/scheduler/cjs/scheduler.production.min.js
1.4 KiB ../node_modules/.pnpm/base64-js@1.5.1/node_modules/base64-js/index.js
1.3 KiB src/RootErrorBoundary.tsx
912 B ../node_modules/.pnpm/ieee754@1.2.1/node_modules/ieee754/index.js
789 B src/scenes/ChunkLoadErrorBoundary.tsx
668 B src/index.tsx
Largest files eagerly shipped from src/scenes/AuthenticatedShell.tsx
Size File
277.1 KiB ../node_modules/.pnpm/posthog-js@1.398.2/node_modules/posthog-js/dist/rrweb.js
266.9 KiB ../node_modules/.pnpm/@posthog+icons@0.37.4_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@posthog/icons/dist/posthog-icons.es.js
224.6 KiB src/taxonomy/core-filter-definitions-by-group.json
213.6 KiB ../node_modules/.pnpm/posthog-js@1.398.2/node_modules/posthog-js/dist/module.js
164.0 KiB src/queries/validators.js
154.0 KiB ../node_modules/.pnpm/re2js@0.4.1/node_modules/re2js/build/index.esm.js
126.8 KiB ../node_modules/.pnpm/react-dom@18.3.1_react@18.3.1/node_modules/react-dom/cjs/react-dom.production.min.js
105.7 KiB src/lib/api.ts
93.3 KiB ../node_modules/.pnpm/prosemirror-view@1.40.1/node_modules/prosemirror-view/dist/index.js
90.5 KiB ../node_modules/.pnpm/@tiptap+core@3.20.1_@tiptap+pm@3.20.1/node_modules/@tiptap/core/dist/index.js

Posted automatically by check-eager-graph · sizes are eager output bytes (shipped, post-tree-shake) from the esbuild metafile · part of #32479

Dist folder size — 🟢 -20.26 MiB (-1.4%)

Total size of the built frontend/dist folder (all assets), compared against the base branch.

Total: 1433.69 MiB · 🟢 -20.26 MiB (-1.4%)

ℹ️ MCP UI apps size — 31 app(s), 15642.0 KB JS

Built size of each MCP UI app (main.js + styles.css).

App JS CSS
debug 579.0 KB 173.6 KB
action 426.8 KB 173.6 KB
action-list 543.7 KB 173.6 KB
cohort 425.8 KB 173.6 KB
cohort-list 542.7 KB 173.6 KB
email-template 425.7 KB 173.6 KB
error-details 442.6 KB 173.6 KB
error-issue 426.5 KB 173.6 KB
error-issue-list 543.6 KB 173.6 KB
experiment 540.9 KB 173.6 KB
experiment-list 544.5 KB 173.6 KB
experiment-results 542.7 KB 173.6 KB
feature-flag 546.4 KB 173.6 KB
feature-flag-list 550.0 KB 173.6 KB
feature-flag-testing 429.6 KB 173.6 KB
insight-actors 541.6 KB 173.6 KB
invite-email-preview 425.1 KB 173.6 KB
llm-costs 539.0 KB 173.6 KB
session-recording 427.6 KB 173.6 KB
session-summary 432.9 KB 173.6 KB
survey 427.4 KB 173.6 KB
survey-global-stats 541.8 KB 173.6 KB
survey-list 544.4 KB 173.6 KB
survey-stats 541.8 KB 173.6 KB
trace-span 426.2 KB 173.6 KB
trace-span-list 543.6 KB 173.6 KB
workflow 426.2 KB 173.6 KB
workflow-list 543.1 KB 173.6 KB
query-results 724.5 KB 173.6 KB
render-ui 615.7 KB 173.6 KB
visual-review-snapshots 430.6 KB 173.6 KB

Comment thread products/customer_analytics/backend/logic/custom_property_values.py Outdated
Comment thread products/customer_analytics/backend/logic/custom_property_values.py
Comment thread products/customer_analytics/backend/logic/custom_property_values.py
@arthurdedeus
arthurdedeus marked this pull request as ready for review July 9, 2026 18:21
@github-actions

github-actions Bot commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

🦔 Hogbox preview · ✅ ready

▶ Open the preview

🔑 Login test@posthog.com / 12345678 (demo data)
🧩 Running this PR's backend and frontend, on the PostHog :master base
🔗 Link stable across rebuilds — a re-push swaps the box underneath, the URL stays
🔒 Access tailnet only (PostHog VPN)
💤 Idle sleeps after ~30 min idle (snapshot to S3, zero node cost) and wakes on your next visit in ~30s, behind a brief "waking up" screen

commit d7592b5 · box box-50335bc09f35 · ready in 490s (push → usable) · build log · rebuilds on every push, torn down on close

@pr-assigner-resolver-posthog
pr-assigner-resolver-posthog Bot requested a review from a team July 9, 2026 18:21
- numeric search: filter formatted values before the 50-item limit fills, instead of slicing the queryset first (searches beyond the 50 smallest values no longer return empty)
- skip non-finite value_num rows instead of crashing the endpoint on a stray row
- skip options with missing/empty labels in select suggestions

Generated-By: PostHog Code
Task-Id: 9a9664d7-c2a8-4c3a-9e25-967ee99ae9d9
@github-actions
github-actions Bot requested a deployment to preview-pr-69500 July 9, 2026 18:23 In progress
Comment thread products/customer_analytics/backend/presentation/views/views.py
@greptile-apps

greptile-apps Bot commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Reviews (1): Last reviewed commit: "fix(customer-analytics): apply review fi..." | Re-trigger Greptile

Comment thread products/customer_analytics/backend/logic/custom_property_values.py Outdated
Generated-By: PostHog Code
Task-Id: 9a9664d7-c2a8-4c3a-9e25-967ee99ae9d9
Comment thread products/customer_analytics/backend/presentation/views/views.py
@veria-ai

veria-ai Bot commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

PR overview

All previously flagged issues have been addressed. No open security concerns remain on this pull request.

Security review

No open security issues remain on this pull request.

Fixed/addressed: 1 · PR risk: 0/10

@trunk-io

trunk-io Bot commented Jul 9, 2026

Copy link
Copy Markdown

Static BadgeStatic BadgeStatic BadgeStatic Badge

View Full Report ↗︎Docs

…dynamic ORM keys

Clears the semgrep orm-field-injection finding: instead of interpolating a column name into .exclude() dict keys, branch on the data type and use literal field lookups for the numeric and string paths.

Generated-By: PostHog Code
Task-Id: 9a9664d7-c2a8-4c3a-9e25-967ee99ae9d9
…r mypy

Generated-By: PostHog Code
Task-Id: 9a9664d7-c2a8-4c3a-9e25-967ee99ae9d9

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All three bot-raised concerns (numeric-search truncation, blank select labels, non-finite crash, and the resource-level-vs-object-level access model) were fixed or credibly rebutted with a diff-verified fix and tests; the access-control pattern matches the product's own documented, accepted architecture (confirmed by reading the CLAUDE.md and the viewset's existing scope_object/mixin usage), and the author is on the owning team with STRONG familiarity, giving independent assurance for this API-surface change.

  • Author wrote 100% of the modified lines and has 68 merged PRs in these paths (familiarity STRONG).
  • arthurdedeus reviewed the current head.
Gate mechanics and policy version
Gate Result
prerequisites all clear
deny-list no deny categories matched
size 175L, 7F substantive, 400L/12F incl. docs/generated/snapshots — within ceiling
tier T1-agent / T1d-complex (400L, 12F, two-areas, feat)
stamphog 2.0.0b3 .stamphog/policy.yml @ bf52e45 · reviewed head d7592b5

@arthurdedeus
arthurdedeus enabled auto-merge (squash) July 9, 2026 20:41
@arthurdedeus
arthurdedeus merged commit 8bc5689 into master Jul 9, 2026
330 checks passed
@arthurdedeus
arthurdedeus deleted the posthog-code/custom-property-value-suggestions branch July 9, 2026 20:42
@deployment-status-posthog

deployment-status-posthog Bot commented Jul 9, 2026

Copy link
Copy Markdown

Deploy status

Environment Status Deployed At Workflow
dev ✅ Deployed 2026-07-09 21:15 UTC Run
prod-us ✅ Deployed 2026-07-09 21:28 UTC Run
prod-eu ✅ Deployed 2026-07-09 21:30 UTC Run

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

stamphog Request AI approval (no full review)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants