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-sources): add jellyfish person, team and work category tables (#112550)

Tom Owers5c18abcdf09a
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 5ed3ba165c5b..51c49a2bcdf9 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
@@ -4491,10 +4491,10 @@ Today (9): `allocations_by_investment_category`, `allocations_by_person`, `alloc
Diffed against: <https://raw.githubusercontent.com/Jellyfish-AI/jellyfish-mcp/main/README.md>
-- [ ] `metrics/person_metrics` — per-engineer engineering metrics; we sync engineers and company_metrics but nothing in between (high)
-- [ ] `metrics/team_metrics` — per-team metrics for the teams we already sync — the main breakdown dimension (high)
-- [ ] `allocations/details/work_category (+ by_person, by_team)` — allocation split by work category; we sync the work_categories lookup and investment-category allocations but not the work-category allocations themselves (high)
-- [ ] `delivery/deliverable_scope_and_effort_history` — scope and effort change history for the deliverables we sync — the state-transition record behind delivery risk (high)
+- [x] `metrics/person_metrics` — per-engineer engineering metrics; we sync engineers and company_metrics but nothing in between (high)
+- [x] `metrics/team_metrics` — per-team metrics for the teams we already sync — the main breakdown dimension (high)
+- [x] `allocations/details/work_category (+ by_person, by_team)` — allocation split by work category; we sync the work_categories lookup and investment-category allocations but not the work-category allocations themselves (high)
+- [x] `delivery/deliverable_scope_and_effort_history` — scope and effort change history for the deliverables we sync — the state-transition record behind delivery risk (high)
- [ ] `metrics/team_sprint_summary` — sprint-level throughput and commitment per team (medium)
- [ ] `allocations/details/investment_category_person and investment_category_team` — finer-grained investment-category breakdown than the flat allocations table we have (medium)
- [ ] `allocations/summary/investment_category and summary/work_category` — prebuilt allocation rollups for dashboards without re-aggregating detail rows (medium)
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/jellyfish/canonical_descriptions.py b/products/warehouse_sources/backend/temporal/data_imports/sources/jellyfish/canonical_descriptions.py
index 26a780c1d8d9..d68659b45dda 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/jellyfish/canonical_descriptions.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/jellyfish/canonical_descriptions.py
@@ -79,4 +79,51 @@ CANONICAL_DESCRIPTIONS: CanonicalDescriptions = {
"teams": "Teams contributing to the deliverable.",
},
},
+ "allocations_by_work_category": {
+ "description": "R&D allocation (FTE effort) per deliverable within each work category, for each calendar-month window.",
+ "docs_url": "https://github.com/Jellyfish-AI/jellyfish-mcp",
+ "columns": {
+ **_WINDOW_COLUMNS,
+ "work_category_slug": "Slug of the work category this row was exported for (added by PostHog).",
+ },
+ },
+ "allocations_by_work_category_person": {
+ "description": "R&D allocation (FTE effort) per deliverable and person within each work category, for each calendar-month window.",
+ "docs_url": "https://github.com/Jellyfish-AI/jellyfish-mcp",
+ "columns": {
+ **_WINDOW_COLUMNS,
+ "work_category_slug": "Slug of the work category this row was exported for (added by PostHog).",
+ },
+ },
+ "allocations_by_work_category_team": {
+ "description": "R&D allocation (FTE effort) per deliverable and top-level team within each work category, for each calendar-month window.",
+ "docs_url": "https://github.com/Jellyfish-AI/jellyfish-mcp",
+ "columns": {
+ **_WINDOW_COLUMNS,
+ "work_category_slug": "Slug of the work category this row was exported for (added by PostHog).",
+ },
+ },
+ "person_metrics": {
+ "description": "Engineering metrics per engineer for each calendar-month window.",
+ "docs_url": "https://github.com/Jellyfish-AI/jellyfish-mcp",
+ "columns": {
+ **_WINDOW_COLUMNS,
+ "person_id": "Jellyfish id of the engineer the metrics are for (added by PostHog when absent).",
+ },
+ },
+ "team_metrics": {
+ "description": "Engineering metrics per team, at every level of the team hierarchy, for each calendar-month window. Pull-request figures only include pull requests linked to an issue that resolves to the team.",
+ "docs_url": "https://github.com/Jellyfish-AI/jellyfish-mcp",
+ "columns": {
+ **_WINDOW_COLUMNS,
+ "team_id": "Jellyfish id of the team the metrics are for (added by PostHog when absent).",
+ },
+ },
+ "deliverable_scope_and_effort_history": {
+ "description": "Weekly scope and allocated effort history for each deliverable.",
+ "docs_url": "https://github.com/Jellyfish-AI/jellyfish-mcp",
+ "columns": {
+ "deliverable_id": "Jellyfish id of the deliverable this history is for (added by PostHog when absent).",
+ },
+ },
}
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/jellyfish/jellyfish.py b/products/warehouse_sources/backend/temporal/data_imports/sources/jellyfish/jellyfish.py
index 970880c84edf..a3511366fff3 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/jellyfish/jellyfish.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/jellyfish/jellyfish.py
@@ -15,6 +15,7 @@ from products.warehouse_sources.backend.temporal.data_imports.sources.common.typ
from products.warehouse_sources.backend.temporal.data_imports.sources.jellyfish.settings import (
DEFAULT_LOOKBACK_MONTHS,
JELLYFISH_ENDPOINTS,
+ FanOutParent,
JellyfishEndpointConfig,
)
@@ -44,13 +45,16 @@ class JellyfishRateLimitError(Exception):
self.retry_after = retry_after
[email protected](frozen=True)
class JellyfishResumeConfig:
# Month-windowed endpoints: the ISO date of the next window to fetch. None = start from the
# beginning of the lookback range.
next_window_start: str | None = None
- # Fan-out endpoint (deliverables): work category slugs already fully fetched this job.
- completed_slugs: list[str] = dataclasses.field(default_factory=list)
+ # Fan-out endpoints: parent ids (work category slugs, person/team/deliverable ids) already fully
+ # fetched this job.
+ completed_parent_ids: list[str] = dataclasses.field(default_factory=list)
+ # Fan-out month-windowed endpoints: the parent whose windows `next_window_start` refers to.
+ current_parent_id: str | None = None
def _get_headers(api_token: str) -> dict[str, str]:
@@ -194,6 +198,55 @@ def _list_work_category_slugs(
return slugs
+def _list_ids(rows: list[dict[str, Any]], label: str, logger: FilteringBoundLogger) -> list[str]:
+ ids = [str(row["id"]) for row in rows if row.get("id") is not None]
+ if not ids and rows:
+ logger.error(f"Jellyfish: could not find an id field in {label} rows: keys={sorted(rows[0])}")
+ return ids
+
+
+def _flatten_team_tree(rows: list[dict[str, Any]]) -> list[dict[str, Any]]:
+ # `include_children` may nest child teams under `children` instead of listing them flat.
+ flat: list[dict[str, Any]] = []
+ for row in rows:
+ flat.append(row)
+ children = row.get("children")
+ if isinstance(children, list):
+ flat.extend(_flatten_team_tree([child for child in children if isinstance(child, dict)]))
+ return flat
+
+
+def _list_parent_ids(
+ parent: FanOutParent,
+ session: requests.Session,
+ headers: dict[str, str],
+ logger: FilteringBoundLogger,
+ today: date,
+) -> list[str]:
+ if parent == "work_categories":
+ ids = _list_work_category_slugs(session, headers, logger)
+ elif parent in ("engineers", "teams"):
+ config = JELLYFISH_ENDPOINTS[parent]
+ payload = _fetch(session, _build_url(config.path, {"format": "json", **config.params}), headers, logger)
+ rows = _extract_rows(payload, config.data_key)
+ ids = _list_ids(_flatten_team_tree(rows) if parent == "teams" else rows, parent, logger)
+ else:
+ config = JELLYFISH_ENDPOINTS["deliverables"]
+ assert config.fan_out is not None
+ window_start = _month_windows(today)[0][0]
+ ids = []
+ for slug in _list_work_category_slugs(session, headers, logger):
+ params = {
+ "format": "json",
+ config.fan_out.param: slug,
+ "start_date": window_start.isoformat(),
+ "end_date": today.isoformat(),
+ }
+ payload = _fetch(session, _build_url(config.path, params), headers, logger)
+ ids.extend(_list_ids(_extract_rows(payload, config.data_key), parent, logger))
+ return list(dict.fromkeys(ids))
+
+
def get_rows(
api_token: str,
endpoint: str,
@@ -210,12 +263,12 @@ def get_rows(
resume = resumable_source_manager.load_state() if resumable_source_manager.can_resume() else None
today = datetime.now(UTC).date()
- if config.window_mode == "month":
- yield from _get_month_windowed_rows(
+ if config.fan_out is not None:
+ yield from _get_fan_out_rows(
session, headers, logger, config, base_params, resumable_source_manager, resume, today
)
- elif config.fan_out_slug_param is not None:
- yield from _get_fan_out_rows(
+ elif config.window_mode == "month":
+ yield from _get_month_windowed_rows(
session, headers, logger, config, base_params, resumable_source_manager, resume, today
)
else:
@@ -274,34 +327,56 @@ def _get_fan_out_rows(
resume: JellyfishResumeConfig | None,
today: date,
) -> Iterator[list[dict[str, Any]]]:
- slugs = _list_work_category_slugs(session, headers, logger)
- completed = set(resume.completed_slugs) if resume is not None else set()
+ assert config.fan_out is not None
+ fan_out = config.fan_out
+ parent_ids = _list_parent_ids(fan_out.parent, session, headers, logger, today)
+ completed = set(resume.completed_parent_ids) if resume is not None else set()
if completed:
- logger.debug(f"Jellyfish: resuming {config.name}, skipping {len(completed)} completed work categories")
+ logger.debug(f"Jellyfish: resuming {config.name}, skipping {len(completed)} completed {fan_out.parent}")
- # Deliverables are discrete records, so one wide window over the whole lookback range per work
- # category (rather than per-month slices) fetches each deliverable once.
- window_start = _month_windows(today)[0][0]
-
- for slug in slugs:
- if slug in completed:
+ for parent_id in parent_ids:
+ if parent_id in completed:
continue
- assert config.fan_out_slug_param is not None
- params = {
- **base_params,
- config.fan_out_slug_param: slug,
- "start_date": window_start.isoformat(),
- "end_date": today.isoformat(),
- }
- payload = _fetch(session, _build_url(config.path, params), headers, logger)
- rows = _extract_rows(payload, config.data_key)
- for row in rows:
- row.setdefault("work_category_slug", slug)
- if rows:
- yield rows
- completed.add(slug)
- resumable_source_manager.save_state(JellyfishResumeConfig(completed_slugs=sorted(completed)))
+ if config.window_mode == "month":
+ windows = _month_windows(today)
+ if resume is not None and resume.current_parent_id == parent_id and resume.next_window_start:
+ windows = [w for w in windows if w[0].isoformat() >= resume.next_window_start]
+ else:
+ # Entity-shaped rows (deliverables, scope history) are discrete records, so one wide
+ # window over the whole lookback range fetches each record once.
+ windows = [(_month_windows(today)[0][0], today)]
+
+ for index, (window_start, window_end) in enumerate(windows):
+ params = {
+ **base_params,
+ fan_out.param: parent_id,
+ "start_date": window_start.isoformat(),
+ "end_date": window_end.isoformat(),
+ }
+ if config.window_mode == "month":
+ params["unit"] = "month"
+ payload = _fetch(session, _build_url(config.path, params), headers, logger)
+ rows = _extract_rows(payload, config.data_key)
+ for row in rows:
+ row.setdefault(fan_out.param, parent_id)
+ if config.window_mode == "month":
+ row.setdefault("window_start_date", window_start.isoformat())
+ row.setdefault("window_end_date", window_end.isoformat())
+ if rows:
+ yield rows
+
+ if index + 1 < len(windows):
+ resumable_source_manager.save_state(
+ JellyfishResumeConfig(
+ next_window_start=windows[index + 1][0].isoformat(),
+ completed_parent_ids=sorted(completed),
+ current_parent_id=parent_id,
+ )
+ )
+
+ completed.add(parent_id)
+ resumable_source_manager.save_state(JellyfishResumeConfig(completed_parent_ids=sorted(completed)))
def jellyfish_source(
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/jellyfish/settings.py b/products/warehouse_sources/backend/temporal/data_imports/sources/jellyfish/settings.py
index 06769308f7e0..33421b88c17e 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/jellyfish/settings.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/jellyfish/settings.py
@@ -14,8 +14,23 @@ DEFAULT_LOOKBACK_MONTHS = 24
# - None: no date params (small reference lists).
WindowMode = Optional[Literal["month", "full"]]
+# Parent lists a fan-out endpoint iterates. Each parent's id is passed as `JellyfishFanOut.param`.
+# - "work_categories": slugs from `delivery/work_categories`.
+# - "engineers": person ids from `people/list_engineers`.
+# - "teams": team ids from the whole `teams/list_teams` tree.
+# - "deliverables": deliverable ids from `delivery/work_category_contents` in every work category.
+FanOutParent = Literal["work_categories", "engineers", "teams", "deliverables"]
-@dataclass
+
+@dataclass(frozen=True)
+class JellyfishFanOut:
+ parent: FanOutParent
+ # Query param the parent id goes in. Rows also get it injected under this name, so each row
+ # keeps the entity it was exported for.
+ param: str
+
+
+@dataclass(frozen=True)
class JellyfishEndpointConfig:
name: str
path: str # relative to https://app.jellyfish.co/endpoints/export/v0/
@@ -25,9 +40,8 @@ class JellyfishEndpointConfig:
# Top-level response key wrapping the row list, when known (e.g. `deliverables`). The row
# extractor falls back to auto-detecting a single list-of-dicts value when this is unset.
data_key: str | None = None
- # When set, the endpoint is called once per work category: slugs are listed from
- # `delivery/work_categories` and passed via this query param.
- fan_out_slug_param: str | None = None
+ # When set, the endpoint is called once per parent entity (see `FanOutParent`).
+ fan_out: JellyfishFanOut | None = None
primary_keys: list[str] | None = None
# Only month-windowed endpoints partition — on the injected, stable `window_start_date`.
partition_key: str | None = None
@@ -36,8 +50,8 @@ class JellyfishEndpointConfig:
# The endpoints a Jellyfish user actually wants in a warehouse, cross-referenced against the
# official Jellyfish-AI/jellyfish-mcp wrapper (no Airbyte/Fivetran connector exists): reference
# lists (engineers, teams, work categories), R&D allocation breakdowns, delivery deliverables, and
-# company-level metrics. Endpoints requiring per-entity ids (person/team metrics, scope history)
-# are deliberately left out of v1 — they need fan-out over volatile id lists.
+# company-level metrics. Endpoints that require a per-entity id (person/team metrics, work
+# category allocations, deliverable scope history) fan out over the matching parent list.
JELLYFISH_ENDPOINTS: dict[str, JellyfishEndpointConfig] = {
"engineers": JellyfishEndpointConfig(
name="engineers",
@@ -94,7 +108,51 @@ JELLYFISH_ENDPOINTS: dict[str, JellyfishEndpointConfig] = {
path="delivery/work_category_contents",
window_mode="full",
data_key="deliverables",
- fan_out_slug_param="work_category_slug",
+ fan_out=JellyfishFanOut(parent="work_categories", param="work_category_slug"),
+ ),
+ "allocations_by_work_category": JellyfishEndpointConfig(
+ name="allocations_by_work_category",
+ path="allocations/details/work_category",
+ window_mode="month",
+ fan_out=JellyfishFanOut(parent="work_categories", param="work_category_slug"),
+ partition_key="window_start_date",
+ ),
+ "allocations_by_work_category_person": JellyfishEndpointConfig(
+ name="allocations_by_work_category_person",
+ path="allocations/details/work_category/by_person",
+ window_mode="month",
+ fan_out=JellyfishFanOut(parent="work_categories", param="work_category_slug"),
+ partition_key="window_start_date",
+ ),
+ "allocations_by_work_category_team": JellyfishEndpointConfig(
+ name="allocations_by_work_category_team",
+ path="allocations/details/work_category/by_team",
+ params={"team_hierarchy_level": 1},
+ window_mode="month",
+ fan_out=JellyfishFanOut(parent="work_categories", param="work_category_slug"),
+ partition_key="window_start_date",
+ ),
+ "person_metrics": JellyfishEndpointConfig(
+ name="person_metrics",
+ path="metrics/person_metrics",
+ window_mode="month",
+ fan_out=JellyfishFanOut(parent="engineers", param="person_id"),
+ partition_key="window_start_date",
+ ),
+ "team_metrics": JellyfishEndpointConfig(
+ name="team_metrics",
+ path="metrics/team_metrics",
+ window_mode="month",
+ fan_out=JellyfishFanOut(parent="teams", param="team_id"),
+ partition_key="window_start_date",
+ ),
+ "deliverable_scope_and_effort_history": JellyfishEndpointConfig(
+ name="deliverable_scope_and_effort_history",
+ path="delivery/scope_and_effort_history",
+ # One wide window per deliverable; `unit=week` returns one row per week of history.
+ params={"unit": "week"},
+ window_mode="full",
+ fan_out=JellyfishFanOut(parent="deliverables", param="deliverable_id"),
),
}
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/jellyfish/tests/test_jellyfish.py b/products/warehouse_sources/backend/temporal/data_imports/sources/jellyfish/tests/test_jellyfish.py
index 8d82598ea492..efc64b685f6c 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/jellyfish/tests/test_jellyfish.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/jellyfish/tests/test_jellyfish.py
@@ -15,6 +15,7 @@ from products.warehouse_sources.backend.temporal.data_imports.sources.jellyfish.
_build_url,
_extract_rows,
_get_headers,
+ _list_ids,
_month_windows,
_parse_retry_after,
_retry_wait,
@@ -68,6 +69,12 @@ class TestExtractRows:
def test_missing_data_key_falls_back_to_autodetection(self) -> None:
assert _extract_rows({"items": [{"id": 1}]}, data_key="deliverables") == [{"id": 1}]
+ def test_missing_parent_ids_are_logged(self) -> None:
+ logger = MagicMock()
+
+ assert _list_ids([{"name": "No identifier"}], "engineers", logger) == []
+ logger.error.assert_called_once_with("Jellyfish: could not find an id field in engineers rows: keys=['name']")
+
class _FakeResumableManager:
def __init__(self, state: JellyfishResumeConfig | None = None) -> None:
@@ -191,13 +198,13 @@ class TestGetRowsFanOut:
assert content_calls[0]["params"]["start_date"] == "2024-04-01"
assert content_calls[0]["params"]["end_date"] == "2026-03-10"
assert manager.saved == [
- JellyfishResumeConfig(completed_slugs=["roadmap"]),
- JellyfishResumeConfig(completed_slugs=["kt", "roadmap"]),
+ JellyfishResumeConfig(completed_parent_ids=["roadmap"]),
+ JellyfishResumeConfig(completed_parent_ids=["kt", "roadmap"]),
]
def test_resume_skips_completed_work_categories(self, monkeypatch: Any) -> None:
calls = _install_fake_fetch(monkeypatch, self._responder)
- manager = _FakeResumableManager(JellyfishResumeConfig(completed_slugs=["roadmap"]))
+ manager = _FakeResumableManager(JellyfishResumeConfig(completed_parent_ids=["roadmap"]))
rows = _collect("deliverables", manager, date(2026, 3, 10), monkeypatch)
assert [r["work_category_slug"] for r in rows] == ["kt"]
@@ -218,6 +225,105 @@ class TestGetRowsFanOut:
assert content_calls[0]["params"]["work_category_slug"] == "42"
+class TestGetRowsEntityFanOut:
+ @pytest.mark.parametrize(
+ "endpoint,parent_path,parent_payload,param,expected_ids",
+ [
+ ("person_metrics", "people/list_engineers", [{"id": 11}, {"id": 12}], "person_id", ["11", "12"]),
+ # Child teams nested under `children` are fanned out too, so every level gets metrics.
+ (
+ "team_metrics",
+ "teams/list_teams",
+ {"teams": [{"id": 1, "children": [{"id": 2, "children": [{"id": 3}]}]}]},
+ "team_id",
+ ["1", "2", "3"],
+ ),
+ (
+ "allocations_by_work_category_team",
+ "delivery/work_categories",
+ [{"slug": "roadmap"}, {"slug": "roadmap"}],
+ "work_category_slug",
+ ["roadmap"],
+ ),
+ ],
+ )
+ def test_month_windows_per_parent_with_parent_and_window_injected(
+ self,
+ endpoint: str,
+ parent_path: str,
+ parent_payload: Any,
+ param: str,
+ expected_ids: list[str],
+ monkeypatch: Any,
+ ) -> None:
+ def responder(path: str, params: dict[str, Any]) -> Any:
+ if path == parent_path:
+ return parent_payload
+ return [{"value": 1}]
+
+ calls = _install_fake_fetch(monkeypatch, responder)
+ rows = _collect(endpoint, _FakeResumableManager(), date(2026, 3, 10), monkeypatch)
+
+ child_calls = [c for c in calls if c["path"] == JELLYFISH_ENDPOINTS[endpoint].path]
+ assert [c["params"][param] for c in child_calls[::24]] == expected_ids
+ assert len(child_calls) == 24 * len(expected_ids)
+ assert child_calls[0]["params"]["unit"] == "month"
+ assert rows[0] == {
+ "value": 1,
+ param: expected_ids[0],
+ "window_start_date": "2024-04-01",
+ "window_end_date": "2024-04-30",
+ }
+
+ def test_resume_continues_in_progress_parent_from_saved_window(self, monkeypatch: Any) -> None:
+ def responder(path: str, params: dict[str, Any]) -> Any:
+ if path == "people/list_engineers":
+ return [{"id": 11}, {"id": 12}, {"id": 13}]
+ return [{"value": 1}]
+
+ calls = _install_fake_fetch(monkeypatch, responder)
+ manager = _FakeResumableManager(
+ JellyfishResumeConfig(next_window_start="2026-02-01", completed_parent_ids=["11"], current_parent_id="12")
+ )
+ _collect("person_metrics", manager, date(2026, 3, 10), monkeypatch)
+
+ metric_calls = [
+ (c["params"]["person_id"], c["params"]["start_date"]) for c in calls if "person_id" in c["params"]
+ ]
+ assert metric_calls[:2] == [("12", "2026-02-01"), ("12", "2026-03-01")]
+ # The saved window only applies to the parent it was saved for.
+ assert metric_calls[2] == ("13", "2024-04-01")
+ assert len(metric_calls) == 2 + 24
+ assert manager.saved[1] == JellyfishResumeConfig(completed_parent_ids=["11", "12"])
+ assert manager.saved[2] == JellyfishResumeConfig(
+ next_window_start="2024-05-01", completed_parent_ids=["11", "12"], current_parent_id="13"
+ )
+
+ def test_scope_history_fans_out_over_deliverables_in_every_work_category(self, monkeypatch: Any) -> None:
+ def responder(path: str, params: dict[str, Any]) -> Any:
+ if path == "delivery/work_categories":
+ return [{"slug": "epics"}, {"slug": "initiatives"}]
+ if path == "delivery/work_category_contents":
+ ids = {"epics": [101, 102], "initiatives": [102, 201]}[params["work_category_slug"]]
+ return {"deliverables": [{"id": i} for i in ids]}
+ return [{"week": "2026-03-02", "scope": 5}]
+
+ calls = _install_fake_fetch(monkeypatch, responder)
+ rows = _collect("deliverable_scope_and_effort_history", _FakeResumableManager(), date(2026, 3, 10), monkeypatch)
+
+ history_calls = [c for c in calls if c["path"] == "delivery/scope_and_effort_history"]
+ # A deliverable listed under two work categories is fetched once.
+ assert [c["params"]["deliverable_id"] for c in history_calls] == ["101", "102", "201"]
+ assert history_calls[0]["params"] == {
+ "format": "json",
+ "unit": "week",
+ "deliverable_id": "101",
+ "start_date": "2024-04-01",
+ "end_date": "2026-03-10",
+ }
+ assert rows[0] == {"week": "2026-03-02", "scope": 5, "deliverable_id": "101"}
+
+
class TestJellyfishSourceResponse:
def test_windowed_endpoint_partitions_on_injected_window_start(self) -> None:
response = jellyfish_source("t", "company_metrics", MagicMock(), MagicMock())