: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
chore(signals): remove fully rolled-out report-charts flag (#91275)
posthog[bot]23d1ffb58cce
diff --git a/products/signals/ARCHITECTURE.md b/products/signals/ARCHITECTURE.mdindex 3d7fa4482593..4a0f076a0544 100644--- a/products/signals/ARCHITECTURE.md+++ b/products/signals/ARCHITECTURE.md@@ -485,7 +485,7 @@ An **append-only, attributed, schema-validated log of the work done on a report*Scouts write them via `charts` on `emit_report` / `edit_report`. On an edit `charts` is the report's whole set — it replaces what was there, the way `summary` replaces the summary. Omitting the field (or sending null) leaves the existing charts alone; an explicit empty list clears them, so a scout can retract a chart its finding has outgrown rather than only ever swap one for another. On the emit path the safety judge sees a report's chart titles, captions, and queries alongside its prose, so an injected chart is suppressed with the report. The edit path judges nothing today — not title, summary, notes, reviewers, or charts — so a chart set by a later edit reaches the reader unscreened, exactly as an edited summary does.-The main **agentic research pipeline** authors charts too, so every signal source that funnels through it (not just scouts) can produce a visual report. The research agent's presentation step (`report_generation/research.py`) returns `charts` alongside the title and summary; the caller activity (`temporal/agentic/report.py`) replaces `SignalReport.charts` with them, and a re-research is shown the report's current charts to keep, refresh, or drop. It is gated per team by the `signals-report-charts` flag (`team_report_charts_enabled` in `report_content_gates.py`, on in DEBUG) so it ships dark on the fleet-wide path. Unlike the scout emit path, these charts are **not** safety-judged: the pipeline judge screens the input signals before research runs, so it never sees research-authored charts — the same as it never sees the research-authored title/summary, which are agent output from already-screened signals.+The main **agentic research pipeline** authors charts too, so every signal source that funnels through it (not just scouts) can produce a visual report. The research agent's presentation step (`report_generation/research.py`) returns `charts` alongside the title and summary; the caller activity (`temporal/agentic/report.py`) replaces `SignalReport.charts` with them, and a re-research is shown the report's current charts to keep, refresh, or drop. Unlike the scout emit path, these charts are **not** safety-judged: the pipeline judge screens the input signals before research runs, so it never sees research-authored charts — the same as it never sees the research-authored title/summary, which are agent output from already-screened signals.**Report checks.** `SignalReportCheck` is the report's only forward-looking row: a title, a rationale, a kind-specific config, and the time to evaluate it. Everything else on a report describes what was already observed, so a claim that stopped holding was only ever found by a person going back to look. A check turns that into a scheduled measurement whose verdict lands in the artefact log as a `check_result`.diff --git a/products/signals/backend/management/commands/analyze_report.py b/products/signals/backend/management/commands/analyze_report.pyindex 603df146dcee..4b8438e61d6f 100644--- a/products/signals/backend/management/commands/analyze_report.py+++ b/products/signals/backend/management/commands/analyze_report.py@@ -244,9 +244,6 @@ class Command(BaseCommand):previous_report_research=previous_report_research,verbose=verbose,output_fn=self._flushing_write,- # Local debug tool: always exercise both visual-authoring paths, mirroring the- # DEBUG-on defaults of their production rollout gates.- charts_enabled=True,metrics_enabled=True,))diff --git a/products/signals/backend/report_content_gates.py b/products/signals/backend/report_content_gates.pyindex 2a538e70443b..a2c54aee0c4d 100644--- a/products/signals/backend/report_content_gates.py+++ b/products/signals/backend/report_content_gates.py@@ -1,9 +1,8 @@-"""Organization-level rollout gates for the optional content a report carries.+"""Organization-level rollout gates for report metrics.-Charts and metrics roll out independently, so one flag cannot decide the other. The checks live in-their own module rather than in `report_metrics.py`, which stays dependency-light because report-models and Temporal payloads import it during process setup, and these checks need `Team` and the-flag client.+The checks live in their own module because they need `Team` and the flag client.+Report models and Temporal payloads import `report_metrics.py` during process setup,+so that module must not import these dependencies.A metric gate binds every writer, not only the authoring agent: a stored metric definition is also aquery that the refresh path runs later.@@ -20,7 +19,6 @@ from posthog.ph_client import feature_enabled_or_falselogger = structlog.get_logger(__name__)-REPORT_CHARTS_FLAG = "signals-report-charts"REPORT_METRICS_FLAG = "signals-report-metrics"@@ -69,7 +67,3 @@ def organization_report_metrics_enabled(organization_id: UUID) -> bool:def team_report_metrics_enabled(team_id: int) -> bool:return _team_flag_enabled(REPORT_METRICS_FLAG, team_id)---def team_report_charts_enabled(team_id: int) -> bool:- return _team_flag_enabled(REPORT_CHARTS_FLAG, team_id)diff --git a/products/signals/backend/report_generation/AGENTS.md b/products/signals/backend/report_generation/AGENTS.mdindex 64c1be75c7cc..71da4aacc5e3 100644--- a/products/signals/backend/report_generation/AGENTS.md+++ b/products/signals/backend/report_generation/AGENTS.md@@ -22,7 +22,7 @@ It is exercised locally via management commands, and it is also used by the prod- final report title- very short factual summary- optional typed impact metrics (see below), when the team is opted in- - optional charts (see below), when the team is opted in+ - optional charts (see below)- an optional task-attributed fix verification note for actionable reportsThe repository used for research is tracked separately via the `repo_selection` artefact.@@ -70,9 +70,8 @@ The presentation step can also author `charts` — query nodes the inbox draws o- **Expected on a data-shaped finding.** `_REPORT_CHARTS_GUIDANCE` tells the presentation step to attach the chart whenever the finding rests on data moving (a metric that broke, a rate that slid, a distribution that shifted), and to attach nothing when it lives in code, in a config, or in a single count. That pairs with the summary's 200-word target and 300-word ceiling: the chart carries the interval-by-interval series so the prose can state the finding and stop. Charts today correlate with longer summaries rather than shorter ones, because a run that attaches one still narrates the series underneath it, so the two rules only work together. Nothing but this guidance decides how many charts a report gets, so softening it back toward "usually the wrong call" is what returns the inbox to unillustrated walls of text.- **A malformed chart costs the whole report.** `charts` rides in the same `ReportPresentationOutput` as the title and summary, and `MultiTurnSession._parse_and_validate` calls `model_validate` with no retry, so one bad node raises and the research run fails with nothing persisted. `_resolve_report_charts_payload` never sees it. That is why the guidance names the outer-node wrapping explicitly and tells the run to drop a doubtful chart rather than risk it. Giving a malformed chart its own degrade path would need a retry or a partial parse in the runner, which is shared with every other multi-turn caller.-- **Opt-in.** Gated per team by the `signals-report-charts` flag (`team_report_charts_enabled` in `report_content_gates.py`; on in DEBUG). When off, both the chart guidance and the `charts` field itself are dropped from the presentation prompt (chart-free schema), and the caller drops anything the model returns anyway — so an un-opted team is never shown or steered toward charts on the delicate fleet-wide path.- **Replace, not append.** `charts` is the report's whole set. On a re-research the previous charts are shown back as context (loaded from `SignalReport.charts` by `_load_previous_research`); the run keeps, refreshes, or drops them and the caller replaces the column with the result.-- **Persistence is atomic with the prose.** `run_agentic_report_activity` only _resolves_ the charts payload (`_resolve_report_charts_payload`) and returns it on `RunAgenticReportOutput.charts`; the column is written by the transition activity that also writes the title/summary (`mark_report_ready_activity` / `mark_report_pending_input_activity`), inside the same `transition_to` transaction. So charts and the prose they illustrate land together — a failed run or the not-actionable reset (neither writes the new prose) leaves the charts alone by construction, with no separate-transaction window. The resolver yields three outcomes: a valid non-empty set (replace the column); `None` when the team isn't opted in **or** the run authored no charts (leave the column alone — the presentation field is optional, so an omitted key and a deliberate "drop everything" both arrive empty and are indistinguishable, and wiping user-visible charts on that ambiguity is the worse failure, so the pipeline never auto-clears to zero; a human can clear from the inbox); and `[]` when the set busts the whole-set caps (clear, so a stale set can't sit under the new summary).+- **Persistence is atomic with the prose.** `run_agentic_report_activity` only _resolves_ the charts payload (`_resolve_report_charts_payload`) and returns it on `RunAgenticReportOutput.charts`; the column is written by the transition activity that also writes the title/summary (`mark_report_ready_activity` / `mark_report_pending_input_activity`), inside the same `transition_to` transaction. So charts and the prose they illustrate land together — a failed run or the not-actionable reset (neither writes the new prose) leaves the charts alone by construction, with no separate-transaction window. The resolver yields three outcomes: a valid non-empty set (replace the column); `None` when the run authored no charts (leave the column alone — the presentation field is optional, so an omitted key and a deliberate "drop everything" both arrive empty and are indistinguishable, and wiping user-visible charts on that ambiguity is the worse failure, so the pipeline never auto-clears to zero; a human can clear from the inbox); and `[]` when the set busts the whole-set caps (clear, so a stale set can't sit under the new summary).- **Not safety-judged.** The pipeline's safety judge screens the input signals before research runs, so it never sees research-authored charts — the same as it never sees research-authored title/summary. Charts are agent output derived from already-screened signals, consistent with that model. (This differs from the scout emit path, where charts and prose are judged together.)### Impact metrics@@ -84,7 +83,7 @@ The presentation step can also author up to six typed `metrics` alongside the pr- **A malformed metric costs the whole report.** `metrics` rides in the same `ReportPresentationOutput` as the title and summary, and `MultiTurnSession._parse_and_validate` calls `model_validate` with no retry, so one rejected item fails the research run with nothing persisted. `_resolve_report_metrics_payload` never sees it, because `metric_batch_error` only checks whole-set rules (count, total query characters, duplicate ids, one primary, one affected-users). This is the same tradeoff as a malformed chart, on a wider surface: `ReportMetric` carries about fifteen field validators plus a cross-field one, against four on `ReportChart`, so a metric has many more ways to fail late. Giving one metric its own degrade path needs a retry or a partial parse in the runner, which is shared with every other multi-turn caller. Until then the `signals-report-metrics` flag bounds who is exposed, and the authoring guidance keeps the surface small by telling the run to omit a metric it cannot measure honestly.- **Consumers own the display.** Authored Trends display is not the report presentation contract. Consumers derive `BoldNumber` for the first output series' whole-window `aggregated_value` and `ActionsBar` for longitudinal buckets. Every metric runs through both derived shapes and the normal query cache. The inbox does not maintain a separate time-series table.- **Snapshots are optional fallbacks.** `value` and `value_at` travel together, preserve zero as measured data, and never replace the live query. Opening the inbox list or a report refreshes the stale snapshots on screen through the query cache without changing report ordering; there is no background job. Snapshot-only or queryless rows are legacy or malformed and are always redacted.-- **Independent opt-in.** Metrics use the organization-level `signals-report-metrics` flag (`report_content_gates.py`, on in DEBUG), independent of `signals-report-charts`. When off, pipeline metric guidance and schema fields are removed and the caller preserves existing metrics. Every writer reads the flag, including the scout report channel, which drops a supplied set before the safety judge. Scout-authored metrics are safety-judged with the rest of the report.+- **Independent opt-in.** Metrics use the organization-level `signals-report-metrics` flag (`report_content_gates.py`, on in DEBUG). Charts do not require a feature flag. When off, pipeline metric guidance and schema fields are removed and the caller preserves existing metrics. Every writer reads the flag, including the scout report channel, which drops a supplied set before the safety judge. Scout-authored metrics are safety-judged with the rest of the report.- **Replace, clear, or preserve as a set.** Metrics are the report's whole typed set. A valid non-empty pipeline result replaces them, an explicit or invalid enabled result clears them, and a disabled run returns `None` to preserve them. Scout edits use the same tri-state contract: omission preserves, `[]` clears, and a non-empty list replaces.- **Persistence is atomic with prose.** The agentic activity returns the resolved metric payload on `RunAgenticReportOutput.metrics`; the ready or pending-input transition writes it in the same transaction as title and summary. There is no partially updated report state.- **Design for more than user counts.** `kind`, `role`, format, unit, caption, and optional comparison support conversion, errors, latency, revenue, sessions, and occurrence metrics without overloading an affected-user field. `percentage` means percentage points while `percentage_scaled` means a 0–1 ratio, matching the two standard Trends axis formats. The schema still enforces at most one primary metric and at most one affected-users metric.diff --git a/products/signals/backend/report_generation/research.py b/products/signals/backend/report_generation/research.pyindex d6b8a342f686..b8ee5f0ebcf8 100644--- a/products/signals/backend/report_generation/research.py+++ b/products/signals/backend/report_generation/research.py@@ -446,9 +446,7 @@ def _render_previous_presentation_context(previous_title: str | None, previous_s# Chart-authoring guidance for the presentation step, adapted from the scout channel's-# `_REPORT_CHARTS`. Rendered only when the team has the report-charts capability — and when it isn't,-# the `charts` field is dropped from the schema too (see `build_report_presentation_prompt`), so a-# team that isn't opted in is never shown or steered toward charts on the delicate fleet-wide path.+# `_REPORT_CHARTS`._REPORT_CHARTS_GUIDANCE = f"""## Attaching charts`charts` carries queries the inbox draws on the report itself, so a data move is visible next to the sentence describing it rather than a number the reader has to go and reproduce.@@ -789,19 +787,13 @@ def build_report_presentation_prompt(previous_summary: str | None = None,previous_charts: list[ReportChart] | None = None,previous_metrics: list[ReportMetric] | None = None,- charts_enabled: bool = False,metrics_enabled: bool = False,) -> str:schema_dict = ReportPresentationOutput.model_json_schema()- if not charts_enabled:- schema_dict.get("properties", {}).pop("charts", None)- schema_dict.get("$defs", {}).pop("ReportChart", None)if not metrics_enabled:schema_dict.get("properties", {}).pop("metrics", None)schema_dict.get("$defs", {}).pop("ReportMetric", None)schema_dict.get("$defs", {}).pop("ReportMetricComparison", None)- if not charts_enabled and not metrics_enabled:- schema_dict.pop("$defs", None)schema = json.dumps(schema_dict, indent=2)previous_presentation_context = _render_previous_presentation_context(previous_title, previous_summary)@@ -811,11 +803,10 @@ def build_report_presentation_prompt(previous_metrics_context = _render_previous_metrics_context(previous_metrics or [])if previous_metrics_context:visual_sections.append(previous_metrics_context)- if charts_enabled:- visual_sections.append(_REPORT_CHARTS_GUIDANCE)- previous_charts_context = _render_previous_charts_context(previous_charts or [])- if previous_charts_context:- visual_sections.append(previous_charts_context)+ visual_sections.append(_REPORT_CHARTS_GUIDANCE)+ previous_charts_context = _render_previous_charts_context(previous_charts or [])+ if previous_charts_context:+ visual_sections.append(previous_charts_context)visual_context = "".join(f"\n\n{section}" for section in visual_sections)return f"""Now write the final **report title and summary** based on your research across all {total_signals} signal(s).@@ -933,7 +924,6 @@ async def run_multi_turn_research(has_business_knowledge: bool = False,resolved_report_title: str | None = None,resolved_report_summary: str | None = None,- charts_enabled: bool = False,metrics_enabled: bool = False,steering_section: str = "",) -> ReportResearchOutput:@@ -1097,7 +1087,6 @@ async def run_multi_turn_research(previous_summary=summary or (previous_report_research.summary if previous_report_research else None),previous_charts=previous_report_research.charts if previous_report_research else None,previous_metrics=previous_report_research.metrics if previous_report_research else None,- charts_enabled=charts_enabled,metrics_enabled=metrics_enabled,)presentation_result = await session.send_followup(@@ -1146,10 +1135,7 @@ async def run_multi_turn_research(return ReportResearchOutput(title=presentation_result.title,summary=presentation_result.summary,- # Only carry visuals for an opted-in team, regardless of what the model returned — a- # redundant guard alongside the gated schema/guidance, so the capability can't leak if a- # future change reintroduces a field into a disabled prompt.- charts=presentation_result.charts if charts_enabled else [],+ charts=presentation_result.charts,metrics=presentation_result.metrics if metrics_enabled else [],research_task_id=str(session.task.id),verification_note=verification_note,diff --git a/products/signals/backend/temporal/agentic/report.py b/products/signals/backend/temporal/agentic/report.pyindex 5fb24a9c2598..b27fbc670b75 100644--- a/products/signals/backend/temporal/agentic/report.py+++ b/products/signals/backend/temporal/agentic/report.py@@ -26,7 +26,7 @@ from products.signals.backend.auto_start import ReviewerContentfrom products.signals.backend.models import ArtefactAttribution, SignalReport, SignalReportArtefactfrom products.signals.backend.repo_corrections import SCOUT_REPOSITORY_CONTENT_NEEDLE, WRONG_REPO_CONTENT_NEEDLEfrom products.signals.backend.report_charts import ReportChart, chart_batch_error-from products.signals.backend.report_content_gates import team_report_charts_enabled, team_report_metrics_enabled+from products.signals.backend.report_content_gates import team_report_metrics_enabledfrom products.signals.backend.report_generation.research import (ActionabilityAssessment,ActionabilityChoice,@@ -402,21 +402,20 @@ def _append_agentic_report_artefacts(*, team_id: int, report_id: str, artefacts:def _resolve_report_charts_payload(- charts: list[ReportChart], charts_enabled: bool, *, report_id: str, team_id: int+ charts: list[ReportChart], *, report_id: str, team_id: int) -> list[dict[str, Any]] | None:"""Resolve an authored chart set to what a report's `charts` column should become, or `None` toleave it untouched. The transition activity that writes the title/summary applies this atomically.Three cases, because the model's output is untrusted and the presentation `charts` field is optional:- a valid non-empty set → its JSON payload (replace the column).- - not opted in, or an *empty* set → `None` (leave the column alone). An omitted key and a- deliberate "drop everything" both arrive empty and are indistinguishable, so wiping- user-visible charts on that ambiguity is refused — the pipeline never auto-clears to zero (a- human can clear from the inbox).+ - an *empty* set → `None` (leave the column alone). An omitted key and a deliberate "drop+ everything" both arrive empty and are indistinguishable, so wiping user-visible charts on that+ ambiguity is refused — the pipeline never auto-clears to zero (a human can clear from the inbox).- a cap-busting set (too many, too large, or a duplicate id the agent produced) → `[]` (clear),so a stale set can't sit under the run's new summary; any `chart:` link then degrades to a label."""- if not charts_enabled or not charts:+ if not charts:return Nonebatch_error = chart_batch_error(charts)if batch_error:@@ -666,9 +665,6 @@ async def run_agentic_report_activity(input: RunAgenticReportInput) -> RunAgentiservice_tier=agent_runtime.service_tier,)has_bk = await database_sync_to_async(_team_has_business_knowledge, thread_sensitive=False)(input.team_id)- charts_enabled = await database_sync_to_async(team_report_charts_enabled, thread_sensitive=False)(- input.team_id- )metrics_enabled = await database_sync_to_async(team_report_metrics_enabled, thread_sensitive=False)(input.team_id)@@ -696,7 +692,6 @@ async def run_agentic_report_activity(input: RunAgenticReportInput) -> RunAgentihas_business_knowledge=has_bk,resolved_report_title=resolved_report_title,resolved_report_summary=resolved_report_summary,- charts_enabled=charts_enabled,metrics_enabled=metrics_enabled,steering_section=steering.section,)@@ -713,9 +708,7 @@ async def run_agentic_report_activity(input: RunAgenticReportInput) -> RunAgenti# Resolve the charts payload here, but let the transition activity write it alongside the# title/summary so charts and their prose land in one transaction (and never on the# not-actionable reset or a failed run, which don't write the new prose).- charts_payload = _resolve_report_charts_payload(- result.charts, charts_enabled, report_id=input.report_id, team_id=input.team_id- )+ charts_payload = _resolve_report_charts_payload(result.charts, report_id=input.report_id, team_id=input.team_id)metrics_payload = _resolve_report_metrics_payload(result.metrics, metrics_enabled, report_id=input.report_id, team_id=input.team_id)@@ -736,7 +729,7 @@ async def run_agentic_report_activity(input: RunAgenticReportInput) -> RunAgentirepository=repository,charts=charts_payload,metrics=metrics_payload,- charts_enabled=charts_enabled,+ charts_enabled=True,)except Exception as error:logger.exception(diff --git a/products/signals/backend/test/test_agentic_report_activity.py b/products/signals/backend/test/test_agentic_report_activity.pyindex 91d4d60c593e..73d13468cef7 100644--- a/products/signals/backend/test/test_agentic_report_activity.py+++ b/products/signals/backend/test/test_agentic_report_activity.py@@ -194,16 +194,12 @@ _EXISTING_METRIC = _metric("existing-affected-users").model_dump(mode="json")async def _run_activity_with_output(- monkeypatch, ateam, report, output, *, charts_enabled=True, metrics_enabled=True, repo_selection_as_of=None+ monkeypatch, ateam, report, output, *, metrics_enabled=True, repo_selection_as_of=None):monkeypatch.setattr("products.signals.backend.temporal.agentic.report.resolve_user_id_for_team",lambda team_id: 1,)- monkeypatch.setattr(- "products.signals.backend.temporal.agentic.report.team_report_charts_enabled",- lambda team_id: charts_enabled,- )monkeypatch.setattr("products.signals.backend.temporal.agentic.report.team_report_metrics_enabled",lambda team_id: metrics_enabled,@@ -808,23 +804,19 @@ async def test_run_agentic_report_activity_keeps_quiet_when_reviewers_are_retain@pytest.mark.asyncio@pytest.mark.django_db@pytest.mark.parametrize(- "name,charts_enabled,output_factory,expected",+ "name,output_factory,expected",[- # Opted-in + a valid chart → the JSON set to store.- ("enabled_non_empty", True, _build_research_output_with_chart, [{"chart_id": "signups-drop"}]),- # Not opted in → None (leave the column alone), even though the mocked run returned a chart.- ("disabled", False, _build_research_output_with_chart, None),- # Opted-in but the run authored no charts (optional field omitted / dropped) → None, never a- # wipe of whatever the report already showed.- ("enabled_empty", True, _build_research_output, None),- # Opted-in but the set busts the whole-set caps (duplicate id) → [] to clear, so a stale set- # can't sit under the new summary.- ("enabled_cap_bust", True, _build_research_output_with_duplicate_chart_ids, []),+ # A valid chart → the JSON set to store.+ ("non_empty", _build_research_output_with_chart, [{"chart_id": "signups-drop"}]),+ # The run authored no charts (optional field omitted / dropped) → None, never a wipe of+ # whatever the report already showed.+ ("empty", _build_research_output, None),+ # The set busts the whole-set caps (duplicate id) → [] to clear, so a stale set can't sit+ # under the new summary.+ ("cap_bust", _build_research_output_with_duplicate_chart_ids, []),],)-async def test_run_agentic_report_activity_resolves_charts_payload(- monkeypatch, ateam, name, charts_enabled, output_factory, expected-):+async def test_run_agentic_report_activity_resolves_charts_payload(monkeypatch, ateam, name, output_factory, expected):# The activity resolves the charts payload but does not write it — the transition activity does,# atomically with the title/summary (see test_mark_report_ready_activity_applies_charts). So we# assert the resolved payload on the returned output rather than the report row.@@ -832,9 +824,7 @@ async def test_run_agentic_report_activity_resolves_charts_payload(team=ateam, status=SignalReport.Status.IN_PROGRESS, signal_count=2, total_weight=1.3)- result = await _run_activity_with_output(- monkeypatch, ateam, report, output_factory(), charts_enabled=charts_enabled- )+ result = await _run_activity_with_output(monkeypatch, ateam, report, output_factory())if expected is None:assert result.charts is None@@ -867,7 +857,6 @@ async def test_run_agentic_report_activity_resolves_metrics_payload(ateam,report,output_factory(),- charts_enabled=True,metrics_enabled=metrics_enabled,)diff --git a/products/signals/backend/test/test_research_prompt.py b/products/signals/backend/test/test_research_prompt.pyindex 89804821266e..bb14199928b9 100644--- a/products/signals/backend/test/test_research_prompt.py+++ b/products/signals/backend/test/test_research_prompt.py@@ -208,20 +208,9 @@ def _make_chart() -> ReportChart:class TestBuildReportPresentationPrompt:- # Chart and metric rollouts are independent: a team can receive live impact measurements- # without enabling free-form report charts, or vice versa.- def test_chart_guidance_and_schema_field_only_present_when_enabled(self):- off = build_report_presentation_prompt(2, charts_enabled=False)- on = build_report_presentation_prompt(2, charts_enabled=True)- assert "Attaching charts" not in off- assert "Attaching charts" in on- # The schema field is dropped when disabled and present when enabled.- assert '"charts"' not in off- assert '"charts"' in on-def test_metric_guidance_and_schema_field_only_present_when_enabled(self):- off = build_report_presentation_prompt(2, charts_enabled=True, metrics_enabled=False)- on = build_report_presentation_prompt(2, charts_enabled=False, metrics_enabled=True)+ off = build_report_presentation_prompt(2, metrics_enabled=False)+ on = build_report_presentation_prompt(2, metrics_enabled=True)assert "Measuring impact" not in offassert '"metrics"' not in off@@ -246,8 +235,8 @@ class TestBuildReportPresentationPrompt:assert "and `ActionsBar`" in onassert "bar or line response does not supply the whole-window total" in onassert "must set `aggregationAxisFormat` to exactly the same value" in on- assert "Attaching charts" not in on- assert '"charts"' not in on+ assert "Attaching charts" in on+ assert '"charts"' in on# A DataVisualizationNode carrying `display` but no `chartSettings` stores and validates# cleanly, then draws every row at a single x position instead of a series. The guidance is@@ -255,17 +244,15 @@ class TestBuildReportPresentationPrompt:# SQL-backed chart the pipeline authors renders wrong in the reader's inbox with nothing# reporting a failure. The scout channel guards the same instruction in its own example.def test_chart_guidance_names_the_axes_a_sql_graph_needs(self):- on = build_report_presentation_prompt(2, charts_enabled=True)+ on = build_report_presentation_prompt(2)assert "chartSettings.xAxis.column" in onassert "chartSettings.yAxis[].column" in on- def test_previous_charts_context_only_rendered_when_enabled(self):+ def test_previous_charts_context_rendered_when_present(self):chart = _make_chart()- on = build_report_presentation_prompt(1, previous_charts=[chart], charts_enabled=True)- off = build_report_presentation_prompt(1, previous_charts=[chart], charts_enabled=False)+ on = build_report_presentation_prompt(1, previous_charts=[chart])assert "Charts this report already shows" in onassert "signups-drop" in on- assert "Charts this report already shows" not in offdef test_previous_metric_context_omits_legacy_comparison(self):metric = ReportMetric.model_validate(