: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-modeling): show sync health and data quality for table nodes (#103775)
Jovan Sakovic1e52020a0f17
diff --git a/docs/internal/data-quality-checks.md b/docs/internal/data-quality-checks.mdindex b8ab34e1c0de..7fbeb070d6d8 100644--- a/docs/internal/data-quality-checks.md+++ b/docs/internal/data-quality-checks.md@@ -70,6 +70,14 @@ The panel's text follows the check results. It claims that all data quality checA project that has no models and no saved views gets the first-view text instead of a status claim.+## Model detail++Every table node keeps its Lineage tab. Loading the Data quality subject does not wait for the lineage graph.++A model in the lineage graph can also open a Data quality tab. The tab reads the checks of the model's own subject. A saved view answers as a view. An imported warehouse table answers as a table. The node carries the table identifier. The dependency sync refreshes this identifier when it resolves a saved query. A table that is deleted and imported again then uses its new row.++PostHog tables use the subject catalog API. The frontend matches the node name to a `posthog_table` subject from that API. It passes the returned subject id, subject type, and columns to the checks panel. It does not calculate the subject id. The Data quality panel shows a loading, request-error, access-denied, or unsupported-table state when the catalog cannot provide a supported subject.+## Subject schedulesA subject whose checks run on a recurring schedule has one Temporal Schedule in its canonical project. Metrics and PostHog tables are those subjects; a warehouse table's and a view's checks run when their data changes instead. A PostHog table is never synced or materialized, so a schedule is the only trigger its checks have. The first check creates an enabled daily schedule after the check transaction commits and starts an initial run. Available intervals are one hour, six hours, twelve hours, one day, and one week. A deterministic offset spreads recurring executions across each interval.diff --git a/frontend/snapshots.yml b/frontend/snapshots.ymlindex 033f5cac1982..94ba1618c8c8 100644--- a/frontend/snapshots.yml+++ b/frontend/snapshots.yml@@ -6454,6 +6454,26 @@ snapshots:hash: v1.k794b7964.adee14a71121b1b4a56d6f5b9e4872ee32d8de3a7f40cb0c55b68f174045197d.wEwxxE-6hI2tAGGjdCHIjuEXE96VQWw5MGhW8DCylDkproducts-data-modeling-model-summary-card--narrow--light:hash: v1.k794b7964.a87631a1502874300f9fc74228b2cde19140336b7b1ea99d023f2e8afd8bd8af.3dZIS_Bxsda56LTs2PZhkMQdzd8HY2XeLgjGBnGO7gY+ products-data-modeling-model-table-summary--error--dark:+ hash: v1.k794b7964.b57059fb38081d3185d2b23993b73ed5c15dd9ca0406a3aaa87de93783bf8e30.bKEoxLtzqFYgw_2XU23cvuqh3MI8jAGvL1D7nBemKhw+ products-data-modeling-model-table-summary--error--light:+ hash: v1.k794b7964.e87f83967a1cd4372443d12aaea994d3c2187a7c01cf38807e70dc6329eb4a8d.3SxhBWZ4Czchj3jEj-QwIy4OazRew7SBQ5Vqf_FfMWQ+ products-data-modeling-model-table-summary--loading--dark:+ hash: v1.k794b7964.96b1686eee19960346d57f1ce5095d93e070568a1dc507efb638c3eeb7901dd0.n5caEZLI1C3RuA-95UOci5CyWRyvSPky85wBEgicn-Q+ products-data-modeling-model-table-summary--loading--light:+ hash: v1.k794b7964.d00895dba5f318630caee348834fdb21d9ee73e4a36fcb8208f26aeb0d6fee86.t-nV2_dNFORuTIIERnw4-JvHCuzfJuA8ZPM6mYK0Jzk+ products-data-modeling-model-table-summary--post-hog--dark:+ hash: v1.k794b7964.450c1a6cec8a060c753a1a2048d3d8f9cdb7001fa461a9c320145d7f94c621b9.pe7-QTXhVEnz8ClZ2Oyizkxa9ITwOefYX2O4SL-xnOo+ products-data-modeling-model-table-summary--post-hog--light:+ hash: v1.k794b7964.a8907d047ea7539157ffa1326ac7c24fc291dd9af0226e3758370084d358a5cf.vVqBiUiw5FKu1bw3QWohlKMYAey_pOApD8Rjw6hcDZA+ products-data-modeling-model-table-summary--self-managed--dark:+ hash: v1.k794b7964.91ed3c00050fc05758bfc0f264e6c99ca4fe3b0c8357b3401e4d22c2bdc40e80.yJ9bgMytoyYcCh_uq0jlcrZeKxGCFTzZO_ZnzGb0oIg+ products-data-modeling-model-table-summary--self-managed--light:+ hash: v1.k794b7964.dfff71dbb156ba5d6b8fd1f8e134986f79b266086d3a8ba4266d9c50cc6991bd.tLMJ-Y3O6ccsCJZFuZsdyKKI8EvgpSmMESAa1ua6Ixk+ products-data-modeling-model-table-summary--synced--dark:+ hash: v1.k794b7964.96d2cc266fcb7c32a1d30c7718fc8cb35d9f11e5fbfd21b2218a0f49ddaa6e0b.1kN4E-ZKJeHT9zSWQES30lAunDXDJc3LECFyIfDSsaA+ products-data-modeling-model-table-summary--synced--light:+ hash: v1.k794b7964.e10315afff7e2bd2a2c49b2312b213b636b4e57f5f00a0ec088949163f24dc21.rjpou3TIwacsVEscy9Gt5sxc6hRSDc19q5LC9XKf8CEproducts-data-modeling-model-view-summary--default--dark:hash: v1.k794b7964.737d8a2c361afacd464cd954284a02ce712e05d937c685c531d65febadcba1be.KNgeP1Z_u8nhEEdPH7Nx6pTJCpd27rRj79qLWBIWjWEproducts-data-modeling-model-view-summary--default--light:@@ -6526,6 +6546,10 @@ snapshots:hash: v1.k794b7964.5c623bdf59901765f55de0d7a1164d11feefa003292f7c0fc37a8bdcf778d3d2.UhfAB2qZz0EGEphjIL9GwkuEiuovUfT31-Ow5_gn2b8products-data-modeling-node-detail-scene--paginated-columns--light:hash: v1.k794b7964.b119e3e790d76d28ef0b53b7a7116717a4c2660347e23054a47922696c799548.YmPMhBqGr7MBKRXPb815ZXpqZp1V17KRg4PPq33hd5I+ products-data-modeling-node-detail-scene--post-hog-table--dark:+ hash: v1.k794b7964.a96ef756e2d01161b01e5db98cde06709b23518e7ee914f7eeb0dd21ca5810a8.s0IoMkvwZvyD1_FEELxAyTJkizH93blLZECbndIJoQM+ products-data-modeling-node-detail-scene--post-hog-table--light:+ hash: v1.k794b7964.96c90c4c447779f126aee9c2b3a80e2f5d749287d53d52af9bbc8813d00ab4e6.YjG3VOPfzSkY44how_J4F5gmmP8Xjhpy_WNyugIgIFAproducts-data-modeling-node-detail-scene--suspended-with-run-history--dark:hash: v1.k794b7964.8777021fae0861f86ccd00ee197d14fcacf12d0ae1ba8a8fe7b38f20591cbc41.r_GyHK2h2ozRGIYXoZ3N4CAlJMClpccnfeC5TEgiDOoproducts-data-modeling-node-detail-scene--suspended-with-run-history--light:@@ -6534,6 +6558,10 @@ snapshots:hash: v1.k794b7964.c3a0122ed3c944fd0036bf07405b2e09e14f7f218660863779a3587da606f3aa.HS-n7WOMbDZm10kaWIku0Y01udvSaEeEdFoDzUBLlrkproducts-data-modeling-node-detail-scene--view--light:hash: v1.k794b7964.36643c2fa6800cf361c623fca665343f8b4a2708afd3cd46ed9abb19cfd1db5f.mqGLSD5Sce2yBSvIXIS7PajSjOdXlLIoEjGEK4iwYEc+ products-data-modeling-node-detail-scene--warehouse-table--dark:+ hash: v1.k794b7964.9b4ada16fe4040658293f332d2ef1ac787d442024a46910f31977b5e91b78f18.ZwMWNZ12_XSUiYLnaWKGHTLnba40UqTfSVUtQdGwOwI+ products-data-modeling-node-detail-scene--warehouse-table--light:+ hash: v1.k794b7964.b9eef66cedae5f0ef73ad8a064065a18727ead6de094c06e3ba0721cde6cfef9.M311KjIy20zre5wD_R9dqQyQ_J8_GsyPkmmcm-JL77wproducts-data-modeling-views-list--actions--dark:hash: v1.k794b7964.eceb80b180d692b6f616365ea7269d24bb6f084128cbfafc661cf6159dc281ec.FagEpfMfYMDwAJaH7ctNLBVSS-sThFgcTnQ8Ghwk8wIproducts-data-modeling-views-list--actions--light:diff --git a/frontend/src/initKea.ts b/frontend/src/initKea.tsindex a2f9c1476705..82a36377f5d3 100644--- a/frontend/src/initKea.ts+++ b/frontend/src/initKea.ts@@ -74,6 +74,7 @@ const ERROR_FILTER_ALLOW_LIST = ['loadSessionEventDeltas', // The experiment watch shelf renders the refusal, or the failure with a retry'loadLineage', // MetricLineagePanel renders every failure class itself, including the not-ready 404'loadSourceDocuments', // The knowledge source page renders its own retry banner for the indexed page list+ 'loadTableDetails', // The model detail summary renders its own error state with a retry]/*diff --git a/frontend/src/types.ts b/frontend/src/types.tsindex cbb9128a0b8b..8240f7fd3db7 100644--- a/frontend/src/types.ts+++ b/frontend/src/types.ts@@ -6273,6 +6273,8 @@ export interface DataWarehouseTable {/** Serialized columns; omitted when the table was listed with `include_columns=false`. */columns?: DatabaseSchemaField[]format: DataWarehouseTableTypes+ created_by?: UserBasicType | null+ created_at?: string | nullurl_pattern: string/** Null for tables without user-provided credentials, e.g. created by a managed pipeline. */credential: DataWarehouseCredential | null@@ -6312,6 +6314,8 @@ export interface DataModelingNode {/** UUID of the data catalog metric a metric node stands for */metric_id?: string | nulllineage_issue?: LineageIssueApi | null+ origin?: 'posthog' | 'warehouse' | null+ warehouse_table_id?: string | nullcreated_at: stringupdated_at: stringupstream_count: number@@ -6502,6 +6506,8 @@ export interface ExternalDataSource {source_type: ExternalDataSourceTypeEnumApiprefix: string | nulldescription: string | null+ created_by?: string | null+ created_at?: string | nullaccess_method?: 'warehouse' | 'direct'direct_query_enabled?: booleanauto_sync_new_schemas?: booleandiff --git a/products/data_modeling/backend/logic/saved_query_dag_sync.py b/products/data_modeling/backend/logic/saved_query_dag_sync.pyindex f3a1b0f9c7b0..ce9ef7c06fd4 100644--- a/products/data_modeling/backend/logic/saved_query_dag_sync.py+++ b/products/data_modeling/backend/logic/saved_query_dag_sync.py@@ -163,6 +163,14 @@ def resolve_dependency_to_node("properties": {"origin": "warehouse", "warehouse_table_id": str(warehouse_table.id)},},)+ properties = {+ **(node.properties if isinstance(node.properties, dict) else {}),+ "origin": "warehouse",+ "warehouse_table_id": str(warehouse_table.id),+ }+ if node.properties != properties:+ node.properties = properties+ node.save(update_fields=["properties", "updated_at"])return node# system tablenode, _ = Node.objects.get_or_create(@@ -172,6 +180,11 @@ def resolve_dependency_to_node(type=NodeType.TABLE,defaults={"properties": {"origin": "posthog"}},)+ properties = {**(node.properties if isinstance(node.properties, dict) else {}), "origin": "posthog"}+ properties.pop("warehouse_table_id", None)+ if node.properties != properties:+ node.properties = properties+ node.save(update_fields=["properties", "updated_at"])return nodediff --git a/products/data_modeling/backend/presentation/views/node.py b/products/data_modeling/backend/presentation/views/node.pyindex d924be938109..da1f3ca90af0 100644--- a/products/data_modeling/backend/presentation/views/node.py+++ b/products/data_modeling/backend/presentation/views/node.py@@ -91,6 +91,8 @@ class NodeSerializer(serializers.ModelSerializer):sync_interval = serializers.SerializerMethodField(read_only=True)dag_name = serializers.SerializerMethodField(read_only=True)lineage_issue = serializers.SerializerMethodField(read_only=True)+ origin = serializers.SerializerMethodField(read_only=True)+ warehouse_table_id = serializers.SerializerMethodField(read_only=True)dag = TeamScopedPrimaryKeyRelatedField(queryset=DAG.objects.all())class Meta:@@ -105,6 +107,8 @@ class NodeSerializer(serializers.ModelSerializer):"saved_query_id","metric_id","lineage_issue",+ "origin",+ "warehouse_table_id","created_at","updated_at","upstream_count",@@ -130,6 +134,8 @@ class NodeSerializer(serializers.ModelSerializer):"saved_query_id","metric_id","lineage_issue",+ "origin",+ "warehouse_table_id",]@extend_schema_field(@@ -204,6 +210,32 @@ class NodeSerializer(serializers.ModelSerializer):def get_lineage_issue(self, node: Node) -> dict[str, Any] | None:return node.lineage_issue+ @extend_schema_field(+ serializers.ChoiceField(+ choices=["posthog", "warehouse"],+ allow_null=True,+ help_text="Where a table originates, or null for legacy and unrecognized nodes.",+ )+ )+ def get_origin(self, node: Node) -> str | None:+ origin = node.properties.get("origin") if isinstance(node.properties, dict) else None+ return origin if origin in {"posthog", "warehouse"} else None++ @extend_schema_field(+ serializers.UUIDField(+ allow_null=True,+ help_text="Warehouse table identifier for an imported table, or null when unavailable.",+ )+ )+ def get_warehouse_table_id(self, node: Node) -> str | None:+ table_id = node.properties.get("warehouse_table_id") if isinstance(node.properties, dict) else None+ if not isinstance(table_id, str):+ return None+ try:+ return str(UUID(table_id))+ except ValueError:+ return None+def validate(self, attrs: dict[str, Any]) -> dict[str, Any]:# System-managed DAGs (e.g. Revenue Analytics) own their nodes; the internal sync path# maintains them directly via the ORM and bypasses this serializer. Block users fromdiff --git a/products/data_modeling/backend/test/test_saved_query_dag_sync.py b/products/data_modeling/backend/test/test_saved_query_dag_sync.pyindex 9b1d5d882359..ac220661f9a2 100644--- a/products/data_modeling/backend/test/test_saved_query_dag_sync.py+++ b/products/data_modeling/backend/test/test_saved_query_dag_sync.py@@ -205,6 +205,28 @@ class TestSyncSavedQueryToDag(BaseTest):assert edge is not Noneself.assertEqual(edge.dag_id, dag.id)+ def test_sync_refreshes_the_table_id_when_a_warehouse_table_is_recreated(self):+ old_table = DataWarehouseTable.objects.create(team=self.team, name="orders", format="Parquet")+ saved_query = DataWarehouseSavedQuery.objects.create(+ name="order_summary",+ team=self.team,+ query={"query": "SELECT * FROM orders", "kind": "HogQLQuery"},+ )++ sync_saved_query_to_dag(saved_query)+ table_node = Node.objects.get(team=self.team, dag__name=DEFAULT_DAG_NAME, name="orders")+ self.assertEqual(table_node.properties["warehouse_table_id"], str(old_table.id))++ old_table.deleted = True+ old_table.save(update_fields=["deleted"])+ new_table = DataWarehouseTable.objects.create(team=self.team, name="orders", format="Parquet")++ sync_saved_query_to_dag(saved_query)++ table_node.refresh_from_db()+ self.assertEqual(table_node.properties["origin"], "warehouse")+ self.assertEqual(table_node.properties["warehouse_table_id"], str(new_table.id))+def test_sync_creates_edges_for_multiple_dependencies(self):saved_query = DataWarehouseSavedQuery.objects.create(name="test_view",diff --git a/products/data_modeling/backend/tests/api/test_node_api.py b/products/data_modeling/backend/tests/api/test_node_api.pyindex 64bd17f78a7c..cb8222d47d21 100644--- a/products/data_modeling/backend/tests/api/test_node_api.py+++ b/products/data_modeling/backend/tests/api/test_node_api.py@@ -237,6 +237,29 @@ class TestNodeViewSet(APIBaseTest):self.assertEqual(response.json()["type"], "view")self.assertEqual(response.json()["dag"], str(self.dag.id))+ @parameterized.expand(+ [+ (+ "warehouse",+ {"origin": "warehouse", "warehouse_table_id": "dbd0dfd6-ae37-4733-a065-0f2601ac3a67"},+ "warehouse",+ "dbd0dfd6-ae37-4733-a065-0f2601ac3a67",+ ),+ ("posthog", {"origin": "posthog"}, "posthog", None),+ ("empty", {}, None, None),+ ("malformed", {"origin": "other", "warehouse_table_id": "not-a-uuid"}, None, None),+ ]+ )+ def test_get_node_exposes_valid_table_identity(self, _name, properties, origin, warehouse_table_id):+ self.table_node.properties = properties+ self.table_node.save(update_fields=["properties"])++ response = self.client.get(f"/api/environments/{self.team.id}/data_modeling_nodes/{self.table_node.id}/")++ self.assertEqual(response.status_code, status.HTTP_200_OK)+ self.assertEqual(response.json()["origin"], origin)+ self.assertEqual(response.json()["warehouse_table_id"], warehouse_table_id)+def test_get_node_includes_upstream_downstream_counts(self):response = self.client.get(f"/api/environments/{self.team.id}/data_modeling_nodes/{self.view_node.id}/")diff --git a/products/data_modeling/frontend/generated/api.schemas.ts b/products/data_modeling/frontend/generated/api.schemas.tsindex 1a26c149f63d..899447f92047 100644--- a/products/data_modeling/frontend/generated/api.schemas.ts+++ b/products/data_modeling/frontend/generated/api.schemas.ts@@ -132,6 +132,17 @@ export interface LineageIssueApi {at: string | null}+/**+ * * `posthog` - posthog+ * * `warehouse` - warehouse+ */+export type NodeOriginEnumApi = (typeof NodeOriginEnumApi)[keyof typeof NodeOriginEnumApi]++export const NodeOriginEnumApi = {+ Posthog: 'posthog',+ Warehouse: 'warehouse',+} as const+export interface NodeSuspensionApi {/** When the node was suspended. */at: string@@ -167,6 +178,16 @@ export interface NodeApi {/** @nullable */readonly metric_id: string | nullreadonly lineage_issue: LineageIssueApi | null+ /** Where a table originates, or null for legacy and unrecognized nodes.+ *+ * * `posthog` - posthog+ * * `warehouse` - warehouse */+ readonly origin: NodeOriginEnumApi | null+ /**+ * Warehouse table identifier for an imported table, or null when unavailable.+ * @nullable+ */+ readonly warehouse_table_id: string | nullreadonly created_at: string/** @nullable */readonly updated_at: string | null@@ -223,6 +244,16 @@ export interface PatchedNodeApi {/** @nullable */readonly metric_id?: string | nullreadonly lineage_issue?: LineageIssueApi | null+ /** Where a table originates, or null for legacy and unrecognized nodes.+ *+ * * `posthog` - posthog+ * * `warehouse` - warehouse */+ readonly origin?: NodeOriginEnumApi | null+ /**+ * Warehouse table identifier for an imported table, or null when unavailable.+ * @nullable+ */+ readonly warehouse_table_id?: string | nullreadonly created_at?: string/** @nullable */readonly updated_at?: string | nulldiff --git a/products/data_modeling/frontend/nodeDetail/ModelMetadata.tsx b/products/data_modeling/frontend/nodeDetail/ModelMetadata.tsxindex 346afb7de261..e8df41aef219 100644--- a/products/data_modeling/frontend/nodeDetail/ModelMetadata.tsx+++ b/products/data_modeling/frontend/nodeDetail/ModelMetadata.tsx@@ -7,11 +7,15 @@ import { UserBasicType } from '~/types'export function ModelMetadata({createdBy,+ createdByEmail,+ createdByLabel,createdAt,updatedAt,loading,}: {createdBy?: UserBasicType | null+ createdByEmail?: string | null+ createdByLabel?: string | nullcreatedAt?: string | nullupdatedAt?: string | nullloading?: boolean@@ -25,8 +29,10 @@ export function ModelMetadata({<LemonSkeleton className="h-5 w-20" />) : createdBy ? (<ProfilePicture user={createdBy} showName size="sm" />+ ) : createdByEmail ? (+ <ProfilePicture user={{ email: createdByEmail }} showName size="sm" />) : (- 'Unknown'+ (createdByLabel ?? 'Unknown'))}</dd></div>diff --git a/products/data_modeling/frontend/nodeDetail/ModelTableSummary.stories.tsx b/products/data_modeling/frontend/nodeDetail/ModelTableSummary.stories.tsxnew file mode 100644index 000000000000..0f3259753334--- /dev/null+++ b/products/data_modeling/frontend/nodeDetail/ModelTableSummary.stories.tsx@@ -0,0 +1,79 @@+import type { Meta, StoryObj } from '@storybook/react'++import { dayjs } from 'lib/dayjs'++import { ExternalDataSchemaStatus } from '~/types'++import { ModelTableSummary } from './ModelTableSummary'++const meta: Meta<typeof ModelTableSummary> = {+ title: 'Products/Data modeling/Model table summary',+ component: ModelTableSummary,+ decorators: [+ (Story) => (+ <div className="w-[56rem]">+ <Story />+ </div>+ ),+ ],+ args: {+ id: 'node-1',+ node: { origin: 'posthog', downstream_count: 3 },+ table: null,+ source: null,+ schema: null,+ loading: false,+ error: false,+ accessDenied: false,+ onRetry: () => undefined,+ },+ parameters: {+ // The card reads last_synced_at through TZLabel, which renders it relative to now, so the+ // snapshot changes on its own once the real clock moves past the fixture.+ mockDate: '2026-09-19T10:42:00Z',+ testOptions: { snapshotBrowsers: ['chromium'] },+ },+}+export default meta++type Story = StoryObj<typeof ModelTableSummary>++export const PostHog: Story = {}++export const SelfManaged: Story = {+ args: {+ node: { origin: 'warehouse', downstream_count: 0 },+ table: { format: 'Parquet' },+ },+}++export const Synced: Story = {+ args: {+ node: { origin: 'warehouse', downstream_count: 2 },+ table: { format: 'Parquet' },+ source: { id: 'source-1', source_type: 'Postgres', access_method: 'warehouse' },+ schema: {+ id: 'schema-1',+ status: ExternalDataSchemaStatus.Completed,+ latest_error: null,+ last_synced_at: dayjs('2026-09-19T10:00:00Z'),+ sync_type: 'incremental',+ sync_frequency: '24hour',+ },+ },+}++export const Loading: Story = {+ args: {+ node: { origin: 'warehouse', downstream_count: 0 },+ loading: true,+ },+ parameters: { testOptions: { waitForLoadersToDisappear: false } },+}++export const Error: Story = {+ args: {+ node: { origin: 'warehouse', downstream_count: 0 },+ error: true,+ },+}diff --git a/products/data_modeling/frontend/nodeDetail/ModelTableSummary.test.tsx b/products/data_modeling/frontend/nodeDetail/ModelTableSummary.test.tsxnew file mode 100644index 000000000000..016b3a345b8f--- /dev/null+++ b/products/data_modeling/frontend/nodeDetail/ModelTableSummary.test.tsx@@ -0,0 +1,54 @@+import { render, screen } from '@testing-library/react'++import { dayjs } from 'lib/dayjs'++import { ExternalDataSchemaStatus } from '~/types'++import { ModelTableSummary } from './ModelTableSummary'++const baseProps = {+ id: 'node-1',+ table: null,+ source: null,+ schema: null,+ loading: false,+ error: false,+ accessDenied: false,+ onRetry: jest.fn(),+}++describe('ModelTableSummary', () => {+ it('shows PostHog ownership and downstream models for a PostHog table', () => {+ render(<ModelTableSummary {...baseProps} node={{ origin: 'posthog', downstream_count: 1 }} />)++ expect(screen.getByText('Managed by PostHog')).toBeTruthy()+ expect(screen.getByText('PostHog')).toBeTruthy()+ expect(screen.getByText('1 model')).toBeTruthy()+ })++ it('shows source sync metadata for a warehouse table', () => {+ render(+ <ModelTableSummary+ {...baseProps}+ node={{ origin: 'warehouse', downstream_count: 2 }}+ table={{ format: 'Parquet' }}+ source={{ id: 'source-1', source_type: 'Postgres', access_method: 'warehouse' }}+ schema={{+ id: 'schema-1',+ status: ExternalDataSchemaStatus.Completed,+ latest_error: null,+ last_synced_at: dayjs('2026-09-19T10:00:00Z'),+ sync_type: 'incremental',+ sync_frequency: '24hour',+ }}+ />+ )++ expect(screen.getByText('Current status')).toBeTruthy()+ expect(screen.getByText('Completed')).toBeTruthy()+ expect(screen.getByText('Postgres')).toBeTruthy()+ expect(screen.getByText('Incremental')).toBeTruthy()+ expect(screen.getByText('Daily')).toBeTruthy()+ expect(screen.getByText('2 models')).toBeTruthy()+ })+})diff --git a/products/data_modeling/frontend/nodeDetail/ModelTableSummary.tsx b/products/data_modeling/frontend/nodeDetail/ModelTableSummary.tsxnew file mode 100644index 000000000000..9d9745a84506--- /dev/null+++ b/products/data_modeling/frontend/nodeDetail/ModelTableSummary.tsx@@ -0,0 +1,161 @@+import type { ReactNode } from 'react'++import { LemonButton, LemonSkeleton, LemonTag, Link } from '@posthog/lemon-ui'++import { TZLabel } from 'lib/components/TZLabel'+import { urls } from 'scenes/urls'++import type { DataModelingNode, DataWarehouseTable, ExternalDataSchemaWithSource, ExternalDataSource } from '~/types'++import { StatusTagSetting, SyncFrequencyLabelMap, SyncTypeLabelMap } from 'products/data_warehouse/frontend/utils'++import { ModelDownstreamSummary } from './ModelDownstreamSummary'+import { ModelSummaryCard } from './ModelSummaryCard'++export function ModelTableSummary({+ id,+ node,+ table,+ source,+ schema,+ loading,+ error,+ accessDenied,+ onRetry,+ metadata,+}: {+ id: string+ node: Pick<DataModelingNode, 'origin' | 'downstream_count'>+ table: Pick<DataWarehouseTable, 'format'> | null+ source: Pick<ExternalDataSource, 'id' | 'source_type' | 'access_method'> | null+ schema: Pick<+ ExternalDataSchemaWithSource,+ 'id' | 'status' | 'latest_error' | 'last_synced_at' | 'sync_type' | 'sync_frequency'+ > | null+ loading: boolean+ error: boolean+ accessDenied: boolean+ onRetry: () => void+ metadata?: ReactNode+}): JSX.Element {+ const downstream = (+ <ModelDownstreamSummary downstreamCount={node.downstream_count} lineageUrl={urls.nodeDetail(id, 'lineage')} />+ )++ if (node.origin === 'posthog') {+ return (+ <ModelSummaryCard metadata={metadata} dataAttr="node-detail-table">+ <div className="flex flex-col gap-3">+ <span className="font-semibold">Managed by PostHog</span>+ <dl className="flex flex-wrap gap-x-10 gap-y-3 mb-0 text-sm">+ <div>+ <dt className="text-secondary mb-1">Source</dt>+ <dd className="mb-0">PostHog</dd>+ </div>+ {downstream}+ </dl>+ </div>+ </ModelSummaryCard>+ )+ }++ if (loading) {+ return (+ <ModelSummaryCard metadata={metadata} dataAttr="node-detail-table">+ <LemonSkeleton className="h-20 w-full" />+ </ModelSummaryCard>+ )+ }++ if (error) {+ return (+ <ModelSummaryCard metadata={metadata} dataAttr="node-detail-table">+ <div className="flex flex-col gap-3">+ <div className="flex flex-wrap items-center gap-2 text-secondary">+ <span>+ {accessDenied+ ? "You don't have access to this table's details."+ : "Couldn't load table details. Try again."}+ </span>+ {!accessDenied && (+ <LemonButton size="xsmall" onClick={onRetry} loading={loading}>+ Retry+ </LemonButton>+ )}+ </div>+ <dl className="flex flex-wrap gap-x-10 gap-y-3 mb-0 text-sm">{downstream}</dl>+ </div>+ </ModelSummaryCard>+ )+ }++ const title = schema ? 'Current status' : source?.access_method === 'direct' ? 'Direct query table' : 'Table'+ const sourceUrl = source+ ? schema+ ? urls.dataWarehouseSourceSchema(`managed-${source.id}`, schema.id)+ : urls.dataWarehouseSource(`managed-${source.id}`)+ : null++ return (+ <ModelSummaryCard metadata={metadata} dataAttr="node-detail-table">+ <div className="flex flex-col gap-3">+ <div className="flex flex-wrap items-center gap-2">+ <span className="font-semibold">{title}</span>+ {schema &&+ (schema.status ? (+ <LemonTag type={StatusTagSetting[schema.status] || 'default'}>{schema.status}</LemonTag>+ ) : (+ <span className="text-secondary">—</span>+ ))}+ </div>+ {schema?.latest_error && schema.status === 'Failed' && (+ <p className="mb-0 max-h-64 overflow-auto text-sm font-mono text-danger break-words whitespace-pre-wrap">+ {schema.latest_error}+ </p>+ )}+ <dl className="flex flex-wrap gap-x-10 gap-y-3 mb-0 text-sm">+ {source && sourceUrl ? (+ <div>+ <dt className="text-secondary mb-1">Source</dt>+ <dd className="mb-0">+ <Link to={sourceUrl}>{source.source_type}</Link>+ </dd>+ </div>+ ) : table ? (+ <div>+ <dt className="text-secondary mb-1">File format</dt>+ <dd className="mb-0">+ {table.format === 'CSVWithNames' ? 'CSV with headers' : table.format}+ </dd>+ </div>+ ) : null}+ {schema && (+ <>+ <div>+ <dt className="text-secondary mb-1">Last synced</dt>+ <dd className="mb-0">+ {schema.last_synced_at ? <TZLabel time={schema.last_synced_at} /> : 'Never'}+ </dd>+ </div>+ <div>+ <dt className="text-secondary mb-1">Sync method</dt>+ <dd className="mb-0">+ {schema.sync_type ? SyncTypeLabelMap[schema.sync_type] : 'Not set up'}+ </dd>+ </div>+ <div>+ <dt className="text-secondary mb-1">Sync schedule</dt>+ <dd className="mb-0">+ {schema.sync_frequency+ ? SyncFrequencyLabelMap[schema.sync_frequency]+ : 'Not set up'}+ </dd>+ </div>+ </>+ )}+ {downstream}+ </dl>+ </div>+ </ModelSummaryCard>+ )+}diff --git a/products/data_modeling/frontend/nodeDetail/NodeDetailOverview.tsx b/products/data_modeling/frontend/nodeDetail/NodeDetailOverview.tsxindex 11e69e3ce25d..3c52d753d67a 100644--- a/products/data_modeling/frontend/nodeDetail/NodeDetailOverview.tsx+++ b/products/data_modeling/frontend/nodeDetail/NodeDetailOverview.tsx@@ -1,7 +1,6 @@import { useActions, useValues } from 'kea'import type { ReactNode } from 'react'-import { TZLabel } from 'lib/components/TZLabel'import { materializationJobsLogic } from 'scenes/data-warehouse/saved_queries/materializationJobsLogic'import { CADENCE_LABELS, modeDisabledReason } from 'scenes/data-warehouse/saved_queries/SyncFrequencySelect'import { urls } from 'scenes/urls'@@ -10,18 +9,24 @@ import { DataModelingSyncInterval } from '~/types'import { SERVING_ENGINE } from '../suspension'import { ModelHealthSummary } from './ModelHealthSummary'+import { ModelTableSummary } from './ModelTableSummary'import { ModelViewSummary } from './ModelViewSummary'import { nodeDetailSceneLogic } from './nodeDetailSceneLogic'export function NodeDetailOverview({ id, metadata }: { id: string; metadata?: ReactNode }): JSX.Element | null {+ const sceneLogic = nodeDetailSceneLogic({ id })const {node,savedQuery: sceneSavedQuery,isMaterialized,savedQueryError,- effectiveLastRunAt,effectiveLastRunStatus,- } = useValues(nodeDetailSceneLogic({ id }))+ tableDetails,+ tableDetailsAccessDenied,+ tableDetailsLoading,+ tableDetailsError,+ } = useValues(sceneLogic)+ const { loadTableDetails } = useActions(sceneLogic)const materializationLogic = materializationJobsLogic({viewId: node?.saved_query_id ?? '',kind: node?.type === 'endpoint' ? 'endpoint' : 'view',@@ -41,17 +46,24 @@ export function NodeDetailOverview({ id, metadata }: { id: string; metadata?: Reif (!node) {return null}+ if (node.type === 'table') {+ return (+ <ModelTableSummary+ id={id}+ node={node}+ table={tableDetails?.table ?? null}+ source={tableDetails?.source ?? null}+ schema={tableDetails?.schema ?? null}+ loading={tableDetailsLoading}+ error={tableDetailsError}+ accessDenied={tableDetailsAccessDenied}+ onRetry={loadTableDetails}+ metadata={metadata}+ />+ )+ }if (!(savedQuery?.is_materialized ?? isMaterialized)) {- return node.type === 'table' ? (- <div className="flex flex-wrap items-start gap-x-8 gap-y-3">- {effectiveLastRunAt && (- <p className="text-sm text-secondary mb-0">- Last synced <TZLabel time={effectiveLastRunAt} />- </p>- )}- {metadata}- </div>- ) : (+ return (<ModelViewSummarydownstreamCount={node.downstream_count}lineageUrl={urls.nodeDetail(id, 'lineage')}diff --git a/products/data_modeling/frontend/nodeDetail/NodeDetailScene.stories.tsx b/products/data_modeling/frontend/nodeDetail/NodeDetailScene.stories.tsxindex 8b33819005d0..d18be401eb3d 100644--- a/products/data_modeling/frontend/nodeDetail/NodeDetailScene.stories.tsx+++ b/products/data_modeling/frontend/nodeDetail/NodeDetailScene.stories.tsx@@ -1,6 +1,7 @@import type { Decorator, Meta, StoryObj } from '@storybook/react'import { useEffect, useRef } from 'react'+import { FEATURE_FLAGS } from 'lib/constants'import { urls } from 'scenes/urls'import { mswDecorator } from '~/mocks/browser'@@ -57,6 +58,113 @@ const savedQuery = {],}+const tableNode = {+ id: 'orders-table-node',+ name: 'postgres.public.orders',+ type: 'table',+ dag: 'example-dag',+ saved_query_id: null,+ origin: 'warehouse',+ warehouse_table_id: '2efce7bc-9b76-442a-8234-33f6fc3e8c7d',+ created_at: '2026-02-11T10:00:00Z',+ updated_at: '2026-09-13T10:00:00Z',+ upstream_count: 0,+ downstream_count: 3,+}++const downstreamNodes = [+ {+ ...node,+ id: 'daily-revenue-node',+ name: 'daily_revenue',+ saved_query_id: 'daily-revenue-view',+ upstream_count: 1,+ downstream_count: 1,+ },+ {+ ...node,+ id: 'customer-health-node',+ name: 'customer_health',+ saved_query_id: 'customer-health-view',+ upstream_count: 1,+ downstream_count: 0,+ },+ {+ ...node,+ id: 'sales-forecast-node',+ name: 'sales_forecast',+ saved_query_id: 'sales-forecast-view',+ upstream_count: 1,+ downstream_count: 0,+ },+]++const tableLineage = (+ sourceNode: Omit<typeof tableNode, 'warehouse_table_id'> & { warehouse_table_id: string | null }+): { nodes: object[]; edges: object[] } => ({+ nodes: [sourceNode, ...downstreamNodes],+ edges: downstreamNodes.map((targetNode, index) => ({+ id: `table-edge-${index + 1}`,+ source_id: sourceNode.id,+ target_id: targetNode.id,+ dag: sourceNode.dag,+ properties: {},+ created_at: sourceNode.created_at,+ updated_at: sourceNode.updated_at,+ })),+})++const postHogTableNode = {+ ...tableNode,+ id: 'events-table-node',+ name: 'events',+ origin: 'posthog',+ warehouse_table_id: null,+}++const warehouseTable = {+ id: tableNode.warehouse_table_id,+ name: 'postgres_public_orders',+ hogql_name: tableNode.name,+ format: 'Parquet',+ created_by: null,+ created_at: '2026-02-11T10:00:00Z',+ credential: null,+ columns: [+ { name: 'id', type: 'integer' },+ { name: 'customer_id', type: 'integer' },+ { name: 'total', type: 'decimal' },+ ],+ external_data_source: { id: 'source-1' },+ external_schema: { id: 'schema-1' },+}++const warehouseSource = {+ id: 'source-1',+ source_type: 'Postgres',+ access_method: 'warehouse',+ created_by: '[email protected]',+ created_at: '2026-02-11T10:00:00Z',+}++const warehouseSchema = {+ id: 'schema-1',+ name: 'public.orders',+ label: 'Orders',+ should_sync: true,+ status: 'Completed',+ latest_error: null,+ last_synced_at: '2026-09-13T09:42:00Z',+ sync_type: 'incremental',+ sync_frequency: '1hour',+}++const emptyDataQualityMocks = {+ '/api/projects/:team_id/data_quality_checks/': () => [200, { count: 0, next: null, previous: null, results: [] }],+ '/api/projects/:team_id/data_quality_checks/health/': () => [200, []],+ '/api/projects/:team_id/data_quality_runs/': () => [200, { count: 0, next: null, previous: null, results: [] }],+}+const meta: Meta<typeof NodeDetailScene> = {title: 'Products/Data modeling/Node detail scene',component: NodeDetailScene,@@ -89,6 +197,60 @@ export default metatype Story = StoryObj<typeof NodeDetailScene>export const View: Story = {}++export const WarehouseTable: Story = {+ args: { id: tableNode.id },+ parameters: {+ featureFlags: [FEATURE_FLAGS.DATA_QUALITY_CHECKS],+ pageUrl: urls.nodeDetail(tableNode.id, 'lineage'),+ msw: {+ mocks: {+ get: {+ '/api/environments/:team_id/data_modeling_nodes/:id/': ({ request }: { request: Request }) =>+ request.url.includes('/lineage') ? [200, tableLineage(tableNode)] : [200, tableNode],+ '/api/environments/:team_id/warehouse_tables/:id/': () => [200, warehouseTable],+ '/api/environments/:team_id/external_data_sources/:id/': () => [200, warehouseSource],+ '/api/environments/:team_id/external_data_schemas/:id/': () => [200, warehouseSchema],+ ...emptyDataQualityMocks,+ },+ },+ },+ },+}++export const PostHogTable: Story = {+ args: { id: 'events-table-node' },+ parameters: {+ featureFlags: [FEATURE_FLAGS.DATA_QUALITY_CHECKS],+ pageUrl: urls.nodeDetail('events-table-node', 'lineage'),+ msw: {+ mocks: {+ get: {+ '/api/environments/:team_id/data_modeling_nodes/:id/': ({ request }: { request: Request }) =>+ request.url.includes('/lineage')+ ? [200, tableLineage(postHogTableNode)]+ : [200, postHogTableNode],+ '/api/projects/:team_id/data_quality_checks/subjects/': () => [+ 200,+ [+ {+ subject_type: 'posthog_table',+ id: 'd4fb61da-50ae-59dc-a94f-f2036dfcfe49',+ name: 'events',+ display_name: '',+ time_column: 'timestamp',+ columns: { distinct_id: 'String', timestamp: 'DateTime' },+ editable: true,+ },+ ],+ ],+ ...emptyDataQualityMocks,+ },+ },+ },+ },+}+export const NarrowView: Story = {decorators: [(Story) => (diff --git a/products/data_modeling/frontend/nodeDetail/NodeDetailScene.tsx b/products/data_modeling/frontend/nodeDetail/NodeDetailScene.tsxindex 3b3490a7d30e..89b8a303c65b 100644--- a/products/data_modeling/frontend/nodeDetail/NodeDetailScene.tsx+++ b/products/data_modeling/frontend/nodeDetail/NodeDetailScene.tsx@@ -20,7 +20,11 @@ import { NodeDetailLineage } from './NodeDetailLineage'import { NodeDetailMaterialization } from './NodeDetailMaterialization'import { NodeDetailOverview } from './NodeDetailOverview'import { NodeDetailQuery } from './NodeDetailQuery'-import type { NodeDetailSceneLogicProps, NodeDetailSceneTab } from './nodeDetailSceneLogic'+import type {+ NodeDetailDataQualitySubject,+ NodeDetailSceneLogicProps,+ NodeDetailSceneTab,+} from './nodeDetailSceneLogic'import { nodeDetailSceneLogic } from './nodeDetailSceneLogic'import { NodeDetailTests } from './NodeDetailTests'import { NodeDetailTestsTabLabel } from './NodeDetailTestsTabLabel'@@ -40,17 +44,29 @@ const TAB_LABELS: Record<NodeDetailSceneTab, string> = {history: 'History',}-function tabLabel(tab: NodeDetailSceneTab, savedQueryId: string | null | undefined): JSX.Element | string {- if (tab === 'tests' && savedQueryId) {- return <NodeDetailTestsTabLabel subjectId={savedQueryId} />+function tabLabel(+ tab: NodeDetailSceneTab,+ dataQualitySubject: NodeDetailDataQualitySubject | null+): JSX.Element | string {+ if (tab === 'tests' && dataQualitySubject) {+ return <NodeDetailTestsTabLabel {...dataQualitySubject} />}return TAB_LABELS[tab]}export function NodeDetailScene({ id }: NodeDetailSceneLogicProps): JSX.Element {- const { node, savedQuery, savedQueryLoading, nodeLoading, availableTabs, effectiveTab, visitedTabs } = useValues(- nodeDetailSceneLogic({ id })- )+ const {+ node,+ savedQuery,+ savedQueryLoading,+ nodeLoading,+ availableTabs,+ effectiveTab,+ visitedTabs,+ dataQualitySubject,+ tableDetails,+ tableDetailsLoading,+ } = useValues(nodeDetailSceneLogic({ id }))if (!userHasAccess(AccessControlResourceType.WarehouseObjects, AccessControlLevel.Viewer)) {return (@@ -89,13 +105,13 @@ export function NodeDetailScene({ id }: NodeDetailSceneLogicProps): JSX.Element/>)case 'tests':- return <NodeDetailTests id={id} subjectId={savedQueryId ?? ''} />+ return <NodeDetailTests id={id} />}}const tabs: LemonTab<NodeDetailSceneTab>[] = availableTabs.map((tab) => ({key: tab,- label: tabLabel(tab, savedQueryId),+ label: tabLabel(tab, dataQualitySubject),link: urls.nodeDetail(id, tab),'data-attr': `node-detail-${tab}-tab`,}))@@ -103,18 +119,35 @@ export function NodeDetailScene({ id }: NodeDetailSceneLogicProps): JSX.Elementreturn (<SceneContent><NodeDetailHeader id={id} />- {/* A node row's timestamps describe the node, not the model: editing the- description here patches the node and bumps its updated_at while the saved- query stays untouched. So they stand in only for a node that has no saved- query, and a failed load says nothing rather than the node's dates. */}+ {/* A node row's timestamps describe the node, not the table: the DAG sync bumps+ updated_at when it stamps identity onto the node. So they stand in only for a+ node with no table of its own, and a failed table load says nothing rather than+ the node's dates. */}<NodeDetailOverviewid={id}metadata={<ModelMetadata- createdBy={savedQuery?.created_by}- createdAt={node.saved_query_id ? savedQuery?.created_at : node.created_at}- updatedAt={node.saved_query_id ? undefined : node.updated_at}- loading={!!node.saved_query_id && savedQueryLoading && !savedQuery}+ createdBy={+ node.saved_query_id+ ? savedQuery?.created_by+ : tableDetails?.source+ ? undefined+ : tableDetails?.table.created_by+ }+ createdByEmail={node.saved_query_id ? undefined : tableDetails?.source?.created_by}+ createdByLabel={node.origin === 'posthog' ? 'PostHog' : undefined}+ createdAt={+ node.saved_query_id+ ? savedQuery?.created_at+ : node.warehouse_table_id+ ? (tableDetails?.source?.created_at ?? tableDetails?.table.created_at)+ : node.created_at+ }+ updatedAt={node.saved_query_id || node.warehouse_table_id ? undefined : node.updated_at}+ loading={+ (!!node.saved_query_id && savedQueryLoading && !savedQuery) ||+ (!!node.warehouse_table_id && tableDetailsLoading && !tableDetails)+ }/>}/>diff --git a/products/data_modeling/frontend/nodeDetail/NodeDetailTableTests.tsx b/products/data_modeling/frontend/nodeDetail/NodeDetailTableTests.tsxnew file mode 100644index 000000000000..37a217a0da3a--- /dev/null+++ b/products/data_modeling/frontend/nodeDetail/NodeDetailTableTests.tsx@@ -0,0 +1,64 @@+import { useActions, useValues } from 'kea'++import { LemonButton, LemonSkeleton } from '@posthog/lemon-ui'++import type { DatabaseSchemaField } from '~/queries/schema/schema-general'++import { DataQualityChecksPanel } from 'products/data_quality/frontend/DataQualityChecksPanel'++import { nodeDetailSceneLogic } from './nodeDetailSceneLogic'++export function NodeDetailTableTests({+ id,+ subjectType,+ subjectId,+ columns,+ editable,+}: {+ id: string+ subjectType: 'table' | 'posthog_table'+ subjectId: string+ columns?: DatabaseSchemaField[]+ editable?: boolean+}): JSX.Element {+ const logic = nodeDetailSceneLogic({ id })+ const { tableDetails, tableDetailsAccessDenied, tableDetailsLoading, tableDetailsError } = useValues(logic)+ const { loadTableDetails } = useActions(logic)+ const lastSyncedAt = tableDetails?.schema?.last_synced_at++ if (subjectType === 'table' && tableDetailsLoading && !tableDetails) {+ return <LemonSkeleton className="h-64 w-full" />+ }++ if (subjectType === 'table' && tableDetailsError && !tableDetails) {+ return (+ <div className="flex flex-wrap items-center gap-2 text-secondary">+ <span>+ {tableDetailsAccessDenied+ ? "You don't have access to this table's details."+ : "Couldn't load table details. Try again."}+ </span>+ {!tableDetailsAccessDenied && (+ <LemonButton size="xsmall" onClick={loadTableDetails} loading={tableDetailsLoading}>+ Retry+ </LemonButton>+ )}+ </div>+ )+ }++ return (+ <div className="flex flex-col gap-4">+ <DataQualityChecksPanel+ subjectType={subjectType}+ subjectId={subjectId}+ columns={subjectType === 'posthog_table' ? (columns ?? []) : (tableDetails?.table.columns ?? [])}+ dataLastSyncedAt={typeof lastSyncedAt === 'string' ? lastSyncedAt : lastSyncedAt?.toISOString()}+ newCheckDisabledReason={+ editable === false ? "You don't have permission to add checks for this table." : undefined+ }+ hideTitle+ />+ </div>+ )+}diff --git a/products/data_modeling/frontend/nodeDetail/NodeDetailTests.tsx b/products/data_modeling/frontend/nodeDetail/NodeDetailTests.tsxindex 98b4d4f581f4..928673ddf41b 100644--- a/products/data_modeling/frontend/nodeDetail/NodeDetailTests.tsx+++ b/products/data_modeling/frontend/nodeDetail/NodeDetailTests.tsx@@ -1,54 +1,84 @@-import { useValues } from 'kea'+import { useActions, useValues } from 'kea'-import { LemonBanner, Link } from '@posthog/lemon-ui'--import { materializationJobsLogic } from 'scenes/data-warehouse/saved_queries/materializationJobsLogic'-import { urls } from 'scenes/urls'+import { LemonBanner, Spinner } from '@posthog/lemon-ui'+import type { DataQualitySubjectType } from 'products/data_quality/frontend/checksApi'import { dataQualityChecksLogic } from 'products/data_quality/frontend/dataQualityChecksLogic'-import { DataQualityChecksPanel } from 'products/data_quality/frontend/DataQualityChecksPanel'-import { dataQualityGateLogic } from 'products/data_quality/frontend/dataQualityGateLogic'+import type { NodeDetailDataQualitySubject } from './nodeDetailSceneLogic'import { nodeDetailSceneLogic } from './nodeDetailSceneLogic'+import { NodeDetailTableTests } from './NodeDetailTableTests'+import { NodeDetailViewTests } from './NodeDetailViewTests'++export type NodeDetailTestsSubjectType = DataQualitySubjectType++export function NodeDetailTests({ id }: { id: string }): JSX.Element {+ const logic = nodeDetailSceneLogic({ id })+ const { node, dataQualitySubject, postHogSubjectLoading, postHogSubjectError, postHogSubjectAccessDenied } =+ useValues(logic)+ const { loadPostHogSubject } = useActions(logic)++ if (node?.type === 'table' && node.origin === 'posthog') {+ if (postHogSubjectLoading) {+ return (+ <LemonBanner type="info" icon={<Spinner />}>+ Loading data quality for this table.+ </LemonBanner>+ )+ }-function GateNotice(): JSX.Element | null {- const { gateConfig, gateReadable } = useValues(dataQualityGateLogic)+ if (postHogSubjectAccessDenied) {+ return (+ <LemonBanner type="error">+ You don't have access to data quality for this table. Ask a project admin for access.+ </LemonBanner>+ )+ }- if (!gateReadable || !gateConfig) {- return null+ if (postHogSubjectError) {+ return (+ <LemonBanner type="error" action={{ children: 'Retry', onClick: loadPostHogSubject }}>+ Couldn't load data quality for this table. Try again.+ </LemonBanner>+ )+ }++ if (!dataQualitySubject || dataQualitySubject.subjectType !== 'posthog_table') {+ return <LemonBanner type="info">Data quality is not available for this table.</LemonBanner>+ }}- return (- <LemonBanner type="info">- {gateConfig.gate_materialization_on_checks- ? 'This project blocks materialization on failing error-severity checks.'- : 'This project materializes this view even when an error-severity check fails.'}{' '}- <Link to={urls.settings('environment-data-quality')} data-attr="node-detail-tests-gate-settings">- Change this in data quality settings- </Link>- </LemonBanner>- )+ if (!dataQualitySubject) {+ return <LemonBanner type="info">Data quality is not available for this model.</LemonBanner>+ }++ return <ResolvedNodeDetailTests id={id} subject={dataQualitySubject} />}-export function NodeDetailTests({ id, subjectId }: { id: string; subjectId: string }): JSX.Element {- const { savedQuery } = useValues(nodeDetailSceneLogic({ id }))- const { accessDenied } = useValues(dataQualityChecksLogic({ subjectType: 'view', subjectId }))- const { lastSuccessfulSyncAt } = useValues(materializationJobsLogic({ viewId: subjectId }))+function ResolvedNodeDetailTests({ id, subject }: { id: string; subject: NodeDetailDataQualitySubject }): JSX.Element {+ const { accessDenied } = useValues(+ dataQualityChecksLogic({ subjectType: subject.subjectType, subjectId: subject.subjectId })+ )if (accessDenied) {return <p className="mb-0 text-secondary">You don't have access to the tests for this model.</p>}- return (- <div className="flex flex-col gap-4">- <DataQualityChecksPanel- subjectType="view"- subjectId={subjectId}- columns={savedQuery?.columns ?? []}- dataLastSyncedAt={savedQuery?.is_materialized ? lastSuccessfulSyncAt : undefined}- hideTitle- notice={savedQuery?.is_materialized ? <GateNotice /> : undefined}+ if (subject.subjectType === 'view') {+ return <NodeDetailViewTests id={id} subjectId={subject.subjectId} />+ }++ if (subject.subjectType === 'table' || subject.subjectType === 'posthog_table') {+ return (+ <NodeDetailTableTests+ id={id}+ subjectType={subject.subjectType}+ subjectId={subject.subjectId}+ columns={subject.columns}+ editable={subject.editable}/>- </div>- )+ )+ }++ return <LemonBanner type="info">Data quality is not available for this model.</LemonBanner>}diff --git a/products/data_modeling/frontend/nodeDetail/NodeDetailTestsTabLabel.tsx b/products/data_modeling/frontend/nodeDetail/NodeDetailTestsTabLabel.tsxindex a2ac3f28c4f5..71068cc09a6d 100644--- a/products/data_modeling/frontend/nodeDetail/NodeDetailTestsTabLabel.tsx+++ b/products/data_modeling/frontend/nodeDetail/NodeDetailTestsTabLabel.tsx@@ -7,6 +7,8 @@ import { pluralize } from 'lib/utils/strings'import { dataQualityChecksLogic } from 'products/data_quality/frontend/dataQualityChecksLogic'+import type { NodeDetailTestsSubjectType } from './NodeDetailTests'+/** Erroring means a check could not run at all, so it reports no failure count to speak of. */const TONES: Record<string, string> = {failing: 'text-danger',@@ -14,8 +16,14 @@ const TONES: Record<string, string> = {erroring: 'text-warning',}-export function NodeDetailTestsTabLabel({ subjectId }: { subjectId: string }): JSX.Element {- const { health } = useValues(dataQualityChecksLogic({ subjectType: 'view', subjectId }))+export function NodeDetailTestsTabLabel({+ subjectType,+ subjectId,+}: {+ subjectType: NodeDetailTestsSubjectType+ subjectId: string+}): JSX.Element {+ const { health } = useValues(dataQualityChecksLogic({ subjectType, subjectId }))const tone = health ? TONES[health.health] : undefinedconst explanation =health?.health === 'erroring'diff --git a/products/data_modeling/frontend/nodeDetail/NodeDetailViewTests.tsx b/products/data_modeling/frontend/nodeDetail/NodeDetailViewTests.tsxnew file mode 100644index 000000000000..a58b6976f4dd--- /dev/null+++ b/products/data_modeling/frontend/nodeDetail/NodeDetailViewTests.tsx@@ -0,0 +1,48 @@+import { useValues } from 'kea'++import { LemonBanner, Link } from '@posthog/lemon-ui'++import { materializationJobsLogic } from 'scenes/data-warehouse/saved_queries/materializationJobsLogic'+import { urls } from 'scenes/urls'++import { DataQualityChecksPanel } from 'products/data_quality/frontend/DataQualityChecksPanel'+import { dataQualityGateLogic } from 'products/data_quality/frontend/dataQualityGateLogic'++import { nodeDetailSceneLogic } from './nodeDetailSceneLogic'++function GateNotice(): JSX.Element | null {+ const { gateConfig, gateReadable } = useValues(dataQualityGateLogic)++ if (!gateReadable || !gateConfig) {+ return null+ }++ return (+ <LemonBanner type="info">+ {gateConfig.gate_materialization_on_checks+ ? 'This project blocks materialization on failing error-severity checks.'+ : 'This project materializes this view even when an error-severity check fails.'}{' '}+ <Link to={urls.settings('environment-data-quality')} data-attr="node-detail-tests-gate-settings">+ Change this in data quality settings+ </Link>+ </LemonBanner>+ )+}++export function NodeDetailViewTests({ id, subjectId }: { id: string; subjectId: string }): JSX.Element {+ const { savedQuery } = useValues(nodeDetailSceneLogic({ id }))+ const { lastSuccessfulSyncAt } = useValues(materializationJobsLogic({ viewId: subjectId }))++ return (+ <div className="flex flex-col gap-4">+ <DataQualityChecksPanel+ subjectType="view"+ subjectId={subjectId}+ columns={savedQuery?.columns ?? []}+ dataLastSyncedAt={savedQuery?.is_materialized ? lastSuccessfulSyncAt : undefined}+ hideTitle+ notice={savedQuery?.is_materialized ? <GateNotice /> : undefined}+ />+ </div>+ )+}diff --git a/products/data_modeling/frontend/nodeDetail/nodeDetailSceneLogic.test.ts b/products/data_modeling/frontend/nodeDetail/nodeDetailSceneLogic.test.tsindex 4c4e726f46d5..2b9b5051b537 100644--- a/products/data_modeling/frontend/nodeDetail/nodeDetailSceneLogic.test.ts+++ b/products/data_modeling/frontend/nodeDetail/nodeDetailSceneLogic.test.ts@@ -16,6 +16,7 @@ import { DataModelingNode, DataModelingNodeType, DataWarehouseSavedQuery } fromimport { NodeDetailOverview } from './NodeDetailOverview'import { NodeDetailQuery } from './NodeDetailQuery'import { NodeDetailSceneTab, nodeDetailSceneLogic } from './nodeDetailSceneLogic'+import { NodeDetailTests } from './NodeDetailTests'const NODE_ID = 'node-1'const SAVED_QUERY_ID = 'saved-query-1'@@ -120,6 +121,203 @@ describe('nodeDetailSceneLogic', () => {expect(logic.values.currentTab).toEqual('lineage')})+ it('adds data quality for a warehouse table ID and loads its details', async () => {+ node = buildNode('table', { warehouse_table_id: 'table-1' })+ useMocks({+ get: {+ '/api/environments/:team_id/data_modeling_nodes/lineage/': { nodes: [], edges: [] },+ '/api/environments/:team_id/data_modeling_nodes/:id/': () => [200, node],+ '/api/environments/:team_id/warehouse_tables/:id/': {+ id: 'table-1',+ name: 'orders',+ format: 'Parquet',+ external_data_source: { id: 'source-1' },+ external_schema: { id: 'schema-1' },+ },+ '/api/environments/:team_id/external_data_sources/:id/': {+ id: 'source-1',+ source_type: 'Stripe',+ },+ '/api/environments/:team_id/external_data_schemas/:id/': {+ id: 'schema-1',+ sync_type: 'incremental',+ sync_frequency: '24hour',+ },+ },+ })++ await mountScene(urls.nodeDetail(NODE_ID))++ expect(logic.values.availableTabs).toEqual(['lineage', 'tests'])+ expect(logic.values.dataQualitySubject).toEqual({ subjectType: 'table', subjectId: 'table-1' })+ expect(logic.values.tableDetails).toMatchObject({+ table: { id: 'table-1' },+ source: { id: 'source-1' },+ schema: { id: 'schema-1' },+ })+ })++ it.each(['events', 'persons', 'groups'])(+ 'loads the matching %s subject for data quality without loading warehouse details',+ async (tableName) => {+ node = buildNode('table', { name: tableName, origin: 'posthog' })+ useMocks({+ get: {+ '/api/environments/:team_id/data_modeling_nodes/lineage/': { nodes: [], edges: [] },+ '/api/environments/:team_id/data_modeling_nodes/:id/': () => [200, node],+ '/api/projects/:team_id/data_quality_checks/subjects/': () => [+ 200,+ [+ {+ subject_type: 'posthog_table',+ id: `${tableName}-subject`,+ name: tableName,+ display_name: '',+ time_column: 'timestamp',+ columns: { id: 'String', timestamp: 'DateTime' },+ editable: true,+ },+ ],+ ],+ },+ })++ await mountScene(urls.nodeDetail(NODE_ID))++ expect(logic.values.availableTabs).toEqual(['lineage', 'tests'])+ expect(logic.values.dataQualitySubject).toEqual({+ subjectType: 'posthog_table',+ subjectId: `${tableName}-subject`,+ columns: [+ { name: 'id', hogql_value: 'id', type: 'String', schema_valid: true },+ { name: 'timestamp', hogql_value: 'timestamp', type: 'DateTime', schema_valid: true },+ ],+ editable: true,+ })+ expect(logic.values.tableDetails).toBeNull()+ expect(logic.values.tableDetailsError).toBe(false)+ }+ )++ it('loads the PostHog subject when the data quality flag arrives after the node', async () => {+ node = buildNode('table', { name: 'events', origin: 'posthog' })+ flagsLogic.actions.setFeatureFlags([], { [FEATURE_FLAGS.DATA_QUALITY_CHECKS]: false })+ useMocks({+ get: {+ '/api/environments/:team_id/data_modeling_nodes/lineage/': { nodes: [], edges: [] },+ '/api/environments/:team_id/data_modeling_nodes/:id/': () => [200, node],+ '/api/projects/:team_id/data_quality_checks/subjects/': () => [+ 200,+ [+ {+ subject_type: 'posthog_table',+ id: 'events-subject',+ name: 'events',+ display_name: '',+ time_column: 'timestamp',+ columns: {},+ editable: true,+ },+ ],+ ],+ },+ })++ await mountScene(urls.nodeDetail(NODE_ID))+ expect(logic.values.availableTabs).toEqual(['lineage'])++ await expectLogic(logic, () => {+ flagsLogic.actions.setFeatureFlags([FEATURE_FLAGS.DATA_QUALITY_CHECKS], {+ [FEATURE_FLAGS.DATA_QUALITY_CHECKS]: true,+ })+ }).toFinishAllListeners()++ expect(logic.values.availableTabs).toEqual(['lineage', 'tests'])+ expect(logic.values.dataQualitySubject).toMatchObject({+ subjectType: 'posthog_table',+ subjectId: 'events-subject',+ })+ })++ it('keeps the data quality tab for an unsupported PostHog table', async () => {+ node = buildNode('table', { name: 'unsupported_table', origin: 'posthog' })+ useMocks({+ get: {+ '/api/environments/:team_id/data_modeling_nodes/lineage/': { nodes: [], edges: [] },+ '/api/environments/:team_id/data_modeling_nodes/:id/': () => [200, node],+ '/api/projects/:team_id/data_quality_checks/subjects/': () => [200, []],+ },+ })++ await mountScene(urls.nodeDetail(NODE_ID, 'tests'))++ expect(logic.values.effectiveTab).toEqual('tests')+ expect(logic.values.dataQualitySubject).toBeNull()++ render(createElement(NodeDetailTests, { id: NODE_ID }))++ expect(screen.getByText('Data quality is not available for this table.')).toBeTruthy()+ })++ it('keeps Lineage available while the PostHog subject request fails', async () => {+ node = buildNode('table', { name: 'events', origin: 'posthog' })+ useMocks({+ get: {+ '/api/environments/:team_id/data_modeling_nodes/lineage/': { nodes: [], edges: [] },+ '/api/environments/:team_id/data_modeling_nodes/:id/': () => [200, node],+ '/api/projects/:team_id/data_quality_checks/subjects/': () => [500, {}],+ },+ })++ await mountScene(urls.nodeDetail(NODE_ID))++ expect(logic.values.availableTabs).toEqual(['lineage', 'tests'])+ expect(logic.values.lineageGraph).toEqual({ currentNodeId: NODE_ID, nodes: [], edges: [] })+ expect(logic.values.postHogSubjectError).toBe(true)++ render(createElement(NodeDetailTests, { id: NODE_ID }))++ expect(screen.getByText("Couldn't load data quality for this table. Try again.")).toBeTruthy()+ })++ it('records PostHog subject access denials', async () => {+ node = buildNode('table', { name: 'events', origin: 'posthog' })+ useMocks({+ get: {+ '/api/environments/:team_id/data_modeling_nodes/lineage/': { nodes: [], edges: [] },+ '/api/environments/:team_id/data_modeling_nodes/:id/': () => [200, node],+ '/api/projects/:team_id/data_quality_checks/subjects/': () => [403, {}],+ },+ })++ await mountScene(urls.nodeDetail(NODE_ID))++ expect(logic.values.postHogSubjectAccessDenied).toBe(true)+ expect(logic.values.postHogSubjectError).toBe(true)++ render(createElement(NodeDetailTests, { id: NODE_ID }))++ expect(+ screen.getByText("You don't have access to data quality for this table. Ask a project admin for access.")+ ).toBeTruthy()+ })++ it('records table detail access denials', async () => {+ node = buildNode('table', { warehouse_table_id: 'table-1' })+ useMocks({+ get: {+ '/api/environments/:team_id/data_modeling_nodes/lineage/': { nodes: [], edges: [] },+ '/api/environments/:team_id/data_modeling_nodes/:id/': () => [200, node],+ '/api/environments/:team_id/warehouse_tables/:id/': () => [403, {}],+ },+ })++ await mountScene(urls.nodeDetail(NODE_ID))++ expect(logic.values.tableDetailsAccessDenied).toBe(true)+ expect(logic.values.tableDetailsError).toBe(true)+ })+it('shows ten columns on each query page', async () => {savedQuery = {...savedQuery,diff --git a/products/data_modeling/frontend/nodeDetail/nodeDetailSceneLogic.ts b/products/data_modeling/frontend/nodeDetail/nodeDetailSceneLogic.tsindex d0436de088e7..42d74f559017 100644--- a/products/data_modeling/frontend/nodeDetail/nodeDetailSceneLogic.ts+++ b/products/data_modeling/frontend/nodeDetail/nodeDetailSceneLogic.ts@@ -9,7 +9,19 @@ import type { DataWarehouseSavedQuerySummary } from 'scenes/data-warehouse/savedimport { dataWarehouseViewsLogic } from 'scenes/data-warehouse/saved_queries/dataWarehouseViewsLogic'import { urls } from 'scenes/urls'-import { Breadcrumb, DataModelingEdge, DataModelingNode, DataWarehouseSavedQuery } from '~/types'+import type { DatabaseSchemaField } from '~/queries/schema/schema-general'+import {+ Breadcrumb,+ DataModelingEdge,+ DataModelingNode,+ DataWarehouseSavedQuery,+ DataWarehouseTable,+ ExternalDataSchemaWithSource,+ ExternalDataSource,+} from '~/types'++import { checksApi, type DataQualitySubjectType } from 'products/data_quality/frontend/checksApi'+import type { DataQualitySubjectApi } from 'products/data_quality/frontend/generated/api.schemas'import { MATERIALIZING_TYPES } from '../freshness'import type { NodeTypeEnumApi } from '../generated/api.schemas'@@ -21,6 +33,19 @@ export interface NodeDetailSceneLogicProps {id: string}+export interface TableDetails {+ table: DataWarehouseTable+ source: ExternalDataSource | null+ schema: ExternalDataSchemaWithSource | null+}++export interface NodeDetailDataQualitySubject {+ subjectType: DataQualitySubjectType+ subjectId: string+ columns?: DatabaseSchemaField[]+ editable?: boolean+}+export interface LineageGraphData {/** DataModelingNode objects in the subgraph (ancestors + current + descendants) */nodes: DataModelingNode[]@@ -40,6 +65,7 @@ export interface nodeDetailSceneLogicValues {availableTabs: NodeDetailSceneTab[]breadcrumbs: Breadcrumb[]currentTab: NodeDetailSceneTab | null+ dataQualitySubject: NodeDetailDataQualitySubject | nulldefaultTab: NodeDetailSceneTabeffectiveLastRunAt: string | nulleffectiveLastRunStatus: string | null@@ -52,11 +78,19 @@ export interface nodeDetailSceneLogicValues {node: DataModelingNode | nullnodeLoading: booleannodeType: NodeTypeEnumApi | null+ postHogSubject: DataQualitySubjectApi | null+ postHogSubjectAccessDenied: boolean+ postHogSubjectError: boolean+ postHogSubjectLoading: booleansavedQuery: DataWarehouseSavedQuery | nullsavedQueryError: booleansavedQueryLoading: booleansavedQuerySettled: booleansceneResolved: boolean+ tableDetails: TableDetails | null+ tableDetailsAccessDenied: boolean+ tableDetailsError: boolean+ tableDetailsLoading: booleanvisitedTabs: NodeDetailSceneTab[]}@@ -78,6 +112,13 @@ export interface nodeDetailSceneLogicActions {dataWarehouseSavedQueries: DataWarehouseSavedQuerySummary[]payload?: import('scenes/data-warehouse/saved_queries/dataWarehouseViewsLogic').DataWarehouseSavedQueryUpdate} // dataWarehouseViewsLogic+ setFeatureFlags: (+ flags: string[],+ variants: Record<string, boolean | string>+ ) => {+ flags: string[]+ variants: Record<string, boolean | string>+ } // featureFlagLogiccanonicalizeTab: () => {value: true}@@ -122,6 +163,21 @@ export interface nodeDetailSceneLogicActions {node: DataModelingNodepayload?: any}+ loadPostHogSubject: () => any+ loadPostHogSubjectFailure: (+ error: string,+ errorObject?: any+ ) => {+ error: string+ errorObject?: any+ }+ loadPostHogSubjectSuccess: (+ postHogSubject: DataQualitySubjectApi | null,+ payload?: any+ ) => {+ postHogSubject: DataQualitySubjectApi | null+ payload?: any+ }loadSavedQuery: () => anyloadSavedQueryFailure: (error: string,@@ -137,6 +193,29 @@ export interface nodeDetailSceneLogicActions {savedQuery: DataWarehouseSavedQuery | nullpayload?: any}+ loadTableDetails: () => any+ loadTableDetailsFailure: (+ error: string,+ errorObject?: any+ ) => {+ error: string+ errorObject?: any+ }+ loadTableDetailsSuccess: (+ tableDetails: {+ schema: ExternalDataSchemaWithSource | null+ source: ExternalDataSource | null+ table: DataWarehouseTable+ } | null,+ payload?: any+ ) => {+ tableDetails: {+ schema: ExternalDataSchemaWithSource | null+ source: ExternalDataSource | null+ table: DataWarehouseTable+ } | null+ payload?: any+ }openLineageModal: () => {value: true}@@ -178,6 +257,10 @@ export interface nodeDetailSceneLogicMeta {sceneResolved: boolean,featureFlags: FeatureFlagsSet) => NodeDetailSceneTab[]+ dataQualitySubject: (+ node: DataModelingNode | null,+ postHogSubject: DataQualitySubjectApi | null+ ) => NodeDetailDataQualitySubject | nullisMaterialized: (node: DataModelingNode | null, savedQuery: DataWarehouseSavedQuery | null) => booleandefaultTab: (node: DataModelingNode | null, isMaterialized: boolean) => NodeDetailSceneTabeffectiveTab: (@@ -207,6 +290,8 @@ export const nodeDetailSceneLogic = kea<nodeDetailSceneLogicType>([connect(() => ({values: [featureFlagLogic, ['featureFlags']],actions: [+ featureFlagLogic,+ ['setFeatureFlags'],dataWarehouseViewsLogic,['updateDataWarehouseSavedQuerySuccess', 'deleteDataWarehouseSavedQuerySuccess'],],@@ -257,6 +342,38 @@ export const nodeDetailSceneLogic = kea<nodeDetailSceneLogicType>([loadLineageGraphFailure: () => true,},],+ tableDetailsAccessDenied: [+ false,+ {+ loadTableDetails: () => false,+ loadTableDetailsSuccess: () => false,+ loadTableDetailsFailure: (_, { errorObject }) => errorObject?.status === 403,+ },+ ],+ tableDetailsError: [+ false,+ {+ loadTableDetails: () => false,+ loadTableDetailsSuccess: () => false,+ loadTableDetailsFailure: () => true,+ },+ ],+ postHogSubjectAccessDenied: [+ false,+ {+ loadPostHogSubject: () => false,+ loadPostHogSubjectSuccess: () => false,+ loadPostHogSubjectFailure: (_, { errorObject }) => errorObject?.status === 403,+ },+ ],+ postHogSubjectError: [+ false,+ {+ loadPostHogSubject: () => false,+ loadPostHogSubjectSuccess: () => false,+ loadPostHogSubjectFailure: () => true,+ },+ ],lineageModalOpen: [false,{@@ -297,6 +414,42 @@ export const nodeDetailSceneLogic = kea<nodeDetailSceneLogicType>([return { nodes, edges, currentNodeId: node.id }},},+ postHogSubject: {+ __default: null as DataQualitySubjectApi | null,+ loadPostHogSubject: async () => {+ const node = values.node+ if (node?.type !== 'table' || node.origin !== 'posthog') {+ return null+ }+ const subjects = await checksApi.subjects()+ return (+ subjects.find(+ (subject) => subject.subject_type === 'posthog_table' && subject.name === node.name+ ) ?? null+ )+ },+ },+ tableDetails: {+ __default: null as TableDetails | null,+ loadTableDetails: async () => {+ const node = values.node+ if (node?.type !== 'table' || !node.warehouse_table_id) {+ return null+ }+ const table = await api.dataWarehouseTables.get(node.warehouse_table_id)+ // A grant on the table alone outranks a denial on its source, so a refused or+ // failed source or schema read narrows the summary rather than emptying it.+ const [source, schema] = await Promise.all([+ table.external_data_source+ ? api.externalDataSources.get(table.external_data_source.id).catch(() => null)+ : null,+ table.external_schema+ ? api.externalDataSchemas.get(table.external_schema.id).catch(() => null)+ : null,+ ])+ return { table, source, schema }+ },+ },})),selectors({breadcrumbs: [@@ -331,6 +484,15 @@ export const nodeDetailSceneLogic = kea<nodeDetailSceneLogicType>([if (!sceneResolved || !node) {return []}+ if (node.type === 'table') {+ return [+ 'lineage',+ ...(featureFlags[FEATURE_FLAGS.DATA_QUALITY_CHECKS] &&+ (node.warehouse_table_id || node.origin === 'posthog')+ ? ['tests' as const]+ : []),+ ]+ }const tabs: NodeDetailSceneTab[] = []if (node.saved_query_id) {tabs.push('query')@@ -352,6 +514,34 @@ export const nodeDetailSceneLogic = kea<nodeDetailSceneLogicType>([return tabs},],+ dataQualitySubject: [+ (s) => [s.node, s.postHogSubject],+ (+ node: DataModelingNode | null,+ postHogSubject: DataQualitySubjectApi | null+ ): NodeDetailDataQualitySubject | null => {+ if (node?.type === 'table' && node.warehouse_table_id) {+ return { subjectType: 'table', subjectId: node.warehouse_table_id }+ }+ if (node?.type === 'table' && node.origin === 'posthog' && postHogSubject) {+ return {+ subjectType: postHogSubject.subject_type,+ subjectId: postHogSubject.id,+ columns: Object.entries(postHogSubject.columns).map(([name, type]) => ({+ name,+ hogql_value: name,+ type: type as DatabaseSchemaField['type'],+ schema_valid: true,+ })),+ editable: postHogSubject.editable,+ }+ }+ if (node?.saved_query_id) {+ return { subjectType: 'view', subjectId: node.saved_query_id }+ }+ return null+ },+ ],// The saved query is the authority on this, but its request can fail, and the scene still// renders once it settles. The node's type carries the same answer, so a failed load falls// back to it rather than reading as not materialized -- which would contradict the@@ -414,9 +604,32 @@ export const nodeDetailSceneLogic = kea<nodeDetailSceneLogicType>([if (node?.saved_query_id) {actions.loadSavedQuery()}+ if (node?.type === 'table' && node.warehouse_table_id) {+ actions.loadTableDetails()+ }+ if (+ node?.type === 'table' &&+ node.origin === 'posthog' &&+ values.featureFlags[FEATURE_FLAGS.DATA_QUALITY_CHECKS]+ ) {+ actions.loadPostHogSubject()+ }actions.loadLineageGraph()actions.canonicalizeTab()},+ setFeatureFlags: () => {+ const node = values.node+ if (+ node?.type === 'table' &&+ node.origin === 'posthog' &&+ values.featureFlags[FEATURE_FLAGS.DATA_QUALITY_CHECKS] &&+ !values.postHogSubject &&+ !values.postHogSubjectLoading &&+ !values.postHogSubjectError+ ) {+ actions.loadPostHogSubject()+ }+ },loadSavedQuerySuccess: () => actions.canonicalizeTab(),loadSavedQueryFailure: () => actions.canonicalizeTab(),// The address bar decides which tab shows, so once the data says which tabs exist, a URLdiff --git a/services/mcp/src/api/generated.ts b/services/mcp/src/api/generated.tsindex 0be9b1b5635b..fdb847fea107 100644--- a/services/mcp/src/api/generated.ts+++ b/services/mcp/src/api/generated.ts@@ -56842,6 +56842,18 @@ export namespace Schemas {Metric: 'metric',} as const;+ /**+ * * `posthog` - posthog+ * * `warehouse` - warehouse+ */+ export type NodeOriginEnum = typeof NodeOriginEnum[keyof typeof NodeOriginEnum];+++ export const NodeOriginEnum = {+ Posthog: 'posthog',+ Warehouse: 'warehouse',+ } as const;+export interface NodeSuspension {/** When the node was suspended. */at: string;@@ -56877,6 +56889,16 @@ export namespace Schemas {/** @nullable */readonly metric_id: string | null;readonly lineage_issue: LineageIssue | null;+ /** Where a table originates, or null for legacy and unrecognized nodes.+ *+ * * `posthog` - posthog+ * * `warehouse` - warehouse */+ readonly origin: NodeOriginEnum | null;+ /**+ * Warehouse table identifier for an imported table, or null when unavailable.+ * @nullable+ */+ readonly warehouse_table_id: string | null;readonly created_at: string;/** @nullable */readonly updated_at: string | null;@@ -76007,6 +76029,16 @@ export namespace Schemas {/** @nullable */readonly metric_id?: string | null;readonly lineage_issue?: LineageIssue | null;+ /** Where a table originates, or null for legacy and unrecognized nodes.+ *+ * * `posthog` - posthog+ * * `warehouse` - warehouse */+ readonly origin?: NodeOriginEnum | null;+ /**+ * Warehouse table identifier for an imported table, or null when unavailable.+ * @nullable+ */+ readonly warehouse_table_id?: string | null;readonly created_at?: string;/** @nullable */readonly updated_at?: string | null;