Migrate datasources panel to the catalog children model#599
Draft
Light2Dark wants to merge 1 commit into
Draft
Conversation
marimo-team/marimo#9874 replaces the flat `Database.schemas` list and the `sql-table-list-preview` / `sql-schema-list-preview` notifications with a recursive `Database.children` tree (tagged `schema` / `namespace` / `data_table` nodes) and a single `catalog-children-preview` notification. Because the extension's notification types are generated from `@marimo-team/openapi`, that change is a compile break here once the marimo version is bumped. This migrates the consumers: - types.ts: drop `SqlTableListPreviewNotification`; add `CatalogChildrenPreviewNotification` plus `CatalogNode` / `SchemaNode` / `NamespaceNode` / `DataTableNode`. - KernelManager: route `catalog-children-preview`; the removed `sql-schema-list-preview` no longer needs ignoring (the exhaustive switch enforces this). - DatasourcesService: store databases as a recursive `CatalogTreeNode` tree; `normalizeCatalogNode` walks `schema.tables` / `namespace.children` and flattens deferred (`null`) buckets to `[]`. `updateCatalogChildrenPreview` skips error responses so a transient failure can't erase cached children. - DatasourcesView: render Connection -> Database -> (Schema | Namespace)* -> Table recursively via path-prefix matching; adds a `marimoNamespace` contextValue. - Add DatasourcesService tests (the panel's first) covering tree normalization, deferred flattening, the error guard, and clearNotebook. Lands with the `.marimo-version` bump to the release containing #9874 — the new wire types don't exist in the currently pinned openapi package. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Contributor
|
I have read the CLA Document and I hereby sign the CLA You can retrigger this bot by commenting recheck in this Pull Request. Posted by the CLA Assistant Lite bot. |
Contributor
Coverage Report
TypeScript statements: 48.95% (2296 / 4690) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adapts the extension to marimo-team/marimo#9874, which unifies catalog browsing around a recursive
Database.childrentree and one lazy-load endpoint. That PR:Database.schemaslist with a taggedchildrentree (schema/namespace/data_tablenodes), usingnullbuckets for deferred discovery; andsql-table-list-preview+sql-schema-list-previewnotifications with a singlecatalog-children-preview.Since our notification/schema types are generated from
@marimo-team/openapi, that is a compile break here once.marimo-versionis bumped to the release containing #9874 (Database.schemas,SqlTableListPreviewNotification, and the old op tags all disappear). This migrates the consumers.Changes
types.ts— dropSqlTableListPreviewNotification; addCatalogChildrenPreviewNotificationandCatalogNode/SchemaNode/NamespaceNode/DataTableNode.KernelManager.ts— routecatalog-children-preview; the now-removedsql-schema-list-previewno longer needs to be ignored (the exhaustiveunreachable(operation)switch enforces full coverage).DatasourcesService.ts— databases now hold a recursiveCatalogTreeNodetree instead of a flat schema map.normalizeCatalogNodewalksschema.tables/namespace.childrenand flattens deferred (null) buckets to[](the panel renders what the kernel has discovered; it does not drive lazy fetches).updateCatalogChildrenPreviewskips error responses so a transient failure can't erase cached children.DatasourcesView.ts— generalized the fixedConnection → Database → Schema → Tableview into a recursiveConnection → Database → (Schema | Namespace)* → Tabletree using path-prefix matching. Adds amarimoNamespacecontextValue (no menus key on it today). In-memory datasets render unchanged.DatasourcesService.test.ts(the panel's first): tree normalization (nested namespaces, root-level tables), deferred-nullflattening, the error-skip guard, andclearNotebook.Verification
Verified by checking out the #9874 commit in a sibling
marimocheckout (so the linked@marimo-team/openapi+ frontend are consistent):tsc— cleanvp test— 5/5 passvp check(lint + format) — cleanThis must land together with the
.marimo-versionbump to the release containing #9874. Against the currently pinned openapi package the new wire types don't exist yet, so CI here will not go green until that bump is in this branch.🤖 Generated with Claude Code