: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(warehouse-sources): add doppler role, project member and config log tables (#105910)
Tom Owers0d95d43d8891
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 717acfdd91f3..4754cd9b1cff 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@@ -2592,14 +2592,14 @@ Note: The public DocuSeal API exposes exactly three listable resources — submi## Doppler — gaps-Today (8): `activity_logs`, `configs`, `environments`, `groups`, `invites`, `projects`, `service_accounts`, `workplace_users`+Today (12): `activity_logs`, `config_logs`, `configs`, `environments`, `groups`, `invites`, `project_members`, `project_roles`, `projects`, `service_accounts`, `workplace_roles`, `workplace_users`Diffed against: <https://docs.doppler.com/llms.txt>-- [ ] `GET /v3/configs/config/logs (config_logs)` — per-config change history — the state-transition table for who changed which secret and when (high)-- [ ] `GET /v3/projects/{project}/members (project_members)` — project↔user membership junction; projects and workplace_users sync today with nothing joining them (high)-- [ ] `GET /v3/projects/roles (project_roles)` — lookup resolving the role slug carried on every project member and invite (high)-- [ ] `GET /v3/workplace/roles (workplace_roles)` — lookup resolving the workplace role ID on synced workplace_users (medium)+- [x] `GET /v3/configs/config/logs (config_logs)` — per-config change history — the state-transition table for who changed which secret and when (high)+- [x] `GET /v3/projects/project/members (project_members)` — project↔user membership junction; projects and workplace_users sync today with nothing joining them (high)+- [x] `GET /v3/projects/roles (project_roles)` — lookup resolving the role slug carried on every project member and invite (high)+- [x] `GET /v3/workplace/roles (workplace_roles)` — lookup resolving the workplace role ID on synced workplace_users (medium)- [ ] `GET /v3/workplace/groups/{slug}/members` — group↔user membership; groups sync but their members do not (medium)- [ ] `GET /v3/change_requests` — approval-workflow records showing proposed vs applied secret changes (medium)- [ ] `GET /v3/configs/config/secrets/names` — secret-name inventory per config (names only, no values) for sprawl and coverage audits (medium)diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/doppler/canonical_descriptions.py b/products/warehouse_sources/backend/temporal/data_imports/sources/doppler/canonical_descriptions.pyindex 5c7869647605..5badd33d5568 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/doppler/canonical_descriptions.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/doppler/canonical_descriptions.py@@ -93,4 +93,55 @@ CANONICAL_DESCRIPTIONS: CanonicalDescriptions = {"created_at": "When the invite was sent.",},},+ "project_members": {+ "description": "Members granted access to a Doppler project: workplace users, groups, service accounts, and pending invites.",+ "docs_url": "https://docs.doppler.com/reference/project_members-list",+ "columns": {+ "project": "Slug of the project the membership belongs to.",+ "type": "Kind of member: `workplace_user`, `group`, `invite`, or `service_account`.",+ "slug": "Identifier for the member, unique within its member type.",+ "role": "The project role the member holds, as an object carrying the role `identifier`.",+ "access_all_environments": "Whether the member can reach every environment in the project.",+ "environments": "Identifiers of the environments the member can reach when access is not project-wide.",+ },+ },+ "project_roles": {+ "description": "Project role definitions available in the workplace, resolving the role identifier carried on project members.",+ "docs_url": "https://docs.doppler.com/reference/project_roles-list",+ "columns": {+ "identifier": "Unique identifier for the role, as referenced by project members.",+ "name": "Human-readable name of the role.",+ "permissions": "Permission slugs the role grants within a project.",+ "is_custom_role": "Whether the role was defined by the workplace rather than supplied by Doppler.",+ "created_at": "When the role was created.",+ },+ },+ "workplace_roles": {+ "description": "Workplace role definitions, resolving the workplace role carried on workplace users, service accounts, and invites.",+ "docs_url": "https://docs.doppler.com/reference/workplace_roles-list",+ "columns": {+ "identifier": "Unique identifier for the role, as referenced by workplace members.",+ "name": "Human-readable name of the role.",+ "permissions": "Permission slugs the role grants across the workplace.",+ "is_custom_role": "Whether the role was defined by the workplace rather than supplied by Doppler.",+ "is_inline_role": "Whether the role is an inline role generated for a single assignment.",+ "created_at": "When the role was created.",+ },+ },+ "config_logs": {+ "description": "Change history for a config, recording each secret edit and rollback. Secret values are not synced.",+ "docs_url": "https://docs.doppler.com/reference/config_logs-list",+ "columns": {+ "id": "Unique identifier for the config log entry.",+ "text": "Plain-text description of the change.",+ "html": "HTML description of the change.",+ "diff": "The secrets the change touched, by name. `added` and `removed` say whether a value was set or cleared. Secret values are not synced.",+ "rollback": "Whether the entry is a rollback of an earlier change.",+ "user": "The user who made the change (email, name, profile image).",+ "project": "Identifier of the project the config belongs to.",+ "environment": "Identifier of the environment the config belongs to.",+ "config": "Name of the config the change was made to.",+ "created_at": "When the change was made.",+ },+ },}diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/doppler/doppler.py b/products/warehouse_sources/backend/temporal/data_imports/sources/doppler/doppler.pyindex 19ab3a40e994..05484c8b202b 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/doppler/doppler.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/doppler/doppler.py@@ -24,7 +24,7 @@ class DopplerRetryableError(Exception):pass[email protected](frozen=True)class DopplerResumeConfig:# Next 1-indexed page to fetch.next_page: int = 1@@ -32,6 +32,9 @@ class DopplerResumeConfig:# positional index) so projects created or deleted between a crash and the retry can't resume# into the wrong project. None for workplace-level endpoints.project: str | None = None+ # Second-level fan-out bookmark: name of the config currently being processed. Only set for+ # config-scoped endpoints.+ config: str | None = Nonedef _headers(api_token: str) -> dict[str, str]:@@ -87,6 +90,47 @@ def _fetch_page(session: requests.Session, url: str, headers: dict[str, str], loreturn response.json()+def _redact_secret_values(item: dict[str, Any]) -> dict[str, Any]:+ """Strip the secret values out of a config log's `diff`, keeping the secret names.++ Doppler reports each changed secret as `{"name", "added", "removed"}`, where `added` and+ `removed` are the plaintext values. The names are what a change history is read for, so they+ stay; the values would put live credentials in the warehouse. An undocumented shape is+ dropped rather than passed through, since anything in this field may be a secret.+ """+ diff = item.get("diff")+ if diff is None:+ return item+ if not isinstance(diff, list):+ return {**item, "diff": None}+ return {+ **item,+ "diff": [+ {+ "name": change.get("name"),+ "added": change.get("added") is not None,+ "removed": change.get("removed") is not None,+ }+ for change in diff+ if isinstance(change, dict)+ ],+ }++[email protected](frozen=True)+class _FanOutParent:+ """A project — and for config-scoped endpoints, a config within it — to issue one request-set for."""++ project: str+ config: str | None = None++ @property+ def params(self) -> dict[str, str]:+ if self.config is None:+ return {"project": self.project}+ return {"project": self.project, "config": self.config}++def _iter_project_slugs(session: requests.Session, headers: dict[str, str], logger: FilteringBoundLogger) -> Iterator[str]:@@ -104,58 +148,103 @@ def _iter_project_slugs(page += 1+def _iter_config_names(+ session: requests.Session, headers: dict[str, str], logger: FilteringBoundLogger, project_slug: str+) -> Iterator[str]:+ page = 1+ while True:+ url = _build_url("/configs", {"project": project_slug, "page": page, "per_page": DEFAULT_PER_PAGE})+ configs = _fetch_page(session, url, headers, logger).get("configs") or []+ for item in configs:+ name = item.get("name")+ if name:+ yield name++ if len(configs) < DEFAULT_PER_PAGE:+ break+ page += 1+++def _iter_fan_out_parents(+ session: requests.Session,+ headers: dict[str, str],+ logger: FilteringBoundLogger,+ endpoint_config: DopplerEndpointConfig,+) -> Iterator[_FanOutParent]:+ for project_slug in _iter_project_slugs(session, headers, logger):+ if not endpoint_config.fan_out_over_configs:+ yield _FanOutParent(project=project_slug)+ continue+ for config_name in _iter_config_names(session, headers, logger, project_slug):+ yield _FanOutParent(project=project_slug, config=config_name)+++def _resume_at(parent: _FanOutParent, next_page: int) -> DopplerResumeConfig:+ return DopplerResumeConfig(next_page=next_page, project=parent.project, config=parent.config)++def _get_fan_out_rows(session: requests.Session,headers: dict[str, str],logger: FilteringBoundLogger,resumable_source_manager: ResumableSourceManager[DopplerResumeConfig],- config: DopplerEndpointConfig,+ endpoint_config: DopplerEndpointConfig,resume: DopplerResumeConfig | None,) -> Iterator[Any]:- """Fan out over every project for endpoints that require a `project` query param.+ """Fan out over every project, and for config-scoped endpoints every config within it.- Rows already carry a `project` field in Doppler's responses, so no parent injection is needed- for the composite primary keys.+ Most of Doppler's project-scoped responses echo `project` back on each row, so the composite+ primary keys need no parent injection; `inject_project` covers the ones that don't."""- project_slugs = list(_iter_project_slugs(session, headers, logger))+ parents = list(_iter_fan_out_parents(session, headers, logger, endpoint_config))- # Resolve the saved project bookmark to the slice of projects still to process. If the- # bookmarked project no longer exists (deleted between runs), start over from the first- # project — merge dedupes the re-pulled rows on the primary key.- remaining = project_slugs+ # Resolve the saved bookmark to the slice of parents still to process. If the bookmarked+ # parent no longer exists (deleted between runs), start over from the first one — merge+ # dedupes the re-pulled rows on the primary key.+ remaining = parentsresume_page = 1- if resume is not None and resume.project is not None and resume.project in project_slugs:- remaining = project_slugs[project_slugs.index(resume.project) :]- resume_page = resume.next_page or 1- logger.debug(f"Doppler: resuming {config.name} from project={resume.project}, page={resume_page}")-- for index, project_slug in enumerate(remaining):+ if resume is not None and resume.project is not None:+ bookmark = _FanOutParent(project=resume.project, config=resume.config)+ if bookmark in parents:+ remaining = parents[parents.index(bookmark) :]+ resume_page = resume.next_page or 1+ logger.debug(f"Doppler: resuming {endpoint_config.name} from {bookmark}, page={resume_page}")++ for index, parent in enumerate(remaining):page = resume_page- resume_page = 1 # only the resumed-into project starts mid-way; the rest start at page 1+ resume_page = 1 # only the resumed-into parent starts mid-way; the rest start at page 1while True:- params: dict[str, Any] = {"project": project_slug}- if config.paginated:+ params: dict[str, Any] = dict(parent.params)+ if endpoint_config.paginated:params["page"] = page- if config.per_page is not None:- params["per_page"] = config.per_page-- data = _fetch_page(session, _build_url(config.path, params), headers, logger)- items = data.get(config.data_key) or []+ if endpoint_config.per_page is not None:+ params["per_page"] = endpoint_config.per_page++ data = _fetch_page(session, _build_url(endpoint_config.path, params), headers, logger)+ items = data.get(endpoint_config.data_key) or []+ if endpoint_config.inject_project:+ items = [{**item, "project": parent.project} for item in items]+ if endpoint_config.carries_secret_values:+ items = [_redact_secret_values(item) for item in items]if items:yield items- has_more = config.paginated and config.per_page is not None and len(items) >= config.per_page+ has_more = (+ endpoint_config.paginated+ and endpoint_config.per_page is not None+ and len(items) >= endpoint_config.per_page+ )if not has_more:break# Save AFTER yielding so a crash re-yields the last page rather than skipping it —# merge dedupes on the primary key.- resumable_source_manager.save_state(DopplerResumeConfig(next_page=page + 1, project=project_slug))+ resumable_source_manager.save_state(_resume_at(parent, page + 1))page += 1- # Advance the bookmark to the next project so a crash between projects resumes correctly.+ # Advance the bookmark to the next parent so a crash between parents resumes correctly.if index + 1 < len(remaining):- resumable_source_manager.save_state(DopplerResumeConfig(next_page=1, project=remaining[index + 1]))+ resumable_source_manager.save_state(_resume_at(remaining[index + 1], 1))def get_rows(@@ -170,11 +259,11 @@ def get_rows(headers = _headers(api_token)# One session reused across every page (and, for fan-out, every project) so urllib3 keeps the# connection alive instead of re-handshaking per request.- session = make_tracked_session()+ session = make_tracked_session(capture=not config.carries_secret_values)resume = resumable_source_manager.load_state() if resumable_source_manager.can_resume() else None- if config.fan_out_over_projects:+ if config.fan_out_over_projects or config.fan_out_over_configs:yield from _get_fan_out_rows(session, headers, logger, resumable_source_manager, config, resume)return@@ -189,9 +278,11 @@ def get_rows(logger.debug(f"Doppler: resuming {endpoint} from page {page}")while True:- params: dict[str, Any] = {"page": page}- if config.per_page is not None:- params["per_page"] = config.per_page+ params: dict[str, Any] = {}+ if config.paginated:+ params["page"] = page+ if config.per_page is not None:+ params["per_page"] = config.per_pagedata = _fetch_page(session, _build_url(config.path, params), headers, logger)items = data.get(config.data_key) or []@@ -211,7 +302,7 @@ def get_rows(else:yield items- has_more = len(items) >= config.per_page if config.per_page is not None else True+ has_more = config.paginated and (len(items) >= config.per_page if config.per_page is not None else True)if not has_more:break# Save AFTER yielding so a crash re-yields the last page rather than skipping it — mergediff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/doppler/settings.py b/products/warehouse_sources/backend/temporal/data_imports/sources/doppler/settings.pyindex e76998c54174..b898f86338a4 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/doppler/settings.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/doppler/settings.py@@ -20,7 +20,7 @@ def _created_at_incremental_fields() -> list[IncrementalField]:]-@dataclass+@dataclass(frozen=True)class DopplerEndpointConfig:name: strpath: str # Path under /v3, e.g. "/projects"@@ -35,12 +35,22 @@ class DopplerEndpointConfig:per_page: Optional[int] = DEFAULT_PER_PAGE# Fan out one request-set per project: the endpoint requires a `project` query param.fan_out_over_projects: bool = False+ # Fan out one request-set per config: the endpoint requires both `project` and `config`.+ fan_out_over_configs: bool = False+ # Stamp the fanned-out project slug onto each row. Only for endpoints whose rows omit it —+ # most of Doppler's project-scoped responses already echo `project` back.+ inject_project: bool = False+ # The endpoint's responses contain plaintext secret values. Those are redacted out of the+ # rows before they are yielded, and the responses are kept out of HTTP sample capture,+ # whose name-based scrubbers cannot recognise a secret under a field named `added`.+ carries_secret_values: bool = Falseincremental_fields: list[IncrementalField] = field(default_factory=list)# Stable creation-time field to partition by. Only worthwhile for the (large, append-only)- # activity log; the remaining endpoints are small dimension tables.+ # log endpoints; the remaining endpoints are small dimension tables.partition_key: Optional[str] = Nonesort_mode: SortMode = "asc"should_sync_default: bool = True+ description: Optional[str] = NoneDOPPLER_ENDPOINTS: dict[str, DopplerEndpointConfig] = {@@ -76,6 +86,10 @@ DOPPLER_ENDPOINTS: dict[str, DopplerEndpointConfig] = {# /v3/logs has no sort param and returns newest-first; incremental syncs stop paging once# a page reaches already-synced entries (see doppler.py).sort_mode="desc",+ description=(+ "Workplace activity log of project, config, and access changes. Incremental syncs "+ "stop paging once they reach already-synced entries."+ ),),"workplace_users": DopplerEndpointConfig(name="workplace_users",@@ -102,6 +116,53 @@ DOPPLER_ENDPOINTS: dict[str, DopplerEndpointConfig] = {data_key="invites",primary_keys=["slug"],),+ "project_members": DopplerEndpointConfig(+ name="project_members",+ path="/projects/project/members",+ data_key="members",+ # Member rows carry no project field, so the fan-out stamps one on. Doppler addresses a+ # member by type and slug within a project, so all three make the row unique.+ primary_keys=["project", "type", "slug"],+ fan_out_over_projects=True,+ inject_project=True,+ description="Which workplace users, groups, service accounts, and invites can reach each project.",+ ),+ "project_roles": DopplerEndpointConfig(+ name="project_roles",+ path="/projects/roles",+ data_key="roles",+ primary_keys=["identifier"],+ paginated=False,+ per_page=None,+ description="Project role definitions, including the permissions each role grants.",+ ),+ "workplace_roles": DopplerEndpointConfig(+ name="workplace_roles",+ path="/workplace/roles",+ data_key="roles",+ primary_keys=["identifier"],+ paginated=False,+ per_page=None,+ description="Workplace role definitions, including the permissions each role grants.",+ ),+ "config_logs": DopplerEndpointConfig(+ name="config_logs",+ path="/configs/config/logs",+ data_key="logs",+ # Log ids are documented as unique per object, but this table pools every config's logs,+ # so keep the parents in the key rather than rely on that holding workplace-wide.+ primary_keys=["project", "config", "id"],+ fan_out_over_configs=True,+ carries_secret_values=True,+ partition_key="created_at",+ # One request-set per config, and the endpoint offers no time filter to narrow a re-sync,+ # so this stays off by default and is opted into deliberately.+ should_sync_default=False,+ description=(+ "Per-config change history of secret edits and rollbacks. This table syncs each config "+ "separately, so it takes longer than the others."+ ),+ ),}ENDPOINTS = tuple(DOPPLER_ENDPOINTS.keys())diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/doppler/source.py b/products/warehouse_sources/backend/temporal/data_imports/sources/doppler/source.pyindex a50e23d81238..7bd8ceb46d1c 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/doppler/source.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/doppler/source.py@@ -103,12 +103,7 @@ Use a [personal token](https://docs.doppler.com/docs/personal-tokens) or a [servsupports_append=False,incremental_fields=INCREMENTAL_FIELDS.get(endpoint, []),should_sync_default=endpoint_config.should_sync_default,- description=(- "Workplace activity log of project, config, and access changes. Incremental syncs "- "stop paging once they reach already-synced entries."- if endpoint == "activity_logs"- else None- ),+ description=endpoint_config.description,)schemas = [_build_schema(endpoint) for endpoint in ENDPOINTS]diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/doppler/tests/test_doppler.py b/products/warehouse_sources/backend/temporal/data_imports/sources/doppler/tests/test_doppler.pyindex bbf641377116..d60ecb5d4c89 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/doppler/tests/test_doppler.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/doppler/tests/test_doppler.py@@ -1,6 +1,8 @@+import jsonfrom datetime import UTC, date, datetimefrom typing import Any+import pytestfrom unittest.mock import MagicMockfrom parameterized import parameterized@@ -117,6 +119,28 @@ class TestGetRows:assert [r["id"] for r in rows] == ["p1"]assert fetched == [f"{_BASE}/projects?page=3&per_page=20"]+ @pytest.mark.parametrize(+ "endpoint, url",+ [+ ("project_roles", f"{_BASE}/projects/roles"),+ ("workplace_roles", f"{_BASE}/workplace/roles"),+ ],+ )+ def test_unpaginated_endpoint_makes_one_unparameterised_request(+ self, monkeypatch: Any, endpoint: str, url: str+ ) -> None:+ # The roles endpoints take no pagination params, so a full-looking page must not send the+ # loop round again — there is no short or empty page coming to stop it.+ pages = {url: _items("roles", [f"r{i}" for i in range(DEFAULT_PER_PAGE)])}+ fetched = _patch_fetch(monkeypatch, pages)+ manager = _FakeResumableManager()++ rows = _collect(manager, endpoint=endpoint)++ assert len(rows) == DEFAULT_PER_PAGE+ assert fetched == [url]+ assert manager.saved == []+def test_endpoint_without_per_page_terminates_on_empty_page(self, monkeypatch: Any) -> None:# workplace users documents no `per_page`, so a short page must NOT stop pagination —# only an empty page does.@@ -254,6 +278,106 @@ class TestGetRowsFanOut:assert manager.saved == [DopplerResumeConfig(next_page=1, project="proj-b")]+class TestGetRowsProjectMemberFanOut:+ def test_stamps_the_project_onto_rows_that_omit_it(self, monkeypatch: Any) -> None:+ # Member rows carry no project of their own, and `project` leads the primary key — an+ # unstamped row would collide with the same member in every other project.+ pages = {+ f"{_BASE}/projects?page=1&per_page=20": {"projects": [{"slug": "proj-a"}, {"slug": "proj-b"}]},+ f"{_BASE}/projects/project/members?project=proj-a&page=1&per_page=20": {+ "members": [{"type": "workplace_user", "slug": "user-1"}]+ },+ f"{_BASE}/projects/project/members?project=proj-b&page=1&per_page=20": {+ "members": [{"type": "workplace_user", "slug": "user-1"}]+ },+ }+ fetched = _patch_fetch(monkeypatch, pages)++ rows = _collect(_FakeResumableManager(), endpoint="project_members")++ assert [(row["project"], row["slug"]) for row in rows] == [("proj-a", "user-1"), ("proj-b", "user-1")]+ assert fetched == list(pages)+++class TestGetRowsConfigFanOut:+ _PROJECTS_URL = f"{_BASE}/projects?page=1&per_page=20"++ def _logs_url(self, project: str, config: str, page: int = 1) -> str:+ return f"{_BASE}/configs/config/logs?project={project}&config={config}&page={page}&per_page=20"++ def test_fans_out_over_every_config_of_every_project(self, monkeypatch: Any) -> None:+ pages = {+ self._PROJECTS_URL: {"projects": [{"slug": "proj-a"}, {"slug": "proj-b"}]},+ f"{_BASE}/configs?project=proj-a&page=1&per_page=20": {"configs": [{"name": "dev"}, {"name": "prd"}]},+ f"{_BASE}/configs?project=proj-b&page=1&per_page=20": {"configs": [{"name": "dev"}]},+ self._logs_url("proj-a", "dev"): _items("logs", ["a-dev"]),+ self._logs_url("proj-a", "prd"): _items("logs", ["a-prd"]),+ self._logs_url("proj-b", "dev"): _items("logs", ["b-dev"]),+ }+ fetched = _patch_fetch(monkeypatch, pages)+ manager = _FakeResumableManager()++ rows = _collect(manager, endpoint="config_logs")++ assert [row["id"] for row in rows] == ["a-dev", "a-prd", "b-dev"]+ # Both fan-out levels are resolved up front, so every parent listing precedes the logs.+ assert fetched == list(pages)+ # The bookmark carries the config too; a project-only bookmark would restart the project.+ assert manager.saved == [+ DopplerResumeConfig(next_page=1, project="proj-a", config="prd"),+ DopplerResumeConfig(next_page=1, project="proj-b", config="dev"),+ ]++ def test_drops_secret_values_from_the_diff(self, monkeypatch: Any) -> None:+ # Doppler puts the plaintext before and after value of every changed secret in `diff`.+ # Yielding the field as returned would write live credentials into the warehouse.+ log = {+ "id": "log-1",+ "created_at": "2024-01-05T00:00:00.000Z",+ "diff": [+ {"name": "STRIPE", "added": "sk_test_notarealkey"},+ {"name": "OLD_TOKEN", "removed": "tok_notarealtoken"},+ {"name": "ROTATED", "added": "new_value", "removed": "old_value"},+ ],+ }+ pages = {+ self._PROJECTS_URL: {"projects": [{"slug": "proj-a"}]},+ f"{_BASE}/configs?project=proj-a&page=1&per_page=20": {"configs": [{"name": "dev"}]},+ self._logs_url("proj-a", "dev"): {"logs": [log]},+ }+ _patch_fetch(monkeypatch, pages)++ rows = _collect(_FakeResumableManager(), endpoint="config_logs")++ assert [row["diff"] for row in rows] == [+ [+ {"name": "STRIPE", "added": True, "removed": False},+ {"name": "OLD_TOKEN", "added": False, "removed": True},+ {"name": "ROTATED", "added": True, "removed": True},+ ]+ ]+ assert "sk_test_notarealkey" not in json.dumps(rows)++ def test_resumes_from_the_bookmarked_config(self, monkeypatch: Any) -> None:+ pages = {+ self._PROJECTS_URL: {"projects": [{"slug": "proj-a"}, {"slug": "proj-b"}]},+ f"{_BASE}/configs?project=proj-a&page=1&per_page=20": {"configs": [{"name": "dev"}, {"name": "prd"}]},+ f"{_BASE}/configs?project=proj-b&page=1&per_page=20": {"configs": [{"name": "dev"}]},+ self._logs_url("proj-a", "prd", page=2): _items("logs", ["a-prd-page2"]),+ self._logs_url("proj-b", "dev"): _items("logs", ["b-dev"]),+ }+ fetched = _patch_fetch(monkeypatch, pages)++ rows = _collect(+ _FakeResumableManager(DopplerResumeConfig(next_page=2, project="proj-a", config="prd")),+ endpoint="config_logs",+ )++ # proj-a/dev is skipped entirely; proj-a/prd picks up at its saved page.+ assert [row["id"] for row in rows] == ["a-prd-page2", "b-dev"]+ assert fetched == list(pages)++class TestDopplerSourceResponse:@parameterized.expand([@@ -265,6 +389,10 @@ class TestDopplerSourceResponse:("groups", ["slug"], "asc", None),("service_accounts", ["slug"], "asc", None),("invites", ["slug"], "asc", None),+ ("project_members", ["project", "type", "slug"], "asc", None),+ ("project_roles", ["identifier"], "asc", None),+ ("workplace_roles", ["identifier"], "asc", None),+ ("config_logs", ["project", "config", "id"], "asc", ["created_at"]),])def test_source_response_shape(