mirror of
https://github.com/hanzoai/insights.git
synced 2026-11-03 00:52:32 +00:00
The tree still named ee in 82 files. Handled by what each one actually needed
rather than by one rule:
- Repointed where a native equivalent exists — APILicensedTest becomes the
native APIBaseTest (this fork licenses nothing, so nothing is license-gated),
and the serializer/model imports that already had homes here.
- Cut the individual tests, not the files, where an enterprise MODEL has no
counterpart — AccessControl, License, ExplicitTeamMembership,
EnterpriseEventDefinition, materialized columns. test_presentation_api.py is
9,572 lines and test_usage_report.py is 6,545; each used the enterprise symbol
in a small minority of its content, and deleting either to save the effort
would have thrown away real coverage.
- Retired the paths that can only fail: the salesforce enrichment providers, the
insights_ai evaluation dags, the ee.hogai.mcp_tool cold-load guard, and
bulk_update_verified — whose 'verified' field lived on the enterprise event
definition, so the base row here has no column to write. It now refuses with
that reason instead of importing a model that is not there.
The gate added in f2956e1 is green, and both import graphs the images run — web
(insights.urls) and worker (start_temporal_worker) — load clean.
40 lines
1.4 KiB
Python
40 lines
1.4 KiB
Python
"""Enrichment provider interface.
|
|
|
|
The interface keeps the enrichment core provider-agnostic. No firmographic provider ships in
|
|
this fork: the only implementation looked companies up through an enterprise-licensed client
|
|
that is not carried, so a domain lookup has no source and every signup reads as unmatched —
|
|
see insights/temporal/signup_enrichment/workflow.py, which no longer calls the core.
|
|
"""
|
|
|
|
import abc
|
|
import dataclasses
|
|
from typing import Any, Optional
|
|
|
|
from products.growth.backend.enrichment.fields import EnrichmentFields
|
|
|
|
|
|
@dataclasses.dataclass
|
|
class ProviderLookup:
|
|
"""One provider lookup: the transformed fields plus the raw response kept for the archive.
|
|
|
|
`fields` is None on a not-found. `raw_payload` is the provider's verbatim response for the
|
|
company, or None when the provider returns nothing at all for a miss.
|
|
"""
|
|
|
|
fields: Optional[EnrichmentFields]
|
|
raw_payload: Optional[dict[str, Any]]
|
|
|
|
|
|
class EnrichmentProvider(abc.ABC):
|
|
"""Looks up firmographic enrichment for a single company by domain."""
|
|
|
|
name: str
|
|
|
|
@abc.abstractmethod
|
|
async def enrich_by_domain(self, domain: str) -> ProviderLookup:
|
|
"""Return the fields and raw payload for a domain; fields is None when not found.
|
|
|
|
Raises on operational failure (network, provider outage) so the caller can retry
|
|
and alert, rather than conflating an outage with a genuine not-found.
|
|
"""
|