Skip to content

chore(deck): upgrade @geoarrow/deck.gl-layers to @geoarrow/[email protected] - #745

Merged
igorDykhta merged 11 commits into
mainfrom
igr/geoarrow-upgrade
Jun 29, 2026
Merged

igorDykhta merged 11 commits into
mainfrom
igr/geoarrow-upgrade

Conversation

@igorDykhta

@igorDykhta igorDykhta commented Jun 20, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

  • Replaces the deprecated @geoarrow/[email protected] with its successor @geoarrow/[email protected]
  • Adds a createTableToRecordBatchAdapter utility to bridge the API change (0.4.x expects RecordBatch + Data instead of Table + Vector)
  • All GeoArrow layers used in the JSON pipeline are wrapped through the adapter so the existing data flow continues to work without changes upstream

What changed

The 0.4.x package changed its layer input contract from data: arrow.Table with geometry as arrow.Vector to data: arrow.RecordBatch with geometry as arrow.Data. The adapter splits a Table into per-batch sublayers and converts Vector props to their corresponding Data chunks — the same iteration the old library did internally. No data is copied; all geometry buffers are shared by reference.

Summary by CodeRabbit

  • New Features
    • Added a table-to-record-batch adapter to improve GeoArrow-driven JSON layer rendering for both single- and multi-batch inputs.
    • Updated GeoArrow-backed JSON layers to use GeoArrow-native layer implementations.
  • Bug Fixes
    • Fixed multi-batch row indexing for hexagon accessors to use the correct batch and local row.
    • Improved GeoArrow accessor compilation/runtime compatibility with GeoArrow 0.4.x behavior.
  • Documentation
    • Updated GeoArrow/deck.gl integration package references and compatibility notes.
    • Clarified fit-to-bounds configuration input shape.

Signed-off-by: Ihor Dykhta <[email protected]>
@coderabbitai

coderabbitai Bot commented Jun 20, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

This PR switches the deck package to @geoarrow/deck.gl-geoarrow, adds a Table-to-RecordBatch adapter, rewires GeoArrow JSON layers to use it, updates accessor handling for 0.4.x batch context, and tightens the deck map fitToData schema.

Changes

GeoArrow deck.json migration

Layer / File(s) Summary
Adapter and runtime contract
packages/deck/src/json/layers/createTableToRecordBatchAdapter.ts, packages/deck/src/json/layers/index.ts, packages/deck/src/prepare/types.ts, packages/deck/src/json/compileGeoArrowAccessor.ts, packages/deck/src/json/rewriteGeoArrowAccessors.ts
createTableToRecordBatchAdapter renders upstream GeoArrow layers from RecordBatch inputs or per-batch slices from Table inputs, and the related comments describe the 0.4.x input and accessor contract.
Default GeoArrow JSON classes
packages/deck/src/json/defaultClasses.ts
DEFAULT_DECK_JSON_CLASSES now wraps scatterplot, heatmap, path, polygon, solid polygon, and arc GeoArrow entries with createTableToRecordBatchAdapter and is typed as a constructor map.
DeckColumnLayer adapter
packages/deck/src/json/layers/DeckColumnLayer.ts
DeckColumnLayer now imports GeoArrowColumnLayer from @geoarrow/deck.gl-geoarrow and exports an adapter constant instead of a subclass.
H3 batch context
packages/deck/src/json/layers/DeckH3HexagonLayer.ts
DeckH3HexagonLayer resolves per-batch row context for compiled accessors and passes batch-local indices to GeoArrow callbacks.
Package name references
packages/deck/package.json, packages/deck/README.md, packages/deck/src/json/layers/DeckTripsLayer.ts
The deck package dependency and README references move to @geoarrow/deck.gl-geoarrow, and the trips comment is rewritten in past tense.
Deck map fit-to-data schema
packages/deck/src/ai.ts
fitToData changes from an unstructured record to a structured optional object with explicit dataset and column fields.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

  • sqlrooms/sqlrooms#654: Both PRs modify packages/deck/src/ai.ts and the deck-map config shape around fitToData.
  • sqlrooms/sqlrooms#700: Both PRs change the deck GeoArrow wrapper layers and adapter wiring in packages/deck.

Suggested reviewers

  • ilyabo
  • dmitriy-kostianetskiy

Poem

A rabbit hopped through Table lanes,
To RecordBatch fields and GeoArrow plains.
New wrappers leapt, batch by batch,
While schema carrots kept the catch.
Thump—deck.gl twitched its whiskers bright.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 12.50% 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 clearly and concisely states the main change: upgrading the GeoArrow deck.gl package from @geoarrow/deck.gl-layers to @geoarrow/deck.gl-geoarrow@0.4.1.
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.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch igr/geoarrow-upgrade

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.

Ihor Dykhta added 2 commits June 21, 2026 01:26
@igorDykhta igorDykhta self-assigned this Jun 22, 2026
@igorDykhta
igorDykhta marked this pull request as ready for review June 26, 2026 11:46

@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: 08dbd2453b

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment on lines +39 to +40
const table = data as arrow.Table;
const batches = table.batches;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Guard loading placeholder data before splitting batches

When a managed dataset is still loading, createDeckJsonConfiguration returns data: [] for GeoArrow layers; this adapter treats any truthy value as an Arrow Table and immediately reads table.batches. On the initial/loading render, batches is undefined and batches.length throws instead of rendering an empty layer, so maps can crash until the dataset becomes ready. Guard non-Table values before this split.

Useful? React with 👍 / 👎.

batchProps[propName] = chunkData;
}
} else {
batchProps[propName] = propValue;

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 Preserve generated IDs for each batch layer

For multi-batch tables, otherProps still contains the parent id, so this assignment overwrites the per-batch id created above with the same id for every sublayer. Deck tracks layers by id, so multiple RecordBatches from one table produce duplicate GeoArrow layer ids and can cause later batches to replace or confuse earlier ones during updates/picking/rendering; exclude id from otherProps or apply the generated id last.

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: 2

🧹 Nitpick comments (2)
packages/deck/README.md (1)

20-20: 📐 Maintainability & Code Quality | 🔵 Trivial

Update the GitHub repository URLs to match the renamed repository.

The repository for @geoarrow/deck.gl-geoarrow has been renamed from deck.gl-layers to deck.gl-geoarrow. While the existing link redirects successfully, it should be updated to the canonical URL to align with the package name and eliminate reliance on redirects.

Location Current URL
packages/deck/README.md:20 https://github.com/geoarrow/deck.gl-layers
packages/deck/README.md:442 https://github.com/geoarrow/deck.gl-layers

Update both instances to: https://github.com/geoarrow/deck.gl-geoarrow.

🤖 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/README.md` at line 20, The README links for
`@geoarrow/deck.gl-geoarrow` still point to the old deck.gl-layers repository URL;
update both GitHub links in the packages/deck/README.md references to use the
canonical deck.gl-geoarrow repository so they match the package name and avoid
redirect reliance.
packages/deck/src/json/layers/createTableToRecordBatchAdapter.ts (1)

14-71: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Add a unit test for the new adapter behavior.

This adapter encapsulates non-trivial branching (RecordBatch passthrough, multi-batch splitting, Vector→Data mapping). A small test over a 2-batch Table and a RecordBatch input would lock in the contract.

As per coding guidelines: "Add or update tests when changing behavior or public API, when practical".

🤖 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/json/layers/createTableToRecordBatchAdapter.ts` around
lines 14 - 71, Add unit tests for createTableToRecordBatchAdapter to lock in the
new branching behavior: verify that a RecordBatch input is passed through to a
single UpstreamLayer instance unchanged, and that a multi-batch arrow.Table is
split into one sublayer per batch with the expected batch-specific data and
props mapping. Use the createTableToRecordBatchAdapter factory and the
Adapter/renderLayers path in the test so the contract stays covered if internals
change.

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/json/layers/createTableToRecordBatchAdapter.ts`:
- Around line 29-36: The RecordBatch passthrough in
createTableToRecordBatchAdapter currently forwards otherProps without converting
arrow.Vector values to arrow.Data, which can break downstream layers expecting
Data. Reuse the same Vector-to-Data conversion logic already applied in the
Table branch, and run it in the RecordBatch path before constructing the
UpstreamLayer so rewriteGeoArrowAccessors outputs are normalized consistently
for both branches.

In `@packages/deck/src/json/layers/DeckColumnLayer.ts`:
- Around line 29-39: The DeckColumnLayer export currently only wraps
GeoArrowColumnLayer with createTableToRecordBatchAdapter, but the wireframe
workaround for deck.gl `#10021` is missing while the comment still claims it
exists. Either reintroduce the ColumnLayer.prototype.draw patch around
GeoArrowColumnLayer before exporting DeckColumnLayer, or confirm the underlying
`@deck.gl/layers` version is already at the fixed v9.3.4+ and then update the
comment to remove the obsolete workaround reference.

---

Nitpick comments:
In `@packages/deck/README.md`:
- Line 20: The README links for `@geoarrow/deck.gl-geoarrow` still point to the
old deck.gl-layers repository URL; update both GitHub links in the
packages/deck/README.md references to use the canonical deck.gl-geoarrow
repository so they match the package name and avoid redirect reliance.

In `@packages/deck/src/json/layers/createTableToRecordBatchAdapter.ts`:
- Around line 14-71: Add unit tests for createTableToRecordBatchAdapter to lock
in the new branching behavior: verify that a RecordBatch input is passed through
to a single UpstreamLayer instance unchanged, and that a multi-batch arrow.Table
is split into one sublayer per batch with the expected batch-specific data and
props mapping. Use the createTableToRecordBatchAdapter factory and the
Adapter/renderLayers path in the test so the contract stays covered if internals
change.
🪄 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: e9ab005f-ae26-4dd1-b2ed-cdbf8830133c

📥 Commits

Reviewing files that changed from the base of the PR and between 3b3bb0a and 08dbd24.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (11)
  • packages/deck/README.md
  • packages/deck/package.json
  • packages/deck/src/json/compileGeoArrowAccessor.ts
  • packages/deck/src/json/defaultClasses.ts
  • packages/deck/src/json/layers/DeckColumnLayer.ts
  • packages/deck/src/json/layers/DeckH3HexagonLayer.ts
  • packages/deck/src/json/layers/DeckTripsLayer.ts
  • packages/deck/src/json/layers/createTableToRecordBatchAdapter.ts
  • packages/deck/src/json/layers/index.ts
  • packages/deck/src/json/rewriteGeoArrowAccessors.ts
  • packages/deck/src/prepare/types.ts

Comment thread packages/deck/src/json/layers/createTableToRecordBatchAdapter.ts
Comment on lines +29 to +39
* GeoArrowColumnLayer adapter that accepts Table + Vector data (the format
* used by our JSON pipeline) and bridges to the 0.4.x RecordBatch API.
* Also includes a fix for the deck.gl ColumnLayer wireframe index buffer
* bug (#10021).
*
* Remove this wrapper once deck.gl includes the upstream fix (PR #10094).
* Remove the prototype patch once deck.gl includes the upstream fix (PR #10094).
*/
export class DeckColumnLayer<
ExtraProps extends object = object,
> extends GeoArrowColumnLayer<ExtraProps> {
static layerName = 'GeoArrowColumnLayer';
}
export const DeckColumnLayer = createTableToRecordBatchAdapter(
GeoArrowColumnLayer as any,
'GeoArrowColumnLayer',
);

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.

🎯 Functional Correctness | 🔴 Critical

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Inspect what the previous DeckColumnLayer implementation did (the removed prototype patch)
fd -t f 'DeckColumnLayer.ts' packages/deck
git log --oneline -n 5 -- packages/deck/src/json/layers/DeckColumnLayer.ts
git show HEAD~1:packages/deck/src/json/layers/DeckColumnLayer.ts 2>/dev/null | sed -n '1,80p'
# Check whether the adapter implements any wireframe / prototype patch
rg -nP -C3 'wireframe|prototype|10021|10094' packages/deck/src

Repository: sqlrooms/sqlrooms

Length of output: 2556


🌐 Web query:

deck.gl PR #10094 merged ColumnLayer wireframe index buffer fix version

💡 Result:

The fix for the ColumnLayer wireframe index buffer issue was implemented in deck.gl Pull Request #10094, titled "fix(ColumnLayer): closed shapes with binary data and transition props" [1]. This pull request was merged into the master branch and officially included in deck.gl version v9.3.4 [2][3]. The fix addresses a bug where the ColumnLayer, which used a shared geometry for both fill and wireframe models, would incorrectly re-attach wireframe indices to the fill model during binary-data transitions or HMR (Hot Module Replacement) rebuilds [1]. This resulted in "open" or missing faces in the rendered columns [1]. The PR resolved this by ensuring the fill model uses a separate, non-indexed geometry [1].

Citations:


🌐 Web query:

@geoarrow/deck.gl-geoarrow changelog 0.4 0.4.1 0.4.2 ColumnLayer wireframe fix

💡 Result:

The @geoarrow/deck.gl-geoarrow package (formerly @geoarrow/deck.gl-layers) versions 0.4.0, 0.4.1, and 0.4.2 do not contain specific mentions of a ColumnLayer wireframe fix in their respective release notes [1][2][3][4][5]. The release v0.4.1 (published 2026-05-18) included only the following changes: - Exporting types from types.ts through the top-level package [1]. - A fix for extending objects [1]. While a significant fix for ColumnLayer wireframe/rendering issues (specifically related to closed shapes and binary data) was merged into the upstream deck.gl library in March 2026 (Pull Request #10094), there is no evidence that @geoarrow/deck.gl-geoarrow addressed a similar issue in the 0.4.x release series [1][6]. Users experiencing issues with ColumnLayer wireframe rendering are likely encountering behavior inherent to the core deck.gl library rather than the geoarrow-specific wrapper [7][6].

Citations:


Wireframe fix (deck.gl #10021) was removed but the comment falsely claims it remains.

The current code exports only createTableToRecordBatchAdapter(GeoArrowColumnLayer, ...) with no prototype patch or wireframe-related logic. The previous implementation explicitly overrode ColumnLayer.prototype.draw (lines 10–27 in HEAD~1) to work around deck.gl bug #10021; this workaround is entirely missing. The comment (lines 29–35) is stale and misleading.

The upstream fix exists in deck.gl v9.3.4 (PR #10094), but @geoarrow/deck.gl-geoarrow 0.4.x release notes do not indicate inheritance of this fix. Until the underlying ColumnLayer used by GeoArrowColumnLayer is confirmed to include v9.3.4+, the workaround must be re-applied inside or around the adapter.

Either:

  • Re-apply the prototype patch within the adapter or in a wrapper before export, or
  • Verify the @deck.gl/layers version beneath @geoarrow/deck.gl-geoarrow is ≥9.3.4 and update the comment to remove the obsolete prototype-patch reference.
🤖 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/json/layers/DeckColumnLayer.ts` around lines 29 - 39, The
DeckColumnLayer export currently only wraps GeoArrowColumnLayer with
createTableToRecordBatchAdapter, but the wireframe workaround for deck.gl `#10021`
is missing while the comment still claims it exists. Either reintroduce the
ColumnLayer.prototype.draw patch around GeoArrowColumnLayer before exporting
DeckColumnLayer, or confirm the underlying `@deck.gl/layers` version is already at
the fixed v9.3.4+ and then update the comment to remove the obsolete workaround
reference.

Ihor Dykhta added 2 commits June 27, 2026 01:12
Signed-off-by: Ihor Dykhta <[email protected]>
Signed-off-by: Ihor Dykhta <[email protected]>

@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: 6a7df932fa

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment on lines +31 to +35
return new UpstreamLayer({
...otherProps,
id: `${this.props.id}-0`,
data,
} as Record<string, unknown>);

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 Convert RecordBatch vector props before pass-through

When a caller uses this RecordBatch branch with accessors from the batch (for example getPosition: recordBatch.getChild('geom')), otherProps still contains Arrow Vectors. The Table path converts vectors to Data chunks, but this branch sends them directly to the 0.4 GeoArrow layer, whose render path expects arrow.Data and throws for geometry accessors instead of rendering. Convert Vector props to their first chunk here as well.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

looks like this is a real issue we should fix

Ihor Dykhta added 3 commits June 27, 2026 02:36
@ilyabo

ilyabo commented Jun 27, 2026

Copy link
Copy Markdown
Collaborator

Maybe for a follow-up PR:


would it make sense to change SQLRooms's existing Table + Vector preparation contract? what would be the cleanest way to solve this?

Yes, it could make sense, but I would not change the whole prepared/map boundary just to remove createTableToRecordBatchAdapter.

Cleanest shape, to me:

  1. Keep prepareDeckDataset table-oriented.
    SQLRooms’ data model is naturally table-first: queries return arrow.Table, cache entries are table-shaped, color scales and expression compilation want whole-table schema/context, and non-GeoArrow layers also consume table-derived products. Making the core prepared dataset “batch-first” would leak a rendering detail upward.

  2. Add a GeoArrow-specific prepared render payload.
    Instead of exposing only:

{
  table,
  geometryColumn: arrow.Vector,
}

expose something like:

{
  table,
  batches: Array<{
    batch: arrow.RecordBatch;
    geometry: arrow.Data;
    columns: Record<string, arrow.Data>;
    rowOffset: number;
  }>
}

or more minimally, a helper:

forEachGeoArrowBatch(layerData, (batchContext) => ...)

That makes the batch split a first-class prepared/render concept without making all of SQLRooms batch-native.

  1. Move Vector -> Data conversion out of the layer class adapter.
    The adapter is okay as a compatibility shim, but the cleaner long-term place is the map JSON preprocessing stage: once SQLRooms resolves bindings, it should know which props are geometry/vector accessors and materialize batch-local layer props explicitly.

  2. Have createDeckJsonConfiguration expand one logical GeoArrow JSON layer into N physical upstream layers.
    The user-authored spec can stay simple:

{"@@type": "GeoArrowScatterplotLayer", "_sqlroomsBinding": {"dataset": "x"}}

but internally SQLRooms can produce per-batch upstream layers using real @geoarrow/deck.gl-geoarrow classes directly.

So my answer: yes, but the boundary should become “table-first plus GeoArrow batch views,” not “everything becomes RecordBatch/Data.” That keeps SQLRooms’ local-first/query-first model intact while removing the fake constructor compatibility layer.

Short-term, I’d keep the adapter and fix its RecordBatch + Vector gap. Medium-term, I’d replace it with a prepareGeoArrowLayerBatches(...) helper used by JSON preprocessing. That feels like the cleanest line.

Signed-off-by: Ihor Dykhta <[email protected]>

@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: 162367f043

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment on lines +53 to +54
const batches = table.batches;
const batchOffsets = new Int32Array(batches.length);

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 Guard H3 placeholders before reading batches

When a managed H3 layer is still loading, createDeckJsonConfiguration returns stripped props with data: [] and can leave an explicit getHexagon such as @@=h3 in place. This new batch-offset setup assumes data is an Arrow Table and immediately reads table.batches.length, so the initial/loading render crashes before the dataset becomes ready; guard non-Table placeholder data here as the generic GeoArrow adapter does.

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: 2

🧹 Nitpick comments (1)
packages/deck/src/ai.ts (1)

190-215: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Add regression coverage for the new fitToData contract and normalization path.

This change both narrows the accepted schema and silently rewrites malformed nested input, so a small test matrix for flat point/geometry/H3 cases plus the nested-wrapper repair would pay off quickly. As per coding guidelines, **/*.{js,ts,jsx,tsx}: Add or update tests when changing behavior or public API, when practical.

Also applies to: 274-290

🤖 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/ai.ts` around lines 190 - 215, Add regression tests for the
updated fitToData API and its normalization behavior. Cover the accepted
fitToData shapes in ai.ts for flat point data (longitudeColumn/latitudeColumn),
geometryColumn, and h3Column, and add a case for the nested-wrapper repair path
that rewrites malformed input into the normalized contract. Update or add tests
around the fitToData schema/normalization logic so the new public behavior is
locked in.

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/__tests__/createTableToRecordBatchAdapter.test.ts`:
- Around line 141-150: This test is mislabeled because table.slice(0, 0) still
produces one empty RecordBatch, so it never covers the zero-batch branch in
createTableToRecordBatchAdapter. Update the case in
createTableToRecordBatchAdapter.test.ts to either build a true zero-batch Table
and assert callRenderLayers returns null for the !batches.length path, or rename
the test to reflect the single-empty-batch behavior. Use the existing
callRenderLayers helper and the adapter behavior in
createTableToRecordBatchAdapter as the reference points.

In `@packages/deck/src/ai.ts`:
- Around line 190-215: The fitToData schema description is missing the valid H3
dataset-only path, so update the description on the fitToData z.object in ai.ts
to mention that callers can provide just dataset when bounds can be inferred
from H3 layers via h3Column, alongside the existing geometryColumn and
longitudeColumn+latitudeColumn cases. Keep the wording aligned with
useDeckMapFitToBounds and the fitToData validator so the AI is guided toward the
supported H3 flow.

---

Nitpick comments:
In `@packages/deck/src/ai.ts`:
- Around line 190-215: Add regression tests for the updated fitToData API and
its normalization behavior. Cover the accepted fitToData shapes in ai.ts for
flat point data (longitudeColumn/latitudeColumn), geometryColumn, and h3Column,
and add a case for the nested-wrapper repair path that rewrites malformed input
into the normalized contract. Update or add tests around the fitToData
schema/normalization logic so the new public behavior is locked in.
🪄 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: 293525f0-d2c2-4212-b5a5-b98c2d9d5c86

📥 Commits

Reviewing files that changed from the base of the PR and between 1e86c79 and 162367f.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (4)
  • packages/deck/README.md
  • packages/deck/__tests__/createTableToRecordBatchAdapter.test.ts
  • packages/deck/src/ai.ts
  • packages/deck/src/json/layers/createTableToRecordBatchAdapter.ts
✅ Files skipped from review due to trivial changes (1)
  • packages/deck/README.md
🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/deck/src/json/layers/createTableToRecordBatchAdapter.ts

Comment thread packages/deck/__tests__/createTableToRecordBatchAdapter.test.ts
Comment thread packages/deck/src/ai.ts
Comment on lines +190 to +215
fitToData: z
.object({
dataset: z.string().describe('Dataset id to compute bounds from.'),
longitudeColumn: z
.string()
.optional()
.describe('Longitude column name for point data.'),
latitudeColumn: z
.string()
.optional()
.describe('Latitude column name for point data.'),
geometryColumn: z
.string()
.optional()
.describe('WKB geometry column name for computing bounds.'),
h3Column: z
.string()
.optional()
.describe('H3 hex index column for computing bounds.'),
padding: z.number().optional(),
maxZoom: z.number().optional(),
})
.optional()
.describe(
'Fit map view to data bounds. Provide dataset plus either geometryColumn (for WKB geometry) or longitudeColumn+latitudeColumn (for separate coordinate columns). Example: {"dataset": "myDataset", "geometryColumn": "geom"}',
),

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.

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Include the H3 dataset-only case in this schema description.

The validator allows { "dataset": "..." }, and useDeckMapFitToBounds can infer h3Column from bound layers, but the current description says callers need geometryColumn or longitudeColumn+latitudeColumn. That mismatch will push the AI away from the valid H3 path documented earlier in this file.

🤖 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/ai.ts` around lines 190 - 215, The fitToData schema
description is missing the valid H3 dataset-only path, so update the description
on the fitToData z.object in ai.ts to mention that callers can provide just
dataset when bounds can be inferred from H3 layers via h3Column, alongside the
existing geometryColumn and longitudeColumn+latitudeColumn cases. Keep the
wording aligned with useDeckMapFitToBounds and the fitToData validator so the AI
is guided toward the supported H3 flow.

Ihor Dykhta Ihor Dykhta
nit
Signed-off-by: Ihor Dykhta <[email protected]>
@igorDykhta
igorDykhta merged commit cd00b0f into main Jun 29, 2026
3 checks passed
@igorDykhta
igorDykhta deleted the igr/geoarrow-upgrade branch June 29, 2026 14:52
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