计划执行与检查节点
executing-plans
按既定实施计划完成工作,保持过程检查和反馈。
modifying-taxonomic-filter【效率与协作】Guides safe changes to the TaxonomicFilter, PostHog's picker for events, actions, properties, cohorts, and more. Use when adding features, fixing bugs, improving search or loading performance, or refactoring the classic picker, rebuild menu, or headless filter panel. Covers real selection behavior, two live surfaces, shared telemetry, the conditional…
独立 GitHub 快照 · 自动分类 · 以原作者文档为准
The TaxonomicFilter is the picker users hit to choose any "thing PostHog
knows about" — events, properties, actions, cohorts, groups. It's the
on-ramp into almost every analytics and replay configuration. Code lives
in frontend/src/lib/components/TaxonomicFilter/.
Three guardrails:
Ratios from production telemetry. Re-run via references/refreshing-product-reality.md when older than ~3 months.
| Source group type | Share |
|---|---|
events | ~40% |
event_properties | ~30% |
person_properties | ~14% |
cohorts | ~2% |
email_addresses | ~2% |
actions | ~2% |
pageview_urls | ~1% |
| everything else | <1% |
| Term | Share |
|---|---|
email | ~29% |
url | ~22% |
user | ~12% |
utm | ~10% |
page | ~9% |
path | ~8% |
current | ~6% |
country | ~5% |
email and url are over half the top-8. They're the entire reason
PROMOTED_PROPERTIES_BY_SEARCH_TERM (in infiniteListLogic.ts) maps
them to $email and $current_url at position 0. Touching
promotion or ordering needs explicit human sign-off.
email, url, utm, path against cohorts, event_feature_flags,
session_properties produce most empty-result events — users type the
same canonical terms across every tab. Tab order, suggested-filters
aggregation, and shortcut routing are how they get to the right answer.
~93% typed, ~7% pasted. Both feed inputMode on taxonomic_filter_search_query.
Treat property shapes as a public API. Every taxonomic filter * event now
carries a surface property (legacy-pill / rebuild-menu) so the
surfaces are distinguishable by an explicit property. The classic-picker stamp comes from
legacyTaxonomicSurface() in taxonomicFilterSurface.ts; the rebuild stamps
rebuild-menu from menu/TaxonomicFilterMenu.tsx.
Shared events both surfaces emit (keep these comparable across arms):
taxonomic filter closed — surface, dwellMs, hadSelection (legacy
also sends groupType; the rebuild omits it — there's no single active
tab at close)taxonomic filter item selected — surface, groupType,
sourceGroupType, wasFromRecents, wasFromPinnedList, wasQuickFilter,
hadSearchInput, position, query, wasStaleLegacy-only: taxonomic_filter_search_query
(searchQuery, groupType, inputMode, pastedFraction),
taxonomic filter empty result (groupType, searchQuery),
taxonomic filter include stale toggled,
taxonomic filter category dropdown opened (pill only).
Rebuild-only menu events: taxonomic filter menu opened / drilled /
closed / option clicked / item selected.
When you add a property to a shared event, add it to both emitters or the arms stop being comparable. Adding properties: fine. Removing dead ones: fine. Renaming or repurposing silently is the worst case — dashboards keep working and start lying.
One feature flag selects between two surfaces. A bug report that doesn't reproduce locally is almost always a variant mismatch — confirm which surface the reporter is on first.
| Surface | Flag | Value | What renders |
|---|---|---|---|
legacy-pill | TAXONOMIC_FILTER_MENU_REBUILD | off | classic picker with a category dropdown |
rebuild-menu | TAXONOMIC_FILTER_MENU_REBUILD | on | ground-up rewrite in menu/ over headless/ |
taxonomicFilterLogic.tsx +
InfiniteList) with a suffix category dropdown. A person can pin the
category rail from that dropdown.@adamleith) being
tested internally. It is a fresh implementation: the menu/ dropdown
and combobox UI on top of headless/ (a hooks-based filter panel). It
does not route through taxonomicFilterLogic/infiniteListLogic;
it has its own group definitions, fetch/pagination, and ordering. See
headless/UX_SPEC.md for its design source of truth.The rebuild is opt-in in exactly two consumer wrappers:
TaxonomicPopover.tsx and
PropertyFilters/components/TaxonomicPropertyFilter.tsx. Both check
TAXONOMIC_FILTER_MENU_REBUILD and render <TaxonomicFilterMenu> or the
legacy <TaxonomicFilter>. A call site reaching one of those wrappers can
still land on the legacy path: TaxonomicPopover renders the rebuild only
when newMenuSupportsCallSite holds (!allowClear && closeOnChange && ref == null), because the rebuilt menu cannot honour those three capabilities.
So "does this reach the rebuild?" depends on the wrapper and the props
that call site passes, not a single global switch — ActionFilterRow goes
through TaxonomicPopover and passes none of the three, so it does reach
the rebuild. Only a call site that hand-rolls its own popover around
<TaxonomicFilter> bypasses the wrappers entirely.
Touching tab/group rendering means testing all three surfaces.
The rebuild reimplements the legacy data layer rather than reusing it, so the same concern lives in two files. There is no lint rule or test enforcing parity — the only guard is "Mirrors the legacy…" comments. When you change one, change the other (or flag to the human that you can't).
| Concern | Legacy | Rebuild |
|---|---|---|
| Group definitions (endpoint, excluded props, group meta) | taxonomicFilterLogic.tsx taxonomicGroups selector | utils/buildTaxonomicGroups.tsx |
| Group ordering + SuggestedFilters injection | taxonomicFilterLogic.tsx taxonomicGroupTypes selector | hooks/useTaxonomicFilter.ts resolveTaxonomicGroupTypes |
| Per-tab fetch / pagination / min-query-length | infiniteListLogic.ts | hooks/useGroupList.ts + useTaxonomicResource.ts + fetchTaxonomicListPage.ts |
| Data-warehouse config flow | inline in InfiniteList.tsx | menu/DwhFlow.tsx |
taxonomic filter item selected / closed telemetry | taxonomicFilterLogic.tsx | menu/TaxonomicFilterMenu.tsx |
New TaxonomicFilterGroupType enum value | types.ts (shared) — then add group config in both tables above | |
| Logic-backed group data (Actions, Dashboards, …) | already in kea | also register in hooks/useTaxonomicLocalOverrides.ts |
Genuinely shared — change once: types.ts (the enum),
utils/promoteProperties.ts (PROMOTED_PROPERTIES_BY_SEARCH_TERM),
recentTaxonomicFiltersLogic.ts and
taxonomicFilterPinnedPropertiesLogic.ts (the rebuild reads recents/pinned
through these via a bridge, it doesn't fork them).
redistributeTopMatches is legacy-only, not shared: it lives in
taxonomicFilterLogic.tsx and the rebuild never calls it.
One intentional divergence is already documented in
useTaxonomicFilter.ts: both surfaces lead with SuggestedFilters when the
picker has more than one substantive group. Preserve documented divergences;
don't "fix" them into parity.
legacy-pill,
rebuild-menurebuild-menu opt-in to the human reviewerhogli test frontend/src/lib/components/TaxonomicFilter/