Context
Part of the implementation plan in #14658 for schema-aware Assistant responses. IDataConnectionHandle (src/vs/workbench/services/positronDataConnections/common/interfaces/dataConnectionDriver.ts) only exposes lazy, per-node tree walking (getChildren()/nodeGetChildren()) built for UI rendering - there's no API to produce a bounded schema summary for a whole connection. This is issue 1 of 2; issue 2 (the getSchema command) depends on this helper.
AC
- New
summarizeDataConnectionSchema(handle: IDataConnectionHandle, options?: { maxDepth?, maxNodesPerLevel?, maxTotalNodes? }): Promise<IDataConnectionSchemaSummary> in new file src/vs/workbench/services/positronDataConnections/common/dataConnectionSchemaSummary.ts, recursively walking getChildren()/nodeGetChildren().
- Bounded output via defaults (
maxDepth=4, maxNodesPerLevel=50, maxTotalNodes=500); on a cap, annotate the parent node with truncatedChildCount instead of dropping data silently.
- Flatten container-only
DataConnectionNodeKind values (src/positron-dts/positron.d.ts) into their parent so they don't add nodes with no schema information.
- Output is a plain JSON-serializable tree:
IDataConnectionSchemaSummary { instanceId; nodes: IDataConnectionSchemaNode[]; truncated: boolean }, IDataConnectionSchemaNode { name; kind; dataType?; isPrimaryKey?; children?; truncatedChildCount? }.
Testing
Context
Part of the implementation plan in #14658 for schema-aware Assistant responses.
IDataConnectionHandle(src/vs/workbench/services/positronDataConnections/common/interfaces/dataConnectionDriver.ts) only exposes lazy, per-node tree walking (getChildren()/nodeGetChildren()) built for UI rendering - there's no API to produce a bounded schema summary for a whole connection. This is issue 1 of 2; issue 2 (thegetSchemacommand) depends on this helper.AC
summarizeDataConnectionSchema(handle: IDataConnectionHandle, options?: { maxDepth?, maxNodesPerLevel?, maxTotalNodes? }): Promise<IDataConnectionSchemaSummary>in new filesrc/vs/workbench/services/positronDataConnections/common/dataConnectionSchemaSummary.ts, recursively walkinggetChildren()/nodeGetChildren().maxDepth=4,maxNodesPerLevel=50,maxTotalNodes=500); on a cap, annotate the parent node withtruncatedChildCountinstead of dropping data silently.DataConnectionNodeKindvalues (src/positron-dts/positron.d.ts) into their parent so they don't add nodes with no schema information.IDataConnectionSchemaSummary { instanceId; nodes: IDataConnectionSchemaNode[]; truncated: boolean },IDataConnectionSchemaNode { name; kind; dataType?; isPrimaryKey?; children?; truncatedChildCount? }.Testing
dataConnectionSchemaSummary.vitest.ts): depth cap; node-count cap; kind-flattening; empty schema; payload survivesJSON.parse(JSON.stringify(...))deep-equal, matching Data Connections: Add positronDataConnections.getConnections command #14923's test style.