Skip to content

fix: Standardize table name qualification across SQLRooms - #734

Merged
ilyabo merged 10 commits into
mainfrom
refactor-table-name-qualification
Jun 19, 2026
Merged

ilyabo merged 10 commits into
mainfrom
refactor-table-name-qualification

Conversation

@ilyabo

@ilyabo ilyabo commented Jun 19, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

  • Normalize table identity handling so table references are parsed and displayed consistently with schema qualification.
  • Update AI table-schema context, DuckDB schema utilities, and table listing/schema loading to use the new qualified-name behavior.
  • Propagate the change through SQL editor, execution, dashboard, pivot, cells, and mosaic code paths that inspect or render table names.
  • Refresh related tests and docs to cover the new behavior.

Testing

  • Added and updated unit tests for table identity, schema-tree utilities, SQL parsing, and AI table-schema context.
  • Updated integration-style coverage for dashboard, DuckDB, pivot, and box plot flows that depend on table naming.
  • Not run (not requested)

Summary by CodeRabbit

  • Refactor
    • Unified qualified table naming across query building, schema/context formatting, and UI components for more consistent handling of databases and schemas.
    • Standardized how charts and table views pass table identity through the app using canonical references.
  • Bug Fixes
    • Improved table lookup and schema loading behavior for default and attached databases, avoiding incorrect/double-qualification.
  • Documentation
    • Updated examples and AI guidance to clarify the expected canonical quoted tableId format (including when the default database may be omitted).
  • Tests
    • Expanded test coverage for canonical vs fully-qualified table name behavior and AI context formatting.

@coderabbitai

coderabbitai Bot commented Jun 19, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

QualifiedTableName gains a defaultDatabase field and a toFullString() method, while toString() is made canonical (omitting the database when it matches the default). The DuckDb store adds qualifyTableName(). Schema loading, AI table-context formatting, Mosaic BoxPlot, DeckMap bounds querying, and several other consumers are migrated from standalone helper functions to the new canonical identity.

Changes

QualifiedTableName Canonicalization

Layer / File(s) Summary
QualifiedTableName type, makeQualifiedTableName, and schemaTreeUtils
packages/duckdb-core/src/duckdb-utils.ts, packages/duckdb-core/src/schema-tree/schemaTreeUtils.ts, packages/duckdb-core/__tests__/getUnqualifiedSqlIdentifier.test.ts, packages/duckdb-core/__tests__/schemaTreeUtils.test.ts, packages/duckdb-core/README.md
QualifiedTableName adds defaultDatabase and toFullString(); toString() is now canonical (omits database when it matches default), while toFullString() always includes the database. makeQualifiedTableName computes both forms. findTableInSchemaTrees drops its makeQualifiedTableName parameter and compares via tableObj.table.toString() directly. resolveTableReference matches against both canonical and full-qualified forms. New tests verify toString()/toFullString() behavior under defaultDatabase.
loadTableSchemas defaultDatabase propagation
packages/duckdb/src/loadTableSchemas.ts
LoadTableSchemasOptions and LoadSchemaCatalogOptions gain defaultDatabase?: string. The field is threaded through loadTableSchemas, loadSchemaCatalog, parseSchemaCatalogTableRow, and parseTableSchemaRow, and forwarded into makeQualifiedTableName so every loaded table carries the canonical context.
DuckDbSlice: qualifyTableName API, findTable, and refreshTableSchemas
packages/duckdb/src/DuckDbSlice.ts, packages/duckdb/__tests__/DuckDbSlice.test.ts, packages/duckdb/README.md
DuckDbSliceState gains qualifyTableName() method for context-aware qualification from string or structured input. New QualifiedTableNameInput type and parseTableReferenceParts helper support consistent name resolution across loadTableSchemaByName, createTableFromQuery, loadTableRowCount, checkTableExists, dropRelation, dropTable, addTable, and setTableRowCount. findTable adds findUniqueMatchingTable to resolve stale cross-database identifier references by schema/table matching. refreshTableSchemas now passes defaultDatabase: currentDatabase into loadSchemaCatalog.
AI tools: remove helper functions, adopt canonical toString()
packages/ai/src/tools/tableSchemaContext.ts, packages/ai/src/index.ts, packages/ai/src/tools/defaultInstructions.ts, packages/ai/src/tools/tables/listTables.ts, packages/ai/src/tools/tables/readTableSchema.ts, packages/ai/src/tools/tables/tableIdentity.ts, packages/ai/__tests__/tableSchemaContext.test.ts
Removes six exported AI table-identity helpers (getTableNameForAi, getTableIdForAi, getSchemaNameForAi, getDatabaseNameForAi, getFullTableNameForAi, getQualifiedTableNameForAi). All internal scope/format logic switches to table.table.toString() and direct field access. Prompt strings adopt "canonical quoted SQLRooms table reference" wording. Tests update makeTable helper to construct via makeQualifiedTableName with defaultDatabase context, and assert the new LLM output format with tableId: "schema"."table".
Mosaic BoxPlot: tableName string → QualifiedTableName
packages/mosaic/src/charts/chart-types/base-types.ts, packages/mosaic/src/charts/chart-types/box-plot/renderer/BoxPlotClient.ts, packages/mosaic/src/charts/chart-types/box-plot/renderer/useBoxPlotClient.ts, packages/mosaic/src/charts/chart-types/box-plot/renderer/BoxPlotPanelRenderer.tsx, packages/mosaic/src/charts/MosaicChartView.tsx, packages/mosaic/__tests__/BoxPlotClient.test.ts
ChartRendererProps.tableName: string → table: QualifiedTableName. BoxPlotClientOptions, buildBoxPlotQuery, BoxPlotClient field/constructor/query(), useBoxPlotClient, and BoxPlotPanelRenderer all updated. getMosaicSqlTableReference replaces quoteTableReference for the SQL FROM clause. MosaicChartView passes renderContext.dataTable.table directly. Tests verify database-omitted canonical SQL references and dotted table-name preservation.
DeckMap bounds query: DeckMapBoundsQuerySource discriminated union
packages/deck/src/dashboard.tsx, packages/deck/__tests__/dashboard-ai-map.test.ts
Introduces DeckMapBoundsQuerySource discriminated union ({table: QualifiedTableName} or {sqlQuery: string}). createDeckMapBoundsQuery generates SQL from either branch via source.table.toString() or subquery-wrapped sqlQuery. DeckMapDashboardRenderer adds findTable lookup to build fitToDataBoundsSource memo; early-return guard, bounds-query call site, and useEffect dependency updated accordingly.
Consumer callsite migrations: cells, db, schema-tree, sql-editor
packages/cells/src/defaultCellRegistry.tsx, packages/cells/src/execution.ts, packages/db/src/DbSlice.ts, packages/schema-tree/src/nodes/TableTreeNode.tsx, packages/sql-editor/src/components/CreateTableModal.tsx, packages/sql-editor/src/utils/qualified-name-parser.ts, packages/pivot/__tests__/pivot-sql.test.ts, examples/code-editor/src/SqlEditor.tsx
Replaces makeQualifiedTableName(...) standalone calls with db.qualifyTableName(...) throughout cells, db, and sql-editor. TableTreeNode uses the pre-qualified table from nodeObject instead of deriving it. qualified-name-parser.ts drops optional chaining on table.table.table. CreateTableModal switches from makeQualifiedTableName to store qualifyTableName. Fixture objects in pivot tests and example code gain toFullString() methods.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Possibly related PRs

  • sqlrooms/sqlrooms#683: Directly introduces the tableSchemaContext.ts AI tooling layer (including getTableIdForAi, formatTableSchemaForAi, formatTableSummaryForAi) that this PR removes and replaces with QualifiedTableName.toString().
  • sqlrooms/sqlrooms#731: Refactors Mosaic to propagate QualifiedTableName and build SQL FROM clauses via getMosaicSqlTableReference, which directly matches this PR's new table-reference normalization for chart/query generation.

Suggested reviewers

  • dmitriy-kostianetskiy

Poem

🐇 A table's true name, once fully spelled out,
Now knows its default and may leave it out.
toFullString holds all, toString stays trim,
No helper functions left dangling on a limb.
The canonical rabbit hops, tidy and bright,
One qualified method to rule the night! ✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'fix: Standardize table name qualification across SQLRooms' directly and clearly describes the main change throughout the PR: standardizing how table references are qualified and referenced consistently across multiple files and modules.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch refactor-table-name-qualification

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@ilyabo ilyabo changed the title Standardize table name qualification across SQLRooms fix: Standardize table name qualification across SQLRooms Jun 19, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 2226fec544

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread packages/duckdb/src/DuckDbSlice.ts Outdated

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Nitpick comments (5)
packages/ai/__tests__/tableSchemaContext.test.ts (1)

8-31: ⚡ Quick win

Exercise default-database canonicalization in this fixture path.

Because makeQualifiedTableName is created without defaultDatabase, .toString() here never validates the “omit default database” branch. On Line 89, the expectation then locks in a fully-qualified local ID and misses the new canonical behavior coverage.

Proposed test-fixture update
 function makeTable(
   tableName: string,
   options: {
     database?: string;
     schema?: string;
+    defaultDatabase?: string;
     columns?: {name: string; type?: string}[];
     rowCount?: number;
     comment?: string;
   } = {},
 ): DataTable {
   return {
     tableName,
     table: makeQualifiedTableName({
       database: options.database,
       schema: options.schema ?? 'main',
       table: tableName,
+      defaultDatabase: options.defaultDatabase,
     }),
     isView: false,
@@
-    expect(output).toContain('tableId: "local"."main"."events"');
+    expect(output).toContain('tableId: "main"."events"');

As per coding guidelines **/*.test.{ts,tsx,js,jsx}: Add or update tests when changing behavior or public API, when practical.

Also applies to: 89-89

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/ai/__tests__/tableSchemaContext.test.ts` around lines 8 - 31, The
makeTable fixture function does not pass a defaultDatabase parameter when
calling makeQualifiedTableName, which means the test never exercises the code
path that omits the default database from the canonical representation. Update
the makeTable function to include a defaultDatabase option (defaulted
appropriately, such as to options.database or a test default value) and pass it
to the makeQualifiedTableName call. Additionally, update the expectation at line
89 to verify the canonical behavior where the database name is properly omitted
when it matches the default database, ensuring full coverage of the
canonicalization logic.

Source: Coding guidelines

packages/mosaic/src/charts/chart-types/box-plot/renderer/BoxPlotClient.ts (1)

42-51: ⚡ Quick win

Document exported BoxPlot query/client APIs with TSDoc.

BoxPlotClientOptions, buildBoxPlotQuery, and BoxPlotClient were updated as public exports; please add concise TSDoc so consumers understand the QualifiedTableName requirements and SQL-reference behavior.

As per coding guidelines, packages/**/*.{ts,tsx}: Add tsdoc to exported types and functions.

Also applies to: 132-213, 215-381

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/mosaic/src/charts/chart-types/box-plot/renderer/BoxPlotClient.ts`
around lines 42 - 51, Add comprehensive TSDoc documentation to the three public
exports in BoxPlotClient.ts: the BoxPlotClientOptions type, the
buildBoxPlotQuery function, and the BoxPlotClient class. For
BoxPlotClientOptions, document each property and explain the QualifiedTableName
requirements. For buildBoxPlotQuery and BoxPlotClient, provide clear
descriptions of their purpose, parameters, return values, and document the
SQL-reference behavior as applicable. Follow the existing TSDoc conventions in
the codebase to ensure consistency.

Source: Coding guidelines

packages/mosaic/src/charts/chart-types/base-types.ts (1)

153-170: ⚡ Quick win

Add TSDoc to the exported ChartRendererProps contract.

This interface’s public API changed (table now carries canonical qualified-name semantics), so a short TSDoc block should document expectations for downstream renderers.

As per coding guidelines, packages/**/*.{ts,tsx}: Add tsdoc to exported types and functions.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/mosaic/src/charts/chart-types/base-types.ts` around lines 153 - 170,
The exported interface ChartRendererProps lacks a TSDoc documentation block
above its declaration. Add a TSDoc comment block before the interface definition
that documents the purpose and contract of this interface for downstream
renderers. Include a note that the table property now carries canonical
qualified-name semantics as part of the public API contract. Follow the coding
guideline requiring TSDoc documentation for all exported types in the packages
directory.

Source: Coding guidelines

packages/mosaic/src/charts/chart-types/box-plot/renderer/useBoxPlotClient.ts (1)

13-21: ⚡ Quick win

Add TSDoc for the exported useBoxPlotClient hook.

Since the hook’s public input changed to QualifiedTableName, a brief TSDoc contract here will prevent misuse and make integration expectations explicit.

As per coding guidelines, packages/**/*.{ts,tsx}: Add tsdoc to exported types and functions.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/mosaic/src/charts/chart-types/box-plot/renderer/useBoxPlotClient.ts`
around lines 13 - 21, The exported function useBoxPlotClient is missing TSDoc
documentation. Add a TSDoc comment block above the function definition that
describes its purpose as a hook and documents the input parameters object, with
particular attention to explaining the table parameter which now uses the
QualifiedTableName type to make the contract explicit and prevent misuse during
integration.

Source: Coding guidelines

packages/deck/src/dashboard.tsx (1)

192-195: ⚡ Quick win

Add TSDoc for the exported createDeckMapBoundsQuery API.

This export is part of packages/ and should carry TSDoc for contract clarity.

📝 Suggested doc block
+/**
+ * Builds the SQL used to compute map bounds from either a table source
+ * or an arbitrary SQL source query.
+ */
 export function createDeckMapBoundsQuery(options: {
   source: DeckMapBoundsQuerySource;
   fitToData: DeckMapDashboardFitToDataConfig;
 }) {

As per coding guidelines, packages/**/*.{ts,tsx}: Add tsdoc to exported types and functions.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/deck/src/dashboard.tsx` around lines 192 - 195, The exported
function `createDeckMapBoundsQuery` in the dashboard module is missing TSDoc
documentation. Add a TSDoc comment block above the function definition that
documents the purpose of the function, describes the options parameter object
and its properties (source and fitToData), and documents the return type. This
will provide clear API contract documentation for consumers of this exported
function from the packages directory.

Source: Coding guidelines

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@packages/deck/src/dashboard.tsx`:
- Around line 502-516: In the fitToDataBoundsSource useMemo hook, the current
logic returns undefined when findTable(fitToDataSource.tableName) fails to
locate the table in the cache, which causes auto-fit to be skipped. Modify the
logic at the end of the useMemo where table is resolved to add a fallback path:
instead of immediately returning undefined when the table is not found, create a
qualified table reference directly from the fitToDataSource.tableName string
(the configured name itself) and use that as a fallback return value, ensuring
that bounds queries can still execute even when the schema-cache lookup misses.

In `@packages/duckdb/src/DuckDbSlice.ts`:
- Around line 792-794: The guard condition on line 792 in the
findUniqueMatchingTable fallback block is too permissive - it triggers for any
`database !== currentDatabase` check, even when the caller intentionally
specifies a different database, which can return the wrong table and cause
incorrect operations. Add an additional guard condition to only trigger this
fallback when dealing with a stale database reference scenario (not an
intentional explicit database reference). The condition should verify that the
database parameter was not explicitly provided by the caller before falling back
to findUniqueMatchingTable.

---

Nitpick comments:
In `@packages/ai/__tests__/tableSchemaContext.test.ts`:
- Around line 8-31: The makeTable fixture function does not pass a
defaultDatabase parameter when calling makeQualifiedTableName, which means the
test never exercises the code path that omits the default database from the
canonical representation. Update the makeTable function to include a
defaultDatabase option (defaulted appropriately, such as to options.database or
a test default value) and pass it to the makeQualifiedTableName call.
Additionally, update the expectation at line 89 to verify the canonical behavior
where the database name is properly omitted when it matches the default
database, ensuring full coverage of the canonicalization logic.

In `@packages/deck/src/dashboard.tsx`:
- Around line 192-195: The exported function `createDeckMapBoundsQuery` in the
dashboard module is missing TSDoc documentation. Add a TSDoc comment block above
the function definition that documents the purpose of the function, describes
the options parameter object and its properties (source and fitToData), and
documents the return type. This will provide clear API contract documentation
for consumers of this exported function from the packages directory.

In `@packages/mosaic/src/charts/chart-types/base-types.ts`:
- Around line 153-170: The exported interface ChartRendererProps lacks a TSDoc
documentation block above its declaration. Add a TSDoc comment block before the
interface definition that documents the purpose and contract of this interface
for downstream renderers. Include a note that the table property now carries
canonical qualified-name semantics as part of the public API contract. Follow
the coding guideline requiring TSDoc documentation for all exported types in the
packages directory.

In `@packages/mosaic/src/charts/chart-types/box-plot/renderer/BoxPlotClient.ts`:
- Around line 42-51: Add comprehensive TSDoc documentation to the three public
exports in BoxPlotClient.ts: the BoxPlotClientOptions type, the
buildBoxPlotQuery function, and the BoxPlotClient class. For
BoxPlotClientOptions, document each property and explain the QualifiedTableName
requirements. For buildBoxPlotQuery and BoxPlotClient, provide clear
descriptions of their purpose, parameters, return values, and document the
SQL-reference behavior as applicable. Follow the existing TSDoc conventions in
the codebase to ensure consistency.

In
`@packages/mosaic/src/charts/chart-types/box-plot/renderer/useBoxPlotClient.ts`:
- Around line 13-21: The exported function useBoxPlotClient is missing TSDoc
documentation. Add a TSDoc comment block above the function definition that
describes its purpose as a hook and documents the input parameters object, with
particular attention to explaining the table parameter which now uses the
QualifiedTableName type to make the contract explicit and prevent misuse during
integration.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 836412cb-fea6-4f9a-acb0-0a3c5d1e5eea

📥 Commits

Reviewing files that changed from the base of the PR and between 36dbc67 and 2ecf325.

📒 Files selected for processing (32)
  • examples/code-editor/src/SqlEditor.tsx
  • packages/ai/__tests__/tableSchemaContext.test.ts
  • packages/ai/src/index.ts
  • packages/ai/src/tools/defaultInstructions.ts
  • packages/ai/src/tools/tableSchemaContext.ts
  • packages/ai/src/tools/tables/listTables.ts
  • packages/ai/src/tools/tables/readTableSchema.ts
  • packages/ai/src/tools/tables/tableIdentity.ts
  • packages/cells/src/defaultCellRegistry.tsx
  • packages/cells/src/execution.ts
  • packages/db/src/DbSlice.ts
  • packages/deck/__tests__/dashboard-ai-map.test.ts
  • packages/deck/src/dashboard.tsx
  • packages/duckdb-core/README.md
  • packages/duckdb-core/__tests__/getUnqualifiedSqlIdentifier.test.ts
  • packages/duckdb-core/__tests__/schemaTreeUtils.test.ts
  • packages/duckdb-core/src/duckdb-utils.ts
  • packages/duckdb-core/src/schema-tree/schemaTreeUtils.ts
  • packages/duckdb/README.md
  • packages/duckdb/__tests__/DuckDbSlice.test.ts
  • packages/duckdb/src/DuckDbSlice.ts
  • packages/duckdb/src/loadTableSchemas.ts
  • packages/mosaic/__tests__/BoxPlotClient.test.ts
  • packages/mosaic/src/charts/MosaicChartView.tsx
  • packages/mosaic/src/charts/chart-types/base-types.ts
  • packages/mosaic/src/charts/chart-types/box-plot/renderer/BoxPlotClient.ts
  • packages/mosaic/src/charts/chart-types/box-plot/renderer/BoxPlotPanelRenderer.tsx
  • packages/mosaic/src/charts/chart-types/box-plot/renderer/useBoxPlotClient.ts
  • packages/pivot/__tests__/pivot-sql.test.ts
  • packages/schema-tree/src/nodes/TableTreeNode.tsx
  • packages/sql-editor/src/components/CreateTableModal.tsx
  • packages/sql-editor/src/utils/qualified-name-parser.ts
💤 Files with no reviewable changes (1)
  • packages/ai/src/index.ts

Comment thread packages/deck/src/dashboard.tsx Outdated
Comment thread packages/duckdb/src/DuckDbSlice.ts Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f2c650c55d

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +527 to +530
const table = findTable(fitToDataSource.tableName);
return {
table: table?.table ?? qualifyTableName(fitToDataSource.tableName),
};

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Parse stored table refs before fit-to-data fallback

When a map with fitToData renders before the schema cache contains fitToDataSource.tableName, this fallback passes the persisted dashboard string into qualifyTableName. That helper treats string inputs as literal table names, so a canonical id like "main"."events" becomes a relation literally named "main"."events" in the current schema instead of main.events; because this component only subscribes to the action functions, a later schema refresh does not necessarily rebuild the source, and the bounds query can fail while marking fit as handled. Parse the table reference or subscribe to the resolved table instead of qualifying the raw string.

Useful? React with 👍 / 👎.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@packages/duckdb/__tests__/DuckDbSlice.test.ts`:
- Around line 350-353: The test for the dropTable negative path is currently
swallowing the rejection error with .catch(() => undefined), which allows the
test to pass even if the database-miss guard stops throwing correctly. Remove
the .catch() handler and instead assert the rejection directly using
expect().rejects to validate that the dropTable call on the non-existent table
actually throws the expected error. This ensures the test properly validates
that the guard is triggered for the intended reason.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: d9bce405-a8d9-41fa-b6e1-00475a323ddf

📥 Commits

Reviewing files that changed from the base of the PR and between 2ecf325 and 6f6386a.

📒 Files selected for processing (8)
  • packages/ai/__tests__/tableSchemaContext.test.ts
  • packages/deck/src/dashboard.tsx
  • packages/duckdb-core/src/duckdb-utils.ts
  • packages/duckdb/__tests__/DuckDbSlice.test.ts
  • packages/duckdb/src/DuckDbSlice.ts
  • packages/mosaic/src/charts/chart-types/base-types.ts
  • packages/mosaic/src/charts/chart-types/box-plot/renderer/BoxPlotClient.ts
  • packages/mosaic/src/charts/chart-types/box-plot/renderer/useBoxPlotClient.ts
🚧 Files skipped from review as they are similar to previous changes (6)
  • packages/mosaic/src/charts/chart-types/box-plot/renderer/useBoxPlotClient.ts
  • packages/mosaic/src/charts/chart-types/base-types.ts
  • packages/deck/src/dashboard.tsx
  • packages/duckdb-core/src/duckdb-utils.ts
  • packages/mosaic/src/charts/chart-types/box-plot/renderer/BoxPlotClient.ts
  • packages/duckdb/src/DuckDbSlice.ts

Comment on lines +350 to +353
await store
.getState()
.db.dropTable('"remote"."main"."drop_database_miss"')
.catch(() => undefined);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Assert the rejection instead of swallowing it in this negative-path test.

Catching and discarding the dropTable error makes this test pass even if the explicit database-miss guard stops throwing for the intended reason. Assert rejection directly so this test validates both “no drop” and “guard triggered”.

Suggested test adjustment
-      await store
-        .getState()
-        .db.dropTable('"remote"."main"."drop_database_miss"')
-        .catch(() => undefined);
+      await expect(
+        store.getState().db.dropTable('"remote"."main"."drop_database_miss"'),
+      ).rejects.toThrow();
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
await store
.getState()
.db.dropTable('"remote"."main"."drop_database_miss"')
.catch(() => undefined);
await expect(
store.getState().db.dropTable('"remote"."main"."drop_database_miss"'),
).rejects.toThrow();
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/duckdb/__tests__/DuckDbSlice.test.ts` around lines 350 - 353, The
test for the dropTable negative path is currently swallowing the rejection error
with .catch(() => undefined), which allows the test to pass even if the
database-miss guard stops throwing correctly. Remove the .catch() handler and
instead assert the rejection directly using expect().rejects to validate that
the dropTable call on the non-existent table actually throws the expected error.
This ensures the test properly validates that the guard is triggered for the
intended reason.

@ilyabo
ilyabo merged commit c86c7f1 into main Jun 19, 2026
4 checks passed
@ilyabo
ilyabo deleted the refactor-table-name-qualification branch June 19, 2026 12:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant