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.

fix(plain): document company:read and machineUser:read scopes (#72773)

Tom Owers07abedd517f9
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/plain/source.py b/products/warehouse_sources/backend/temporal/data_imports/sources/plain/source.py
index d17a60f19e04..f555d0b5b9e9 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/plain/source.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/plain/source.py
@@ -61,6 +61,8 @@ Make sure to grant the following read permissions:
- timeline:read
- user:read
- label:read
+- company:read
+- machineUser:read
""",
iconPath="/static/services/plain.png",
fields=cast(
@@ -89,9 +91,10 @@ Make sure to grant the following read permissions:
return {
"401 Client Error": "Invalid Plain credentials. Please check your API key.",
# Plain fails the whole GraphQL request when the key lacks a scope any requested field needs.
- # Our customers/threads queries read assignee (user:read) and label (label:read) data on top
- # of the basics, so name every required scope — retrying a key missing one never succeeds.
- "403 Client Error": "Access forbidden. Grant your Plain API key these read permissions, then reconnect: customer:read, thread:read, timeline:read, user:read, label:read.",
+ # Our customers/threads/timeline_entries queries read assignee (user:read), label (label:read),
+ # company (company:read), and machine-user actor (machineUser:read) data on top of the basics,
+ # so name every required scope — retrying a key missing one never succeeds.
+ "403 Client Error": "Access forbidden. Grant your Plain API key these read permissions, then reconnect: customer:read, thread:read, timeline:read, user:read, label:read, company:read, machineUser:read.",
}
def get_schemas(
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/plain/tests/test_plain_source.py b/products/warehouse_sources/backend/temporal/data_imports/sources/plain/tests/test_plain_source.py
index a344d7971949..553ed09f3859 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/plain/tests/test_plain_source.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/plain/tests/test_plain_source.py
@@ -39,10 +39,19 @@ class TestPlainSource:
assert "403 Client Error" in errors
def test_source_config_documents_scopes_the_queries_require(self):
- # The customers/threads queries read assignee (user:read) and label (label:read) data, and Plain
- # 403s the whole request when the key lacks a scope any requested field needs. Keep the setup
- # caption and the forbidden-error guidance in sync with what the queries actually fetch.
- required_scopes = ["customer:read", "thread:read", "timeline:read", "user:read", "label:read"]
+ # The customers/threads/timeline_entries queries read assignee (user:read), label (label:read),
+ # company (company:read), and machine-user actor (machineUser:read) data, and Plain 403s the whole
+ # request when the key lacks a scope any requested field needs. Keep the setup caption and the
+ # forbidden-error guidance in sync with what the queries actually fetch.
+ required_scopes = [
+ "customer:read",
+ "thread:read",
+ "timeline:read",
+ "user:read",
+ "label:read",
+ "company:read",
+ "machineUser:read",
+ ]
caption = self.source.get_source_config.caption
forbidden_message = self.source.get_non_retryable_errors()["403 Client Error"]
assert caption is not None