: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
fix(engineering-analytics): tighten delivery timeline edges (#101226)
Julian Bezd9585de2986d
diff --git a/products/engineering_analytics/backend/logic/pr_timeline.py b/products/engineering_analytics/backend/logic/pr_timeline.pyindex c4d4253b2566..0cb1f9d66fbd 100644--- a/products/engineering_analytics/backend/logic/pr_timeline.py+++ b/products/engineering_analytics/backend/logic/pr_timeline.py@@ -16,7 +16,8 @@ merge into one segment. The evaluation is a fixed precedence, most blocking firsreviewer's latest verdict requests changes, approved when none does, else waiting for review.A commit's check state per workflow is its latest attempt: a re-run in flight reads as running,-not red, the same way GitHub shows it.+not red, the same way GitHub shows it. A run that exists but has not started yet also reads as+running, because the wait for a runner is CI time, not review time."""import bisect@@ -190,6 +191,7 @@ class PRTimelineBuilder:def _change_points(self) -> list[datetime]:points: list[datetime] = [*self._push_times]for attempt in self._pr.attempts:+ points.append(attempt.pushed_at)points.append(attempt.started_at)if attempt.completed_at is not None:points.append(attempt.completed_at)@@ -233,12 +235,16 @@ class PRTimelineBuilder:@staticmethoddef _check_state(push: _Push, at: datetime) -> tuple[list[RunAttempt], bool]:- """The head commit's failed latest attempts and whether any latest attempt still runs."""+ """The head commit's failed latest attempts and whether any latest attempt still runs or waits to start."""failed: list[RunAttempt] = []running = Falsefor attempts in push.attempts_by_workflow.values():started = [attempt for attempt in attempts if attempt.started_at <= at]if not started:+ # Only a first attempt proves a queue wait: every attempt of a run carries the run's+ # creation time, so a re-run's would stretch back over the stretch it was red.+ if any(attempt.attempt == 1 and attempt.pushed_at <= at for attempt in attempts):+ running = Truecontinuelatest = started[-1]if latest.completed_at is None or latest.completed_at > at:diff --git a/products/engineering_analytics/backend/logic/queries/_curated.py b/products/engineering_analytics/backend/logic/queries/_curated.pyindex b4937aceb562..85b5d0561c9b 100644--- a/products/engineering_analytics/backend/logic/queries/_curated.py+++ b/products/engineering_analytics/backend/logic/queries/_curated.py@@ -241,12 +241,13 @@ class CuratedGitHubSource:return Nonereturn f"({team_members.build_query(self._tables.team_members)})"- def issue_events_source(self) -> str | None:+ def issue_events_source(self, *, created_floor: bool = False) -> str | None:"""Curated PR draft/ready transitions ``SELECT`` subquery, or None when the optional- issue-events table isn't synced."""+ issue-events table isn't synced. ``created_floor`` adds the raw-string scan floor — callers+ must register {event_created_floor} (see run_started_floor_constant)."""if not self._tables.issue_events:return None- return f"({issue_events.build_query(self._tables.issue_events)})"+ return f"({issue_events.build_query(self._tables.issue_events, created_floor=created_floor)})"def reviews_source(self) -> str | None:"""Curated submitted-reviews ``SELECT`` subquery, or None when the optional reviews tablediff --git a/products/engineering_analytics/backend/logic/queries/delivery_summary.py b/products/engineering_analytics/backend/logic/queries/delivery_summary.pyindex ef996d37acdd..dee7115d5a52 100644--- a/products/engineering_analytics/backend/logic/queries/delivery_summary.py+++ b/products/engineering_analytics/backend/logic/queries/delivery_summary.py@@ -33,6 +33,7 @@ from products.engineering_analytics.backend.logic.merge_queue import GATE_RUN_LOfrom products.engineering_analytics.backend.logic.queries._curated import CuratedGitHubSourcefrom products.engineering_analytics.backend.logic.queries._workflow_filters import (DECISIVE_FAILURE_CONCLUSIONS_SQL,+ UNPAGED_SCAN_LIMIT,run_started_floor_constant,)from products.engineering_analytics.backend.logic.queries.dora import DeployedPR, query_deployed_prs@@ -43,8 +44,6 @@ from products.engineering_analytics.backend.logic.views.reviews import APPROVED_# ran its CI days before; older runs are left out so the runs and jobs scans stay bounded.CI_LOOKBACK = timedelta(days=30)-_ROW_LIMIT = 100000-_MERGED_SELECT = f"""SELECTpr.number,@@ -56,7 +55,7 @@ _MERGED_SELECT = f"""__READY_JOIN__WHERE pr.merged_at IS NOT NULL AND pr.merged_at >= {{date_from}} __DATE_TO__AND NOT pr.is_bot AND NOT pr.is_draft- LIMIT {_ROW_LIMIT}+ LIMIT {UNPAGED_SCAN_LIMIT}"""# Open and draft counts are current state, so they ignore the window.@@ -74,7 +73,7 @@ _APPROVALS_SELECT = f"""FROM __REVIEWS_SOURCE__ AS rvWHERE state = '{APPROVED_STATE}' AND pr_number IN {{pr_numbers}}GROUP BY pr_number- LIMIT {_ROW_LIMIT}+ LIMIT {UNPAGED_SCAN_LIMIT}"""# A push is a distinct head commit that triggered CI; gate runs are the queue's rebases, not pushes.@@ -88,7 +87,7 @@ _PUSHES_SELECT = f"""GROUP BY pr_number, head_sha)GROUP BY pr_number- LIMIT {_ROW_LIMIT}+ LIMIT {UNPAGED_SCAN_LIMIT}"""_GATE_ATTEMPTS_SELECT = f"""@@ -100,7 +99,7 @@ _GATE_ATTEMPTS_SELECT = f"""FROM __RUNS_SOURCE__ AS rWHERE r.is_merge_queue AND r.pr_number IN {{pr_numbers}} AND r.run_started_at >= {{gate_from}}GROUP BY pr_number, attempt- LIMIT 1000000+ LIMIT {UNPAGED_SCAN_LIMIT}"""@@ -332,7 +331,12 @@ def _lead_time(deploy_data_available=True,environment_scope=deployed.environment_scope,merged_pr_count=scope_merged_count,- deployed_merged_pr_count=sum(1 for row in deployed.rows if row.in_scope and in_window(row.merged_at)),+ # A deploy after the window end had not happened yet in the selected horizon.+ deployed_merged_pr_count=sum(+ 1+ for row in deployed.rows+ if row.in_scope and in_window(row.merged_at) and (date_to is None or row.deployed_at <= date_to)+ ),open_to_deploy=pair(lambda row: (row.deployed_at - row.created_at).total_seconds()),open_to_merge=pair(lambda row: (row.merged_at - row.created_at).total_seconds()),merge_to_deploy=pair(lambda row: (row.deployed_at - row.merged_at).total_seconds()),diff --git a/products/engineering_analytics/backend/logic/queries/dora.py b/products/engineering_analytics/backend/logic/queries/dora.pyindex b3948d5d0d66..c9ec4b3bd4f3 100644--- a/products/engineering_analytics/backend/logic/queries/dora.py+++ b/products/engineering_analytics/backend/logic/queries/dora.py@@ -50,6 +50,7 @@ from products.engineering_analytics.backend.logic.queries._buckets import ()from products.engineering_analytics.backend.logic.queries._curated import CuratedGitHubSource, DeploySources, opt_floatfrom products.engineering_analytics.backend.logic.queries._workflow_filters import (+ UNPAGED_SCAN_LIMIT,run_started_floor_constant,window_pair_predicates,)@@ -802,11 +803,11 @@ def query_dora_overview(# Every deployed PR relevant to one window, one row each: deployed in the window (the distribution# population) or merged in it (the attribution-coverage population). The author page splits the# rows in Python, so the containment rule stays defined once, in the CTEs above.-_DEPLOYED_PR_ROWS_SELECT = """+_DEPLOYED_PR_ROWS_SELECT = f"""SELECT number, (__SCOPE__) AS in_scope, created_at, merged_at, deployed_atFROM deployed_prs- WHERE (deployed_at >= {date_from} __DATE_TO_DEPLOYED__) OR (merged_at >= {date_from} __DATE_TO_MERGED__)- LIMIT 100000+ WHERE (deployed_at >= {{date_from}} __DATE_TO_DEPLOYED__) OR (merged_at >= {{date_from}} __DATE_TO_MERGED__)+ LIMIT {UNPAGED_SCAN_LIMIT}"""diff --git a/products/engineering_analytics/backend/logic/queries/pull_request_timelines.py b/products/engineering_analytics/backend/logic/queries/pull_request_timelines.pyindex a3fca7a9b81f..2fe2994c9936 100644--- a/products/engineering_analytics/backend/logic/queries/pull_request_timelines.py+++ b/products/engineering_analytics/backend/logic/queries/pull_request_timelines.py@@ -39,6 +39,7 @@ from products.engineering_analytics.backend.logic.queries._curated import Curatefrom products.engineering_analytics.backend.logic.queries._workflow_filters import (DECISIVE_FAILURE_CONCLUSIONS,DECISIVE_FAILURE_CONCLUSIONS_SQL,+ UNPAGED_SCAN_LIMIT,run_started_floor_constant,run_windowed_job_created_floor_constant,)@@ -66,43 +67,43 @@ _PRS_SELECT = f"""LIMIT {_LIMIT + 1}"""-_TRANSITIONS_SELECT = """+_TRANSITIONS_SELECT = f"""SELECT pr_number, event, created_atFROM __EVENTS_SOURCE__ AS se- WHERE pr_number IN {pr_numbers}+ WHERE pr_number IN {{pr_numbers}}ORDER BY created_at ASC, id ASC- LIMIT 100000+ LIMIT {UNPAGED_SCAN_LIMIT}"""-_REVIEWS_SELECT = """+_REVIEWS_SELECT = f"""SELECT pr_number, reviewer_login, state, submitted_atFROM __REVIEWS_SOURCE__ AS rv- WHERE pr_number IN {pr_numbers}- LIMIT 100000+ WHERE pr_number IN {{pr_numbers}}+ LIMIT {UNPAGED_SCAN_LIMIT}"""-# A skipped run never executes, so it adds no red or running time. HogQL caps a result at 50k rows,-# and skipped and merge-queue runs are a third of a busy team's runs, so both stay out of this list.-_RUNS_SELECT = """+# A skipped run never executes, so it adds no red or running time. Skipped and merge-queue runs are a+# third of a busy team's runs, so both stay out of this list to keep it under UNPAGED_SCAN_LIMIT.+_RUNS_SELECT = f"""SELECTid, pr_number, workflow_name, head_sha, status, conclusion, run_started_at, updated_at, run_attempt, created_atFROM __RUNS_SOURCE__ AS r- WHERE pr_number IN {pr_numbers} AND run_started_at >= {run_from}+ WHERE pr_number IN {{pr_numbers}} AND run_started_at >= {{run_from}}AND NOT is_merge_queue AND ifNull(conclusion, '') != 'skipped'- LIMIT 1000000+ LIMIT {UNPAGED_SCAN_LIMIT}"""# One row per merge-queue attempt: the queue runs several workflows for each attempt.-_GATE_ATTEMPTS_SELECT = """+_GATE_ATTEMPTS_SELECT = f"""SELECTpr_number,min(run_started_at) AS started_at,max(updated_at) AS completed_at,countIf(status != 'completed' OR updated_at IS NULL) AS unfinishedFROM __RUNS_SOURCE__ AS r- WHERE pr_number IN {pr_numbers} AND run_started_at >= {run_from} AND is_merge_queue+ WHERE pr_number IN {{pr_numbers}} AND run_started_at >= {{run_from}} AND is_merge_queueGROUP BY pr_number, __GATE_ATTEMPT__- LIMIT 1000000+ LIMIT {UNPAGED_SCAN_LIMIT}"""# One row per run attempt. Re-run copies are GitHub's re-listing of jobs that never ran again, so@@ -119,7 +120,7 @@ _JOB_ATTEMPTS_SELECT = f"""FROM __JOBS_SOURCE__ AS jWHERE run_id IN {{run_ids}} AND NOT is_rerun_copyGROUP BY run_id, run_attempt- LIMIT 1000000+ LIMIT {UNPAGED_SCAN_LIMIT}"""_MASTER_FAILURES_SELECT = f"""@@ -132,7 +133,7 @@ _MASTER_FAILURES_SELECT = f"""AND j.conclusion IN ({DECISIVE_FAILURE_CONCLUSIONS_SQL})AND j.completed_at IS NOT NULLAND j.workflow_name IN {{workflow_names}}- LIMIT 200000+ LIMIT {UNPAGED_SCAN_LIMIT}"""_TRUNK_STATE_SELECT = """@@ -196,7 +197,7 @@ class PullRequestTimelinesQuery:# An open PR is listed whatever its age, and one old PR would stretch every scan back months.# A listed PR's CI is read from the same lookback the summary uses, and its timeline starts there.run_from = max(run_from, self._date_from - CI_LOOKBACK)- ready_at = self._query_ready_at(pr_numbers)+ ready_at = self._query_ready_at(pr_numbers, run_from)reviews = self._query_reviews(pr_numbers)attempts, gates = self._query_attempts(pr_numbers, run_from)default_branch = next((row[9] for row in prs if row[9]), "")@@ -298,14 +299,19 @@ class PullRequestTimelinesQuery:)return [row for row in response.results or [] if row[6] is not None]- def _query_ready_at(self, pr_numbers: list[int]) -> dict[int, list[datetime]]:- source = self._curated.issue_events_source()+ def _query_ready_at(self, pr_numbers: list[int], run_from: datetime) -> dict[int, list[datetime]]:+ # A timeline never starts before run_from, so an older ready event cannot move its start. The+ # floor keeps the scan from parsing the whole append-growing events history.+ source = self._curated.issue_events_source(created_floor=True)if source is None:return {}response = self._curated.run(_TRANSITIONS_SELECT.replace("__EVENTS_SOURCE__", source),query_type="engineering_analytics.pull_request_timelines_transitions",- placeholders={"pr_numbers": ast.Constant(value=pr_numbers)},+ placeholders={+ "pr_numbers": ast.Constant(value=pr_numbers),+ "event_created_floor": run_started_floor_constant(run_from),+ },)ready_at: dict[int, list[datetime]] = defaultdict(list)for number, event, created_at in response.results or []:@@ -369,14 +375,15 @@ class PullRequestTimelinesQuery:run_failed = completed and conclusion in DECISIVE_FAILURE_CONCLUSIONSnewest_attempt = int(attempt or 1)for job_attempt in run_attempts:- # The run row decides its newest attempt's outcome: the jobs sync can still hold a queued- # job row, or miss the failing job's row, after the run itself completed.+ # The run row decides its newest attempt's outcome and end: the jobs sync can still hold a+ # queued job row, miss the failing job's row, or hold only the jobs that finished first,+ # after the run itself completed.is_newest = job_attempt.attempt == newest_attemptfailed = bool(job_attempt.failed_jobs) or (is_newest and run_failed)completed_at = job_attempt.completed_atsucceeded = job_attempt.succeeded and not failedif is_newest and completed:- completed_at = completed_at or updated_at+ completed_at = updated_at or completed_atsucceeded = conclusion == "success" and not failedattempts[int(number)].append(RunAttempt(diff --git a/products/engineering_analytics/backend/logic/views/issue_events.py b/products/engineering_analytics/backend/logic/views/issue_events.pyindex 6e4ff273854f..5101fc9f6c16 100644--- a/products/engineering_analytics/backend/logic/views/issue_events.py+++ b/products/engineering_analytics/backend/logic/views/issue_events.py@@ -15,7 +15,13 @@ READY_FOR_REVIEW_EVENT = "ready_for_review"CONVERT_TO_DRAFT_EVENT = "convert_to_draft"-def build_query(table_name: str) -> str:+def build_query(table_name: str, *, created_floor: bool = False) -> str:+ # With ``created_floor`` the raw-string floor sits in its own innermost SELECT, so the scan can prune+ # on it. The parsing SELECT below aliases the parsed timestamp as created_at, and a WHERE there would+ # compare the parsed DateTime with the string. Callers register {event_created_floor}.+ table_source = (+ f"(SELECT * FROM {table_name} WHERE created_at >= {{event_created_floor}})" if created_floor else table_name+ )# A row whose timestamp parses to NULL cannot be ordered and would poison the per-PR argMax.return f"""SELECT id, event, pr_number, actor_login, created_at@@ -26,7 +32,7 @@ def build_query(table_name: str) -> str:JSONExtractInt(issue, 'number') AS pr_number,ifNull(JSONExtractString(actor, 'login'), '') AS actor_login,parseDateTimeBestEffort(created_at) AS created_at- FROM {table_name}+ FROM {table_source}WHERE event IN ('{READY_FOR_REVIEW_EVENT}', '{CONVERT_TO_DRAFT_EVENT}'))WHERE created_at IS NOT NULLdiff --git a/products/engineering_analytics/backend/tests/_github_fixtures.py b/products/engineering_analytics/backend/tests/_github_fixtures.pyindex 0c6059e294da..2f8584f64cbd 100644--- a/products/engineering_analytics/backend/tests/_github_fixtures.py+++ b/products/engineering_analytics/backend/tests/_github_fixtures.py@@ -282,6 +282,42 @@ def _run_row(}+def _deployment_row(+ deployment_id: int, sha: str, environment: str, created_at: str, *, production: bool, transient: bool = False+) -> dict:+ return {+ "id": deployment_id,+ "sha": sha,+ "ref": "master",+ "task": "deploy",+ "environment": environment,+ "original_environment": environment,+ "description": "",+ "creator": "{}",+ "payload": "{}",+ "production_environment": production,+ "transient_environment": transient,+ "created_at": created_at,+ "updated_at": created_at,+ }+++def _status_row(status_id: int, deployment_id: int, state: str, environment: str, created_at: str) -> dict:+ return {+ "id": status_id,+ "deployment_id": deployment_id,+ "state": state,+ "creator": "{}",+ "description": "",+ "environment": environment,+ "target_url": "",+ "log_url": "",+ "environment_url": "",+ "created_at": created_at,+ "updated_at": created_at,+ }++def create_github_warehouse_table(test: BaseTest, base_name: str, columns: dict, rows: list[dict[str, Any]]) -> str:# Returns the real table name (prefixed), which the builder is then told to read,# proving build_query honors the resolved name instead of a hardcoded one.diff --git a/products/engineering_analytics/backend/tests/test_delivery.py b/products/engineering_analytics/backend/tests/test_delivery.pyindex 756ed7fdb891..53ce65ef5171 100644--- a/products/engineering_analytics/backend/tests/test_delivery.py+++ b/products/engineering_analytics/backend/tests/test_delivery.py@@ -30,13 +30,21 @@ from products.engineering_analytics.backend.logic.queries.delivery_summary impor)from products.engineering_analytics.backend.logic.queries.pull_request_timelines import query_pull_request_timelinesfrom products.engineering_analytics.backend.logic.views.source_schema import (+ DEPLOYMENT_STATUSES_COLUMNS,+ DEPLOYMENTS_COLUMNS,ISSUE_EVENTS_COLUMNS,PULL_REQUESTS_COLUMNS,REVIEWS_COLUMNS,TEAM_MEMBERS_COLUMNS,WORKFLOW_RUNS_COLUMNS,)-from products.engineering_analytics.backend.tests._github_fixtures import _issue_event_row, _pr_row, _run_row+from products.engineering_analytics.backend.tests._github_fixtures import (+ _deployment_row,+ _issue_event_row,+ _pr_row,+ _run_row,+ _status_row,+)from products.engineering_analytics.backend.tests._logic_helpers import (_ago,_ago_offset_with_duration,@@ -60,13 +68,14 @@ def _attempt(succeeded: bool | None = None,attempt: int = 1,jobs: tuple[str, ...] = (),+ pushed: float | None = None,) -> RunAttempt:return RunAttempt(run_id=hash(sha) % 1000,workflow_name="CI",head_sha=sha,attempt=attempt,- pushed_at=_at(start),+ pushed_at=_at(start if pushed is None else pushed),started_at=_at(start),completed_at=_at(end) if end is not None else None,failed=failed,@@ -129,6 +138,27 @@ class TestPRTimelineBuilder(SimpleTestCase):(Kind.REVIEW_STATE_UNKNOWN, 4, 5),],),+ (+ "queued_check_counts_as_ci",+ _pr(+ 4,+ [_attempt("a", 1, 2, pushed=0)],+ reviews=[ReviewVerdict(reviewer="ada", state="APPROVED", submitted_at=_at(0))],+ ),+ [],+ [(Kind.CI_RUNNING, 0, 2), (Kind.APPROVED_NOT_ENQUEUED, 2, 4)],+ ),+ (+ "rerun_does_not_backfill_queue_time",+ _pr(5, [_attempt("a", 0, 1, failed=True), _attempt("a", 3, 4, attempt=2, pushed=0)]),+ [],+ [+ (Kind.CI_RUNNING, 0, 1),+ (Kind.RED_PASSED_ON_RERUN, 1, 3),+ (Kind.CI_RUNNING, 3, 4),+ (Kind.REVIEW_STATE_UNKNOWN, 4, 5),+ ],+ ),("later_push_ends_red",_pr(4, [_attempt("a", 0, 1, failed=True), _attempt("b", 2, 3)]),@@ -459,6 +489,76 @@ class TestDeliveryReadsOnWarehouse(_WarehouseMixin):assert old_open is None or old_open.started_at == date_from - CI_LOOKBACK+class TestDeliveryDeployWindow(_WarehouseMixin):+ def _seed(self) -> None:+ # Two merges inside the window, each heading its own production deploy: one deploy lands+ # inside the reported window, the other two days after it.+ self._create_table(+ "github_pull_requests",+ PULL_REQUESTS_COLUMNS,+ [+ _pr_row(+ 31,+ "alice",+ "closed",+ 0,+ "2026-01-11 08:00:00",+ merged_at="2026-01-12 08:00:00",+ merge_commit_sha="sha-inside",+ base_ref="main",+ default_branch="main",+ ),+ _pr_row(+ 32,+ "alice",+ "closed",+ 0,+ "2026-01-11 09:00:00",+ merged_at="2026-01-12 09:00:00",+ merge_commit_sha="sha-after",+ base_ref="main",+ default_branch="main",+ ),+ ],+ )+ self._create_table("github_workflow_runs", WORKFLOW_RUNS_COLUMNS, [])+ self._create_table(+ "github_deployments",+ DEPLOYMENTS_COLUMNS,+ [+ _deployment_row(1, "sha-inside", "prod", "2026-01-12 09:30:00", production=True),+ _deployment_row(2, "sha-after", "prod", "2026-01-14 09:30:00", production=True),+ ],+ )+ self._create_table(+ "github_deployment_statuses",+ DEPLOYMENT_STATUSES_COLUMNS,+ [+ _status_row(11, 1, "success", "prod", "2026-01-12 10:00:00"),+ _status_row(21, 2, "success", "prod", "2026-01-14 10:00:00"),+ ],+ )++ def test_deployed_count_stops_at_the_report_end(self) -> None:+ self._seed()+ curated = CuratedGitHubSource.for_team(self.team)++ summary = query_delivery_summary(+ curated=curated,+ scope=_ALICE,+ date_from=_dt("2026-01-10T00:00:00"),+ date_to=_dt("2026-01-12T12:00:00"),+ )++ lead_time = summary.lead_time+ assert lead_time.deploy_data_available is True+ assert lead_time.merged_pr_count == 2+ # The second PR's deploy is two days past the window end, so it is not deployed work yet,+ # and the count has to agree with the distribution beside it.+ assert lead_time.deployed_merged_pr_count == 1+ assert lead_time.open_to_deploy.scope.pr_count == 1++class TestDeliveryEndpoints(APIBaseTest):@parameterized.expand([("delivery_summary",), ("pull_request_timelines",)])def test_requires_exactly_one_scope(self, action: str) -> None:diff --git a/products/engineering_analytics/backend/tests/test_dora.py b/products/engineering_analytics/backend/tests/test_dora.pyindex 8c45db03f5e9..8eccdfc2dee7 100644--- a/products/engineering_analytics/backend/tests/test_dora.py+++ b/products/engineering_analytics/backend/tests/test_dora.py@@ -26,8 +26,10 @@ from products.engineering_analytics.backend.logic.views.source_schema import ()from products.engineering_analytics.backend.presentation.serializers.dora import DoraEnvironmentQuerySerializerfrom products.engineering_analytics.backend.tests._github_fixtures import (+ _deployment_row,_pr_row,_run_row,+ _status_row,connect_github_source_without_data,create_github_warehouse_table,)@@ -58,42 +60,6 @@ class TestDoraEnvironmentQuerySerializer(SimpleTestCase):assert "environment" in serializer.errors-def _deployment_row(- deployment_id: int, sha: str, environment: str, created_at: str, *, production: bool, transient: bool = False-) -> dict:- return {- "id": deployment_id,- "sha": sha,- "ref": "master",- "task": "deploy",- "environment": environment,- "original_environment": environment,- "description": "",- "creator": "{}",- "payload": "{}",- "production_environment": production,- "transient_environment": transient,- "created_at": created_at,- "updated_at": created_at,- }---def _status_row(status_id: int, deployment_id: int, state: str, environment: str, created_at: str) -> dict:- return {- "id": status_id,- "deployment_id": deployment_id,- "state": state,- "creator": "{}",- "description": "",- "environment": environment,- "target_url": "",- "log_url": "",- "environment_url": "",- "created_at": created_at,- "updated_at": created_at,- }--class TestDoraEndpoint(ClickhouseTestMixin, APIBaseTest):def test_degrades_without_deploy_tables(self):# The source resolves (pull_requests + workflow_runs) but has no deployments schemas: