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(data-warehouse): add glassfrog governance and action tables (#109920)

Tom Owers37bcd8da0e24
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 621ecd16a7b6..ec85598c389c 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
@@ -3659,14 +3659,14 @@ Note: Important: PostHog does not use Gladly's REST list endpoints — it ingest
## Glassfrog — gaps
-Today (8): `assignments`, `checklist_items`, `circles`, `custom_fields`, `metrics`, `people`, `projects`, `roles`
+Today (12): `actions`, `assignments`, `checklist_items`, `circles`, `custom_fields`, `governance_meetings`, `metrics`, `people`, `projects`, `proposals`, `roles`, `tensions`
Diffed against: <https://app.glassfrog.com/api/v3/docs/spec.yaml>
-- [ ] `/tensions` — tensions are the core Holacracy input object and the driver of every governance and tactical outcome (high)
-- [ ] `/actions` — next-actions are the operational work items sitting alongside the projects already synced (high)
-- [ ] `/proposals` — governance proposals with their responses — the transition record for how roles and circles changed (high)
-- [ ] `/governance_meetings` — governance meeting records that timestamp and group structural changes (medium)
+- [x] `/tensions` — tensions are the core Holacracy input object and the driver of every governance and tactical outcome (high)
+- [x] `/actions` — next-actions are the operational work items sitting alongside the projects already synced (high)
+- [x] `/proposals` — governance proposals with their responses — the transition record for how roles and circles changed (high)
+- [x] `/governance_meetings` — governance meeting records that timestamp and group structural changes (medium)
- [ ] `/tactical_meetings` — tactical meeting cadence and attendance, the operational counterpart to governance meetings (medium)
- [ ] `/agenda_items` — agenda items per meeting — the line items making meeting throughput measurable (medium)
- [ ] `/domains` — lookup resolving the domains held by the roles and circles already synced (medium)
@@ -3674,7 +3674,7 @@ Diffed against: <https://app.glassfrog.com/api/v3/docs/spec.yaml>
- [ ] `/organizations` — top-level org lookup that scopes every other table (medium)
- [ ] `/triggers` — role triggers (when-then rules) attached to roles and people (low)
-Note: The docs page at /api/v3/docs is a Swagger UI shell; the real spec is at /api/v3/docs/spec.yaml, which is what was diffed. GlassFrog exposes 12 listable top-level collections and PostHog covers 8 nouns but none of the governance-process objects.
+Note: The docs page at /api/v3/docs is a Swagger UI shell; the real spec is at /api/v3/docs/spec.yaml, which is what was diffed. GlassFrog exposes 18 listable top-level collections and PostHog covers 12.
## GNews — adequate
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/glassfrog/canonical_descriptions.py b/products/warehouse_sources/backend/temporal/data_imports/sources/glassfrog/canonical_descriptions.py
index 751a90085d23..6c4fd0023f82 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/glassfrog/canonical_descriptions.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/glassfrog/canonical_descriptions.py
@@ -5,6 +5,24 @@ from products.warehouse_sources.backend.temporal.data_imports.sources.common.can
_DOCS_URL = "https://app.glassfrog.com/api/v3/docs"
CANONICAL_DESCRIPTIONS: CanonicalDescriptions = {
+ "actions": {
+ "description": "A next-action: a single step of work owned by a person, optionally in a role or tied to a project.",
+ "docs_url": _DOCS_URL,
+ "columns": {
+ "id": "Unique identifier for the action.",
+ "description": "Text describing the action.",
+ "type": "Type of the action.",
+ "status": "Current status of the action.",
+ "created_at": "When the action was created.",
+ "completed_at": "When the action was completed, if it has been.",
+ "note": "Free-text note attached to the action.",
+ "position": "Sort position of the action in its owner's list.",
+ "private_to_circle": "Whether the action is only visible inside its circle.",
+ "trigger": "Trigger that created the action, if any.",
+ "trigger_event": "Event that fired the trigger, if any.",
+ "links": "Identifiers of the related person, circle, role, and project.",
+ },
+ },
"assignments": {
"description": "An assignment of a person to a role, optionally with a focus.",
"docs_url": _DOCS_URL,
@@ -50,6 +68,17 @@ CANONICAL_DESCRIPTIONS: CanonicalDescriptions = {
"links": "Identifier of the role the custom field is attached to.",
},
},
+ "governance_meetings": {
+ "description": "A governance meeting held by a circle to process changes to its structure.",
+ "docs_url": _DOCS_URL,
+ "columns": {
+ "id": "Unique identifier for the governance meeting.",
+ "started_at": "When the meeting started.",
+ "ended_at": "When the meeting ended.",
+ "scratch_pad": "Shared notes taken during the meeting.",
+ "links": "Identifiers of the circle, the person who started the meeting, agenda items, and meeting hosts.",
+ },
+ },
"metrics": {
"description": "A metric reported in a circle's tactical meetings.",
"docs_url": _DOCS_URL,
@@ -96,6 +125,24 @@ CANONICAL_DESCRIPTIONS: CanonicalDescriptions = {
"links": "Identifiers of the related role, person, and circle.",
},
},
+ "proposals": {
+ "description": "A governance proposal to change a circle's roles, policies, or other structure.",
+ "docs_url": _DOCS_URL,
+ "columns": {
+ "id": "Unique identifier for the proposal.",
+ "status": "Current status of the proposal.",
+ "proposed_at": "When the proposal was made.",
+ "escalated_at": "When the proposal was escalated, if it was.",
+ "accepted_at": "When the proposal was accepted, if it was.",
+ "response_deadline": "Deadline for responders to respond to the proposal.",
+ "received_response_count": "Number of responses received.",
+ "expected_response_count": "Number of responses expected.",
+ "current_responders": "Identifiers of the people who have responded.",
+ "possible_responders": "Identifiers of the people who can respond.",
+ "instructions": "The governance changes the proposal makes.",
+ "links": "Identifiers of the related circle, tension, and proposer.",
+ },
+ },
"roles": {
"description": "A role defined in the organization's governance structure.",
"docs_url": _DOCS_URL,
@@ -110,4 +157,25 @@ CANONICAL_DESCRIPTIONS: CanonicalDescriptions = {
"links": "Identifiers of related resources: circle, supporting circle, domains, accountabilities, and people filling the role.",
},
},
+ "tensions": {
+ "description": "A tension: a gap between what is and what could be, raised by a person for a circle to process.",
+ "docs_url": _DOCS_URL,
+ "columns": {
+ "id": "Unique identifier for the tension.",
+ "body": "Text of the tension.",
+ "plain_body": "Text of the tension without formatting.",
+ "label": "Short label for the tension.",
+ "agenda_label": "Label shown when the tension is on a meeting agenda.",
+ "type": "Type of the tension.",
+ "created_at": "When the tension was created.",
+ "impacted_role_id": "Identifier of the role the tension impacts, if any.",
+ "meeting_type": "Type of meeting the tension is raised for (governance or tactical).",
+ "proposal_status": "Status of the proposal made for the tension, if any.",
+ "is_triaged": "Whether the tension has been triaged.",
+ "is_agenda_item": "Whether the tension is on a meeting agenda.",
+ "is_resolved": "Whether the tension is resolved.",
+ "processed": "Whether the tension has been processed.",
+ "links": "Identifiers of the related person, circle, impacted role, and proposal.",
+ },
+ },
}
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/glassfrog/glassfrog.py b/products/warehouse_sources/backend/temporal/data_imports/sources/glassfrog/glassfrog.py
index 0747550778e6..c79bbcbd10ae 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/glassfrog/glassfrog.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/glassfrog/glassfrog.py
@@ -1,15 +1,45 @@
+from typing import Any, Optional
+
import requests
+from requests import Response
from products.warehouse_sources.backend.temporal.data_imports.sources.common.http import make_tracked_session
from products.warehouse_sources.backend.temporal.data_imports.sources.common.rest_source import (
RESTAPIConfig,
rest_api_resource,
)
+from products.warehouse_sources.backend.temporal.data_imports.sources.common.rest_source.paginators import (
+ PageNumberPaginator,
+)
from products.warehouse_sources.backend.temporal.data_imports.sources.common.source_helpers import validate_via_probe
from products.warehouse_sources.backend.temporal.data_imports.sources.common.typings import SourceResponse
from products.warehouse_sources.backend.temporal.data_imports.sources.glassfrog.settings import GLASSFROG_ENDPOINTS
GLASSFROG_BASE_URL = "https://api.glassfrog.com/api/v3"
+# Documented `per_page` maximum; the API default is 30.
+GLASSFROG_PAGE_SIZE = 100
+
+
+class GlassfrogPageNumberPaginator(PageNumberPaginator):
+ """Page-number paginator that stops on a short page.
+
+ List responses carry no total count, so a page with fewer than `per_page` rows is the last one.
+ """
+
+ def __init__(self) -> None:
+ super().__init__(base_page=1)
+ self._previous_first_row: Any = None
+
+ def update_state(self, response: Response, data: Optional[list[Any]] = None) -> None:
+ first_row = data[0] if data else None
+ # Fail loudly instead of looping forever if the API ignores `page` and returns the same rows.
+ if first_row is not None and first_row == self._previous_first_row:
+ raise ValueError(f"GlassFrog returned the same rows for page {self.page} as the page before it")
+ self._previous_first_row = first_row
+
+ super().update_state(response, data)
+ if self._has_next_page and data is not None and len(data) < GLASSFROG_PAGE_SIZE:
+ self._has_next_page = False
def _make_session(api_key: str) -> requests.Session:
@@ -43,9 +73,7 @@ def glassfrog_source(api_key: str, endpoint: str, team_id: int, job_id: str) ->
"headers": {"Accept": "application/json"},
# Framework auth (not a hand-built header) so the key is redacted wherever it surfaces.
"auth": {"type": "api_key", "name": "X-Auth-Token", "api_key": api_key, "location": "header"},
- # GlassFrog v3 list endpoints return the full collection in one response — no
- # pagination, page, or cursor params are documented or honored.
- "paginator": "single_page",
+ "paginator": GlassfrogPageNumberPaginator(),
"session": _make_session(api_key),
},
"resources": [
@@ -53,6 +81,7 @@ def glassfrog_source(api_key: str, endpoint: str, team_id: int, job_id: str) ->
"name": endpoint,
"endpoint": {
"path": endpoint_config.path,
+ "params": {"per_page": GLASSFROG_PAGE_SIZE, **endpoint_config.params},
# Rows are wrapped under a resource key ({"circles": [...]}); a body without it
# is an unexpected/error shape. Fail loud instead of syncing zero rows.
"data_selector": endpoint_config.data_selector,
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/glassfrog/settings.py b/products/warehouse_sources/backend/temporal/data_imports/sources/glassfrog/settings.py
index dc69129d2128..877958c0d301 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/glassfrog/settings.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/glassfrog/settings.py
@@ -1,26 +1,36 @@
from dataclasses import dataclass, field
+from typing import Any
from products.warehouse_sources.backend.types import IncrementalField
-@dataclass
+@dataclass(frozen=True)
class GlassfrogEndpointConfig:
name: str
path: str
# Key wrapping the row list in the v3 response body (e.g. {"circles": [...]}).
data_selector: str
# Field to partition Delta files by. Must be a stable creation-time timestamp so a row never
- # moves between partitions. Only `projects` exposes one (`created_at`); the other resources
- # carry no datetime fields at all.
+ # moves between partitions. Only `projects`, `actions`, and `tensions` expose one (`created_at`).
+ # Proposal and meeting timestamps are nullable and set as the process advances.
partition_key: str | None = None
# Incremental cursor candidates. Left empty for every GlassFrog endpoint: the v3 API exposes
# no server-side timestamp/cursor filters, so an "incremental" sync would still fetch the
# whole collection each run. Full refresh is the honest strategy.
incremental_fields: list[IncrementalField] = field(default_factory=list)
primary_keys: list[str] = field(default_factory=lambda: ["id"])
+ params: dict[str, Any] = field(default_factory=dict)
GLASSFROG_ENDPOINTS: dict[str, GlassfrogEndpointConfig] = {
+ "actions": GlassfrogEndpointConfig(
+ name="actions",
+ path="/actions",
+ data_selector="actions",
+ partition_key="created_at",
+ # The API hides completed actions by default, which would drop them from the table.
+ params={"exclude_completed": "false"},
+ ),
"assignments": GlassfrogEndpointConfig(
name="assignments",
path="/assignments",
@@ -41,6 +51,11 @@ GLASSFROG_ENDPOINTS: dict[str, GlassfrogEndpointConfig] = {
path="/custom_fields",
data_selector="custom_fields",
),
+ "governance_meetings": GlassfrogEndpointConfig(
+ name="governance_meetings",
+ path="/governance_meetings",
+ data_selector="governance_meetings",
+ ),
"metrics": GlassfrogEndpointConfig(
name="metrics",
path="/metrics",
@@ -57,11 +72,22 @@ GLASSFROG_ENDPOINTS: dict[str, GlassfrogEndpointConfig] = {
data_selector="projects",
partition_key="created_at",
),
+ "proposals": GlassfrogEndpointConfig(
+ name="proposals",
+ path="/proposals",
+ data_selector="proposals",
+ ),
"roles": GlassfrogEndpointConfig(
name="roles",
path="/roles",
data_selector="roles",
),
+ "tensions": GlassfrogEndpointConfig(
+ name="tensions",
+ path="/tensions",
+ data_selector="tensions",
+ partition_key="created_at",
+ ),
}
ENDPOINTS = tuple(GLASSFROG_ENDPOINTS.keys())
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/glassfrog/source.py b/products/warehouse_sources/backend/temporal/data_imports/sources/glassfrog/source.py
index 1d4d96a6e697..5f7057a3a85e 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/glassfrog/source.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/glassfrog/source.py
@@ -49,7 +49,7 @@ class GlassfrogSource(SimpleSource[GlassfrogSourceConfig]):
category=DataWarehouseSourceCategory.PRODUCTIVITY,
label="GlassFrog",
releaseStatus=ReleaseStatus.ALPHA,
- caption="""Enter your GlassFrog API key to sync your organization's circles, roles, people, projects, metrics, and checklist items into the PostHog Data warehouse.
+ caption="""Enter your GlassFrog API key to sync your organization's circles, roles, people, projects, actions, tensions, proposals, governance meetings, metrics, and checklist items into the PostHog Data warehouse.
You can create a v3 API key in GlassFrog under [Profile & Settings > API](https://app.glassfrog.com/). The key grants access at your user's permission level.""",
iconPath="/static/services/glassfrog.png",
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/glassfrog/tests/test_glassfrog.py b/products/warehouse_sources/backend/temporal/data_imports/sources/glassfrog/tests/test_glassfrog.py
index 83ffc462c732..6357481400f8 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/glassfrog/tests/test_glassfrog.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/glassfrog/tests/test_glassfrog.py
@@ -1,5 +1,6 @@
import json
from typing import Any
+from urllib.parse import parse_qs, urlsplit
import pytest
from unittest import mock
@@ -14,6 +15,7 @@ from products.warehouse_sources.backend.temporal.data_imports.sources.common.res
)
from products.warehouse_sources.backend.temporal.data_imports.sources.glassfrog.glassfrog import (
GLASSFROG_BASE_URL,
+ GLASSFROG_PAGE_SIZE,
glassfrog_source,
validate_credentials,
)
@@ -65,7 +67,7 @@ class TestGetRows:
RESTClient._send_request.retry.wait = self._original_wait # type: ignore[attr-defined]
@mock.patch(SESSION_PATCH)
- def test_single_request_yields_rows_unwrapped_from_resource_key(self, MockSession) -> None:
+ def test_short_first_page_yields_rows_unwrapped_from_resource_key(self, MockSession) -> None:
session = MockSession.return_value
rows_body = [{"id": 1, "name": "General Company Circle"}, {"id": 2, "name": "Ops"}]
prepared = _wire(session, [_response(200, {"circles": rows_body})])
@@ -73,9 +75,34 @@ class TestGetRows:
rows = _rows(glassfrog_source("gf_key", "circles", team_id=1, job_id="j"))
assert rows == rows_body
- # No pagination params exist — the whole collection comes back in one request.
assert session.send.call_count == 1
- assert prepared[0].url == f"{GLASSFROG_BASE_URL}/circles"
+ assert prepared[0].url == f"{GLASSFROG_BASE_URL}/circles?per_page={GLASSFROG_PAGE_SIZE}&page=1"
+
+ @mock.patch(SESSION_PATCH)
+ def test_walks_pages_until_a_short_page(self, MockSession) -> None:
+ session = MockSession.return_value
+ first_page = [{"id": i} for i in range(GLASSFROG_PAGE_SIZE)]
+ prepared = _wire(
+ session,
+ [_response(200, {"tensions": first_page}), _response(200, {"tensions": [{"id": GLASSFROG_PAGE_SIZE}]})],
+ )
+
+ rows = _rows(glassfrog_source("gf_key", "tensions", team_id=1, job_id="j"))
+
+ assert rows == [*first_page, {"id": GLASSFROG_PAGE_SIZE}]
+ assert session.send.call_count == 2
+ assert [parse_qs(urlsplit(p.url or "").query)["page"] for p in prepared] == [["1"], ["2"]]
+
+ @mock.patch(SESSION_PATCH)
+ def test_repeated_page_raises_instead_of_looping(self, MockSession) -> None:
+ session = MockSession.return_value
+ full_page = [{"id": i} for i in range(GLASSFROG_PAGE_SIZE)]
+ _wire(session, [_response(200, {"tensions": full_page})] * 3)
+
+ with pytest.raises(ValueError, match="same rows"):
+ _rows(glassfrog_source("gf_key", "tensions", team_id=1, job_id="j"))
+
+ assert session.send.call_count == 2
@mock.patch(SESSION_PATCH)
def test_empty_collection_yields_no_rows(self, MockSession) -> None:
@@ -94,10 +121,22 @@ class TestGetRows:
with pytest.raises(ValueError, match="matched nothing"):
_rows(glassfrog_source("gf_key", "circles", team_id=1, job_id="j"))
- @parameterized.expand([(name, config.path, config.data_selector) for name, config in GLASSFROG_ENDPOINTS.items()])
+ @parameterized.expand(
+ [
+ (
+ name,
+ config.path,
+ config.data_selector,
+ f"?per_page={GLASSFROG_PAGE_SIZE}"
+ + ("&exclude_completed=false" if name == "actions" else "")
+ + "&page=1",
+ )
+ for name, config in GLASSFROG_ENDPOINTS.items()
+ ]
+ )
@mock.patch(SESSION_PATCH)
def test_each_endpoint_requests_its_path_and_unwraps_its_key(
- self, endpoint: str, path: str, data_selector: str, MockSession
+ self, endpoint: str, path: str, data_selector: str, query: str, MockSession
) -> None:
session = MockSession.return_value
prepared = _wire(session, [_response(200, {data_selector: [{"id": 42}]})])
@@ -105,7 +144,7 @@ class TestGetRows:
rows = _rows(glassfrog_source("gf_key", endpoint, team_id=1, job_id="j"))
assert rows == [{"id": 42}]
- assert prepared[0].url == f"{GLASSFROG_BASE_URL}{path}"
+ assert prepared[0].url == f"{GLASSFROG_BASE_URL}{path}{query}"
@mock.patch(SESSION_PATCH)
def test_api_key_sent_via_header_auth(self, MockSession) -> None:
@@ -224,8 +263,8 @@ class TestGlassfrogSourceResponse:
assert response.name == endpoint
assert response.primary_keys == ["id"]
- if endpoint == "projects":
- # Partition on the stable creation timestamp — the only GlassFrog resource with one.
+ if endpoint in ("actions", "projects", "tensions"):
+ # Partition on the stable creation timestamp — only these GlassFrog resources have one.
assert response.partition_keys == ["created_at"]
assert response.partition_mode == "datetime"
else: