: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(data-warehouse): add hellobaton project users, phases and custom field tables (#110727)
Tom Owers2ca19fb2a53a
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/COVERAGE_GAPS_APPENDIX.md b/products/warehouse_sources/backend/temporal/data_imports/sources/COVERAGE_GAPS_APPENDIX.mdindex 8fa4f67c4922..cca694ee074b 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/COVERAGE_GAPS_APPENDIX.md+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/COVERAGE_GAPS_APPENDIX.md@@ -3971,14 +3971,14 @@ Note: Helicone's API is POST-query shaped rather than REST-collection shaped, so## Hellobaton — gaps-Today (11): `activity`, `companies`, `milestones`, `phases`, `project_attachments`, `projects`, `task_attachments`, `tasks`, `templates`, `time_entries`, `users`+Today (15): `activity`, `companies`, `custom_field_values`, `custom_fields`, `milestones`, `phases`, `project_attachments`, `project_phases`, `project_users`, `projects`, `task_attachments`, `tasks`, `templates`, `time_entries`, `users`Diffed against: <https://app.hellobaton.com/api/swagger.json>-- [ ] `project_users` — project membership join table — who is on which project, missing entirely today (high)-- [ ] `custom_field_values` — the actual custom field data on projects and tasks; without it custom fields are invisible (high)-- [ ] `custom_fields` — lookup table naming and typing the custom field ids carried by custom_field_values (high)-- [ ] `project_phases` — per-project phase instances with dates — the state/transition history behind project progress (high)+- [x] `project_users` — project membership join table — who is on which project, missing entirely today (high)+- [x] `custom_field_values` — the actual custom field data on projects (the endpoint returns project values only); without it custom fields are invisible (high)+- [x] `custom_fields` — lookup table naming and typing the custom field ids carried by custom_field_values (high)+- [x] `project_phases` — per-project phase instances with dates — the state/transition history behind project progress (high)- [ ] `comments` — collaboration events on projects and tasks, the main activity signal alongside activity (high)- [ ] `custom_field_options` — lookup resolving picklist option ids stored in custom_field_values (medium)- [ ] `departments` — lookup table resolving the department ids on users and projects (medium)diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/hellobaton/canonical_descriptions.py b/products/warehouse_sources/backend/temporal/data_imports/sources/hellobaton/canonical_descriptions.pyindex 3203627836ec..2617a274ee3f 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/hellobaton/canonical_descriptions.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/hellobaton/canonical_descriptions.py@@ -37,6 +37,42 @@ CANONICAL_DESCRIPTIONS: CanonicalDescriptions = {"modified": "Timestamp when the company was last modified.",},},+ "custom_fields": {+ "description": "Custom field definitions — the name, type and display settings of each custom field configured in Baton.",+ "docs_url": _DOCS_URL,+ "columns": {+ "id": "Unique identifier for the custom field.",+ "title": "Custom field name.",+ "description": "Custom field description.",+ "type": "Data type of the custom field.",+ "visibility": "Who can see the custom field.",+ "required": "Whether a value is required for the custom field.",+ "multiselect": "Whether the custom field accepts more than one option.",+ "is_date_reference": "Whether the custom field is a date that other dates can be offset from.",+ "number_scale": "Number of decimal places for numeric values.",+ "number_display": "How numeric values are displayed.",+ "options": "Link to the selectable options of the custom field.",+ "created_by": "User who created the custom field.",+ "order": "Display order of the custom field.",+ "created": "Timestamp when the custom field was created.",+ "modified": "Timestamp when the custom field was last modified.",+ },+ },+ "custom_field_values": {+ "description": "Custom field values set on projects. Join `field` to custom_fields for the field name and type.",+ "docs_url": _DOCS_URL,+ "columns": {+ "id": "Unique identifier for the custom field value.",+ "project": "Project the value is set on.",+ "field": "Custom field the value belongs to.",+ "value_numeric": "Value of a numeric custom field.",+ "value_text": "Value of a text custom field.",+ "value_date": "Value of a date custom field.",+ "selected_option": "Selected option of a picklist custom field.",+ "created": "Timestamp when the value was created.",+ "modified": "Timestamp when the value was last modified.",+ },+ },"milestones": {"description": "Milestones within a project — grouped deliverables with a target completion date.","docs_url": _DOCS_URL,@@ -112,6 +148,35 @@ CANONICAL_DESCRIPTIONS: CanonicalDescriptions = {"modified": "Timestamp when the attachment was last modified.",},},+ "project_phases": {+ "description": "Phase instances on a project, with the scheduled start and end of each phase.",+ "docs_url": _DOCS_URL,+ "columns": {+ "id": "Unique identifier for the project phase.",+ "project": "Project the phase belongs to.",+ "phase": "Phase definition this instance is based on.",+ "start_datetime": "When the phase starts on the project.",+ "end_datetime": "When the phase ends on the project.",+ "template_offset_days": "Days from the project start to the phase start, from the template.",+ "template_duration_days": "Duration of the phase in days, from the template.",+ },+ },+ "project_users": {+ "description": "Project membership — which users are on which project, with their role and invitation status.",+ "docs_url": _DOCS_URL,+ "columns": {+ "id": "Unique identifier for the project membership.",+ "project": "Project the user is a member of.",+ "user": "User who is a member of the project.",+ "role": "Role of the user on the project.",+ "joined": "Whether the user has joined the project.",+ "joined_on": "When the user joined the project.",+ "invited": "Whether the user was invited to the project.",+ "invited_on": "When the user was invited to the project.",+ "created": "Timestamp when the membership was created.",+ "modified": "Timestamp when the membership was last modified.",+ },+ },"tasks": {"description": "Tasks — the unit of work within a project, grouped under milestones.","docs_url": _DOCS_URL,diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/hellobaton/settings.py b/products/warehouse_sources/backend/temporal/data_imports/sources/hellobaton/settings.pyindex c7d7f9f1b27e..779f44ed6bc1 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/hellobaton/settings.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/hellobaton/settings.py@@ -22,10 +22,15 @@ class HellobatonEndpointConfig:HELLOBATON_ENDPOINTS: dict[str, HellobatonEndpointConfig] = {"activity": HellobatonEndpointConfig(name="activity", path="/activity/"),"companies": HellobatonEndpointConfig(name="companies", path="/companies/"),+ "custom_fields": HellobatonEndpointConfig(name="custom_fields", path="/custom_fields/"),+ "custom_field_values": HellobatonEndpointConfig(name="custom_field_values", path="/custom_field_values/"),"milestones": HellobatonEndpointConfig(name="milestones", path="/milestones/"),"phases": HellobatonEndpointConfig(name="phases", path="/phases/"),"projects": HellobatonEndpointConfig(name="projects", path="/projects/"),"project_attachments": HellobatonEndpointConfig(name="project_attachments", path="/project_attachments/"),+ # Project phases carry no created/modified timestamp, and their start/end datetimes are nullable.+ "project_phases": HellobatonEndpointConfig(name="project_phases", path="/project_phases/", partition_key=None),+ "project_users": HellobatonEndpointConfig(name="project_users", path="/project_users/"),"tasks": HellobatonEndpointConfig(name="tasks", path="/tasks/"),"task_attachments": HellobatonEndpointConfig(name="task_attachments", path="/task_attachments/"),# Templates carry no non-null created/modified timestamp, so there's no stable partition key.diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/hellobaton/tests/test_hellobaton.py b/products/warehouse_sources/backend/temporal/data_imports/sources/hellobaton/tests/test_hellobaton.pyindex 60a5c3138eba..a7912698690b 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/hellobaton/tests/test_hellobaton.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/hellobaton/tests/test_hellobaton.py@@ -186,6 +186,24 @@ class TestPagination:assert session.send.call_count == 1+class TestPartitioning:+ @pytest.mark.parametrize(+ "endpoint, expected_keys",+ [+ ("projects", ["created"]),+ ("time_entries", ["reference_date"]),+ # No stable non-null creation timestamp, so partitioning would rewrite partitions.+ ("project_phases", None),+ ("templates", None),+ ],+ )+ def test_partitions_only_on_a_stable_field(self, endpoint: str, expected_keys: list[str] | None) -> None:+ response = _source(_make_manager(), endpoint=endpoint)++ assert response.partition_keys == expected_keys+ assert response.partition_mode == ("datetime" if expected_keys else None)++class TestErrorHandling:@mock.patch(CLIENT_SESSION_PATCH)def test_client_error_raises_and_scrubs_api_key(self, MockSession) -> None: