: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(codefresh): add environments, teams and users tables (#103353)
Tom Owers56f7ab26e4f3
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 265cd67b45f7..dec3fabcd79a 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@@ -1761,13 +1761,14 @@ Note: Codecov (now part of Sentry) serves a live drf-spectacular schema at https## Codefresh — gaps-Today (6): `builds`, `images`, `pipelines`, `projects`, `step_types`, `triggers`+Today (9): `builds`, `environments`, `images`, `pipelines`, `projects`, `step_types`, `teams`, `triggers`, `users`Diffed against: <https://g.codefresh.io/api/openapi.json>- [ ] `/builds/tree/{buildId}` — Per-build step tree with status and duration per step - without it a build is a single opaque row and slow-step analysis is impossible (high)-- [ ] `/accounts/{accountId}/users and /team` — User and team lookup that resolves the initiator/committer IDs stamped on every build (high)-- [ ] `/environments-v2 and /environments-v2/activity/{id}` — Deployment environments and their activity history - turns CI build data into deployment/DORA analysis (high)+- [x] `/accounts/{accountId}/users and /team` — User and team lookup that resolves the initiator/committer IDs stamped on every build (high) — added as `users` + `teams`+- [x] `/environments-v2` — Deployment environments, which turn CI build data into deployment/DORA analysis (high) — added as `environments`+- [ ] `/environments-v2/activity/{id}` — Activity history behind the environment dashboard (high)- [ ] `/gitops/application` — Argo CD application inventory with sync and health state, the GitOps half of the product (medium)- [ ] `/annotations (and /annotations/keys, /annotations/values/{key})` — Key/value metrics teams attach to builds and images (coverage, test counts) - the custom measures behind build reporting (medium)- [ ] `/audit` — Account audit log of who changed pipelines and settings, for correlating pipeline changes with build outcomes (medium)@@ -1778,6 +1779,8 @@ Diffed against: <https://g.codefresh.io/api/openapi.json>- [ ] `/clusters` — Cluster inventory that gives releases and environments a deployment-target dimension (low)- [ ] `/repos` — Connected git repositories, the source dimension for pipelines and builds (low)+Note: `/builds/tree/{buildId}`, `/environments-v2/activity/{id}` and `/analytics/reports/{reportName}` are left unticked on purpose. The build tree is the parent/sibling/child build hierarchy behind Codefresh's Build Tree view, not a step tree: a build's step names already sit on the build row, and step detail lives on `/progress/{id}`. Its body is undocumented, and it is a per-build detail endpoint, so syncing it means one request per build over a table that is full refresh only. `/environments-v2/activity/{id}` takes an activity id, and no endpoint enumerates activity ids, so there is no parent to fan out from. `/analytics/reports/{reportName}` needs a report name from an undocumented catalog and returns a body that changes per report, per granularity and per date range, so it has no stable row grain; it is a rollup of build data the warehouse can already aggregate from `builds`.+Note: Codefresh serves its OpenAPI 3 spec unauthenticated at https://g.codefresh.io/api/openapi.json (312 paths, 180 with GET). The synced `builds` table maps to GET /workflow. Much of the remaining surface is config/admin (contexts, registries, runtime-environments, ABAC, auth keys) and correctly excluded; the real gaps are step-level build data, identity lookups, and the GitOps/deployment side.## Codemagic — adequatediff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/codefresh/canonical_descriptions.py b/products/warehouse_sources/backend/temporal/data_imports/sources/codefresh/canonical_descriptions.pyindex 58caa3c6cd0e..4f8aa69ab3a5 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/codefresh/canonical_descriptions.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/codefresh/canonical_descriptions.py@@ -81,4 +81,35 @@ CANONICAL_DESCRIPTIONS: CanonicalDescriptions = {"id": "Unique identifier of the step type.",},},+ "environments": {+ "description": "A deployment environment tracked by the Codefresh environment dashboard, with the services and release currently deployed to it.",+ "docs_url": "https://g.codefresh.io/api/",+ },+ "teams": {+ "description": "A team in the Codefresh account, with the users that belong to it.",+ "docs_url": "https://g.codefresh.io/api/",+ "columns": {+ "_id": "Unique identifier of the team.",+ "name": "Name of the team.",+ "type": "Kind of team, for example `default` or `admin`.",+ "account": "Identifier of the Codefresh account the team belongs to.",+ "tags": "Free-form tags applied to the team.",+ "users": "Members of the team, each with their user id, user name, and email.",+ },+ },+ "users": {+ "description": "A user of the Codefresh account. Resolves the user ids that builds carry in `initiator`, `triggeredBy`, and `committer`.",+ "docs_url": "https://g.codefresh.io/api/",+ "columns": {+ "_id": "Unique identifier of the user.",+ "userName": "Codefresh user name.",+ "email": "Email address of the user.",+ "status": "Account membership status of the user, for example `new` or `pending`.",+ "roles": "Roles granted to the user in the account.",+ "personal": "Personal profile of the user: first name, last name, company, phone number, and country.",+ "shortProfile": "Compact profile holding the user name Codefresh shows in build and commit views.",+ "logins": "Identity provider logins linked to the user.",+ "register_date": "Timestamp the user registered with Codefresh.",+ },+ },}diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/codefresh/codefresh.py b/products/warehouse_sources/backend/temporal/data_imports/sources/codefresh/codefresh.pyindex 5bcb5353bb20..bd18317f8084 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/codefresh/codefresh.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/codefresh/codefresh.py@@ -4,6 +4,7 @@ from typing import Any, Optionalfrom requests import Request, Responsefrom products.warehouse_sources.backend.temporal.data_imports.sources.codefresh.settings import (+ ACCOUNT_ID_PLACEHOLDER,CODEFRESH_ENDPOINTS,CodefreshEndpointConfig,)@@ -25,10 +26,21 @@ from products.warehouse_sources.backend.temporal.data_imports.sources.common.typ# let the user retarget yet (it would mean sending the stored API key to an arbitrary host).CODEFRESH_BASE_URL = "https://g.codefresh.io/api"+REQUEST_TIMEOUT_SECONDS = 10.0+# Prefix of the error raised when the account id cannot be resolved. Shared with the source's+# non-retryable error map so the user reads one explanation instead of a raw exception.+ACCOUNT_LOOKUP_FAILED = "Could not resolve the Codefresh account for this API key"++ACCOUNT_LOOKUP_MESSAGE = (+ "PostHog could not work out which Codefresh account this API key belongs to, so the users table "+ "cannot sync. Give the key access to your teams, then try again."+)++[email protected](frozen=True)class CodefreshResumeConfig:- # Offset pagination position (projects, pipelines, images, step_types).+ # Offset pagination position (projects, pipelines, images, step_types, environments).offset: int | None = None# Page pagination position (builds) plus the stable pagination session cursor so resumed pages# read against the same snapshot the first page opened.@@ -131,6 +143,29 @@ def _transform_row(item: dict[str, Any], config: CodefreshEndpointConfig) -> dicreturn row+def _resolve_account_id(api_key: str) -> str:+ """Return the id of the account the API key belongs to.++ ``/accounts/{accountId}/users`` needs that id in its path, and Codefresh publishes no endpoint+ that reports the account a key is scoped to. ``/team`` is scoped to that same account, is not+ paginated, and every team it returns carries the account it belongs to, so one request answers+ it.+ """+ session = make_tracked_session(redact_values=(api_key,))+ response = session.get(+ f"{CODEFRESH_BASE_URL}/team",+ headers={"Authorization": api_key, "Accept": "application/json"},+ timeout=REQUEST_TIMEOUT_SECONDS,+ )+ response.raise_for_status()+ body = response.json()+ for team in body if isinstance(body, list) else []:+ account_id = team.get("account") if isinstance(team, dict) else None+ if account_id:+ return str(account_id)+ raise ValueError(f"{ACCOUNT_LOOKUP_FAILED}: no team returned by /team names an account.")++def _build_paginator_and_params(config: CodefreshEndpointConfig) -> tuple[BasePaginator, dict[str, Any]]:if config.pagination == "offset":# No usable body total; termination is short/empty page. The paginator injects limit+offset.@@ -150,6 +185,9 @@ def codefresh_source() -> SourceResponse:config = CODEFRESH_ENDPOINTS[endpoint]paginator, params = _build_paginator_and_params(config)+ path = config.path+ if ACCOUNT_ID_PLACEHOLDER in path:+ path = path.replace(ACCOUNT_ID_PLACEHOLDER, _resolve_account_id(api_key))rest_config: RESTAPIConfig = {"client": {@@ -164,14 +202,16 @@ def codefresh_source({"name": endpoint,"endpoint": {- "path": config.path,+ "path": path,"params": params,# Codefresh returns either a bare array or an envelope ({docs: [...]},# {workflows: {docs: [...]}}); data_key is the path to walk."data_selector": ".".join(config.data_key) if config.data_key else None,- # For bare-array endpoints a 200 body that isn't a list means the response shape- # changed — fail loud instead of syncing a stray object as a row.- "data_selector_required": config.data_key is None,+ # For bare-array endpoints a 200 body that isn't a list means the response+ # shape changed, so fail loud instead of syncing a stray object as a row.+ # ``require_data_key`` extends the same treatment to an envelope endpoint whose+ # body shape the vendor does not document.+ "data_selector_required": config.data_key is None or config.require_data_key,},"data_map": lambda item, config=config: _transform_row(item, config),}@@ -228,6 +268,19 @@ def validate_credentials(api_key: str, schema_name: Optional[str] = None) -> tupand let the user pick the tables their key can reach. A 401 always means a bad token."""config = CODEFRESH_ENDPOINTS.get(schema_name) if schema_name else Nonepath = config.path if config is not None else "/projects"+ if ACCOUNT_ID_PLACEHOLDER in path:+ # The path is only knowable once /team resolves the account id, and that lookup is the first+ # request the sync makes, so run it here too. A 200 from /team is not enough on its own: a+ # response that names no account fails the sync later, so reject it now.+ try:+ path = path.replace(ACCOUNT_ID_PLACEHOLDER, _resolve_account_id(api_key))+ except ValueError:+ return False, ACCOUNT_LOOKUP_MESSAGE+ except Exception:+ # The lookup failed for a reason that is not an answer about the account, such as a bad+ # token, a missing scope, or a transport error. Probe /team so the status mapping below+ # reports which of those it was.+ path = CODEFRESH_ENDPOINTS["teams"].pathok, status = validate_via_probe(lambda: make_tracked_session(redact_values=(api_key,)),diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/codefresh/settings.py b/products/warehouse_sources/backend/temporal/data_imports/sources/codefresh/settings.pyindex 867a96637e75..c137e7fe78d3 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/codefresh/settings.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/codefresh/settings.py@@ -4,13 +4,19 @@ from typing import Literal, Optionalfrom products.warehouse_sources.backend.types import IncrementalField# How an endpoint paginates. Codefresh is inconsistent across resources:-# - "offset": limit/offset query params, terminate when a page is short (projects, pipelines, images, step_types)+# - "offset": limit/offset query params, terminate when a page is short (projects, pipelines,+# images, step_types, environments)# - "page": 1-indexed `page` param plus a `pagination.nextPage` flag and a stable `sessionId` cursor (builds)-# - "none": single request, no pagination params (triggers)+# - "none": single request, no pagination params (triggers, teams, users)PaginationMode = Literal["offset", "page", "none"]+# Placeholder substituted with the account id before an endpoint path is requested. Codefresh+# publishes no endpoint that reports the account a key belongs to, so the id is resolved at sync+# time (see ``_resolve_account_id``).+ACCOUNT_ID_PLACEHOLDER = "{account_id}"-@dataclass++@dataclass(frozen=True)class CodefreshEndpointConfig:name: strpath: str@@ -28,6 +34,10 @@ class CodefreshEndpointConfig:page_size: int = 100should_sync_default: bool = Trueincremental_fields: list[IncrementalField] = field(default_factory=list)+ # Fail loud when the configured ``data_key`` is absent from a 200 body, instead of syncing zero+ # rows. Set it where the vendor does not document the response envelope, so a wrong guess or a+ # later shape change is visible. Bare-array endpoints (``data_key`` is ``None``) always fail loud.+ require_data_key: bool = False# Fields to strip from every row before it's emitted, to keep secret-bearing fields (e.g. a# project's `variables` or a pipeline's `spec.variables`, which can hold plaintext config values)# out of the warehouse, where any table reader could see them. Each entry is a dotted path, so@@ -90,6 +100,34 @@ CODEFRESH_ENDPOINTS: dict[str, CodefreshEndpointConfig] = {data_key=None, # bare arrayprimary_keys=["id"],),+ "environments": CodefreshEndpointConfig(+ name="environments",+ path="/environments-v2",+ pagination="offset",+ # Codefresh does not document this response body. Its other undocumented list endpoints+ # wrap rows in a ``docs`` envelope, so that is what we read, and ``require_data_key`` turns+ # a wrong envelope into a loud failure instead of a table that syncs zero rows every run.+ data_key=["docs"],+ require_data_key=True,+ primary_keys=["_id"],+ ),+ "teams": CodefreshEndpointConfig(+ name="teams",+ path="/team",+ pagination="none",+ data_key=None, # bare array, no pagination params+ primary_keys=["_id"],+ ),+ "users": CodefreshEndpointConfig(+ name="users",+ path=f"/accounts/{ACCOUNT_ID_PLACEHOLDER}/users",+ pagination="none",+ data_key=None, # bare array, no pagination params+ primary_keys=["_id"],+ # An invite URL lets whoever holds it join the account, so it must stay out of the+ # warehouse where any table reader could recover it.+ redact_keys=["inviteUrl"],+ ),}ENDPOINTS = tuple(CODEFRESH_ENDPOINTS.keys())diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/codefresh/source.py b/products/warehouse_sources/backend/temporal/data_imports/sources/codefresh/source.pyindex 4a54cef9e8d2..b9504aac701c 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/codefresh/source.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/codefresh/source.py@@ -8,6 +8,8 @@ from products.warehouse_sources.backend.facade.source_config import (SourceFieldInputConfigType,)from products.warehouse_sources.backend.temporal.data_imports.sources.codefresh.codefresh import (+ ACCOUNT_LOOKUP_FAILED,+ ACCOUNT_LOOKUP_MESSAGE,CodefreshResumeConfig,codefresh_source,validate_credentials as validate_codefresh_credentials,@@ -57,6 +59,9 @@ You can create an API key in your [Codefresh user settings](https://g.codefresh.- **Pipeline** (pipelines, triggers)- **Build** (builds, images)- **Step Type** (step types)+- **Environments V2** (environments)++The teams and users tables read your account's membership, which Codefresh does not put behind a resource scope.Only the US SaaS host (`g.codefresh.io`) is supported. EU and self-hosted/on-prem installations are not yet supported.""",@@ -92,6 +97,9 @@ Only the US SaaS host (`g.codefresh.io`) is supported. EU and self-hosted/on-pre# per-request path/query."401 Client Error: Unauthorized for url: https://g.codefresh.io": "Your Codefresh API key is invalid or has been revoked. Create a new key in your Codefresh user settings, then reconnect.","403 Client Error: Forbidden for url: https://g.codefresh.io": "Your Codefresh API key is missing the access scope needed to sync this data. Grant the required resource scopes to the key in your Codefresh user settings, then reconnect.",+ # The users table needs an account id, which is read from the teams the key can see. A+ # key that reaches no team can never resolve one, so retrying cannot help.+ ACCOUNT_LOOKUP_FAILED: ACCOUNT_LOOKUP_MESSAGE,}def get_schemas(diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/codefresh/tests/test_codefresh.py b/products/warehouse_sources/backend/temporal/data_imports/sources/codefresh/tests/test_codefresh.pyindex 9a0add830202..a61dfc56d912 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/codefresh/tests/test_codefresh.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/codefresh/tests/test_codefresh.py@@ -8,8 +8,12 @@ from parameterized import parameterizedfrom requests import PreparedRequest, Responsefrom products.warehouse_sources.backend.temporal.data_imports.sources.codefresh.codefresh import (+ ACCOUNT_LOOKUP_FAILED,+ ACCOUNT_LOOKUP_MESSAGE,+ CODEFRESH_BASE_URL,CodefreshResumeConfig,_flatten,+ _resolve_account_id,_transform_row,codefresh_source,validate_credentials,@@ -61,10 +65,15 @@ def _wire(session: mock.MagicMock, responses: list[Response]) -> tuple[list[dictreturn param_snapshots, header_snapshots-def _source(endpoint: str, manager: mock.MagicMock | None = None):- return codefresh_source(- "token", endpoint, team_id=1, job_id="j", resumable_source_manager=manager or _make_manager()- )+def _source(endpoint: str, manager: mock.MagicMock | None = None, account_teams: Any = None):+ """Build the source response, stubbing the /team lookup the ``users`` path needs for its+ account id. Other endpoints never make that call, so the stub is inert for them."""+ session = mock.MagicMock()+ session.get.return_value = _response([{"account": "acc-1"}] if account_teams is None else account_teams)+ with mock.patch(CODEFRESH_SESSION_PATCH, return_value=session):+ return codefresh_source(+ "token", endpoint, team_id=1, job_id="j", resumable_source_manager=manager or _make_manager()+ )def _rows(source_response) -> list[dict[str, Any]]:@@ -149,11 +158,12 @@ class TestTransformRow:("pipelines", "spec.variables"),("triggers", "event-data.endpoint"),("triggers", "event-data.secret"),+ ("users", "inviteUrl"),])def test_endpoint_redacts_secret_bearing_variables(self, endpoint: str, redacted_key: str) -> None:- # These endpoints expose plaintext config/CI variables or webhook secrets; the configured- # source must strip them.+ # These endpoints expose plaintext config/CI variables, webhook secrets, or an invite URL+ # that grants account access; the configured source must strip them.assert redacted_key in CODEFRESH_ENDPOINTS[endpoint].redact_keys@@ -402,6 +412,41 @@ class TestValidateCredentials:if not expected_valid:assert error is not None+ def test_users_schema_probes_the_resolved_users_path(self) -> None:+ # The users path is only knowable after /team resolves the account id, so probing the+ # unfilled path would report a 404 rather than whether the key can reach the data.+ session = mock.MagicMock()+ session.get.side_effect = [_response([{"account": "acc-9"}]), _FakeResponse(200)]+ with mock.patch(CODEFRESH_SESSION_PATCH, return_value=session):+ valid, _error = validate_credentials("token", schema_name="users")+ assert valid is True+ assert session.get.call_args.args[0] == "https://g.codefresh.io/api/accounts/acc-9/users?limit=1"++ def test_users_schema_is_rejected_when_no_team_names_an_account(self) -> None:+ # A 200 from /team that names no account passes a status probe but fails the sync later,+ # so validation has to reject it rather than report the table as reachable.+ session = mock.MagicMock()+ session.get.return_value = _response([{"_id": "t1", "name": "users"}])+ with mock.patch(CODEFRESH_SESSION_PATCH, return_value=session):+ valid, error = validate_credentials("token", schema_name="users")+ assert valid is False+ assert error == ACCOUNT_LOOKUP_MESSAGE++ @parameterized.expand([("unauthorized", 401), ("forbidden", 403)])+ def test_users_schema_reports_the_status_the_team_lookup_returned(self, _name: str, status: int) -> None:+ # A denied /team lookup is a credential answer, not an account answer, so the status+ # mapping must report it instead of the account-lookup message.+ denied = Response()+ denied.status_code = status+ denied._content = b"{}"+ denied.url = f"{CODEFRESH_BASE_URL}/team"+ session = mock.MagicMock()+ session.get.side_effect = [denied, _FakeResponse(status)]+ with mock.patch(CODEFRESH_SESSION_PATCH, return_value=session):+ valid, error = validate_credentials("token", schema_name="users")+ assert valid is False+ assert error != ACCOUNT_LOOKUP_MESSAGE+def test_connection_error_is_invalid(self) -> None:session = mock.MagicMock()session.get.side_effect = ConnectionError("boom")@@ -411,6 +456,73 @@ class TestValidateCredentials:assert error is not None+class TestAccountIdResolution:+ def _patched(self, body: Any) -> mock.MagicMock:+ session = mock.MagicMock()+ session.get.return_value = _response(body)+ return session++ def test_returns_the_account_the_first_team_names(self) -> None:+ session = self._patched([{"_id": "t1", "name": "users", "account": "acc-7"}])+ with mock.patch(CODEFRESH_SESSION_PATCH, return_value=session):+ assert _resolve_account_id("token") == "acc-7"++ @parameterized.expand(+ [+ ("no_teams", []),+ ("team_without_account", [{"_id": "t1", "name": "users"}]),+ ("unexpected_envelope", {"docs": [{"account": "acc-7"}]}),+ ]+ )+ def test_unresolvable_account_raises_the_curated_error(self, _name: str, body: Any) -> None:+ # The message is what the user reads, because the source maps this prefix to an explanation+ # in get_non_retryable_errors.+ session = self._patched(body)+ with mock.patch(CODEFRESH_SESSION_PATCH, return_value=session):+ with pytest.raises(ValueError, match=ACCOUNT_LOOKUP_FAILED):+ _resolve_account_id("token")++ @mock.patch(CLIENT_SESSION_PATCH)+ def test_users_request_path_carries_the_resolved_account_id(self, MockSession) -> None:+ session = MockSession.return_value+ session.headers = {}+ urls: list[str] = []++ def _prepare(request: Any) -> mock.MagicMock:+ urls.append(request.url)+ return mock.MagicMock()++ session.prepare_request.side_effect = _prepare+ session.send.side_effect = [_response([{"_id": "u1", "userName": "ada"}])]++ rows = _rows(_source("users", account_teams=[{"_id": "t1", "account": "acc-42"}]))++ assert rows == [{"_id": "u1", "userName": "ada"}]+ assert urls == ["https://g.codefresh.io/api/accounts/acc-42/users"]+++class TestEnvelopeEndpointFailsLoudOnAMissingDataKey:+ @mock.patch(CLIENT_SESSION_PATCH)+ def test_environments_rows_come_from_the_docs_envelope(self, MockSession) -> None:+ session = MockSession.return_value+ params, _headers = _wire(session, [_response({"docs": [{"_id": "e1", "name": "staging"}]})])++ rows = _rows(_source("environments"))++ assert rows == [{"_id": "e1", "name": "staging"}]+ assert params[0] == {"limit": 100, "offset": 0}++ @mock.patch(CLIENT_SESSION_PATCH)+ def test_body_without_the_docs_envelope_fails_loud(self, MockSession) -> None:+ # Codefresh does not document this response body. A shape we did not expect must stop the+ # sync instead of quietly syncing an empty table on every run.+ session = MockSession.return_value+ _wire(session, [_response([{"_id": "e1"}])])++ with pytest.raises(ValueError, match="matched nothing in the response"):+ _rows(_source("environments"))++class TestCodefreshSourceResponse:@parameterized.expand([@@ -420,6 +532,9 @@ class TestCodefreshSourceResponse:("images", ["id"], "created"),("triggers", ["event", "pipeline"], None),("step_types", ["id"], None),+ ("environments", ["_id"], None),+ ("teams", ["_id"], None),+ ("users", ["_id"], None),])def test_source_response_primary_keys_and_partition(