: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.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
feat(growth): map Harmonic customer type and funding null-status, drop VENTURE_UNKNOWN placeholder (#79068)
Matt Brooker9bf5f4a06207
diff --git a/ee/billing/salesforce_enrichment/constants.py b/ee/billing/salesforce_enrichment/constants.pyindex cb38d742dd54..19c2bdf693a8 100644--- a/ee/billing/salesforce_enrichment/constants.py+++ b/ee/billing/salesforce_enrichment/constants.py@@ -27,6 +27,8 @@ mutation($identifiers: CompanyEnrichmentIdentifiersInput!) {headcountdescriptionownershipStatus+ customerType+ fundingAttributeNullStatusrelatedCompanies {acquiredBy {companyUrndiff --git a/products/growth/backend/enrichment/fields.py b/products/growth/backend/enrichment/fields.pyindex c6ac60c90250..0f5e201f0d76 100644--- a/products/growth/backend/enrichment/fields.py+++ b/products/growth/backend/enrichment/fields.py@@ -46,6 +46,8 @@ class EnrichmentFields:ownership_status: Optional[str] = Noneparent_company: Optional[str] = Noneparent_company_domain: Optional[str] = None+ customer_type: Optional[str] = None+ funding_status: Optional[str] = Nonedef to_dict(self) -> dict[str, Any]:"""Return set (non-None) fields keyed by registry name."""diff --git a/products/growth/backend/enrichment/transform.py b/products/growth/backend/enrichment/transform.pyindex 1069f65d185d..ac7479669812 100644--- a/products/growth/backend/enrichment/transform.py+++ b/products/growth/backend/enrichment/transform.py@@ -38,6 +38,26 @@ def _funding_date(value: Any) -> Optional[str]:return None+# Harmonic's catch-all when it has no real funding-stage signal, distinct from a company it has+# genuinely confirmed raised nothing. ~83% of fetched stages are this shell with no round data+# behind it (prod-checked Aug 2026), so passing it through as funding_stage reads as a real signal+# to downstream consumers when it is actually an absence of one.+_FUNDING_STAGE_UNKNOWN_PLACEHOLDER = "VENTURE_UNKNOWN"+++def _has_substantiating_round_data(funding: dict[str, Any]) -> bool:+ total = funding.get("fundingTotal")+ rounds = funding.get("numFundingRounds")+ return (isinstance(total, (int, float)) and total > 0) or (isinstance(rounds, (int, float)) and rounds > 0)+++def _funding_stage(funding: dict[str, Any]) -> Optional[str]:+ stage = funding.get("fundingStage")+ if stage == _FUNDING_STAGE_UNKNOWN_PLACEHOLDER and not _has_substantiating_round_data(funding):+ return None+ return stage++# Bound the passthrough so the group property can't grow unboundedly for a heavily-funded company.MAX_INVESTORS = 25@@ -97,7 +117,7 @@ def transform_harmonic_company(company: Optional[dict[str, Any]]) -> Optional[En# ISO alpha-2 to match the format the icp_country group property already holds.country=country_name_to_iso_code(location.get("country")),founded_year=_founded_year(founding),- funding_stage=funding.get("fundingStage"),+ funding_stage=_funding_stage(funding),total_raised=_funding_amount(funding.get("fundingTotal")),last_round_size=_funding_amount(funding.get("lastFundingTotal")),last_round_date=_funding_date(funding.get("lastFundingAt")),@@ -105,4 +125,10 @@ def transform_harmonic_company(company: Optional[dict[str, Any]]) -> Optional[Enis_yc_company=_is_yc_funded(funding.get("investors")),is_ai_native=_is_ai_native(tags_v2),ownership_status=company.get("ownershipStatus"),+ customer_type=company.get("customerType"),+ # Harmonic's own known-none-vs-unknown vocabulary for the funding data itself, passed+ # through verbatim rather than re-derived, since fundingAttributeNullStatus already+ # distinguishes what funding_stage's VENTURE_UNKNOWN placeholder conflates. Lives at the+ # top level of Company in the GraphQL schema, not inside funding (API-verified).+ funding_status=company.get("fundingAttributeNullStatus"),)diff --git a/products/growth/backend/tests/test_enrichment_transform.py b/products/growth/backend/tests/test_enrichment_transform.pyindex 41beeb48605c..39cb4148a8ba 100644--- a/products/growth/backend/tests/test_enrichment_transform.py+++ b/products/growth/backend/tests/test_enrichment_transform.py@@ -143,3 +143,49 @@ def test_ownership_status_mapping(_name, overrides, expected):assert fields.parent_company is Noneassert fields.parent_company_domain is Noneassert "parent_company" not in fields.to_dict()+++ [+ ("dropped_with_no_round_data", "VENTURE_UNKNOWN", {}, None),+ ("kept_with_funding_total", "VENTURE_UNKNOWN", {"fundingTotal": 5000000}, "VENTURE_UNKNOWN"),+ ("kept_with_funding_rounds", "VENTURE_UNKNOWN", {"numFundingRounds": 1}, "VENTURE_UNKNOWN"),+ ("real_stage_kept_with_no_round_data", "SEED", {}, "SEED"),+ ]+)+def test_venture_unknown_placeholder_filtered_only_without_round_data(_name, stage, funding_overrides, expected):+ funding = {"fundingStage": stage, **funding_overrides}+ fields = transform_harmonic_company(_company(funding=funding))+ assert fields is not None+ assert fields.funding_stage == expected+++def test_venture_unknown_placeholder_dropped_entirely_from_to_dict():+ fields = transform_harmonic_company(_company(funding={"fundingStage": "VENTURE_UNKNOWN"}))+ assert fields is not None+ assert "funding_stage" not in fields.to_dict()+++ [+ ("mapped_when_present", {"customerType": "B2B"}, "B2B"),+ ("unset_when_absent", {}, None),+ ]+)+def test_customer_type_mapping(_name, overrides, expected):+ fields = transform_harmonic_company(_company(**overrides))+ assert fields is not None+ assert fields.customer_type == expected+++ [+ # Top-level Company field in the GraphQL schema, not nested under funding.+ ("mapped_when_present", {"fundingAttributeNullStatus": "NULL_TRUE_ZERO"}, "NULL_TRUE_ZERO"),+ ("unset_when_absent", {}, None),+ ]+)+def test_funding_status_mapping(_name, overrides, expected):+ fields = transform_harmonic_company(_company(**overrides))+ assert fields is not None+ assert fields.funding_status == expected