Skip to content

: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.

feat(warehouse): add yousign approvers table (#120209)

Tom Owersf20692c6ed18
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.md
index ec21b4acda19..c87e8bd6d012 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
@@ -13470,13 +13470,14 @@ Diffed against: <https://developers.yousign.com/reference/get-contacts-1>
- [ ] `identity verifications (GET /verifications/identity_documents, /companies, /bank_accounts, /proofs_of_address, /identity_videos, /watchlists)` — KYC verification outcomes per signer, an entire product surface with no coverage (medium)
- [ ] `workflow sessions (GET /workflow_sessions)` — identity/onboarding workflow runs and their state (medium)
- [ ] `workflow session applicants (GET /workflow_sessions/{id}/applicants)` — per-applicant outcome inside a workflow session (medium)
+- [x] `approvers (GET /signature_requests/{signatureRequestId}/approvers)` — full approver details and approval status per signature request, alongside the signers we already sync (medium)
- [ ] `followers (GET /signature_requests/{signatureRequestId}/followers)` — who is CC'd on a request, alongside the signers we already sync (medium)
- [ ] `document analyses (GET /document_analyses)` — automated document checks and their verdicts (low)
- [ ] `consent requests (GET /signature_requests/{signatureRequestId}/consent_requests)` — per-signer consent steps within a request (low)
- [ ] `workflow templates (GET /workflow_templates)` — lookup resolving the template behind a workflow session (low)
- [ ] `electronic seals (GET /electronic_seals/{id})` — sealed-document records, distinct from the signature request flow (low)
-Note: Yousign publishes an OAS spec (docs slug 'oas-specification'); paths above were confirmed one by one from the ReadMe reference pages. Approvers only expose a single-item GET (/signature_requests/{id}/approvers/{approverId}) with no list endpoint, so they are not listed as a gap. Audit trails are PDF downloads rather than queryable collections.
+Note: Yousign publishes an OAS spec (docs slug 'oas-specification'); paths above were confirmed one by one from the ReadMe reference pages. Audit trails are PDF downloads rather than queryable collections.
## YouTube Analytics — gaps
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/yousign/canonical_descriptions.py b/products/warehouse_sources/backend/temporal/data_imports/sources/yousign/canonical_descriptions.py
index 93ca6756bca6..3c475331019b 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/yousign/canonical_descriptions.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/yousign/canonical_descriptions.py
@@ -63,6 +63,22 @@ CANONICAL_DESCRIPTIONS: CanonicalDescriptions = {
"recipient_stage_index": "Notification stage; recipients sharing an index are notified together.",
},
},
+ "approvers": {
+ "description": "An approver of a signature request, with their identity details and approval status.",
+ "docs_url": "https://developers.yousign.com/reference/get-signature_requests-id-approvers",
+ "columns": {
+ "id": "Unique identifier of the approver.",
+ "signature_request_id": "Signature request this approver belongs to.",
+ "info": "Approver identity: first name, last name, email, phone number, and locale.",
+ "status": "Approval status: initiated, notified, approved, or rejected.",
+ # approval_link is intentionally not imported (see yousign.APPROVER_CAPABILITY_FIELDS).
+ "approval_link_expiration_date": "When the approver's (non-imported) approval link expires.",
+ "custom_text": "Custom subjects and bodies of the request and reminder emails sent to the approver.",
+ "approved_at": "When the approver approved the signature request.",
+ "recipient_stage_index": "Notification stage; recipients sharing an index are notified together.",
+ "excluded_documents": "Ids of documents not visible to this approver.",
+ },
+ },
"documents": {
"description": "A document attached to a signature request, either signable or a simple attachment.",
"docs_url": "https://developers.yousign.com/reference/get-signature_requests-signaturerequestid-documents-1",
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/yousign/settings.py b/products/warehouse_sources/backend/temporal/data_imports/sources/yousign/settings.py
index 91ab629056e8..941f59730ab8 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/yousign/settings.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/yousign/settings.py
@@ -86,6 +86,22 @@ YOUSIGN_ENDPOINTS: dict[str, YousignEndpointConfig] = {
),
description="Signer details for every signature request, one row per signer.",
),
+ "approvers": YousignEndpointConfig(
+ name="approvers",
+ path="/signature_requests/{signatureRequestId}/approvers",
+ data_selector="$",
+ primary_key=["signature_request_id", "id"],
+ paginated=False,
+ fanout=DependentEndpointConfig(
+ parent_name="signature_requests",
+ resolve_param="signatureRequestId",
+ resolve_field="id",
+ include_from_parent=["id"],
+ parent_field_renames={"id": "signature_request_id"},
+ parent_params={"source[in]": SIGNATURE_REQUEST_SOURCES},
+ ),
+ description="Approver details for every signature request, one row per approver.",
+ ),
"documents": YousignEndpointConfig(
name="documents",
path="/signature_requests/{signatureRequestId}/documents",
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/yousign/tests/test_yousign.py b/products/warehouse_sources/backend/temporal/data_imports/sources/yousign/tests/test_yousign.py
index 870a4fd1eeb1..9a5dd249b477 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/yousign/tests/test_yousign.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/yousign/tests/test_yousign.py
@@ -218,36 +218,46 @@ class TestWebhookTableTransformer:
assert [row["id"] for row in rows] == ["sr-3"]
-class TestSignerCapabilityStripping:
- """`signature_link` (and other capability fields) must never reach the warehouse on any path."""
+class TestCapabilityLinkStripping:
+ """Signing and approval links (capability fields) must never reach the warehouse on any path."""
- def test_signers_fanout_strips_signature_link(self) -> None:
+ @pytest.mark.parametrize(
+ "endpoint, link_field",
+ [("signers", "signature_link"), ("approvers", "approval_link")],
+ )
+ def test_fanout_strips_capability_link(self, endpoint: str, link_field: str) -> None:
result = _driver().run(
- "signers",
+ endpoint,
route(
{
"/signature_requests": [
ScriptedResponse(json={"data": [{"id": "sr-1"}], "meta": {"next_cursor": None}})
],
- "/signature_requests/sr-1/signers": [
- ScriptedResponse(json=[{"id": "s-1", "status": "signed", "signature_link": "https://sign/abc"}])
+ f"/signature_requests/sr-1/{endpoint}": [
+ ScriptedResponse(json=[{"id": "r-1", "status": "notified", link_field: "https://link/abc"}])
],
}
),
)
assert result.raised is None
- assert result.rows[0].get("signature_link") is None
- assert result.rows[0]["id"] == "s-1"
+ assert result.rows[0].get(link_field) is None
+ assert result.rows[0]["id"] == "r-1"
assert result.rows[0]["signature_request_id"] == "sr-1"
- def test_signature_requests_strips_embedded_signer_links(self) -> None:
+ def test_signature_requests_strips_embedded_links(self) -> None:
result = _driver().run(
"signature_requests",
[
ScriptedResponse(
json={
- "data": [{"id": "sr-1", "signers": [{"id": "s-1", "signature_link": "https://sign/abc"}]}],
+ "data": [
+ {
+ "id": "sr-1",
+ "signers": [{"id": "s-1", "signature_link": "https://sign/abc"}],
+ "approvers": [{"id": "a-1", "approval_link": "https://approve/abc"}],
+ }
+ ],
"meta": {"next_cursor": None},
}
)
@@ -257,6 +267,8 @@ class TestSignerCapabilityStripping:
assert result.raised is None
assert result.rows[0]["signers"][0].get("signature_link") is None
assert result.rows[0]["signers"][0]["id"] == "s-1"
+ assert result.rows[0]["approvers"][0].get("approval_link") is None
+ assert result.rows[0]["approvers"][0]["id"] == "a-1"
def _hook(endpoint: str = "https://ph/webhook", **extra: Any) -> dict[str, Any]:
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/yousign/yousign.py b/products/warehouse_sources/backend/temporal/data_imports/sources/yousign/yousign.py
index 259a9c60e3a7..acd7a92e692b 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/yousign/yousign.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/yousign/yousign.py
@@ -108,6 +108,8 @@ def _date_filter_value(value: Any) -> str | None:
# any second factor — so anyone granted access to the warehouse table (a broader set than the
# Yousign account) could open it and sign. Strip these before any row reaches the warehouse.
SIGNER_CAPABILITY_FIELDS = ("signature_link",)
+# `approval_link` lets the holder approve or reject the request on the approver's behalf.
+APPROVER_CAPABILITY_FIELDS = ("approval_link",)
def _scrub_signer_capabilities(signer: dict[str, Any]) -> dict[str, Any]:
@@ -116,19 +118,29 @@ def _scrub_signer_capabilities(signer: dict[str, Any]) -> dict[str, Any]:
return signer
+def _scrub_approver_capabilities(approver: dict[str, Any]) -> dict[str, Any]:
+ for field_name in APPROVER_CAPABILITY_FIELDS:
+ approver.pop(field_name, None)
+ return approver
+
+
def _scrub_signature_request_row(row: dict[str, Any]) -> dict[str, Any]:
- # Signature request rows embed a `signers` array whose entries carry the same signing links.
- signers = row.get("signers")
- if isinstance(signers, list):
- for signer in signers:
- if isinstance(signer, dict):
- _scrub_signer_capabilities(signer)
+ # Signature request rows embed `signers` and `approvers` arrays whose entries can carry the
+ # same links (activation payloads include approval links).
+ for key, scrub in (("signers", _scrub_signer_capabilities), ("approvers", _scrub_approver_capabilities)):
+ entries = row.get(key)
+ if isinstance(entries, list):
+ for entry in entries:
+ if isinstance(entry, dict):
+ scrub(entry)
return row
def _row_transform_for(config: YousignEndpointConfig) -> Callable[[dict[str, Any]], dict[str, Any]] | None:
if config.name == "signers":
return _scrub_signer_capabilities
+ if config.name == "approvers":
+ return _scrub_approver_capabilities
if config.name == "signature_requests":
return _scrub_signature_request_row
return None