: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 4 missing tables to the Pluralsight Flow source (#119126)
Tom Owers4332d71b2f8e
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 ae572948290f..ae09148bb384 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@@ -9554,10 +9554,10 @@ Today (8): `CodingMetrics`, `CollaborationMetrics`, `Commits`, `PullRequests`, `Diffed against: <https://appfire.atlassian.net/wiki/spaces/FD/pages/1802600473>-- [ ] `User Aliases (GET /v3/customer/core/user_alias/)` — resolve user_alias_id values on commits and connect vendor identities to Flow users (high)-- [ ] `Pull Request Projects (GET /v3/customer/core/pull_request_projects/)` — resolve project IDs on pull requests and link their projects to repositories (high)-- [ ] `Ticket Projects (GET /v3/customer/core/ticket_projects/)` — identify the issue tracker projects that contain synced tickets (high)-- [ ] `Team Membership (GET /v3/customer/core/team_membership)` — connect users to teams for engineering activity analysis by team (high)+- [x] `User Aliases (GET /v3/customer/core/user_alias/)` — resolve user_alias_id values on commits and connect vendor identities to Flow users (high)+- [x] `Pull Request Projects (GET /v3/customer/core/pull_request_projects/)` — resolve project IDs on pull requests and link their projects to repositories (high)+- [x] `Ticket Projects (GET /v3/customer/core/ticket_projects/)` — identify the issue tracker projects that contain synced tickets (high)+- [x] `Team Membership (GET /v3/customer/core/team_membership)` — connect users to teams for engineering activity analysis by team (high)- [ ] `DORA Metrics (GET /dora/build-release/change/lead_time/; GET /dora/build-release/deployment/frequency/; GET /dora/build-release/incident/change_failure_rate/; GET /dora/build-release/incident/time_to_restore/)` — measure deployment frequency, change failure rate, recovery time, and change lead time (high)- [ ] `Ticket Metrics (GET /ticket-delivery/metrics/)` — track Flow velocity, cycle time, queue time, backflow rate, and jitter (high)- [ ] `Pull Request Events (GET /v3/customer/core/pull_request_events/)` — analyze review approvals and pull request state changes over time (medium)diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/pluralsight_flow/canonical_descriptions.py b/products/warehouse_sources/backend/temporal/data_imports/sources/pluralsight_flow/canonical_descriptions.pyindex 93d7302122c2..063de8cf7bb6 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/pluralsight_flow/canonical_descriptions.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/pluralsight_flow/canonical_descriptions.py@@ -106,6 +106,76 @@ CANONICAL_DESCRIPTIONS: CanonicalDescriptions = {"comment_count": "Number of comments on the ticket.",},},+ "UserAliases": {+ "description": (+ "One identity (email address or user ID) under which a person shows up in an integrated "+ "vendor such as GitHub or Jira. Many aliases can merge into one apex user."+ ),+ "docs_url": "https://appfire.atlassian.net/wiki/spaces/FD/pages/1802305876",+ "columns": {+ "id": "User alias's unique identifier.",+ "username": "User alias username.",+ "name": "User alias name.",+ "email": "User alias email address.",+ "integration": "Integration the user alias is associated with.",+ "vendor_type": "Vendor the user alias comes from (e.g. github).",+ "apex_user": "Flow user that this alias is merged into.",+ "created_at": "Date and time the user alias was created.",+ "first_activity_at": "Time of the user alias's earliest tracked activity.",+ "last_activity_at": "Time of the user alias's most recent tracked activity.",+ },+ },+ "TeamMemberships": {+ "description": "A relationship between a Flow user and a team.",+ "docs_url": "https://appfire.atlassian.net/wiki/spaces/FD/pages/1802371338",+ "columns": {+ "id": "Unique identifier for the team membership.",+ "membership_type": "Membership type (e.g. contributor).",+ "apex_user": "Flow user that is a member of the team.",+ "apex_user_id": "Unique identifier of the Flow user that is a member of the team.",+ "team": "Team that the user is a member of.",+ },+ },+ "PullRequestProjects": {+ "description": (+ "An entity that receives pull requests. Every pull request belongs to one pull request "+ "project, and a pull request project is usually bound to a repository."+ ),+ "docs_url": "https://appfire.atlassian.net/wiki/spaces/FD/pages/1802535281",+ "columns": {+ "id": "Unique identifier for the pull request project.",+ "name": "Pull request project name.",+ "url": "URL for the pull request project.",+ "vendor_type": "Vendor type.",+ "repo_id": "Unique identifier for the repository the project is bound to.",+ "added_by_id": "Unique identifier for the person who added the pull request project.",+ "created_at": "Date and time the pull request project was created.",+ "updated_at": "Date and time the pull request project was updated.",+ "integration": "Name of the integration used to import the project.",+ "last_processing_success_at": "Date and time of the last successful processing.",+ "processing_status": "Processing status.",+ },+ },+ "TicketProjects": {+ "description": (+ "A project in an integrated issue-tracking application that contains tickets. Every ticket "+ "belongs to one ticket project."+ ),+ "docs_url": "https://appfire.atlassian.net/wiki/spaces/FD/pages/1802535305",+ "columns": {+ "id": "Unique identifier for the ticket project.",+ "name": "Name of the ticket project.",+ "url": "URL for the ticket project.",+ "vendor_type": "Vendor type.",+ "repo_id": "Unique identifier for a repository.",+ "added_by": "Unique identifier for the user that added the ticket project.",+ "created_at": "Date and time the ticket project was created.",+ "updated_at": "Date and time the ticket project was updated.",+ "integration": "Unique identifier for the integration.",+ "last_processing_success_at": "Date and time the project was last successfully updated.",+ "processing_status": "Status of the project.",+ },+ },"CodingMetrics": {"description": ("Aggregate coding activity metrics (coding days, commits per day, impact, efficiency) "diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/pluralsight_flow/settings.py b/products/warehouse_sources/backend/temporal/data_imports/sources/pluralsight_flow/settings.pyindex 068940a544b5..12de27e26d1c 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/pluralsight_flow/settings.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/pluralsight_flow/settings.py@@ -9,6 +9,10 @@ CORE_ENDPOINTS = ("PullRequests","Repos","Tickets",+ "UserAliases",+ "TeamMemberships",+ "PullRequestProjects",+ "TicketProjects",)# Aggregate report resources under the shared Metrics API (`https://api.appfireflow.com/collaboration/`).@@ -29,6 +33,11 @@ CORE_ENDPOINT_PATHS: dict[str, str] = {"PullRequests": "pull_requests/","Repos": "repos/","Tickets": "tickets/",+ "UserAliases": "user_alias/",+ # Flow documents this path without a trailing slash, but only `team_membership/` routes to the API.+ "TeamMemberships": "team_membership/",+ "PullRequestProjects": "pull_request_projects/",+ "TicketProjects": "ticket_projects/",}# Path of each metrics endpoint under the shared collaboration host.@@ -54,12 +63,16 @@ TABLE_NAMES: dict[str, str] = {"PullRequests": "pull_requests","Repos": "repos","Tickets": "tickets",+ "UserAliases": "user_aliases",+ "TeamMemberships": "team_memberships",+ "PullRequestProjects": "pull_request_projects",+ "TicketProjects": "ticket_projects","CodingMetrics": "coding_metrics","CollaborationMetrics": "collaboration_metrics",}# Stable datetime field to partition on, for endpoints where one is confirmed by the API docs.-# Repos has no documented date field, and the metrics endpoints return one aggregate row per+# Repos and TeamMemberships have no documented date field, and the metrics endpoints return one aggregate row per# sync, so neither partitions.PARTITION_KEYS: dict[str, str] = {"Users": "created_at",@@ -67,11 +80,15 @@ PARTITION_KEYS: dict[str, str] = {"Commits": "author_date","PullRequests": "created_at","Tickets": "created_at",+ "UserAliases": "created_at",+ "PullRequestProjects": "created_at",+ "TicketProjects": "created_at",}# Only endpoints with a documented `<field>__gte`/`<field>__lt`-filterable timestamp get an entry.-# Repos and the metrics endpoints are full refresh: Repos has no documented date field to filter on,-# and the metrics endpoints already require an explicit date-range window on every call.+# Repos, TeamMemberships, PullRequestProjects, TicketProjects and the metrics endpoints are full refresh:+# the first four document no date filter, and the metrics endpoints already require an explicit+# date-range window on every call.INCREMENTAL_FIELDS: dict[str, list[IncrementalField]] = {"Users": [incremental_field("last_activity_at", IncrementalFieldType.DateTime)],"Teams": [incremental_field("created_at", IncrementalFieldType.DateTime)],@@ -81,6 +98,10 @@ INCREMENTAL_FIELDS: dict[str, list[IncrementalField]] = {# matches the incremental window (e.g. merged much later) won't be re-fetched."PullRequests": [incremental_field("created_at", IncrementalFieldType.DateTime)],"Tickets": [incremental_field("updated_at", IncrementalFieldType.DateTime)],+ # `last_activity_at` is null for an alias with no activity yet, and a `__gte` filter would never+ # return it. Merging an alias into another apex user does not move `created_at`, so only a+ # full refresh picks up that change.+ "UserAliases": [incremental_field("created_at", IncrementalFieldType.DateTime)],}# Maximum page size documented for the Customer API's `limit` parameter.diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/pluralsight_flow/tests/test_pluralsight_flow.py b/products/warehouse_sources/backend/temporal/data_imports/sources/pluralsight_flow/tests/test_pluralsight_flow.pyindex 763231b1bf8b..aadeb4374d50 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/pluralsight_flow/tests/test_pluralsight_flow.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/pluralsight_flow/tests/test_pluralsight_flow.py@@ -77,15 +77,43 @@ class TestPluralsightFlowSourceCoreEndpoints:assert result.rows == [{"id": 5}]assert result.params("offset") == ["2000"]- def test_incremental_endpoint_sends_gte_filter(self) -> None:+ @pytest.mark.parametrize(+ ("endpoint", "path", "filter_param"),+ [+ ("Commits", "/v3/customer/core/commits/", "author_date__gte"),+ ("UserAliases", "/v3/customer/core/user_alias/", "created_at__gte"),+ ],+ )+ def test_incremental_endpoint_sends_gte_filter(self, endpoint: str, path: str, filter_param: str) -> None:result = self._driver().run(- "Commits",+ endpoint,[ScriptedResponse(json={"count": 1, "next": None, "previous": None, "results": [{"id": 1}]})],should_use_incremental_field=True,)assert result.raised is None- assert result.requests[0].param("author_date__gte") == "1970-01-01T00:00:00"+ assert result.paths == [path]+ assert result.requests[0].param(filter_param) == "1970-01-01T00:00:00"++ @pytest.mark.parametrize(+ ("endpoint", "path"),+ [+ ("TeamMemberships", "/v3/customer/core/team_membership/"),+ ("PullRequestProjects", "/v3/customer/core/pull_request_projects/"),+ ("TicketProjects", "/v3/customer/core/ticket_projects/"),+ ],+ )+ def test_full_refresh_endpoint_sends_no_date_filter(self, endpoint: str, path: str) -> None:+ result = self._driver().run(+ endpoint,+ [ScriptedResponse(json={"count": 1, "next": None, "previous": None, "results": [{"id": 7}]})],+ should_use_incremental_field=True,+ )++ assert result.raised is None+ assert result.rows == [{"id": 7}]+ assert result.paths == [path]+ assert not [name for name in result.requests[0].query if name.endswith("__gte")]class TestPluralsightFlowSourceMetricsEndpoints: