: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
feat(data-tools): retire completed rollout flags (#119648)
Marius Andra0e76f138951d
diff --git a/docs/internal/generated-notebook-widgets.md b/docs/internal/generated-notebook-widgets.mdindex 40c12d219220..4616ae83588c 100644--- a/docs/internal/generated-notebook-widgets.md+++ b/docs/internal/generated-notebook-widgets.md@@ -60,7 +60,7 @@ The dashboard keeps the selected generated version; generating a new version in- `<Widget>` is the only notebook markdown tag for generated widgets.- Widget previews allow pointer lock for interactive controls such as games. Both the iframe and artifact CSP permit `allow-pointer-lock`; the preview URL varies to refresh previously cached CSP headers.- Organizations must approve AI data processing before a job is queued and when its worker starts.-- Every widget endpoint requires the `notebook-generated-widgets` feature flag: creation, status, history, source, restore, cancellation, and dataframe reads. While it is disabled, existing widget nodes still render but every request they make returns 404. A generation job that is already running does not recheck the flag; it finishes model generation and the Canvas build, bounded by the 10-minute stale window and the 15-minute activity timeout. Keep the flag disabled until the generated-code data boundary and mixed-version Canvas rollout are approved.+- Widget endpoints require authentication and notebook permissions; dataframe reads also require query access. A generation job is bounded by the 10-minute stale window and the 15-minute activity timeout.- Production artifact delivery requires `CANVAS_ARTIFACT_ORIGIN`, a dedicated bare HTTPS origin with no path, query, fragment, or credentials, set before rollout. A production deploy with it unset boots clean, but every widget builds and then reports its preview unavailable, because no artifact URL is minted. Artifact URLs use Django's rotating `SECRET_KEY` values for signing by default. Deployments can set `CANVAS_ARTIFACT_SIGNING_KEYS` for independent rotation.“Widget” is the umbrella term. Data visualizations are one possible widget type.@@ -74,7 +74,7 @@ The reusable catalog fields, demo data, input bindings, and pending reviews sharThe four new non-null fields retain database defaults, so workers from before this migration can still create widgets, versions, and placements during a rolling deploy or rollback.Local databases that already applied the earlier catalog, input-binding, pending-review, and merge migrations need their migration records reconciled after verifying all nine fields exist. Record the consolidated migration as applied and prune the four superseded records in both the development and reused test databases. Preserve the existing tables and data; rolling back those field additions would discard saved catalog metadata, bindings, and demo rows.-The notebooks index shows **Notebooks** and **Reusable widgets** tabs only when `notebook-generated-widgets` is enabled. With the flag disabled, it shows the notebook list without tabs.+The notebooks index shows **Notebooks** and **Reusable widgets** tabs.Each reusable widget's page header has a back arrow before the notebook icon that returns to the **Reusable widgets** tab.A generated widget can be published to the project-scoped reusable widget catalog using **Make reusable…** beside its version pin controls. Publishing gives the widget a stable ID, keeps its existing immutable version history, and creates empty demo inputs from the input contract. Publishing preserves the placement’s bindings and does not copy notebook rows or source run identifiers. Authors can add up to 20 invented sample rows per input using **Demo data**. The success message links to the catalog on the notebooks index's **Reusable widgets** tab. Each catalog entry has a dedicated page for its live demo, input contract, source, usage count, and shared improvement or regeneration actions.@@ -121,7 +121,7 @@ Pinning the displayed version keeps its preview available. Updated input bindingFork requests accept an optional `version_id`, so forking copies the version selected in history. Omitting it copies the placement's pinned or latest version. Concurrent attachments to the same node reuse one placement.Fork publication and placement replacement commit together. If either fails, both roll back and the build is not queued.-Reusable widgets remain behind the `notebook-generated-widgets` feature flag and preserve the generated-code trust gate described below. Catalog access requires resource-level notebook permissions, rather than an access grant to one notebook. Reading or editing demo rows also requires query viewer access and the `query:read` token scope. Demo inputs start empty. Authors must use invented sample rows because saved demos are shared with catalog viewers and do not carry notebook or source access restrictions. Catalog demo approval applies only to the open preview and never grants consent to run the build against notebook data. Editing the demo or switching versions clears this approval.+Reusable widgets preserve the generated-code trust gate described below. Catalog access requires resource-level notebook permissions, rather than an access grant to one notebook. Reading or editing demo rows also requires query viewer access and the `query:read` token scope. Demo inputs start empty. Authors must use invented sample rows because saved demos are shared with catalog viewers and do not carry notebook or source access restrictions. Catalog demo approval applies only to the open preview and never grants consent to run the build against notebook data. Editing the demo or switching versions clears this approval.## Agent access@@ -131,8 +131,8 @@ Widget IDs are saved when their settings, title, or panel visibility change, soNew SQL cells receive a unique name beginning with `sql_df_`; Python cells receive one beginning with `df_`.You can rename a dataframe below its results while its edit, filters, or query panel is also open. Results-only views hide the name controls.In Jupyter mode, dataframe names use smaller text. Code cells keep the name below their output alongside their visible source editor.-The SQL and insight dataframe name rows are visible when either `revamped-py-notebooks` or `notebook-generated-widgets` is enabled.-The widget flag enables HogQL dataframe preparation. Python, kernel-backed SQL, and direct connections require `revamped-py-notebooks`.+The SQL and insight dataframe name rows are available to notebook editors.+HogQL dataframe preparation is available without a feature flag. Python, kernel-backed SQL, and direct connections require `revamped-py-notebooks`.Insights that expose SQL have the same dataframe name field below their results, starting with `insight_df` (with a numeric suffix when needed).An editor prepares the insight's dataframe when a SQL or Python cell first references it, before generating a widget, or when rerunning a widget's data dependencies.Widget generation continues with the available dataframes if an embedded insight cannot be prepared.@@ -156,7 +156,7 @@ Loading a saved result does not execute a cell or mark dependent cells stale. IfNew notebooks place the typing caret in the title, including when opened through the command menu. Enter continues into the notebook body.Click a cell's title or choose **Edit title** from its **More actions** menu to rename it without collapsing its panels. Enter or leaving the field saves; Escape cancels. The cell-type label toggles both panels, and the pencil toggles filters or the editor.-The notebook's inline **Ask AI** uses LangGraph and receives widget authoring instructions when `notebook-generated-widgets` is enabled for the user.+The notebook's inline **Ask AI** uses LangGraph and receives widget authoring instructions.The bookmark toggle **Keep question with answer** is on by default, retaining the question and the submitting user's name above the answer. Turning it off saves `keepQuestion={false}` on that prompt.**Ask AI** is disabled until the organization approves AI data processing, including submission from saved prompt blocks.@@ -174,12 +174,11 @@ Inline notebook artifacts update the open notebook without saving a second copy,Full-notebook replacements preserve the retained question when **Keep question with answer** is on.Standalone AI notebook saves preserve Markdown separators and live MDX cells, including `<SQLV2 />` and `<Widget />`, while resolving visualization references.Its notebook context and `create_notebook` tool share the same instructions for inserting `<Widget title="Interactive visualization" prompt="Describe the visualization" />`.-When the widget flag is enabled, inline AI insertion also converts plain, `md`, or `markdown` code fences containing only valid `<Widget>` tags into widget blocks. Fences containing other code, malformed tags, or an explicit language such as `text` remain code examples.+Inline AI insertion also converts plain, `md`, or `markdown` code fences containing only valid `<Widget>` tags into widget blocks. Fences containing other code, malformed tags, or an explicit language such as `text` remain code examples.The user clicks **Generate widget** in the inserted block's settings to start generation.-The widget flag and SQL/Python cell flag are independent; enabling widgets does not grant access to SQLV2 or PythonV2 cells.+Widgets do not grant access to SQLV2 or PythonV2 cells; those still require `revamped-py-notebooks`.-The MCP tools `notebooks-widget-generate`, `notebooks-widget-status`, and `notebooks-widget-cancel` use the same `notebook-generated-widgets` flag as the editor.-The MCP server evaluates this flag for the authenticated user when it resolves available tools.+The MCP tools `notebooks-widget-generate`, `notebooks-widget-status`, and `notebooks-widget-cancel` are available to authenticated users with their required notebook and query scopes.Generation also requires the organization's AI data processing consent and the `notebook:write` and `query:read` scopes.An agent inserts a `Widget` component through `notebooks-add-cell`, then calls `notebooks-widget-generate` with its returned `node_id`.diff --git a/ee/hogai/context/context.py b/ee/hogai/context/context.pyindex 51ebe5c5f67b..164b81ad8cc7 100644--- a/ee/hogai/context/context.py+++ b/ee/hogai/context/context.py@@ -377,25 +377,20 @@ class AssistantContextManager(AssistantContextMixin):# Flag lookups read `user.organization`; keep them off the event loop and skip them# when no notebook needs inline authoring guidance.sql_v2_enabled = False- widgets_enabled = False- if any(nb.markdown_with_insertion_placeholder for nb in ui_context.notebooks):+ has_inline_notebook = any(nb.markdown_with_insertion_placeholder for nb in ui_context.notebooks)+ if has_inline_notebook:sql_v2_enabled = await database_sync_to_async(notebooks_facade.is_sql_v2_enabled)(self._user)- widgets_enabled = await database_sync_to_async(notebooks_facade.is_notebook_widget_enabled)(self._user)notebook_texts = []reusable_catalog = (await database_sync_to_async(reusable_widget_catalog_context)(team_id=self._team.id, user=self._user)- if widgets_enabled+ if has_inline_notebookelse "")if reusable_catalog:notebook_texts.append(reusable_catalog)for nb in ui_context.notebooks:if nb.markdown_with_insertion_placeholder:- notebook_texts.append(- self._format_markdown_notebook_context(- nb, sql_v2_enabled=sql_v2_enabled, widgets_enabled=widgets_enabled- )- )+ notebook_texts.append(self._format_markdown_notebook_context(nb, sql_v2_enabled=sql_v2_enabled))continuectx = await NotebookContext.from_short_id(self._team, nb.id)@@ -453,9 +448,7 @@ class AssistantContextManager(AssistantContextMixin):)return None- def _format_markdown_notebook_context(- self, notebook: MaxNotebookContext, *, sql_v2_enabled: bool, widgets_enabled: bool- ) -> str:+ def _format_markdown_notebook_context(self, notebook: MaxNotebookContext, *, sql_v2_enabled: bool) -> str:title = _sanitize_inline_prompt_value(notebook.name or f"Notebook {notebook.id}")inline_request_id = _sanitize_inline_prompt_value(notebook.insertion_placeholder_block_id or "unknown")response_marker = _sanitize_inline_prompt_value(notebook.insertion_placeholder_marker or "Thinking...")@@ -503,7 +496,7 @@ class AssistantContextManager(AssistantContextMixin):"- The user may ask you to change selected text, nearby content, or the entire notebook. ""Preserve unrelated content only when the request's scope is local."),- cell_guidance_prompt(sql_v2_enabled=sql_v2_enabled, widgets_enabled=widgets_enabled),+ cell_guidance_prompt(sql_v2_enabled=sql_v2_enabled),("When the current user asks you to change broad notebook content, use notebook tools against ""the current notebook instead of explaining how the user could do it. "diff --git a/ee/hogai/context/notebook/prompts.py b/ee/hogai/context/notebook/prompts.pyindex 0eb71427c027..e43a5b65bd63 100644--- a/ee/hogai/context/notebook/prompts.py+++ b/ee/hogai/context/notebook/prompts.py@@ -17,16 +17,14 @@ WIDGET_CELL_GUIDANCE = """- Generated widgets are available. When the user asks- Inserting a Widget block does not generate it. Tell the user to click Generate widget in its settings. All notebook dataframes must have completed runs before generation. Do not claim the widget has been generated merely because you inserted the block"""-def cell_guidance_prompt(*, sql_v2_enabled: bool, widgets_enabled: bool) -> str:+def cell_guidance_prompt(*, sql_v2_enabled: bool) -> str:cell_guidance = ("- Notebook content is MDX: Markdown with live component tags. Write component tags directly in the document, ""outside triple-backtick code fences and without backslash-escaping the opening <. A fenced tag is displayed ""as source text and does not create a notebook cell. Only fence code when the user asks to see a code example.\n"+ (SQL_V2_CELL_GUIDANCE if sql_v2_enabled else LEGACY_CELL_GUIDANCE))- if widgets_enabled:- return f"{cell_guidance}\n{WIDGET_CELL_GUIDANCE}"- return f"{cell_guidance}\n- Generated widgets are unavailable for this user. Do not add new `<Widget />` cells. Preserve existing widgets when editing unrelated content"+ return f"{cell_guidance}\n{WIDGET_CELL_GUIDANCE}"NOTEBOOK_CONTEXT_TEMPLATE = """diff --git a/ee/hogai/context/test/test_context.py b/ee/hogai/context/test/test_context.pyindex 7601389cedc9..53e3a95cbdd2 100644--- a/ee/hogai/context/test/test_context.py+++ b/ee/hogai/context/test/test_context.py@@ -394,14 +394,12 @@ class TestAssistantContextManager(BaseTest):@parameterized.expand([- ("sql_v2 and widgets", True, True, SQL_V2_CELL_GUIDANCE, LEGACY_CELL_GUIDANCE),- ("sql_v2 only", True, False, SQL_V2_CELL_GUIDANCE, LEGACY_CELL_GUIDANCE),- ("widgets only", False, True, LEGACY_CELL_GUIDANCE, SQL_V2_CELL_GUIDANCE),- ("neither enabled", False, False, LEGACY_CELL_GUIDANCE, SQL_V2_CELL_GUIDANCE),+ ("sql_v2", True, SQL_V2_CELL_GUIDANCE, LEGACY_CELL_GUIDANCE),+ ("legacy_sql", False, LEGACY_CELL_GUIDANCE, SQL_V2_CELL_GUIDANCE),])async def test_markdown_notebook_context_offers_only_runnable_cell_tags(- self, _name: str, sql_v2_enabled: bool, widgets_enabled: bool, expected: str, unexpected: str+ self, _name: str, sql_v2_enabled: bool, expected: str, unexpected: str) -> None:ui_context = MaxUIContext(notebooks=[@@ -416,9 +414,7 @@ class TestAssistantContextManager(BaseTest):)with (- patch("products.notebooks.backend.widgets.settings", DEBUG=False, TEST=False),patch("products.notebooks.backend.facade.api.is_sql_v2_enabled", return_value=sql_v2_enabled),- patch("products.notebooks.backend.widgets.posthoganalytics.feature_enabled", return_value=widgets_enabled),patch("ee.hogai.context.context.reusable_widget_catalog_context", return_value="Saved widget catalog") as catalog,@@ -428,11 +424,10 @@ class TestAssistantContextManager(BaseTest):assert result is not Noneself.assertIn(expected, result)self.assertNotIn(unexpected, result)- self.assertEqual('<Widget title="' in result, widgets_enabled)- self.assertEqual("Saved widget catalog" in result, widgets_enabled)- self.assertEqual(catalog.call_count, int(widgets_enabled))- if widgets_enabled:- self.assertIn("click Generate widget", result)+ self.assertIn('<Widget title="', result)+ self.assertIn("Saved widget catalog", result)+ catalog.assert_called_once()+ self.assertIn("click Generate widget", result)@patch("ee.hogai.context.notebook.context.NotebookContext.from_short_id")async def test_format_ui_context_markdown_notebook_escapes_user_controlled_fields(self, mock_from_short_id):diff --git a/ee/hogai/tools/create_notebook/test/test_tool.py b/ee/hogai/tools/create_notebook/test/test_tool.pyindex 696e97ad5124..55c657827007 100644--- a/ee/hogai/tools/create_notebook/test/test_tool.py+++ b/ee/hogai/tools/create_notebook/test/test_tool.py@@ -47,27 +47,22 @@ class TestCreateNotebookTool(BaseTest):@parameterized.expand([- ("sql_v2 and widgets", True, True, SQL_V2_CELL_GUIDANCE, LEGACY_CELL_GUIDANCE),- ("sql_v2 only", True, False, SQL_V2_CELL_GUIDANCE, LEGACY_CELL_GUIDANCE),- ("widgets only", False, True, LEGACY_CELL_GUIDANCE, SQL_V2_CELL_GUIDANCE),- ("neither enabled", False, False, LEGACY_CELL_GUIDANCE, SQL_V2_CELL_GUIDANCE),+ ("sql_v2", True, SQL_V2_CELL_GUIDANCE, LEGACY_CELL_GUIDANCE),+ ("legacy_sql", False, LEGACY_CELL_GUIDANCE, SQL_V2_CELL_GUIDANCE),])def test_description_offers_only_runnable_cell_tags(- self, _name: str, sql_v2_enabled: bool, widgets_enabled: bool, expected: str, unexpected: str+ self, _name: str, sql_v2_enabled: bool, expected: str, unexpected: str) -> None:with (- patch("products.notebooks.backend.widgets.settings", DEBUG=False, TEST=False),patch("products.notebooks.backend.facade.api.is_sql_v2_enabled", return_value=sql_v2_enabled),- patch("products.notebooks.backend.widgets.posthoganalytics.feature_enabled", return_value=widgets_enabled),):tool = async_to_sync(CreateNotebookTool.create_tool_class)(team=self.team, user=self.user)assert expected in tool.descriptionassert unexpected not in tool.description- assert ('<Widget title="' in tool.description) == widgets_enabled- if widgets_enabled:- assert "click Generate widget" in tool.description+ assert '<Widget title="' in tool.description+ assert "click Generate widget" in tool.descriptiondef test_returns_error_when_both_content_and_draft_content_provided(self):result, artifact = async_to_sync(self.tool._arun_impl)(diff --git a/ee/hogai/tools/create_notebook/tool.py b/ee/hogai/tools/create_notebook/tool.pyindex 7f9e7411ac1c..e11ece9885de 100644--- a/ee/hogai/tools/create_notebook/tool.py+++ b/ee/hogai/tools/create_notebook/tool.py@@ -28,7 +28,7 @@ from ee.hogai.utils.types.base import AssistantState, NodePathNOTEBOOK_WIDGET_CATALOG_PROMPT = format_notebook_widget_catalog_for_agents()-def create_notebook_prompt(*, sql_v2_enabled: bool, widgets_enabled: bool) -> str:+def create_notebook_prompt(*, sql_v2_enabled: bool) -> str:"""Build the tool description for one user.`sql_v2_enabled` follows the same flag the notebook run endpoint enforces. Without it the@@ -36,7 +36,7 @@ def create_notebook_prompt(*, sql_v2_enabled: bool, widgets_enabled: bool) -> stbutton, so an authored SQLV2 or PythonV2 cell gives the user a dead control and noexplanation. Offer the ungated `<Query />` cell to those users instead."""- cell_guidance = cell_guidance_prompt(sql_v2_enabled=sql_v2_enabled, widgets_enabled=widgets_enabled)+ cell_guidance = cell_guidance_prompt(sql_v2_enabled=sql_v2_enabled)return f"""Use this tool to create a notebook document with rich content.@@ -141,7 +141,7 @@ class CreateNotebookTool(MaxTool):args_schema: type[BaseModel] = CreateNotebookToolArgs# Fail closed: a caller that skips `create_tool_class` gets the description that authors no# cell the user may be unable to run.- description: str = create_notebook_prompt(sql_v2_enabled=False, widgets_enabled=False)+ description: str = create_notebook_prompt(sql_v2_enabled=False)@classmethodasync def create_tool_class(@@ -157,7 +157,6 @@ class CreateNotebookTool(MaxTool):# The flag lookup reads `user.organization`, so it needs a thread with a database# connection rather than this coroutine.sql_v2_enabled = await database_sync_to_async(notebooks.is_sql_v2_enabled)(user)- widgets_enabled = await database_sync_to_async(notebooks.is_notebook_widget_enabled)(user)return cls(team=team,user=user,@@ -165,7 +164,7 @@ class CreateNotebookTool(MaxTool):state=state,config=config,context_manager=context_manager,- description=create_notebook_prompt(sql_v2_enabled=sql_v2_enabled, widgets_enabled=widgets_enabled),+ description=create_notebook_prompt(sql_v2_enabled=sql_v2_enabled),)async def _arun_impl(diff --git a/frontend/snapshots.yml b/frontend/snapshots.ymlindex 594d126572bf..3ee41255fbef 100644--- a/frontend/snapshots.yml+++ b/frontend/snapshots.yml@@ -9439,9 +9439,9 @@ snapshots:scenes-app-batchexports--existing-big-query-export--light:hash: v1.k794b7964.169c050ced77823af76847e5b432e37172733b51a52fa3e4046ab9ef586d40eb.QA_BL0dNaL6VSVaB5YMB03s3-F4U4WQjVKyOY_xGux4scenes-app-batchexports--existing-hog-ql-export--dark:- hash: v1.k794b7964.ae73ef2888f5c209b7e1789309a645a3b48e2411233aac2b8b4baaa2ee26ad7e.UMVhqMnhbqynOwjMErasjzgxUgAwrfFHEU_7kb4jU1E+ hash: v1.k794b7964.18aa327887de90b55b965a47d444f47cca5221810b77a9febf977d5c11fef3f9.lf-GoW4UTmTIBM0EFuyKaHvOqxlCtkz4OPRTqmK7edQscenes-app-batchexports--existing-hog-ql-export--light:- hash: v1.k794b7964.2b4ff50f30637348e5f0f146eb583d58e1ecb75a2a56b10ad68f7803ecd3791e.SYr_Y2YmSoybLbU4lEnN_3Cf6BVzTuxFrVQ1tupHaiQ+ hash: v1.k794b7964.20fde8ba3166050306af242af476929f4903533efb8a8a6e261f878c0455c730.USOwMIkQ6I6-FQhn0OV-8qcq-4OEfQDVshUSu64Toa0scenes-app-batchexports--history-empty--dark:hash: v1.k794b7964.4876ed69bc9129528181a8a663b41e0fb1350b95e3f3a6077a9db2857b081cc4.N_l9zIvhsX-G07IjsNfoWtmuyYaV-o88xTxZz3_w4rMscenes-app-batchexports--history-empty--light:@@ -10243,41 +10243,41 @@ snapshots:scenes-app-data-warehouse-sql-editor--bi-table-analysis--light:hash: v1.k794b7964.dbf2cf1ce2e9f86054f7dddb2cbe184dafef8fee54792354aba104f1b8edecba.qbtA2DIHLtYHtxUnH9FjPmnfkr6nie7aEyVjAfCSC3cscenes-app-data-warehouse-sql-editor--edited-insight--dark:- hash: v1.k794b7964.334b216a8359c768613cdec5b99a8a8ee26b6b5fac76397eaed8d6d1401a23c0.0pI7NMTufzUIfDel9Ngmhv3P3sdBu6IgpSj5xYNmYrY+ hash: v1.k794b7964.4e81f33deba8184b2e4d8c90c20967f98d4cfac08a1903c8b1805604ad94983f.ZI5eb066W3jZYoEroMzzCE08QMOQvQmyTaxzxOZey88scenes-app-data-warehouse-sql-editor--edited-insight--light:- hash: v1.k794b7964.b92f606e9a4e6fae85bfda61c881a0e357eb64ecffc42b7b0f585c1218a547be.26Nvvp7xA6ADbOxOz5l0KD37TYoyGSiGJ6XQgSn1GXE+ hash: v1.k794b7964.1b9f92806a628c4f9fa9fe08a0d1f2102ff41f00c7b03907d014a75acc09fa70.KwEmvIN4XlyI9VtFb0Df823i3G9fqLFossNoMgEiYqMscenes-app-data-warehouse-sql-editor--edited-view--dark:hash: v1.k794b7964.57136a6dbeab9ac511a2a5e0c7401b23a4cb0ac00d82a2be177b84f74a60ebb0.QicPm3hXLpA9re3ShhfrqX6bKcWmuAvRBCtbRpHrSFQscenes-app-data-warehouse-sql-editor--edited-view--light:hash: v1.k794b7964.1bada9403e11b62a50423adde53ce13fcd10a5bd6c33a210f5dd58a10a956cf8.2N9MES9JfDzATg0m-6cJnj7FWTzNt6ZlLxGqqoAI54Ascenes-app-data-warehouse-sql-editor--hosted-trino--dark:- hash: v1.k794b7964.f9994745acd14c1637efcaaba80d853b1c407ab0b9f67f94dae27b0a754e77f5.jeo7IYSV-jC6k5vgl8opPAG8O1Y2Cbw37y2QrEnt6F0+ hash: v1.k794b7964.9c5c2408b68039d1989e4b7d52a787ba6739326a0207118bed07db27c6385eda.slBWrouzz0S3bARV3vpB-WyUyyu4o7c3oCcvLPi-8kwscenes-app-data-warehouse-sql-editor--hosted-trino--light:- hash: v1.k794b7964.1a069b0d0e4660900fa7731adde3ee7738bafa27fc0030ec10ce49d50997beba.KMUhJe60oAoeJ8wuGV4biL24SWSc2byQh15_c7ydid4+ hash: v1.k794b7964.edeb19cea3ae7e50344b0df94be3e99cae5eb79d315dfd30d78bc8b3843410b8.du5LaVfvGqlWPkWOgYtB_Dp27ltGmpj6p1pvOm0vM08scenes-app-data-warehouse-sql-editor--lazy-schema--dark:- hash: v1.k794b7964.377c5cbd365fb00f334e2ad85570c373fc29c7aaddb4fc942b53081f882a02d7.EG98MhlU_8eOPCG85eUQL3egUoLrtejgaMCkD8v4BFo+ hash: v1.k794b7964.520af6c94de8ab081cff352b32dbee68c1054c8fdc6632a87bcecccaf497cf5d.SBsaeAFwZNnQLj-vhwcaUBLbOT1r7VTPn8dgApUR_Mwscenes-app-data-warehouse-sql-editor--lazy-schema--light:- hash: v1.k794b7964.746e808509f8aa54b1a216c485d99b2f3c85366daffc3a2c3cb48b56f8512956.Y-ehuWk2tXIBDKsbWcs5nNXWQe63faDn2JUX2wPXp5o+ hash: v1.k794b7964.46f82cf80402c360318cf7c21d6c1d89ab01e7dad8853a8d882ed75f6509f87d.4bs5KStWG3w60fPsa01nPYvaM3o2HBIXt6fHg4lKGaMscenes-app-data-warehouse-sql-editor--loading-insight--dark:- hash: v1.k794b7964.6a4654528c452e32987fc4054d950f101350e4e214ef0a0b9cbb53a5c3aff85f.W4xxsumuTbYHqWM4plo-C89kQHxG5_OsgdOwKhELtAM+ hash: v1.k794b7964.3943daf2885879b6fbe3573213278be56c09f47bba90bc133ebfbc64a80f9323.Q4NvArXBY5VdTtnNlhmMG7aK481zSBRFCfpQqiLPgIwscenes-app-data-warehouse-sql-editor--loading-insight--light:- hash: v1.k794b7964.2431f31d5d33b7e87db300430cbab7b2cc70f40786587a09e5b41d42a02a8a5f.x7l4JtfZrwoDUHXEzxtxqbOplVJAY4H69OzVesH80Rk+ hash: v1.k794b7964.03be9cdcfabc5c9299d7e9dbe28ac04d1de2808c0701a173b2421a90f5d795ee.j1vfupbc6XDFc08rCy0o-WXyxtFOTRMNT_eE6MyB0oYscenes-app-data-warehouse-sql-editor--managed-warehouse-connection--dark:- hash: v1.k794b7964.3c4bbe63ff30dee2cdef4a41a06d5a83bedcbaf8fd06bd14e8f7632f5c3d097c.qzBmH7GQm_oM_jCNWuSApX-cI65YcyEnwosDth6tlnE+ hash: v1.k794b7964.a214e35f699dae99e7aa4f0beca162d35c0095df90f2b0da43cf78114de5470e.ZG5dRjculzef5ATiURJhJ3M35ZFy6Jf3EG0m2LHnzcgscenes-app-data-warehouse-sql-editor--managed-warehouse-connection--light:- hash: v1.k794b7964.94f8446b422849213e559816286f4692a33dae22bd5e0d2a7e046b39ee9bd995.Fi8bnmt0Ykul6Mhj3kLT5Jr7Pom70Xg2z9QQlNRFXPI+ hash: v1.k794b7964.484a062565c6c6cc5df4aaed73b74b3d76f632e941a05d55cd8f239d4ba86bf0.u3XeIxjSiLkMxX8yeyziaTMF-1xlrEV-oLR859Moxewscenes-app-data-warehouse-sql-editor--materialization-settings--dark:hash: v1.k794b7964.10ccff73d67e6f4d5aad149c0f730982cc4911e89fec03bf05de09b0f52f0c8d.mkYOiFsECj8Tq6ukVR9JjW41SKL0dy-Dqfbc5pDqaVYscenes-app-data-warehouse-sql-editor--materialization-settings--light:hash: v1.k794b7964.99aa3bde7ac4497a83b2008869c8efd14317eda8d8c08950e851089092df8df9.05p6Le0a2itun96QCw7Mk7VkwfAp50woApgM8ZyaHMsscenes-app-data-warehouse-sql-editor--sidebar-materialization-status--dark:- hash: v1.k794b7964.a7f20f84d6ad72d69e0be4bfaf08f0b5e701a203e529743d56ad2c1ab4287e2d.Efand-renJKxJ7d8eJTahwzwGrvnGQ4hKPjS1Us7DQE+ hash: v1.k794b7964.61679b7880682c4f20d03ffae8424f40d458539af169f5968e2669479ea7995c.B-7a_Mcdz3VVb92UpNggKiXjLIFliluBrQB6Y-eg-_Qscenes-app-data-warehouse-sql-editor--sidebar-materialization-status--light:- hash: v1.k794b7964.07c5266940751be2f694d94380d61b6a99c5f1b8371b850f4e2e4c5bf3a97a17.Eem0xkVbnhpmzCV08f0kAF_oTrUjo7VkVAK_viENzC8+ hash: v1.k794b7964.ba71002ed62cdc4ba3f788f63825706e798ea2320d6edcd165926e3e7bb12caf.oanDT3feuobHrZN0Lsrvxe6JqUKKHBDgkKnZZIb-Co0scenes-app-data-warehouse-sql-editor--top-tools-per-server--dark:- hash: v1.k794b7964.7fa7e81fab1b2ac257a56f5de295c6c246b18fe9f6ba8118810302b067f411e0.lOycFI8S9f4jdww5-Xm8rjXVf3DlBEVxtsmkXIxVl_0+ hash: v1.k794b7964.09cbf4fb6c6774ac241e66543414a19356914a2def3c34d7063172dd37cff494.tizuoPtWR7f-Cdka3_-mp0O9CBQ1CPPGRprgEpK0Zzcscenes-app-data-warehouse-sql-editor--top-tools-per-server--light:- hash: v1.k794b7964.c4c5b22777e20c8dc6a83392026100523aba4c228073174cfb956552629e7975.Jrjh7qB_BVDY0MTQeRAXv5lkTsQtY0jgQO6wEZUPpAQ+ hash: v1.k794b7964.2c0e2af910c16e301d1ab2d533a703068282ffbe68db8caf490d425f3c76f94f.4rfOB50ow9LE-i-5Ckh6qe-sYoNiPdIqKDfCzcLRt-Uscenes-app-discussions--replying-to-thread--dark:hash: v1.k794b7964.c2c9d9beff1e3fa0fc6a314aa073610d674eb9cd4af235b31a81e09462b5b58e.-fbBmBjOrnXiwY_8KrKftI-k7wWP9L77S8rFDSiiI3Uscenes-app-discussions--replying-to-thread--light:@@ -13287,9 +13287,9 @@ snapshots:scenes-app-notebooks--notebook-not-found--light:hash: v1.k794b7964.f22f15db87b69cc7ebc8aef74e170320626997e7219e36bfdd6bc74ac2feec25._PnuneTSXvkT_YRO-WBWQNKNyXR5pYpzAsbcsuT5WMkscenes-app-notebooks--notebooks-list--dark:- hash: v1.k794b7964.0815d1eac9470c83505a2c8b54a71c16bb4fa3d6b6b62b38a47c1b9150530157.H6zpAlFdCUW8vwQzYm3Pxb6GPqEzbIdBofexQ6rMYag+ hash: v1.k794b7964.b8c52e32ab6300cf8f276af8b47b883f57be77697768a1b4fe0f55aa7f8d1f4d.vIXFxCS5cvP75yXsW8DxSheX4CLYw7nwSl7F9r1kpcEscenes-app-notebooks--notebooks-list--light:- hash: v1.k794b7964.aa729600bcb9d44362b6c6f7ea759a34cfb81f7e9a234ee891f66d987a16821d.xTE1282qT_roMmjinam7kqquC-WNKKej4oAqH4Nh4Y4+ hash: v1.k794b7964.ea4d71dd4b6011416396d30304f65d67b3c978a0a8d11fc331da27122ea90960.d7KZuxOHqjGvwh8pSJ5aJ1klOSvC59cFqltMtG4EoJwscenes-app-notebooks--numbered-list--dark:hash: v1.k794b7964.86be64e99289f071f001be1201bf1a53b21dcdba2d84eeeb20583bb1706fd7bc.2p2YpMbAI1Zs3y8io1jfp7HMXqAkYksELj67-lNWrRkscenes-app-notebooks--numbered-list--light:@@ -13411,13 +13411,13 @@ snapshots:scenes-app-notebooks-run-all-banner--starting--light:hash: v1.k794b7964.6c7bd37efe1d58d68070782d7d1d0ce20be5abfebe1f829feb0376b584ad1158.CVBhfDqMZqLLuxmDgkiTAS9Vn2SANiX9cOWDF1Ui8hkscenes-app-notebooks-sql-cell-chart--bar-chart--dark:- hash: v1.k794b7964.01d294260ab7f11c6ec5f12babb168e9b4be9b3ac5083437ce4ca08c26fdd307.NEYWZWqJjvheGvI6_V7nSZpr6G1CQXpQVv_LakiSmKk+ hash: v1.k794b7964.c41b37a93d8837b3553828a9a0404b2339ff572b70d5caa2594cb844920f1a2e.yq6UDrqaC0R-JEjBrOyC1NlAOQ-mE7x8k0dvvrNNNbIscenes-app-notebooks-sql-cell-chart--bar-chart--light:- hash: v1.k794b7964.c8b9e39a378111733901720344706caa06054f71617c2f33d048c6bea82e52cb.A0knltu3Io9HZA-xdzQ6xCvsxicU8ZSjvOWWj-jT9bs+ hash: v1.k794b7964.c17bb922582b7e626a3c0c6d52064553eb0746150d4efd364b7d22dcd7234ff7.NZkSVzLm69X_1mCUuYSxBnFA6BwEslWe1q9Brgh7J9Mscenes-app-notebooks-sql-cell-chart--line-chart--dark:- hash: v1.k794b7964.81aa5c1de9525de5b841548cc8b8403451b89c6ab3701bd33fcdc27c2864458d.bbY5Nitk6h_sipbG-d3C7qhQl0xRobRMrq1vBsK9Bf8+ hash: v1.k794b7964.d0680bc106516aaf11e4f59df950c72ff97db4a45b842289c38e99982f5270e8.ZCfy8qhd-5cuv7pFdcsLTt9eMSzxmRTeOyX7HlVlhLIscenes-app-notebooks-sql-cell-chart--line-chart--light:- hash: v1.k794b7964.6ba65b542065dd2a89dce854230c8cd9fa88af21cda380d996a36e602947494f.uBxIB5cGUIDNUBP_HUc1ZKCKP8oVHeYqlyClmTDYDoQ+ hash: v1.k794b7964.a5c899a40bf99bffb5d1d62778397680f12e7d83ff8ab0e52f28ca97645d07a5.AqXt67GYrzGK7YQlHYzRj9h4CPvoQAWxQxwJmGWi2Ukscenes-app-notebooks-widget-generation-cost--less-than-one-cent--dark:hash: v1.k794b7964.3d7ab4ed80e86dee207323ed0baf83d86a9c0b53c868f64769ddc708b4ab5881.RKwiZJnBL8K4kWfRM3MV6Aruoqr20twxVmepMy_SU6Yscenes-app-notebooks-widget-generation-cost--less-than-one-cent--light:@@ -13463,9 +13463,9 @@ snapshots:scenes-app-notebooks-widget-views--group-views--light:hash: v1.k794b7964.3844ddec20fcd7f37bffaca53a98740dfc150d5ec61c040435d9d5683b78c49f.ti5pquIH9vqC56HbmyWDpO9r23A4XSrzBN0zcHNo08Mscenes-app-notebooks-widget-views--insight-views--dark:- hash: v1.k794b7964.3cd6aee7228c98cf2f27bf0126200eaabd87e1cd4afe7123892b6532700b6b07.ybJ4tpHq-P3wNlOCEUspRZB7kLR1DdWC7SDx1QW_ohY+ hash: v1.k794b7964.3f91b2d3de6989bb5897b15bf6b7ac2772c227ba3a6ff999f92e0fdbe4deca80.diY3XQ3LQKSQZRbkEQ3z8qaTQBWQvVn1vcJ2uNjinCAscenes-app-notebooks-widget-views--insight-views--light:- hash: v1.k794b7964.690e0db45d95915a66fb22e02f7ead173186a6cefae5ad6dbdeb5103b7bdfbd0.dzHPbHhENEt9YoK-EEMi88V_XmLPXJNhl9HulAWBKvo+ hash: v1.k794b7964.dfc5d4779f6962c376596b280bfd5d868e308ab02e6514453b9f6d009c83fa1f.EjZN61Xh-kqfbFTOY5QtqEVlpuwNw2qIGYW-FL0wweAscenes-app-notebooks-widget-views--llm-trace-views--dark:hash: v1.k794b7964.4e1ab634bae8a93e4e3c6fed3c379cd10791a8cdfaa37c551ffc10cbb5c2d738.zBi7T4pmBEu1EV1ID04nuFxNs7iSFBMDc-tCKVEmy70scenes-app-notebooks-widget-views--llm-trace-views--light:diff --git a/frontend/src/lib/components/MarkdownNotebook/README.md b/frontend/src/lib/components/MarkdownNotebook/README.mdindex 9fb30fbf2dc6..114a0b6b41d5 100644--- a/frontend/src/lib/components/MarkdownNotebook/README.md+++ b/frontend/src/lib/components/MarkdownNotebook/README.md@@ -81,7 +81,7 @@ The shell only handles keys that happened inside its own DOM. A block that rende## Jupyter mode-The `jupyterMode` prop lays the notebook out and drives it the way JupyterLab does. The notebooks scene passes it behind the `notebook-jupyter-mode` flag, and each user can turn it off from the notebook's View menu.+The `jupyterMode` prop lays the notebook out and drives it the way JupyterLab does. The notebooks scene enables it when notebook kernels are available through `revamped-py-notebooks`, and each user can turn it off from the notebook's View menu.`Shift+Enter` inside markdown text inserts a line break within the text cell. `Escape` selects the markdown cell in command mode, where `Shift+Enter` advances to the next cell and inserts a code cell if there is none. Python and SQL editors keep `Shift+Enter` as run and advance.diff --git a/frontend/src/lib/components/Search/searchLogic.test.ts b/frontend/src/lib/components/Search/searchLogic.test.tsindex 04c0a4670061..a24e01f6afce 100644--- a/frontend/src/lib/components/Search/searchLogic.test.ts+++ b/frontend/src/lib/components/Search/searchLogic.test.ts@@ -152,7 +152,7 @@ describe('searchLogic', () => {['metrics sql', [], '/metrics?activeTab=sql'],['dashboards cross-project', [FEATURE_FLAGS.CROSS_PROJECT_DASHBOARDS], '/dashboard?tab=cross-project'],['tracing sql', [FEATURE_FLAGS.TRACING, FEATURE_FLAGS.TRACING_SCENE_TABS], '/tracing?tab=sql'],- ['reusable widgets', [FEATURE_FLAGS.NOTEBOOK_GENERATED_WIDGETS], '/notebooks?tab=widgets'],+ ['reusable widgets', [], '/notebooks?tab=widgets'],['replay vision usage', [], '/replay-vision?tab=usage'],])('links the tab row found by %j with flags %j to %s', async (search, flags, href) => {featureFlagLogic.actions.setFeatureFlags([], Object.fromEntries(flags.map((flag) => [flag, true])))diff --git a/frontend/src/lib/constants.tsx b/frontend/src/lib/constants.tsxindex 5198b519a73f..9ac692a313d2 100644--- a/frontend/src/lib/constants.tsx+++ b/frontend/src/lib/constants.tsx@@ -386,7 +386,6 @@ export const FEATURE_FLAGS = {INSIGHT_EXPORT_NUDGE: 'insight-export-nudge', // owner: #team-analytics-platform multivariate=control,test, nudges people who just exported an insight toward a recurring subscriptionINSIGHT_SUBSCRIBE_PROMINENT_BUTTON: 'insight-subscribe-prominent-button', // owner: @mattp #team-analytics-platform multivariate=control,testINTERNAL_FEEDBACK_WIDGET: 'internal-feedback-widget', // owner: @adamleithp, gates the staff UI feedback bar that posts to Slack- JEV_CHART_AUTODETECTION: 'jev-chart-autodetection', // owner: #team-data-toolsJS_SNIPPET_VERSIONING: 'js-snippet-versioning', // owner: #team-client-librariesLEGACY_OAUTH_RECONNECT_WARNING: 'legacy-oauth-reconnect-warning', // owner: @jabahamondes #team-web-analytics — kill-switch for the retiring-OAuth-app reconnect bannerLIVE_EVENTS_RICH_FILTERS: 'live-events-rich-filters', // owner: @jordanm-posthog #team-web-analytics@@ -460,8 +459,6 @@ export const FEATURE_FLAGS = {NEW_COMMAND_K_SEARCH: 'new-command-k-search', // owner: @adamleithp #team-platform-ux, gates the Command K search with smart filtersNEW_TAB_PROJECT_EXPLORER: 'new-tab-project-explorer', // owner: #team-platform-uxNEW_TEAM_CORE_EVENTS: 'new-team-core-events', // owner: @jabahamondes #team-web-analytics- NOTEBOOK_GENERATED_WIDGETS: 'notebook-generated-widgets', // owner: #team-data-tools- NOTEBOOK_JUPYTER_MODE: 'notebook-jupyter-mode', // owner: #team-data-tools, lays notebooks out and drives them like JupyterLabNOTEBOOK_SANDBOX_FREE_COMPUTE: 'notebook-sandbox-free-compute', // owner: #team-data-tools, shows the notebook sandbox rate crossed out at $0.00 / hNOTEBOOK_SHARING: 'notebook-sharing', // owner: @reecejones #team-platform-featuresONBOARDING_WIZARD_CLOUD_RUN: 'onboarding-wizard-cloud-run', // owner: @fercgomes #team-growth multivariate=control,test — gates the "open a PR for me" cloud wizard option on the install stepdiff --git a/frontend/src/products.tsx b/frontend/src/products.tsxindex ae81e2803d96..a64878101e71 100644--- a/frontend/src/products.tsx+++ b/frontend/src/products.tsx@@ -2996,13 +2996,7 @@ export const getTreeItemsProducts = (): FileSystemImport[] => [iconType: 'notebook',href: urls.notebooks(),searchKeywords: ['documents', 'scratchpad'],- searchTabs: [- {- name: 'Reusable widgets',- href: urls.notebooks('widgets'),- flag: FEATURE_FLAGS.NOTEBOOK_GENERATED_WIDGETS,- },- ],+ searchTabs: [{ name: 'Reusable widgets', href: urls.notebooks('widgets') }],sceneKey: 'Notebooks',sceneKeys: ['Notebook', 'Notebooks'],},diff --git a/frontend/src/scenes/data-warehouse/editor/SQLEditorScene.stories.tsx b/frontend/src/scenes/data-warehouse/editor/SQLEditorScene.stories.tsxindex 8362739ecf33..a4e83b92b9dd 100644--- a/frontend/src/scenes/data-warehouse/editor/SQLEditorScene.stories.tsx+++ b/frontend/src/scenes/data-warehouse/editor/SQLEditorScene.stories.tsx@@ -962,7 +962,7 @@ const CHART_EXPERIMENT_RESULTS = {}const chartExperimentParameters = (approved: boolean, decisionDelay = 0, queryDelay = 0): Record<string, unknown> => ({- featureFlags: ['ml-inference-decisions', 'jev-chart-autodetection'],+ featureFlags: ['ml-inference-decisions'],pageUrl: urls.sqlEditor({ query: 'SELECT category, revenue FROM example_sales' }),msw: {mocks: {diff --git a/frontend/src/scenes/notebooks/Nodes/NotebookNodeSQLV2.tsx b/frontend/src/scenes/notebooks/Nodes/NotebookNodeSQLV2.tsxindex 82d0787dc95b..e7db29328adb 100644--- a/frontend/src/scenes/notebooks/Nodes/NotebookNodeSQLV2.tsx+++ b/frontend/src/scenes/notebooks/Nodes/NotebookNodeSQLV2.tsx@@ -2,10 +2,8 @@ import { useActions, useMountedLogic, useValues } from 'kea'import { useEffect, useMemo, useRef, useState } from 'react'import { useNotebookJupyterCommands } from 'lib/components/MarkdownNotebook/jupyterMode'-import { FEATURE_FLAGS } from 'lib/constants'import { LemonButton } from 'lib/lemon-ui/LemonButton'import { LemonTabs } from 'lib/lemon-ui/LemonTabs'-import { featureFlagLogic } from 'lib/logic/featureFlagLogic'import { OutputTab } from 'scenes/data-warehouse/editor/outputPaneLogic'import { createPostHogWidgetNode } from 'scenes/notebooks/Nodes/NodeWrapper'import type { NotebookNodeRunTerminalStatus } from 'scenes/notebooks/Notebook/notebookNodeStalenessLogic'@@ -152,7 +150,6 @@ const Component = ({updateAttributes,}: NotebookNodeProps<NotebookNodeSQLV2Attributes>): JSX.Element | null => {const nodeLogic = useMountedLogic(notebookNodeLogic)- const { featureFlags } = useValues(featureFlagLogic)const { nodeId, notebookLogic, expanded, sqlV2ReturnVariable, sqlV2ReturnVariableUsage, isEditable } =useValues(nodeLogic)const { navigateToNode } = useActions(nodeLogic)@@ -439,36 +436,33 @@ const Component = ({<div className="text-xs text-muted font-mono p-2">Run the query to see execution results.</div>)}</div>- {(featureFlags[FEATURE_FLAGS.REVAMPED_PY_NOTEBOOKS] ||- featureFlags[FEATURE_FLAGS.NOTEBOOK_GENERATED_WIDGETS]) && (- <NotebookCellOutputNameFooter- returnVariable={returnVariable}- onChange={(returnVariable) => updateAttributes({ returnVariable })}- inputRef={setReturnVariableInput}- >- <NotebookDataframeHintPopover- nodeId={nodeId}- notebookShortId={notebookShortId}- referenceElement={returnVariableInput}- />- {returnVariableError ? <span className="text-danger">{returnVariableError}</span> : null}- {sqlV2ReturnVariableUsage.length > 0 ? (- <span className="text-muted">- Used in{' '}- {sqlV2ReturnVariableUsage.map((usage) => (- <button- key={usage.nodeId}- type="button"- className="text-muted hover:text-default underline underline-offset-2 ml-1"- onClick={() => navigateToNode(usage.nodeId)}- >- {usageLabel(usage.nodeIndex, usage.title)}- </button>- ))}- </span>- ) : null}- </NotebookCellOutputNameFooter>- )}+ <NotebookCellOutputNameFooter+ returnVariable={returnVariable}+ onChange={(returnVariable) => updateAttributes({ returnVariable })}+ inputRef={setReturnVariableInput}+ >+ <NotebookDataframeHintPopover+ nodeId={nodeId}+ notebookShortId={notebookShortId}+ referenceElement={returnVariableInput}+ />+ {returnVariableError ? <span className="text-danger">{returnVariableError}</span> : null}+ {sqlV2ReturnVariableUsage.length > 0 ? (+ <span className="text-muted">+ Used in{' '}+ {sqlV2ReturnVariableUsage.map((usage) => (+ <button+ key={usage.nodeId}+ type="button"+ className="text-muted hover:text-default underline underline-offset-2 ml-1"+ onClick={() => navigateToNode(usage.nodeId)}+ >+ {usageLabel(usage.nodeIndex, usage.title)}+ </button>+ ))}+ </span>+ ) : null}+ </NotebookCellOutputNameFooter></div>)}diff --git a/frontend/src/scenes/notebooks/Notebook/NotebookJupyterMode.stories.tsx b/frontend/src/scenes/notebooks/Notebook/NotebookJupyterMode.stories.tsxindex d0bfd07caff4..6966b382e68c 100644--- a/frontend/src/scenes/notebooks/Notebook/NotebookJupyterMode.stories.tsx+++ b/frontend/src/scenes/notebooks/Notebook/NotebookJupyterMode.stories.tsx@@ -10,6 +10,7 @@ import { mswDecorator } from '~/mocks/browser'import { notebookTestTemplate } from './__mocks__/notebook-template-for-snapshot'import { buildMarkdownNotebookContent, serializeMarkdownNotebookComponent } from './markdownNotebookV2'import { notebookJupyterLogic } from './notebookJupyterLogic'+import { notebookSettingsLogic } from './notebookSettingsLogic'const SHORT_ID = 'jupyter-mode'@@ -88,6 +89,18 @@ const notebook = {const meta: Meta = {component: App,title: 'Scenes-App/Notebooks/Jupyter mode',+ beforeEach: () => {+ const key = 'scenes.notebooks.notebooks.notebookSettingsLogic.isJupyterMode'+ const previous = localStorage.getItem(key)+ localStorage.setItem(key, JSON.stringify(true))+ return () => {+ if (previous === null) {+ localStorage.removeItem(key)+ } else {+ localStorage.setItem(key, previous)+ }+ }+ },parameters: {layout: 'fullscreen',viewMode: 'story',@@ -125,10 +138,26 @@ type Story = StoryObj<{}>export const JupyterModeOff: Story = {parameters: { featureFlags: [FEATURE_FLAGS.REVAMPED_PY_NOTEBOOKS] },+ play: async ({ canvasElement }) => {+ await waitFor(+ () => {+ if (!canvasElement.querySelector('.MarkdownNotebook__jupyter-cell')) {+ throw new Error('Jupyter cells have not rendered yet')+ }+ },+ { timeout: 30000 }+ )+ notebookSettingsLogic.actions.setIsJupyterMode(false)+ await waitFor(() => {+ if (canvasElement.querySelector('.MarkdownNotebook__jupyter-cell')) {+ throw new Error('Jupyter cells remain after disabling the user preference')+ }+ })+ },}export const JupyterMode: Story = {- parameters: { featureFlags: [FEATURE_FLAGS.REVAMPED_PY_NOTEBOOKS, FEATURE_FLAGS.NOTEBOOK_JUPYTER_MODE] },+ parameters: { featureFlags: [FEATURE_FLAGS.REVAMPED_PY_NOTEBOOKS] },play: async ({ canvasElement }) => {await waitFor(() => {diff --git a/frontend/src/scenes/notebooks/Notebook/NotebookSQLCellChart.stories.tsx b/frontend/src/scenes/notebooks/Notebook/NotebookSQLCellChart.stories.tsxindex 8946cee74351..cb9df8cd4d89 100644--- a/frontend/src/scenes/notebooks/Notebook/NotebookSQLCellChart.stories.tsx+++ b/frontend/src/scenes/notebooks/Notebook/NotebookSQLCellChart.stories.tsx@@ -57,7 +57,7 @@ const meta: Meta = {mockDate: '2023-07-04',featureFlags: [FEATURE_FLAGS.REVAMPED_PY_NOTEBOOKS],testOptions: {- waitForSelector: '[data-attr="notebook-node-sql-v2"] canvas',+ waitForSelector: '.DataVisualization canvas',},},decorators: [diff --git a/frontend/src/scenes/notebooks/Notebook/markdownNotebookRegistry.test.tsx b/frontend/src/scenes/notebooks/Notebook/markdownNotebookRegistry.test.tsxindex 83c10ad5d477..d3e072ecafba 100644--- a/frontend/src/scenes/notebooks/Notebook/markdownNotebookRegistry.test.tsx+++ b/frontend/src/scenes/notebooks/Notebook/markdownNotebookRegistry.test.tsx@@ -105,11 +105,10 @@ describe('markdownNotebookRegistry', () => {expect(flagOff.components.PythonV2.insertCommand).toBeUndefined()})- it('gates widget insertion and registers only the Widget component', () => {- expect(getInsertCommandsByLabel({ [FEATURE_FLAGS.NOTEBOOK_GENERATED_WIDGETS]: true }, 'Widget')).toEqual([+ it('offers widget insertion without feature flags and registers only the Widget component', () => {+ expect(getInsertCommandsByLabel({}, 'Widget')).toEqual([{ key: 'component-Widget', category: 'Common', badge: 'BETA' },])- expect(getInsertCommandsByLabel({}, 'Widget')).toEqual([])for (const legacyTag of ['GeneratedWidget', 'GenUI']) {expect(NOTEBOOK_MARKDOWN_REGISTRY.components).not.toHaveProperty(legacyTag)}@@ -130,7 +129,6 @@ describe('markdownNotebookRegistry', () => {getMarkdownNotebookDefaultRegistry(),getMarkdownRegistryForFeatureFlags({[FEATURE_FLAGS.REVAMPED_PY_NOTEBOOKS]: true,- [FEATURE_FLAGS.NOTEBOOK_GENERATED_WIDGETS]: true,})),(_nodeId, node) => insertedNodes.push(node),diff --git a/frontend/src/scenes/notebooks/Notebook/markdownNotebookRegistry.tsx b/frontend/src/scenes/notebooks/Notebook/markdownNotebookRegistry.tsxindex f6e339d8a25e..c107de155687 100644--- a/frontend/src/scenes/notebooks/Notebook/markdownNotebookRegistry.tsx+++ b/frontend/src/scenes/notebooks/Notebook/markdownNotebookRegistry.tsx@@ -413,9 +413,6 @@ export function getMarkdownRegistryForFeatureFlags(featureFlags: FeatureFlagsSetif (!featureFlags[FEATURE_FLAGS.REVAMPED_PY_NOTEBOOKS]) {hiddenTags.push('SQLV2', 'PythonV2')}- if (!featureFlags[FEATURE_FLAGS.NOTEBOOK_GENERATED_WIDGETS]) {- hiddenTags.push('Widget')- }if (hiddenTags.length === 0) {return NOTEBOOK_MARKDOWN_REGISTRYdiff --git a/frontend/src/scenes/notebooks/NotebooksScene.tsx b/frontend/src/scenes/notebooks/NotebooksScene.tsxindex b0963468c975..9e6a0ec28a5a 100644--- a/frontend/src/scenes/notebooks/NotebooksScene.tsx+++ b/frontend/src/scenes/notebooks/NotebooksScene.tsx@@ -6,8 +6,6 @@ import { LemonButton, LemonTabs } from '@posthog/lemon-ui'import { AccessControlAction } from 'lib/components/AccessControlAction'import { Shortcut } from 'lib/components/Shortcuts/Shortcut'import { keyBinds } from 'lib/components/Shortcuts/shortcuts'-import { FEATURE_FLAGS } from 'lib/constants'-import { featureFlagLogic } from 'lib/logic/featureFlagLogic'import { notebooksTableLogic } from 'scenes/notebooks/NotebooksTable/notebooksTableLogic'import { Scene, SceneExport } from 'scenes/sceneTypes'import { urls } from 'scenes/urls'@@ -31,9 +29,7 @@ export const scene: SceneExport = {export function NotebooksScene(): JSX.Element {const { searchParams } = useValues(router)- const { featureFlags } = useValues(featureFlagLogic)- const reusableWidgetsEnabled = !!featureFlags[FEATURE_FLAGS.NOTEBOOK_GENERATED_WIDGETS]- const activeTab = reusableWidgetsEnabled && searchParams.tab === 'widgets' ? 'widgets' : 'notebooks'+ const activeTab = searchParams.tab === 'widgets' ? 'widgets' : 'notebooks'return (<SceneContent>@@ -67,28 +63,24 @@ export function NotebooksScene(): JSX.Element {</AccessControlAction>}/>- {reusableWidgetsEnabled ? (- <LemonTabs- activeKey={activeTab}- sceneInset- tabs={[- {- key: 'notebooks',- label: 'Notebooks',- link: urls.notebooks(),- content: <NotebooksTable />,- },- {- key: 'widgets',- label: 'Reusable widgets',- link: `${urls.notebooks()}?tab=widgets`,- content: <ReusableWidgetCatalog />,- },- ]}- />- ) : (- <NotebooksTable />- )}+ <LemonTabs+ activeKey={activeTab}+ sceneInset+ tabs={[+ {+ key: 'notebooks',+ label: 'Notebooks',+ link: urls.notebooks(),+ content: <NotebooksTable />,+ },+ {+ key: 'widgets',+ label: 'Reusable widgets',+ link: `${urls.notebooks()}?tab=widgets`,+ content: <ReusableWidgetCatalog />,+ },+ ]}+ /></SceneContent>)}diff --git a/frontend/src/scenes/notebooks/utils.ts b/frontend/src/scenes/notebooks/utils.tsindex a1c920f50133..5c9f954c4a6e 100644--- a/frontend/src/scenes/notebooks/utils.ts+++ b/frontend/src/scenes/notebooks/utils.ts@@ -13,7 +13,7 @@ export function isKernelUiEnabled(featureFlags: FeatureFlagsSet): boolean {// Jupyter mode lays out the sandbox-kernel cells, so it needs them available too.export function isJupyterModeAvailable(featureFlags: FeatureFlagsSet): boolean {- return isKernelUiEnabled(featureFlags) && !!featureFlags[FEATURE_FLAGS.NOTEBOOK_JUPYTER_MODE]+ return isKernelUiEnabled(featureFlags)}export function defaultNotebookContent(title?: string, content?: JSONContent[]): JSONContent {diff --git a/posthog/hogql/database/test/test_warehouse_usage.py b/posthog/hogql/database/test/test_warehouse_usage.pyindex 21fb855979f5..51e27df73a47 100644--- a/posthog/hogql/database/test/test_warehouse_usage.py+++ b/posthog/hogql/database/test/test_warehouse_usage.py@@ -109,10 +109,7 @@ class TestWarehouseUsage(BaseTest):def test_prompt_jev_source_reads_are_attributed(self):source = self._create_stripe_table()- with (- patch("posthog.hogql.transforms.prompt_jev.feature_enabled_or_false", return_value=True),- patch("posthog.hogql.query.sync_execute", return_value=([], [("label", "Nullable(String)")])),- ):+ with patch("posthog.hogql.query.sync_execute", return_value=([], [("label", "Nullable(String)")])):response = execute_hogql_query("SELECT label FROM (SELECT jev(id, 'Refund?') AS label FROM stripe_table_1 LIMIT 10)",self.team,diff --git a/posthog/hogql/test/test_prompt_jev.py b/posthog/hogql/test/test_prompt_jev.pyindex 58d29041bd6a..e4494c225691 100644--- a/posthog/hogql/test/test_prompt_jev.py+++ b/posthog/hogql/test/test_prompt_jev.py@@ -180,12 +180,6 @@ class TestPromptJev(SimpleTestCase):@override_settings(AI_GATEWAY_URL="https://gateway.example.com/v1", AI_GATEWAY_API_KEY="test-key")class TestPromptJevQuery(ClickhouseTestMixin, APIBaseTest):- def setUp(self) -> None:- super().setUp()- flag = patch("posthog.hogql.transforms.prompt_jev.feature_enabled_or_false", return_value=True)- self.feature_enabled = flag.start()- self.addCleanup(flag.stop)-@parameterized.expand([("SELECT " + ", ".join(f"jev('a', 'q{i}') AS p{i}" for i in range(10)) + " LIMIT 101",),@@ -208,19 +202,6 @@ class TestPromptJevQuery(ClickhouseTestMixin, APIBaseTest):execute.assert_not_called()post.assert_not_called()- @parameterized.expand([(False,), (None,)])- def test_unapproved_project_cannot_start_inference(self, enabled: bool | None) -> None:- self.feature_enabled.return_value = enabled- with (- patch("posthog.hogql.query.sync_execute") as execute,- patch("httpx.AsyncClient.post") as post,- self.assertRaisesRegex(QueryError, "not enabled for this project"),- ):- execute_hogql_query("SELECT jev('refund', 'Refund?') AS p", self.team, user=self.user)- execute.assert_not_called()- post.assert_not_called()- self.assertEqual(self.feature_enabled.call_args.kwargs["groups"]["project"], str(self.team.pk))-def test_team_out_of_ai_credits_cannot_start_inference(self) -> None:with (patch("ee.billing.quota_limiting.is_team_over_ai_credit_budget", return_value=True) as limited,diff --git a/posthog/hogql/transforms/prompt_jev.py b/posthog/hogql/transforms/prompt_jev.pyindex 15ebb32bf35b..d8cb96089d95 100644--- a/posthog/hogql/transforms/prompt_jev.py+++ b/posthog/hogql/transforms/prompt_jev.py@@ -32,7 +32,6 @@ from posthog.llm.system_one import (SystemOneRequestFailed,)from posthog.llm.system_one_client import GatewaySystemOneClient, build_system_one_client-from posthog.ph_client import feature_enabled_or_falseif TYPE_CHECKING:from posthog.hogql.context import HogQLContext@@ -492,18 +491,6 @@ class PromptJevPlanner(CloningVisitor):def validate_prompt_jev_access(team: "Team") -> None:if settings.CLICKHOUSE_USE_HTTP or team.pk in settings.CLICKHOUSE_USE_HTTP_PER_TEAM:raise QueryError("jev requires the native ClickHouse connection. Ask your administrator to configure it.")- if not feature_enabled_or_false(- "hogql-prompt-jev",- str(team.uuid),- groups={"organization": str(team.organization_id), "project": str(team.pk)},- group_properties={- "organization": {"id": str(team.organization_id)},- "project": {"id": str(team.pk)},- },- only_evaluate_locally=True,- send_feature_flag_events=False,- ):- raise QueryError("jev is not enabled for this project. Contact support to request access.")if _is_over_ai_credit_budget(team):raise QueryError(OUT_OF_AI_CREDITS_MESSAGE)diff --git a/posthog/temporal/tests/data_modeling/test_materialize_view_activities.py b/posthog/temporal/tests/data_modeling/test_materialize_view_activities.pyindex ce2da1bd82aa..afcb4ab2a7ae 100644--- a/posthog/temporal/tests/data_modeling/test_materialize_view_activities.py+++ b/posthog/temporal/tests/data_modeling/test_materialize_view_activities.py@@ -2103,7 +2103,6 @@ class TestMaterializeViewPromptJev:AI_GATEWAY_URL="https://gateway.example.com/v1",AI_GATEWAY_API_KEY="test-key",),- unittest.mock.patch("posthog.hogql.transforms.prompt_jev.feature_enabled_or_false", return_value=True),unittest.mock.patch("httpx.AsyncClient.post", side_effect=_jev_gateway_response),):inputs = MaterializeViewInputs(@@ -2135,7 +2134,6 @@ class TestMaterializeViewPromptJev:with (override_settings(AI_GATEWAY_URL="https://gateway.example.com/v1", AI_GATEWAY_API_KEY="test-key"),- unittest.mock.patch("posthog.hogql.transforms.prompt_jev.feature_enabled_or_false", return_value=True),pytest.raises(ResolutionCycleError),):[batch async for batch in hogql_table(query, ateam, LOGGER.bind(), view_name="jev_cycle")]diff --git a/products/dashboards/backend/widget_specs/registry.py b/products/dashboards/backend/widget_specs/registry.pyindex b5b661f1dbf6..859c6abb68eb 100644--- a/products/dashboards/backend/widget_specs/registry.py+++ b/products/dashboards/backend/widget_specs/registry.py@@ -145,7 +145,6 @@ def _load_widget_specs() -> dict[str, WidgetSpec]:availability_requirements=(),form_fields=(),filter_fields=(),- creation_flag="notebook-generated-widgets",),ACTIVITY_EVENTS_LIST_WIDGET_TYPE: WidgetSpec(widget_type=ACTIVITY_EVENTS_LIST_WIDGET_TYPE,diff --git a/products/data_quality/backend/tests/test_jev_question.py b/products/data_quality/backend/tests/test_jev_question.pyindex fb004dadf17d..a09adf6177eb 100644--- a/products/data_quality/backend/tests/test_jev_question.py+++ b/products/data_quality/backend/tests/test_jev_question.py@@ -584,8 +584,7 @@ def test_empty_scope_and_failure_rate_equality(rows: int, allowed_rate: float, sassert result.examined_row_count == rows[email protected]("enabled", [True, False])-def test_gateway_access_and_attribution(enabled: bool) -> None:+def test_gateway_access_and_attribution() -> None:team = cast("Team", SimpleNamespace(pk=42, id=42, uuid=UUID(int=42), organization_id=7, api_token="example-api-token"))@@ -596,7 +595,6 @@ def test_gateway_access_and_attribution(enabled: bool) -> None:CLICKHOUSE_USE_HTTP=False,CLICKHOUSE_USE_HTTP_PER_TEAM=[],),- patch("posthog.hogql.transforms.prompt_jev.feature_enabled_or_false", return_value=enabled),patch("ee.billing.quota_limiting.is_team_over_ai_credit_budget", return_value=False),patch.object(httpx.AsyncClient,@@ -605,18 +603,6 @@ def test_gateway_access_and_attribution(enabled: bool) -> None:return_value=httpx.Response(200, json={"model": "example-model", "answers": {"row_0": {"noul": 0.9}}}),) as send,):- if not enabled:- with pytest.raises(QueryError, match="not enabled"):- QuestionGatewayEvaluator(- team=team,- model_id="example-model",- question="Is this valid?",- check_id="example-check",- run_id="example-run",- distinct_id="example-user",- )- assert not send.called- returnrunner = QuestionGatewayEvaluator(team=team,model_id="example-model",diff --git a/products/data_warehouse/frontend/sql_editor/aiChartRecommendationLogic.test.ts b/products/data_warehouse/frontend/sql_editor/aiChartRecommendationLogic.test.tsindex 21e6a69484fd..9c83ba821696 100644--- a/products/data_warehouse/frontend/sql_editor/aiChartRecommendationLogic.test.ts+++ b/products/data_warehouse/frontend/sql_editor/aiChartRecommendationLogic.test.ts@@ -61,7 +61,6 @@ describe('aiChartRecommendationLogic', () => {decide = jest.spyOn(decisionsApi, 'mlInferenceDecisionsDecideCreate').mockResolvedValue(decision)featureFlagLogic.actions.setFeatureFlags([], {[FEATURE_FLAGS.ML_INFERENCE_DECISIONS]: true,- [FEATURE_FLAGS.JEV_CHART_AUTODETECTION]: true,})organizationLogic.actions.loadCurrentOrganizationSuccess({...MOCK_DEFAULT_ORGANIZATION,@@ -100,7 +99,7 @@ describe('aiChartRecommendationLogic', () => {'selects axes, chart and split layout after a query completes in %s',async (environment) => {if (environment === 'local development') {- featureFlagLogic.actions.setFeatureFlags([], { [FEATURE_FLAGS.JEV_CHART_AUTODETECTION]: true })+ featureFlagLogic.actions.setFeatureFlags([], {})preflightLogic.actions.loadPreflightSuccess({ ...preflightLogic.values.preflight!, is_debug: true })}await expectLogic(logic, () => logic.actions.loadDataSuccess(response)).toFinishAllListeners()@@ -113,7 +112,7 @@ describe('aiChartRecommendationLogic', () => {})- it.each(['consent', 'decisions service', 'missing flag', 'disabled flag', 'local flag', 'manual chart'])(+ it.each(['consent', 'decisions service', 'manual chart'])('keeps the existing behavior without %s eligibility',async (reason) => {if (reason === 'consent') {@@ -122,15 +121,7 @@ describe('aiChartRecommendationLogic', () => {is_ai_data_processing_approved: false,})} else if (reason === 'decisions service') {- featureFlagLogic.actions.setFeatureFlags([], { [FEATURE_FLAGS.JEV_CHART_AUTODETECTION]: true })- } else if (['missing flag', 'disabled flag', 'local flag'].includes(reason)) {- featureFlagLogic.actions.setFeatureFlags([], {- [FEATURE_FLAGS.ML_INFERENCE_DECISIONS]: true,- ...(reason === 'disabled flag' ? { [FEATURE_FLAGS.JEV_CHART_AUTODETECTION]: false } : {}),- })- if (reason === 'local flag') {- preflightLogic.actions.loadPreflightSuccess({ ...preflightLogic.values.preflight!, is_debug: true })- }+ featureFlagLogic.actions.setFeatureFlags([], {})} else {visualization.actions.setVisualizationType(ChartDisplayType.ActionsTable)}@@ -249,7 +240,7 @@ describe('aiChartRecommendationLogic', () => {expect(outputPaneLogic({ tabId: 'jev-test' }).values.activeTab).toBe(OutputTab.Results)})- it.each(['consent', 'flag', 'axes', 'layout', 'query', 'skip', 'rerun', 'query error'])(+ it.each(['consent', 'decisions service', 'axes', 'layout', 'query', 'skip', 'rerun', 'query error'])('ignores an in-flight decision after changing %s',async (change) => {let resolve!: (result: DecideResponseApi) => void@@ -274,8 +265,8 @@ describe('aiChartRecommendationLogic', () => {...MOCK_DEFAULT_ORGANIZATION,is_ai_data_processing_approved: false,})- } else if (change === 'flag') {- featureFlagLogic.actions.setFeatureFlags([], { [FEATURE_FLAGS.ML_INFERENCE_DECISIONS]: true })+ } else if (change === 'decisions service') {+ featureFlagLogic.actions.setFeatureFlags([], {})} else if (change === 'axes') {visualization.actions.updateXSeries('value')} else if (change === 'layout') {@@ -375,7 +366,7 @@ describe('aiChartRecommendationLogic', () => {})- it.each(['consent', 'flag', 'query', 'skip'])(+ it.each(['consent', 'decisions service', 'query', 'skip'])('does not send inferred columns to Jev after changing %s while metadata loads',async (change) => {let resolve!: (@@ -399,8 +390,8 @@ describe('aiChartRecommendationLogic', () => {...MOCK_DEFAULT_ORGANIZATION,is_ai_data_processing_approved: false,})- } else if (change === 'flag') {- featureFlagLogic.actions.setFeatureFlags([], { [FEATURE_FLAGS.ML_INFERENCE_DECISIONS]: true })+ } else if (change === 'decisions service') {+ featureFlagLogic.actions.setFeatureFlags([], {})} else if (change === 'query') {visualization.actions.setQuery((query) => ({...query,diff --git a/products/data_warehouse/frontend/sql_editor/aiChartRecommendationLogic.ts b/products/data_warehouse/frontend/sql_editor/aiChartRecommendationLogic.tsindex 15d3fb0cd2da..a171eba5cd47 100644--- a/products/data_warehouse/frontend/sql_editor/aiChartRecommendationLogic.ts+++ b/products/data_warehouse/frontend/sql_editor/aiChartRecommendationLogic.ts@@ -269,7 +269,6 @@ export interface aiChartRecommendationLogicMeta {key: string__keaTypeGenInternalSelectorTypes: {statusMessage: (- featureFlags: FeatureFlagsSet,dataProcessingAccepted: boolean,enabled: boolean,recommendationStatus: RecommendationStatus@@ -344,16 +343,8 @@ export const aiChartRecommendationLogic: LogicWrapper<aiChartRecommendationLogic}),selectors({statusMessage: [- (s) => [s.featureFlags, s.dataProcessingAccepted, s.enabled, s.recommendationStatus],- (- flags: FeatureFlagsSet,- consent: boolean,- enabled: boolean,- status: RecommendationStatus- ): string | null => {- if (!flags[FEATURE_FLAGS.JEV_CHART_AUTODETECTION]) {- return null- }+ (s) => [s.dataProcessingAccepted, s.enabled, s.recommendationStatus],+ (consent: boolean, enabled: boolean, status: RecommendationStatus): string | null => {if (!consent) {return 'AI chart selection needs organization AI consent'}@@ -373,9 +364,7 @@ export const aiChartRecommendationLogic: LogicWrapper<aiChartRecommendationLogicenabled: [(s) => [s.dataProcessingAccepted, s.featureFlags, s.preflight],(consent: boolean, flags: FeatureFlagsSet, preflight: PreflightStatus | null): boolean =>- consent &&- !!flags[FEATURE_FLAGS.JEV_CHART_AUTODETECTION] &&- !!(preflight?.is_debug || flags[FEATURE_FLAGS.ML_INFERENCE_DECISIONS]),+ consent && !!(preflight?.is_debug || flags[FEATURE_FLAGS.ML_INFERENCE_DECISIONS]),],choosingChart: [(s) => [s.recommendationPending, s.enabled, s.responseLoading],diff --git a/products/notebooks/backend/facade/api.py b/products/notebooks/backend/facade/api.pyindex 8ec623375abf..76096da42f62 100644--- a/products/notebooks/backend/facade/api.py+++ b/products/notebooks/backend/facade/api.py@@ -41,14 +41,6 @@ if TYPE_CHECKING:MAX_NOTEBOOK_MIGRATION_BATCH_SIZE = markdown_migration.MAX_NOTEBOOK_MIGRATION_BATCH_SIZE-def is_notebook_widget_enabled(user: "User | None") -> bool:- from ..widgets import (- is_notebook_widget_enabled as is_enabled, # noqa: PLC0415 — avoid loading widget generation and Temporal for unrelated facade callers- )-- return is_enabled(user)--def _to_notebook_data(notebook: Notebook) -> contracts.NotebookData:return contracts.NotebookData(id=notebook.id,diff --git a/products/notebooks/backend/facade/widgets.py b/products/notebooks/backend/facade/widgets.pyindex ff5084ce29e0..7a3d03ba335e 100644--- a/products/notebooks/backend/facade/widgets.py+++ b/products/notebooks/backend/facade/widgets.py@@ -33,7 +33,6 @@ from products.notebooks.backend.widgets import (get_widget_status,infer_widget_inputs,inspect_widget_inputs,- is_notebook_widget_enabled,list_widget_versions,read_widget_frame,read_widget_source,@@ -59,7 +58,6 @@ __all__ = ["get_widget_status","infer_widget_inputs","inspect_widget_inputs",- "is_notebook_widget_enabled","list_widget_versions","read_widget_frame","read_widget_source",diff --git a/products/notebooks/backend/presentation/views/notebook.py b/products/notebooks/backend/presentation/views/notebook.pyindex 0ad6dbf00bac..325725eceac5 100644--- a/products/notebooks/backend/presentation/views/notebook.py+++ b/products/notebooks/backend/presentation/views/notebook.py@@ -106,7 +106,6 @@ from products.notebooks.backend.facade.widgets import (get_widget_status,infer_widget_inputs,inspect_widget_inputs,- is_notebook_widget_enabled,list_widget_versions,publish_reusable_widget,read_widget_frame,@@ -818,7 +817,7 @@ class NotebookViewSet(TeamAndOrgViewSetMixin, AccessControlViewSetMixin, ForbidD)def widget_snapshot_create(self, request: Request, **kwargs) -> Response:self._require_query_access()- if not is_notebook_widget_enabled(self._current_user()):+ if self._current_user() is None:raise Http404()serializer = WidgetSnapshotRequestSerializer(data=request.data)serializer.is_valid(raise_exception=True)@@ -844,7 +843,7 @@ class NotebookViewSet(TeamAndOrgViewSetMixin, AccessControlViewSetMixin, ForbidDdef widget_snapshot_publish(self, request: Request, **kwargs) -> Response:self._require_query_access()user = self._current_user()- if user is None or not is_notebook_widget_enabled(user):+ if user is None:raise Http404()serializer = WidgetSnapshotPublishSerializer(data=request.data)serializer.is_valid(raise_exception=True)@@ -867,7 +866,7 @@ class NotebookViewSet(TeamAndOrgViewSetMixin, AccessControlViewSetMixin, ForbidDrequired_scopes=["notebook:read", "query:read"],)def widget_snapshot_retrieve(self, request: Request, snapshot_id: str, **kwargs) -> Response:- if not is_notebook_widget_enabled(self._current_user()):+ if self._current_user() is None:raise Http404()self._require_query_access()service = WidgetSnapshots(self.get_object(), self._authorize_widget_run)@@ -896,7 +895,7 @@ class NotebookViewSet(TeamAndOrgViewSetMixin, AccessControlViewSetMixin, ForbidDthrottle_classes=[WidgetFrameBurstThrottle, WidgetFrameSustainedThrottle],)def widget_snapshot_frame(self, request: Request, snapshot_id: str, frame_name: str, **kwargs) -> Response:- if not is_notebook_widget_enabled(self._current_user()):+ if self._current_user() is None:raise Http404()self._require_query_access()query = WidgetFrameQuerySerializer(data=request.query_params)@@ -945,8 +944,6 @@ class NotebookViewSet(TeamAndOrgViewSetMixin, AccessControlViewSetMixin, ForbidDuser = self._current_user()if user is None:raise PermissionDenied("A user is required to generate a widget.")- if not is_notebook_widget_enabled(user):- raise Http404()serializer = WidgetGenerateRequestSerializer(data=request.data)serializer.is_valid(raise_exception=True)notebook = self.get_object()@@ -1000,8 +997,6 @@ class NotebookViewSet(TeamAndOrgViewSetMixin, AccessControlViewSetMixin, ForbidDuser = self._current_user()if user is None:raise PermissionDenied("A user is required to cancel widget generation.")- if not is_notebook_widget_enabled(user):- raise Http404()serializer = WidgetCancelRequestSerializer(data=request.data)serializer.is_valid(raise_exception=True)try:@@ -1035,7 +1030,7 @@ class NotebookViewSet(TeamAndOrgViewSetMixin, AccessControlViewSetMixin, ForbidDdef widget_status(self, request: Request, node_id: str | None = None, **kwargs) -> Response:if node_id is None:raise Http404()- if not is_notebook_widget_enabled(self._current_user()):+ if self._current_user() is None:raise Http404()try:result = get_widget_status(notebook=self.get_object(), node_id=node_id)@@ -1074,8 +1069,6 @@ class NotebookViewSet(TeamAndOrgViewSetMixin, AccessControlViewSetMixin, ForbidDuser = self._current_user()if user is None:raise PermissionDenied("A user is required to make a widget reusable.")- if not is_notebook_widget_enabled(user):- raise Http404()serializer = ReusableWidgetPublishRequestSerializer(data=request.data)serializer.is_valid(raise_exception=True)notebook = self.get_object()@@ -1126,8 +1119,6 @@ class NotebookViewSet(TeamAndOrgViewSetMixin, AccessControlViewSetMixin, ForbidDuser = self._current_user()if user is None:raise PermissionDenied("A user is required to add a reusable widget.")- if not is_notebook_widget_enabled(user):- raise Http404()serializer = ReusableWidgetAttachRequestSerializer(data=request.data)serializer.is_valid(raise_exception=True)try:@@ -1178,8 +1169,6 @@ class NotebookViewSet(TeamAndOrgViewSetMixin, AccessControlViewSetMixin, ForbidDuser = self._current_user()if user is None:raise PermissionDenied("A user is required to fork a reusable widget.")- if not is_notebook_widget_enabled(user):- raise Http404()serializer = ReusableWidgetForkRequestSerializer(data=request.data)serializer.is_valid(raise_exception=True)try:@@ -1213,7 +1202,7 @@ class NotebookViewSet(TeamAndOrgViewSetMixin, AccessControlViewSetMixin, ForbidDdef widget_versions(self, request: Request, node_id: str | None = None, **kwargs) -> Response:if node_id is None:raise Http404()- if not is_notebook_widget_enabled(self._current_user()):+ if self._current_user() is None:raise Http404()query = WidgetVersionQuerySerializer(data=request.query_params)query.is_valid(raise_exception=True)@@ -1256,7 +1245,7 @@ class NotebookViewSet(TeamAndOrgViewSetMixin, AccessControlViewSetMixin, ForbidDdef widget_source(self, request: Request, node_id: str | None = None, **kwargs) -> Response:if node_id is None:raise Http404()- if not is_notebook_widget_enabled(self._current_user()):+ if self._current_user() is None:raise Http404()query = WidgetSourceQuerySerializer(data=request.query_params)query.is_valid(raise_exception=True)@@ -1301,8 +1290,6 @@ class NotebookViewSet(TeamAndOrgViewSetMixin, AccessControlViewSetMixin, ForbidDuser = self._current_user()if user is None:raise PermissionDenied("A user is required to restore a widget version.")- if not is_notebook_widget_enabled(user):- raise Http404()serializer = WidgetRevertRequestSerializer(data=request.data)serializer.is_valid(raise_exception=True)try:@@ -1339,7 +1326,7 @@ class NotebookViewSet(TeamAndOrgViewSetMixin, AccessControlViewSetMixin, ForbidDdef widget_pin(self, request: Request, node_id: str | None = None, **kwargs) -> Response:if node_id is None:raise Http404()- if not is_notebook_widget_enabled(self._current_user()):+ if self._current_user() is None:raise Http404()serializer = WidgetPinRequestSerializer(data=request.data)serializer.is_valid(raise_exception=True)@@ -1401,7 +1388,7 @@ class NotebookViewSet(TeamAndOrgViewSetMixin, AccessControlViewSetMixin, ForbidDquery = WidgetFrameQuerySerializer(data=request.query_params)query.is_valid(raise_exception=True)self._require_query_access()- if not is_notebook_widget_enabled(self._current_user()):+ if self._current_user() is None:raise Http404()try:result = read_widget_frame(@@ -1984,7 +1971,7 @@ class NotebookViewSet(TeamAndOrgViewSetMixin, AccessControlViewSetMixin, ForbidDdescription=("Dispatch an asynchronous run of a notebook SQL or Python cell. Returns a run_id immediately; ""poll the run result endpoint until the status is terminal. One run at a time per notebook. "- "Python notebooks enable all run types. Generated widgets enable HogQL runs without a connection or kernel."+ "Python notebooks enable all run types. HogQL runs without a connection or kernel are always available."),)@action(methods=["POST"], url_path="sql_v2/run", detail=True, required_scopes=["notebook:write", "query:read"])@@ -1992,8 +1979,6 @@ class NotebookViewSet(TeamAndOrgViewSetMixin, AccessControlViewSetMixin, ForbidDuser = self._current_user()# Server-side gate is permissive in local dev (frontend still gates the UI); prod is flag-gated.full_compute_enabled = settings.DEBUG or is_sql_v2_enabled(user)- if not full_compute_enabled and not is_notebook_widget_enabled(user):- raise Http404()serializer = NotebookSQLV2RunRequestSerializer(data=request.data)serializer.is_valid(raise_exception=True)@@ -2080,8 +2065,6 @@ class NotebookViewSet(TeamAndOrgViewSetMixin, AccessControlViewSetMixin, ForbidDserializer = NotebookRunStartRequestSerializer(data=request.data)serializer.is_valid(raise_exception=True)include_prepared_insights = serializer.validated_data["include_prepared_insights"]- if include_prepared_insights and not is_notebook_widget_enabled(user):- raise Http404()notebook = self._get_notebook_for_kernel()self._require_query_access()diff --git a/products/notebooks/backend/presentation/views/reusable_widget.py b/products/notebooks/backend/presentation/views/reusable_widget.pyindex 35df7bc8e721..f4583ed8ad3d 100644--- a/products/notebooks/backend/presentation/views/reusable_widget.py+++ b/products/notebooks/backend/presentation/views/reusable_widget.py@@ -20,7 +20,6 @@ from products.notebooks.backend.facade.widgets import (discard_reusable_widget_version,get_reusable_widget,get_reusable_widget_status,- is_notebook_widget_enabled,list_reusable_widget_versions,list_reusable_widgets,read_reusable_widget_demo_frame,@@ -60,9 +59,9 @@ class ReusableWidgetViewSet(TeamAndOrgViewSetMixin, viewsets.ViewSet):if not self.user_access_control.check_access_level_for_resource("query", "viewer"):raise PermissionDenied("You need query access to read or edit widget demo data.")- def _require_feature(self) -> None:+ def _require_user(self) -> None:user = self.request.user- if not isinstance(user, User) or not is_notebook_widget_enabled(user):+ if not isinstance(user, User):raise Http404()def _widget_id(self) -> UUID:@@ -94,7 +93,7 @@ class ReusableWidgetViewSet(TeamAndOrgViewSetMixin, viewsets.ViewSet):],)def list(self, request: Request, **kwargs) -> Response:- self._require_feature()+ self._require_user()query = ReusableWidgetCatalogQuerySerializer(data=request.query_params)query.is_valid(raise_exception=True)result = list_reusable_widgets(@@ -110,7 +109,7 @@ class ReusableWidgetViewSet(TeamAndOrgViewSetMixin, viewsets.ViewSet):responses={200: ReusableWidgetDetailSerializer, 404: WidgetErrorSerializer},)def retrieve(self, request: Request, **kwargs) -> Response:- self._require_feature()+ self._require_user()try:result = get_reusable_widget(team_id=self.team_id, widget_id=self._widget_id())except WidgetError as error:@@ -124,7 +123,7 @@ class ReusableWidgetViewSet(TeamAndOrgViewSetMixin, viewsets.ViewSet):)@action(methods=["GET"], detail=True, required_scopes=["notebook:read"])def versions(self, request: Request, **kwargs) -> Response:- self._require_feature()+ self._require_user()query = WidgetVersionQuerySerializer(data=request.query_params)query.is_valid(raise_exception=True)try:@@ -151,7 +150,7 @@ class ReusableWidgetViewSet(TeamAndOrgViewSetMixin, viewsets.ViewSet):)@action(methods=["POST"], detail=True, required_scopes=["notebook:write"])def restore(self, request: Request, **kwargs) -> Response:- self._require_feature()+ self._require_user()if not isinstance(request.user, User):raise PermissionDenied("A user is required to make a reusable widget version latest.")serializer = ReusableWidgetRestoreRequestSerializer(data=request.data)@@ -195,7 +194,7 @@ class ReusableWidgetViewSet(TeamAndOrgViewSetMixin, viewsets.ViewSet):required_scopes=["notebook:read", "query:read"],)def demo_frame(self, request: Request, frame_name: str | None = None, **kwargs) -> Response:- self._require_feature()+ self._require_user()self._require_query_access()if frame_name is None:raise Http404()@@ -225,7 +224,7 @@ class ReusableWidgetViewSet(TeamAndOrgViewSetMixin, viewsets.ViewSet):# nosemgrep: api-path-underscore -- shipped public API path, a rename breaks clients@action(methods=["POST"], detail=True, url_path="demo-data", required_scopes=["notebook:write", "query:read"])def update_demo_data(self, request: Request, **kwargs) -> Response:- self._require_feature()+ self._require_user()self._require_query_access()serializer = ReusableWidgetDemoDataRequestSerializer(data=request.data)serializer.is_valid(raise_exception=True)@@ -256,7 +255,7 @@ class ReusableWidgetViewSet(TeamAndOrgViewSetMixin, viewsets.ViewSet):)@action(methods=["GET"], detail=True, required_scopes=["notebook:read"])def source(self, request: Request, **kwargs) -> Response:- self._require_feature()+ self._require_user()query = WidgetSourceQuerySerializer(data=request.query_params)query.is_valid(raise_exception=True)try:@@ -283,7 +282,7 @@ class ReusableWidgetViewSet(TeamAndOrgViewSetMixin, viewsets.ViewSet):)@action(methods=["POST"], detail=True, required_scopes=["notebook:write"])def generate(self, request: Request, **kwargs) -> Response:- self._require_feature()+ self._require_user()user = request.userif not isinstance(user, User):raise PermissionDenied("A user is required to change a reusable widget.")@@ -327,7 +326,7 @@ class ReusableWidgetViewSet(TeamAndOrgViewSetMixin, viewsets.ViewSet):# nosemgrep: api-path-underscore -- shipped public API path, a rename breaks clients@action(methods=["POST"], detail=True, url_path="save-version", required_scopes=["notebook:write"])def save_version(self, request: Request, **kwargs) -> Response:- self._require_feature()+ self._require_user()user = request.userif not isinstance(user, User):raise PermissionDenied("A user is required to save a reusable widget version.")@@ -358,7 +357,7 @@ class ReusableWidgetViewSet(TeamAndOrgViewSetMixin, viewsets.ViewSet):# nosemgrep: api-path-underscore -- shipped public API path, a rename breaks clients@action(methods=["POST"], detail=True, url_path="discard-version", required_scopes=["notebook:write"])def discard_version(self, request: Request, **kwargs) -> Response:- self._require_feature()+ self._require_user()if not isinstance(request.user, User):raise PermissionDenied("A user is required to discard a reusable widget draft.")serializer = ReusableWidgetReviewRequestSerializer(data=request.data)@@ -382,7 +381,7 @@ class ReusableWidgetViewSet(TeamAndOrgViewSetMixin, viewsets.ViewSet):)@action(methods=["GET"], detail=True, required_scopes=["notebook:read"])def status(self, request: Request, **kwargs) -> Response:- self._require_feature()+ self._require_user()try:result = get_reusable_widget_status(team_id=self.team_id, widget_id=self._widget_id())except WidgetError as error:diff --git a/products/notebooks/backend/reusable_widgets.py b/products/notebooks/backend/reusable_widgets.pyindex 96ed2d12b36f..47b128f1a25f 100644--- a/products/notebooks/backend/reusable_widgets.py+++ b/products/notebooks/backend/reusable_widgets.py@@ -38,7 +38,6 @@ from products.notebooks.backend.widgets import (assert_widget_node_exists,get_widget_status,inspect_widget_inputs,- is_notebook_widget_enabled,start_widget_generation,)@@ -49,7 +48,7 @@ MAX_REUSABLE_WIDGET_BINDINGS_BYTES = 256 * 1_024def reusable_widget_catalog_context(*, team_id: int, user: User | None) -> str:- if user is None or not is_notebook_widget_enabled(user):+ if user is None:return ""team = Team.objects.get(id=team_id)if not UserAccessControl(user, team=team).check_access_level_for_resource("notebook", "viewer"):diff --git a/products/notebooks/backend/sql_v2_serializers.py b/products/notebooks/backend/sql_v2_serializers.pyindex c6e63ba6ca0a..5ea9c96c1278 100644--- a/products/notebooks/backend/sql_v2_serializers.py+++ b/products/notebooks/backend/sql_v2_serializers.py@@ -706,7 +706,7 @@ class NotebookRunStartRequestSerializer(serializers.Serializer):include_prepared_insights = serializers.BooleanField(required=False,default=False,- help_text="Include prepared embedded insights when refreshing a dashboard widget. Requires notebook widgets to be enabled.",+ help_text="Include prepared embedded insights when refreshing a dashboard widget.",)variables = NotebookVariableSerializer(many=True,diff --git a/products/notebooks/backend/test/test_notebook_run.py b/products/notebooks/backend/test/test_notebook_run.pyindex 8393288dc58b..898a78d83d9e 100644--- a/products/notebooks/backend/test/test_notebook_run.py+++ b/products/notebooks/backend/test/test_notebook_run.py@@ -107,16 +107,13 @@ class TestNotebookRunEndpoints(APIBaseTest):assert [cell["node_id"] for cell in notebook_run.cell_plan] == ["s1", "p1"]assert mock_start.call_args.args[0].node_ids == ["s1", "p1"]- @parameterized.expand([(False, 404), (True, 200)])- def test_prepared_insights_require_explicit_opt_in_and_widget_flag(+ @parameterized.expand([(False, 400), (True, 200)])+ def test_prepared_insights_require_explicit_opt_in(self, mock_start: MagicMock, _flag: MagicMock, enabled: bool, expected_status: int) -> None:self.notebook.content = markdown_content('<Query nodeId="insight" dataframeQuery="select 1" />')self.notebook.save(update_fields=["content"])- with patch(- "products.notebooks.backend.presentation.views.notebook.is_notebook_widget_enabled", return_value=enabled- ):- response = self.client.post(self.runs_url, data={"include_prepared_insights": True}, format="json")+ response = self.client.post(self.runs_url, data={"include_prepared_insights": enabled}, format="json")assert response.status_code == expected_statusif enabled:assert response.json()["cell_count"] == 1@@ -153,17 +150,14 @@ class TestNotebookRunEndpoints(APIBaseTest):))self.notebook.save(update_fields=["content"])- with patch(- "products.notebooks.backend.presentation.views.notebook.is_notebook_widget_enabled", return_value=True- ):- response = self.client.post(- self.runs_url,- data={- "include_prepared_insights": True,- "variables": [{"name": "country", "type": "string", "value": "US"}],- },- format="json",- )+ response = self.client.post(+ self.runs_url,+ data={+ "include_prepared_insights": True,+ "variables": [{"name": "country", "type": "string", "value": "US"}],+ },+ format="json",+ )assert response.status_code == status, response.json()if status == 200:assert response.json()["cell_count"] == countdiff --git a/products/notebooks/backend/test/test_reusable_widgets.py b/products/notebooks/backend/test/test_reusable_widgets.pyindex 49916ccdc03c..2ca4ca57f2df 100644--- a/products/notebooks/backend/test/test_reusable_widgets.py+++ b/products/notebooks/backend/test/test_reusable_widgets.py@@ -490,8 +490,7 @@ class TestReusableWidgets(APIBaseTest):assert entries[0]["inputs"][0]["slot"] == self.input_nameassert "demo_data" not in entries[0]assert "MDX" in context- with patch("products.notebooks.backend.reusable_widgets.is_notebook_widget_enabled", return_value=False):- assert reusable_widget_catalog_context(team_id=self.team.id, user=self.user) == ""+ assert reusable_widget_catalog_context(team_id=self.team.id, user=None) == ""def test_catalog_detail_and_demo_frame_start_without_notebook_rows(self) -> None:self._publish()diff --git a/products/notebooks/backend/test/test_sql_v2.py b/products/notebooks/backend/test/test_sql_v2.pyindex 4de7825d77f1..cbf2c6d5dfb8 100644--- a/products/notebooks/backend/test/test_sql_v2.py+++ b/products/notebooks/backend/test/test_sql_v2.py@@ -462,10 +462,9 @@ class TestSQLV2Run(APIBaseTest):)@override_settings(DEBUG=False)@patch("products.notebooks.backend.presentation.views.notebook.is_sql_v2_enabled", return_value=False)- @patch("products.notebooks.backend.presentation.views.notebook.is_notebook_widget_enabled", return_value=True)@patch("products.notebooks.backend.sql_v2_dispatch.enqueue_direct_run")@patch("products.notebooks.backend.sql_v2_dispatch.start_sql_v2_run_workflow")- def test_widget_only_access(self, _name, payload, expected_status, start_workflow, enqueue, _widget, _python):+ def test_hogql_access_without_full_compute(self, _name, payload, expected_status, start_workflow, enqueue, _python):response = self.client.post(self.run_url, data={"node_id": "n1", **payload}, format="json")assert response.status_code == expected_statusassert enqueue.call_count == (1 if expected_status == 200 else 0)@@ -1944,20 +1943,19 @@ class TestSQLV2DataPlaneToken(SimpleTestCase):class TestNotebookFlagResolution(SimpleTestCase):@parameterized.expand([- ("neither", False, False, True, False),- ("python_only", True, False, True, True),- ("widgets_only", False, True, True, False),- ("both", True, True, True, True),- ("anonymous", True, True, False, False),+ ("disabled", False, True, False),+ ("enabled", True, True, True),+ ("anonymous", True, False, False),])def test_full_compute_requires_python_flag(- self, _name: str, python_enabled: bool, widgets_enabled: bool, has_user: bool, expected: bool+ self, _name: str, python_enabled: bool, has_user: bool, expected: bool) -> None:- enabled = {"revamped-py-notebooks": python_enabled, "notebook-generated-widgets": widgets_enabled}user = Mock(spec=User, distinct_id="example-user", organization=None) if has_user else Nonewith patch("products.notebooks.backend.sql_v2.posthoganalytics.feature_enabled") as feature_enabled:- feature_enabled.side_effect = lambda flag, *_args, **_kwargs: enabled.get(flag, False)+ feature_enabled.side_effect = lambda flag, *_args, **_kwargs: (+ flag == "revamped-py-notebooks" and python_enabled+ )assert is_sql_v2_enabled(user) is expected@parameterized.expand([("enabled", True), ("disabled", False)])diff --git a/products/notebooks/backend/test/test_widgets.py b/products/notebooks/backend/test/test_widgets.pyindex f03c1b5e934e..5213d789005a 100644--- a/products/notebooks/backend/test/test_widgets.py+++ b/products/notebooks/backend/test/test_widgets.py@@ -669,8 +669,7 @@ class TestWidgetData(APIBaseTest):snapshots.capture(self.NODE_ID, version.id, parent.id)assert NotebookWidgetSnapshot.objects.for_team(self.team.id).count() == 1- @patch("products.notebooks.backend.presentation.views.notebook.is_notebook_widget_enabled", return_value=True)- def test_snapshot_creation_pins_metadata_and_rejects_changed_inputs(self, _flag: MagicMock) -> None:+ def test_snapshot_creation_pins_metadata_and_rejects_changed_inputs(self) -> None:instance = self._mapping()version = self._pinned_version(instance)run = self._run()@@ -708,7 +707,6 @@ class TestWidgetData(APIBaseTest):WidgetSnapshots(self.notebook, lambda _run: None).capture(self.NODE_ID, version.id)assert not NotebookWidgetSnapshot.objects.for_team(self.team.id).exists()- @patch("products.notebooks.backend.presentation.views.notebook.is_notebook_widget_enabled", return_value=True)@patch("products.dashboards.backend.widget_publication.dashboard_widgets_enabled", return_value=True)@patch("products.dashboards.backend.widget_create.dashboard_widgets_enabled", return_value=True)@patch("products.dashboards.backend.widget_create.widget_flag_enabled", return_value=True)@@ -727,7 +725,7 @@ class TestWidgetData(APIBaseTest):"name": "Results",}- with patch("products.dashboards.backend.widget_create.widget_flag_enabled", return_value=False):+ with patch("products.dashboards.backend.widget_create.dashboard_widgets_enabled", return_value=False):assert self.client.post(path, payload).status_code == 400assert not NotebookWidgetSnapshot.objects.for_team(self.team.id).exists()assert not dashboard.tiles.exists()@@ -785,8 +783,7 @@ class TestWidgetData(APIBaseTest):assert self.client.post(path, {**refresh, "previous_snapshot_id": response.json()["id"]}).status_code == 403assert NotebookWidgetSnapshot.objects.for_team(self.team.id).count() == 2- @patch("products.notebooks.backend.presentation.views.notebook.is_notebook_widget_enabled", return_value=True)- def test_snapshot_frame_endpoint_checks_query_access_and_notebook_ownership(self, _flag: MagicMock) -> None:+ def test_snapshot_frame_endpoint_checks_query_access_and_notebook_ownership(self) -> None:version = self._pinned_version(self._mapping())run = self._run()run.envelope = {"types": [["lat", "float64"]], "first_page": [[1]], "row_count": 1}@@ -794,10 +791,6 @@ class TestWidgetData(APIBaseTest):snapshot = WidgetSnapshots(self.notebook, lambda _run: None).capture(self.NODE_ID, version.id)path = f"/api/projects/{self.team.id}/notebooks/{self.notebook.short_id}/widget_snapshots/{snapshot.id}/frames/{self.INPUT_NAME}/"assert self.client.get(path).status_code == 200- with patch(- "products.notebooks.backend.presentation.views.notebook.is_notebook_widget_enabled", return_value=False- ):- assert self.client.get(path).status_code == 404with patch("products.notebooks.backend.presentation.views.notebook.NotebookViewSet._has_query_access",return_value=False,@@ -856,7 +849,6 @@ class TestWidgetData(APIBaseTest):cleanup_widget_snapshots()assert list(NotebookWidgetSnapshot.objects.for_team(self.team.id).values_list("id", flat=True)) == [recent.id]- @patch("products.notebooks.backend.presentation.views.notebook.is_notebook_widget_enabled", return_value=True)@patch("products.dashboards.backend.widget_publication.dashboard_widgets_enabled", return_value=True)@patch("products.dashboards.backend.widget_create.dashboard_widgets_enabled", return_value=True)@patch("products.dashboards.backend.widget_create.widget_flag_enabled", return_value=True)@@ -1370,17 +1362,15 @@ class TestWidgetData(APIBaseTest):("frame", "get", f"frames/{INPUT_NAME}/", None),])- def test_widget_endpoint_is_hidden_when_the_feature_is_disabled(+ def test_widget_endpoint_requires_authentication(self, _name: str, method: str, suffix: str, data: dict[str, str] | None) -> None:url = f"/api/projects/{self.team.id}/notebooks/{self.notebook.short_id}/widgets/{self.NODE_ID}/{suffix}"- with patch(- "products.notebooks.backend.presentation.views.notebook.is_notebook_widget_enabled", return_value=False- ):- response = self.client.post(url, data=data, format="json") if method == "post" else self.client.get(url)+ self.client.logout()+ response = self.client.post(url, data=data, format="json") if method == "post" else self.client.get(url)- assert response.status_code == 404+ assert response.status_code == 401assert not NotebookWidgetInstance.objects.for_team(self.team.id).filter(notebook=self.notebook).exists()def test_generation_starts_before_the_widget_has_a_current_version(self) -> None:diff --git a/products/notebooks/backend/widgets.py b/products/notebooks/backend/widgets.pyindex e1b559e07e2a..e6e509bb0031 100644--- a/products/notebooks/backend/widgets.py+++ b/products/notebooks/backend/widgets.py@@ -9,14 +9,11 @@ from decimal import Decimalfrom time import monotonicfrom uuid import UUID-from django.conf import settingsfrom django.core.cache import cachefrom django.db import transactionfrom django.db.models import Qfrom django.utils import timezone-import posthoganalytics-from posthog.dataclasses import frozenfrom posthog.models import Team, User@@ -57,7 +54,6 @@ JOB_STALE_AFTER = timedelta(minutes=10)GENERATION_CANCELLATION_TTL_SECONDS = 60 * 15MAX_SCHEMA_CONTEXT_BYTES = 64 * 1_024MAX_INPUT_CONTRACT_BYTES = 512 * 1_024-NOTEBOOK_GENERATED_WIDGETS_FLAG = "notebook-generated-widgets"_INPUT_NAME = re.compile(r"^[A-Za-z_][A-Za-z0-9_]*$")@@ -453,34 +449,6 @@ def _is_ai_usage_limited(team_api_token: str) -> bool:return is_team_over_ai_credit_budget(team_api_token)-def is_notebook_widget_enabled(user: User | None) -> bool:- if settings.DEBUG or settings.TEST:- return True- if user is None or not user.distinct_id:- return False- organization = getattr(user, "organization", None)- if organization is None:- return bool(- posthoganalytics.feature_enabled(- NOTEBOOK_GENERATED_WIDGETS_FLAG,- user.distinct_id,- only_evaluate_locally=False,- send_feature_flag_events=False,- )- )- organization_id = str(organization.id)- return bool(- posthoganalytics.feature_enabled(- NOTEBOOK_GENERATED_WIDGETS_FLAG,- user.distinct_id,- groups={"organization": organization_id},- group_properties={"organization": {"id": organization_id}},- only_evaluate_locally=False,- send_feature_flag_events=False,- )- )--def _display_name(prompt: str) -> str:return prompt if len(prompt) <= 80 else f"{prompt[:77].rstrip()}..."diff --git a/products/notebooks/frontend/NotebookInsightDataframe.tsx b/products/notebooks/frontend/NotebookInsightDataframe.tsxindex 22c57b938e9c..a7520fc2b681 100644--- a/products/notebooks/frontend/NotebookInsightDataframe.tsx+++ b/products/notebooks/frontend/NotebookInsightDataframe.tsx@@ -1,7 +1,5 @@import { useValues } from 'kea'-import { FEATURE_FLAGS } from 'lib/constants'-import { featureFlagLogic } from 'lib/logic/featureFlagLogic'import { useRequiredNotebookNode } from 'scenes/notebooks/Nodes/NotebookNodeContext'import type { InsightLogicProps } from '~/types'@@ -20,13 +18,7 @@ export function NotebookInsightDataframe({}): JSX.Element | null {const { notebookLogic, nodeId } = useValues(useRequiredNotebookNode())const { canEditNotebook, isShared } = useValues(notebookLogic)- const { featureFlags } = useValues(featureFlagLogic)- const enabled =- !!(- featureFlags[FEATURE_FLAGS.REVAMPED_PY_NOTEBOOKS] || featureFlags[FEATURE_FLAGS.NOTEBOOK_GENERATED_WIDGETS]- ) &&- canEditNotebook &&- !isShared+ const enabled = canEditNotebook && !isSharedif (!enabled) {return null}diff --git a/products/notebooks/frontend/NotebookNodeGeneratedWidget/NotebookNodeGeneratedWidget.stories.tsx b/products/notebooks/frontend/NotebookNodeGeneratedWidget/NotebookNodeGeneratedWidget.stories.tsxindex 84ddc94c33ad..007945401fc3 100644--- a/products/notebooks/frontend/NotebookNodeGeneratedWidget/NotebookNodeGeneratedWidget.stories.tsx+++ b/products/notebooks/frontend/NotebookNodeGeneratedWidget/NotebookNodeGeneratedWidget.stories.tsx@@ -41,7 +41,7 @@ const meta: Meta = {component: WidgetNotebook,parameters: {layout: 'fullscreen',- featureFlags: [FEATURE_FLAGS.NOTEBOOK_GENERATED_WIDGETS, FEATURE_FLAGS.DASHBOARD_WIDGETS],+ featureFlags: [FEATURE_FLAGS.DASHBOARD_WIDGETS],testOptions: {waitForSelector: '[data-attr="notebook-generated-widget-run-button"]',},diff --git a/products/notebooks/frontend/generated/api.schemas.ts b/products/notebooks/frontend/generated/api.schemas.tsindex 3afd8ddf88cc..427036abf0f3 100644--- a/products/notebooks/frontend/generated/api.schemas.ts+++ b/products/notebooks/frontend/generated/api.schemas.ts@@ -1019,7 +1019,7 @@ export interface NotebookKernelStatusResponseApi {}export interface NotebookRunStartRequestApi {- /** Include prepared embedded insights when refreshing a dashboard widget. Requires notebook widgets to be enabled. */+ /** Include prepared embedded insights when refreshing a dashboard widget. */include_prepared_insights?: boolean/** Replace the notebook's variables with this list before the run starts, so the results match what the document declares. Omit it to run with the variables already saved. */variables?: NotebookVariableApi[]diff --git a/products/notebooks/frontend/generated/api.ts b/products/notebooks/frontend/generated/api.tsindex 82cbb5d4e416..950772e42535 100644--- a/products/notebooks/frontend/generated/api.ts+++ b/products/notebooks/frontend/generated/api.ts@@ -773,7 +773,7 @@ export const getNotebooksSqlV2RunCreateUrl = (projectId: string, shortId: string}/**- * Dispatch an asynchronous run of a notebook SQL or Python cell. Returns a run_id immediately; poll the run result endpoint until the status is terminal. One run at a time per notebook. Python notebooks enable all run types. Generated widgets enable HogQL runs without a connection or kernel.+ * Dispatch an asynchronous run of a notebook SQL or Python cell. Returns a run_id immediately; poll the run result endpoint until the status is terminal. One run at a time per notebook. Python notebooks enable all run types. HogQL runs without a connection or kernel are always available.*/export const notebooksSqlV2RunCreate = async (projectId: string,diff --git a/products/notebooks/frontend/generated/api.zod.ts b/products/notebooks/frontend/generated/api.zod.tsindex 155ccf61bc61..bf14e40127cf 100644--- a/products/notebooks/frontend/generated/api.zod.ts+++ b/products/notebooks/frontend/generated/api.zod.ts@@ -688,9 +688,7 @@ export const NotebooksRunsCreateBody = /* @__PURE__ */ zod.object({include_prepared_insights: zod.boolean().default(notebooksRunsCreateBodyIncludePreparedInsightsDefault)- .describe(- 'Include prepared embedded insights when refreshing a dashboard widget. Requires notebook widgets to be enabled.'- ),+ .describe('Include prepared embedded insights when refreshing a dashboard widget.'),variables: zod.array(zod@@ -722,7 +720,7 @@ export const NotebooksRunsCreateBody = /* @__PURE__ */ zod.object({})/**- * Dispatch an asynchronous run of a notebook SQL or Python cell. Returns a run_id immediately; poll the run result endpoint until the status is terminal. One run at a time per notebook. Python notebooks enable all run types. Generated widgets enable HogQL runs without a connection or kernel.+ * Dispatch an asynchronous run of a notebook SQL or Python cell. Returns a run_id immediately; poll the run result endpoint until the status is terminal. One run at a time per notebook. Python notebooks enable all run types. HogQL runs without a connection or kernel are always available.*/export const notebooksSqlV2RunCreateBodyReuseResultsDefault = falseexport const notebooksSqlV2RunCreateBodyNodeTypeDefault = `hogql`diff --git a/products/notebooks/mcp/tools.yaml b/products/notebooks/mcp/tools.yamlindex 1bb96e9d3d07..e2d8672aaadb 100644--- a/products/notebooks/mcp/tools.yaml+++ b/products/notebooks/mcp/tools.yaml@@ -363,7 +363,6 @@ tools:the contract, add a pure Hog expression in `hog` that receives `rows`, `columns`, and `frame` and returns alist of objects with the contract's columns. Omit version_id or pass null to follow the latest sharedversion; pass a version UUID to pin this placement.- feature_flag: notebook-generated-widgetsresponse:exclude:- artifact_url@@ -394,7 +393,6 @@ tools:- notebookId- shortId- notebook_short_id- feature_flag: notebook-generated-widgetsnotebooks-widget-generate:operation: notebooks_widget_generateenabled: true@@ -429,7 +427,6 @@ tools:- shortId- notebook_short_idrequires_ai_consent: true- feature_flag: notebook-generated-widgetsresponse:exclude:- artifact_url@@ -461,7 +458,6 @@ tools:- notebookId- shortId- notebook_short_id- feature_flag: notebook-generated-widgetsresponse:exclude:- artifact_url@@ -486,7 +482,6 @@ tools:generating a new visualization. Results include stable widget IDs, current version IDs, tags, and usagecounts. This is a curated API shape rather than a general database table so it is available in both MCPmodes.- feature_flag: notebook-generated-widgetsresponse:informational_wrapper:tag: reusable-widget-catalog@@ -509,7 +504,6 @@ tools:lists logical slots and required output columns. Use notebooks-widget-attach to bind those slots to localnotebook dataframes. Different dataframe names need only a source binding, not Hog. Add a Hog mapping onlywhen column names, column types, order, or shape differ. Ask the user when units or meaning are ambiguous.- feature_flag: notebook-generated-widgetsresponse:informational_wrapper:tag: reusable-widget-contractdiff --git a/products/product_analytics/manifest.tsx b/products/product_analytics/manifest.tsxindex 38692b3cae6d..0260ac6f0e78 100644--- a/products/product_analytics/manifest.tsx+++ b/products/product_analytics/manifest.tsx@@ -223,7 +223,6 @@ export const manifest: ProductManifest = {{name: 'Reusable widgets',href: urls.notebooks('widgets'),- flag: FEATURE_FLAGS.NOTEBOOK_GENERATED_WIDGETS,},],sceneKey: 'Notebooks',diff --git a/services/mcp/schema/generated-tool-definitions.json b/services/mcp/schema/generated-tool-definitions.jsonindex ef2abf291f2c..11062d074b2d 100644--- a/services/mcp/schema/generated-tool-definitions.json+++ b/services/mcp/schema/generated-tool-definitions.json@@ -9968,8 +9968,7 @@"idempotentHint": true,"openWorldHint": true,"readOnlyHint": false- },- "feature_flag": "notebook-generated-widgets"+ }},"notebooks-widget-cancel": {"description": "Cancel an active generated notebook widget job. Use the notebook short_id, the Widget tag's nodeId, and the generation_id supplied when starting the job or returned as active_job.id by notebooks-widget-status. Existing generated versions remain available.",@@ -9983,8 +9982,7 @@"idempotentHint": true,"openWorldHint": true,"readOnlyHint": false- },- "feature_flag": "notebook-generated-widgets"+ }},"notebooks-widget-generate": {"description": "Generate or improve an interactive notebook widget from instructions and the notebook's completed SQL and Python dataframes. This tool's availability means generated Widget tags are enabled for the current user. First insert a Widget component with notebooks-add-cell: cell_type=\"component\", tag_name=\"Widget\", props={\"prompt\":\"Describe the visualization\"}, and a short title. If using markdown editing instead, insert <Widget nodeId=\"a-stable-unique-id\" prompt=\"Describe the visualization\" /> into a saved markdown notebook. Insertion alone does not start generation. Run the SQL and Python cells the widget should use first; unrelated unrun cells are skipped. Then call this tool with the notebook short_id, the inserted node_id, prompt, and a fresh UUID generation_id. Reuse that UUID when retrying the same request. Use generation_operation=\"initial\" for a new widget, \"regenerate\" to replace it, or \"improve\" with expected_current_version_id to change the current version. Generation uses AI credits. Poll notebooks-widget-status until lifecycle_status is ready or failed; notebooks-widget-cancel stops an active job. Direct the user to the widget in the notebook to review and run it. Generated previews with dataframe access require the user's approval in the notebook.",@@ -9999,8 +9997,7 @@"openWorldHint": true,"readOnlyHint": false},- "requires_ai_consent": true,- "feature_flag": "notebook-generated-widgets"+ "requires_ai_consent": true},"notebooks-widget-status": {"description": "Read a generated notebook widget's lifecycle_status, active job, current version, and automated security review. Use the notebook short_id and the Widget tag's nodeId. Poll while generating or building, waiting a few seconds between calls. Ready means the build finished; the user may still need to approve execution in the notebook. On failed or incompatible, read error_detail and error_code before retrying.",@@ -10014,8 +10011,7 @@"idempotentHint": true,"openWorldHint": true,"readOnlyHint": true- },- "feature_flag": "notebook-generated-widgets"+ }},"opt-outs-add": {"description": "Opt one or more recipients (up to 1000 per call) out of marketing messages. Each entry can name its own message category via category_key; entries without one use the request-level category_key, or all marketing messages if omitted. Importing only ever opts recipients out, so repeating a call is safe.",@@ -11021,8 +11017,7 @@"idempotentHint": true,"openWorldHint": true,"readOnlyHint": true- },- "feature_flag": "notebook-generated-widgets"+ }},"reusable-widgets-retrieve": {"description": "Get a reusable widget's current version and input contract before adding it to a notebook. The contract lists logical slots and required output columns. Use notebooks-widget-attach to bind those slots to local notebook dataframes. Different dataframe names need only a source binding, not Hog. Add a Hog mapping only when column names, column types, order, or shape differ. Ask the user when units or meaning are ambiguous.",@@ -11036,8 +11031,7 @@"idempotentHint": true,"openWorldHint": true,"readOnlyHint": true- },- "feature_flag": "notebook-generated-widgets"+ }},"review-hog-reviews-get": {"description": "Fetch one code review by `id` (from `review-hog-reviews-list` or the trigger's `report_id`). It returns the last completed turn: its validated `findings` (each with file, line ranges, priority, and the suggested fix), the `dismissed_findings` the validator dropped and why, and the `report_markdown` published to the PR. While a re-review runs, the findings are still the previous turn's. A first review that is still running has no detail yet, so poll `review-hog-reviews-list` until it completes.",diff --git a/services/mcp/schema/tool-definitions-all.json b/services/mcp/schema/tool-definitions-all.jsonindex 0cff838ea15b..4297f1533567 100644--- a/services/mcp/schema/tool-definitions-all.json+++ b/services/mcp/schema/tool-definitions-all.json@@ -10485,8 +10485,7 @@"idempotentHint": true,"openWorldHint": true,"readOnlyHint": false- },- "feature_flag": "notebook-generated-widgets"+ }},"notebooks-widget-cancel": {"description": "Cancel an active generated notebook widget job. Use the notebook short_id, the Widget tag's nodeId, and the generation_id supplied when starting the job or returned as active_job.id by notebooks-widget-status. Existing generated versions remain available.",@@ -10500,8 +10499,7 @@"idempotentHint": true,"openWorldHint": true,"readOnlyHint": false- },- "feature_flag": "notebook-generated-widgets"+ }},"notebooks-widget-generate": {"description": "Generate or improve an interactive notebook widget from instructions and the notebook's completed SQL and Python dataframes. This tool's availability means generated Widget tags are enabled for the current user. First insert a Widget component with notebooks-add-cell: cell_type=\"component\", tag_name=\"Widget\", props={\"prompt\":\"Describe the visualization\"}, and a short title. If using markdown editing instead, insert <Widget nodeId=\"a-stable-unique-id\" prompt=\"Describe the visualization\" /> into a saved markdown notebook. Insertion alone does not start generation. Run the SQL and Python cells the widget should use first; unrelated unrun cells are skipped. Then call this tool with the notebook short_id, the inserted node_id, prompt, and a fresh UUID generation_id. Reuse that UUID when retrying the same request. Use generation_operation=\"initial\" for a new widget, \"regenerate\" to replace it, or \"improve\" with expected_current_version_id to change the current version. Generation uses AI credits. Poll notebooks-widget-status until lifecycle_status is ready or failed; notebooks-widget-cancel stops an active job. Direct the user to the widget in the notebook to review and run it. Generated previews with dataframe access require the user's approval in the notebook.",@@ -10516,8 +10514,7 @@"openWorldHint": true,"readOnlyHint": false},- "requires_ai_consent": true,- "feature_flag": "notebook-generated-widgets"+ "requires_ai_consent": true},"notebooks-widget-status": {"description": "Read a generated notebook widget's lifecycle_status, active job, current version, and automated security review. Use the notebook short_id and the Widget tag's nodeId. Poll while generating or building, waiting a few seconds between calls. Ready means the build finished; the user may still need to approve execution in the notebook. On failed or incompatible, read error_detail and error_code before retrying.",@@ -10531,8 +10528,7 @@"idempotentHint": true,"openWorldHint": true,"readOnlyHint": true- },- "feature_flag": "notebook-generated-widgets"+ }},"opt-outs-add": {"description": "Opt one or more recipients (up to 1000 per call) out of marketing messages. Each entry can name its own message category via category_key; entries without one use the request-level category_key, or all marketing messages if omitted. Importing only ever opts recipients out, so repeating a call is safe.",@@ -11623,8 +11619,7 @@"idempotentHint": true,"openWorldHint": true,"readOnlyHint": true- },- "feature_flag": "notebook-generated-widgets"+ }},"reusable-widgets-retrieve": {"description": "Get a reusable widget's current version and input contract before adding it to a notebook. The contract lists logical slots and required output columns. Use notebooks-widget-attach to bind those slots to local notebook dataframes. Different dataframe names need only a source binding, not Hog. Add a Hog mapping only when column names, column types, order, or shape differ. Ask the user when units or meaning are ambiguous.",@@ -11638,8 +11633,7 @@"idempotentHint": true,"openWorldHint": true,"readOnlyHint": true- },- "feature_flag": "notebook-generated-widgets"+ }},"review-hog-reviews-get": {"description": "Fetch one code review by `id` (from `review-hog-reviews-list` or the trigger's `report_id`). It returns the last completed turn: its validated `findings` (each with file, line ranges, priority, and the suggested fix), the `dismissed_findings` the validator dropped and why, and the `report_markdown` published to the PR. While a re-review runs, the findings are still the previous turn's. A first review that is still running has no detail yet, so poll `review-hog-reviews-list` until it completes.",diff --git a/services/mcp/src/api/generated.ts b/services/mcp/src/api/generated.tsindex 9ad4e7e93294..072cf73082c6 100644--- a/services/mcp/src/api/generated.ts+++ b/services/mcp/src/api/generated.ts@@ -68559,7 +68559,7 @@ export namespace Schemas {}export interface NotebookRunStartRequest {- /** Include prepared embedded insights when refreshing a dashboard widget. Requires notebook widgets to be enabled. */+ /** Include prepared embedded insights when refreshing a dashboard widget. */include_prepared_insights?: boolean;/** Replace the notebook's variables with this list before the run starts, so the results match what the document declares. Omit it to run with the variables already saved. */variables?: NotebookVariable[];diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/notebooks-widget-attach.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/notebooks-widget-attach.jsonnew file mode 100644index 000000000000..08a186802f2e--- /dev/null+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/notebooks-widget-attach.json@@ -0,0 +1,48 @@+{+ "$schema": "https://json-schema.org/draft/2020-12/schema",+ "properties": {+ "input_bindings": {+ "additionalProperties": {+ "properties": {+ "hog": {+ "type": "string"+ },+ "source": {+ "type": "string"+ }+ },+ "required": ["source"],+ "type": "object"+ },+ "description": "Notebook-local input mappings keyed by contract slot. Each value names a source dataframe and may include pure Hog source for reshaping its rows.",+ "propertyNames": {+ "type": "string"+ },+ "type": "object"+ },+ "node_id": {+ "description": "Stable identifier of the generated widget node.",+ "type": "string"+ },+ "short_id": {+ "type": "string"+ },+ "version_id": {+ "anyOf": [+ {+ "type": "string"+ },+ {+ "type": "null"+ }+ ],+ "description": "Version to pin, or null to follow the reusable widget's latest version."+ },+ "widget_id": {+ "description": "Reusable widget to place in this notebook node.",+ "type": "string"+ }+ },+ "required": ["node_id", "short_id", "widget_id"],+ "type": "object"+}diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/notebooks-widget-cancel.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/notebooks-widget-cancel.jsonnew file mode 100644index 000000000000..4f2cf6703bbc--- /dev/null+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/notebooks-widget-cancel.json@@ -0,0 +1,19 @@+{+ "$schema": "https://json-schema.org/draft/2020-12/schema",+ "properties": {+ "generation_id": {+ "description": "Generation job to cancel.",+ "type": "string"+ },+ "node_id": {+ "description": "Stable identifier of the generated widget node.",+ "type": "string"+ },+ "short_id": {+ "description": "The notebook's short_id from its URL or notebooks-list, not its UUID id.",+ "type": "string"+ }+ },+ "required": ["node_id", "short_id", "generation_id"],+ "type": "object"+}diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/notebooks-widget-generate.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/notebooks-widget-generate.jsonnew file mode 100644index 000000000000..8555d4860e80--- /dev/null+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/notebooks-widget-generate.json@@ -0,0 +1,40 @@+{+ "$schema": "https://json-schema.org/draft/2020-12/schema",+ "properties": {+ "expected_current_version_id": {+ "description": "Current widget version the improvement is based on. Required for improve operations.",+ "type": "string"+ },+ "generation_id": {+ "description": "Idempotency key for this generation job.",+ "type": "string"+ },+ "generation_operation": {+ "default": "regenerate",+ "description": "Whether to generate from scratch or improve the current source.\n\n* `initial` - initial\n* `regenerate` - regenerate\n* `improve` - improve",+ "enum": ["initial", "regenerate", "improve"],+ "type": "string"+ },+ "model": {+ "default": "claude-sonnet-5",+ "description": "AI model used to generate the widget.\n\n* `claude-haiku-4-5` - claude-haiku-4-5\n* `claude-sonnet-4-6` - claude-sonnet-4-6\n* `claude-sonnet-5` - claude-sonnet-5\n* `claude-opus-5` - claude-opus-5",+ "enum": ["claude-haiku-4-5", "claude-sonnet-4-6", "claude-sonnet-5", "claude-opus-5"],+ "type": "string"+ },+ "node_id": {+ "description": "Stable identifier of the generated widget node.",+ "type": "string"+ },+ "prompt": {+ "description": "Instructions for the generated widget. Initial and improvement instructions accept up to 20,000 characters; regeneration accepts complete instructions up to 50,000 characters.",+ "maxLength": 50000,+ "type": "string"+ },+ "short_id": {+ "description": "The notebook's short_id from its URL or notebooks-list, not its UUID id.",+ "type": "string"+ }+ },+ "required": ["node_id", "short_id", "prompt", "generation_id"],+ "type": "object"+}diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/notebooks-widget-status.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/notebooks-widget-status.jsonnew file mode 100644index 000000000000..a5adf9ffe690--- /dev/null+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/notebooks-widget-status.json@@ -0,0 +1,15 @@+{+ "$schema": "https://json-schema.org/draft/2020-12/schema",+ "properties": {+ "node_id": {+ "description": "Stable identifier of the generated widget node.",+ "type": "string"+ },+ "short_id": {+ "description": "The notebook's short_id from its URL or notebooks-list, not its UUID id.",+ "type": "string"+ }+ },+ "required": ["node_id", "short_id"],+ "type": "object"+}diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/reusable-widgets-list.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/reusable-widgets-list.jsonnew file mode 100644index 000000000000..7f6797d6f3a4--- /dev/null+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/reusable-widgets-list.json@@ -0,0 +1,15 @@+{+ "$schema": "https://json-schema.org/draft/2020-12/schema",+ "properties": {+ "limit": {+ "type": "number"+ },+ "offset": {+ "type": "number"+ },+ "search": {+ "type": "string"+ }+ },+ "type": "object"+}diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/reusable-widgets-retrieve.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/reusable-widgets-retrieve.jsonnew file mode 100644index 000000000000..f9bfd8020ef3--- /dev/null+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/reusable-widgets-retrieve.json@@ -0,0 +1,10 @@+{+ "$schema": "https://json-schema.org/draft/2020-12/schema",+ "properties": {+ "id": {+ "type": "string"+ }+ },+ "required": ["id"],+ "type": "object"+}diff --git a/services/mcp/tests/unit/tool-filtering.test.ts b/services/mcp/tests/unit/tool-filtering.test.tsindex 0111bad32ae8..9352dcdb3e89 100644--- a/services/mcp/tests/unit/tool-filtering.test.ts+++ b/services/mcp/tests/unit/tool-filtering.test.ts@@ -452,21 +452,13 @@ describe('Tool Filtering - API Scopes', () => {['notebooks-widget-status', ['notebook:read']],['notebooks-widget-cancel', ['notebook:write']],] satisfies [string, string[]][])(- 'exposes %s only with notebook widgets enabled and the required scopes',+ 'exposes %s with the required scopes without feature flags',async (toolName, scopes) => {const context = createMockContext(scopes)- const enabledOptions = { featureFlags: { 'notebook-generated-widgets': true }, aiConsentGiven: true }+ const enabledOptions = { aiConsentGiven: true }const enabled = await getToolsFromContext(context, enabledOptions)expect(enabled.map((tool) => tool.name)).toContain(toolName)- for (const flagValue of [false, undefined]) {- const disabled = await getToolsFromContext(context, {- ...enabledOptions,- featureFlags: { 'notebook-generated-widgets': flagValue },- })- expect(disabled.map((tool) => tool.name)).not.toContain(toolName)- }-for (const missingScope of scopes) {const denied = await getToolsFromContext(createMockContext(scopes.filter((scope) => scope !== missingScope)),@@ -1107,9 +1099,7 @@ describe('Tool Filtering - Feature Flags', () => {'customer-analytics-feature-requests','customer-analytics-customer-tasks','notebooks-collaboration',- 'notebook-generated-widgets','revamped-py-notebooks',- 'notebook-generated-widgets','tasks','tasks-mcp-agent-run-start','dashboard-widgets',@@ -1141,7 +1131,7 @@ describe('Tool Filtering - Feature Flags', () => {]))expect(flags).toContain('ai-observability-offline-evaluations')- expect(flags).toHaveLength(39)+ expect(flags).toHaveLength(38)})it('keeps human and task context wiki tools on separate scopes', () => {