Skip to content

feat: Kepler: use fully qualified names for datasets loading errors - #652

Closed
bdjulbic wants to merge 4 commits into
mainfrom
feat/use-fully-qualified-names
Closed

bdjulbic wants to merge 4 commits into
mainfrom
feat/use-fully-qualified-names

Conversation

@bdjulbic

@bdjulbic bdjulbic commented May 21, 2026 •

Copy link
Copy Markdown
Collaborator

Summary by CodeRabbit

  • Bug Fixes

    • Enhanced error handling and reporting for missing dataset references when synchronizing map data; failures are now caught and logged with detailed diagnostic information for troubleshooting.
  • Chores

    • Updated Jest and development dependencies to improve testing environment stability; restructured dependency configurations for better consistency.

Review Change Stack

@coderabbitai

coderabbitai Bot commented May 21, 2026 •

Copy link
Copy Markdown
Contributor
📝 Walkthrough

Walkthrough

This PR refines Kepler dataset synchronization by streamlining the sync logic and updating metadata handling. The addTableToMap function now coerces dataset labels to strings, and syncKeplerDatasets removes the table availability precondition, directly attempting sync for missing datasets with error logging. Configuration updates adjust Jest and pnpm overrides.

Changes

Kepler Dataset Sync Refinement

Layer / File(s) Summary
Dataset label metadata update
packages/kepler/src/KeplerSlice.ts
addTableToMap coerces tableName to a string for datasets.info.label while keeping datasets.info.id as tableName.
Dataset sync logic simplification
packages/kepler/src/KeplerSlice.ts
syncKeplerDatasets removes the database-table availability pre-check, directly calls addTableToMap for missing datasets, wraps in try/catch, and logs errors with dataId and the exception.
Configuration updates
package.json
Jest overrides extended with @jest/core, jest-mock, and jest-runtime; pnpm patchedDependencies reordered before ignoredBuiltDependencies.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Possibly related PRs

  • sqlrooms/sqlrooms#533: Modifies the same syncKeplerDatasets and addTableToMap functions in KeplerSlice.ts to adjust dataset selection and sync behavior.

Suggested reviewers

  • ilyabo

Poem

🐰 Kepler flows cleaner now, no checks in between,
Dataset labels stringified, a sharper scene,
Config tweaks tidy up the Jest parade,
Sync logic dances, error logs well-laid! 🎯

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 75.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Title check ⚠️ Warning The title refers to 'fully qualified names for datasets loading errors', but the actual changes involve updating Jest dependency overrides in package.json and modifying Kepler dataset metadata handling with error wrapping. The title does not accurately reflect these primary changes. Update the title to better reflect the main changes, such as 'refactor: Update Jest dependencies and improve Kepler dataset metadata handling with error handling' or similar.
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
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 feat/use-fully-qualified-names

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.

@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.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
packages/kepler/src/KeplerSlice.ts (1)

653-662: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Reintroduce identifier validation before syncing missing datasets.

At Line 658, dataId is used as a table identifier without a validity/existence gate. Since these IDs come from map config references, non-table or malformed IDs will now hit DB query construction/execution on every sync pass and fail repeatedly. Add a guard before addTableToMap (or validate inside addTableToMap) so only resolvable table identifiers are queried.

Suggested fix
for (const dataId of referencedDataIds) {
  if (keplerDatasets?.[dataId]) {
    continue;
  }
+ const tableExists = Boolean(get().db.tables?.[dataId]);
+ if (!tableExists) {
+   continue;
+ }
  try {
    await get().kepler.addTableToMap(mapId, dataId, {
      autoCreateLayers: false,
      centerMap: false,
    });
  } catch (e) {
🤖 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/kepler/src/KeplerSlice.ts` around lines 653 - 662, The loop over
referencedDataIds calls get().kepler.addTableToMap(mapId, dataId, ...) without
validating dataId; add a pre-check to only attempt sync for resolvable table
identifiers (e.g., verify format and existence via your table registry or kepler
dataset index) before calling addTableToMap. Specifically, in the block that
iterates referencedDataIds, guard with a predicate like "isValidTableId(dataId)"
or "knownTables.has(dataId)" (or add the same guard inside addTableToMap) so
malformed/non-table IDs are skipped and never used to construct DB queries; keep
the existing keplerDatasets check and apply the new identifier validation
immediately before the call to get().kepler.addTableToMap(mapId, dataId, {...}).
🤖 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.

Outside diff comments:
In `@packages/kepler/src/KeplerSlice.ts`:
- Around line 653-662: The loop over referencedDataIds calls
get().kepler.addTableToMap(mapId, dataId, ...) without validating dataId; add a
pre-check to only attempt sync for resolvable table identifiers (e.g., verify
format and existence via your table registry or kepler dataset index) before
calling addTableToMap. Specifically, in the block that iterates
referencedDataIds, guard with a predicate like "isValidTableId(dataId)" or
"knownTables.has(dataId)" (or add the same guard inside addTableToMap) so
malformed/non-table IDs are skipped and never used to construct DB queries; keep
the existing keplerDatasets check and apply the new identifier validation
immediately before the call to get().kepler.addTableToMap(mapId, dataId, {...}).

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 6aeff8c0-101c-4aec-8cc5-7e43029bdbcc

📥 Commits

Reviewing files that changed from the base of the PR and between 821b7c6 and df43b45.

📒 Files selected for processing (1)
  • packages/kepler/src/KeplerSlice.ts

@ilyabo ilyabo changed the title feat: use fully qualified names feat: Kepler: use fully qualified names for datasets loading errors May 21, 2026
@bdjulbic bdjulbic closed this Jun 1, 2026
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.

2 participants