Repository navigation
feat: share block-document Ask AI and Deck map helpers across hosts - #805
Conversation
Add a header "Ask AI" affordance to stateful block-document blocks that opens a prompt popover, seeds an artifact-scoped chat with an explicit block context item, and routes the agent to edit that specific block. Shared: - @sqlrooms/documents: BlockAiTarget + blockContextItemId/parse/defaultBlockTitle; renderBlockHeaderActions slot + hasOwnHeaderActions on renderer providers/node-views; optional BlockDocumentAiAdapter.updateBlock. - @sqlrooms/ai-config: createBlockContextItem (re-exported via ai-core/ai). - @sqlrooms/ai-core: BlockAiPromptPopover; startAnalysisWhenReady. - @sqlrooms/artifacts/ai: findAiSessionForArtifactWithContextItem. - @sqlrooms/mosaic: createBlockDocumentChartTools targetBlockId (in-place chart edit). - @sqlrooms/deck: optional headerActions prop on DeckMapBlockRenderer. CLI app (chart/dashboard/html-app/map): block context resolve/format, selector items + validation, startBlockScopedChat, header wiring, targetBlock routing. Co-Authored-By: Claude Opus 4.8 <[email protected]>
…qlrooms into feat/block-ai-popover
Stateful blocks reused `title` for two unrelated purposes: the embedded artifact's name (dashboards, SQL queries, Python blocks, etc.) and — for `data-table` only — the bound table identity. Data-table even initialized `title` to the artifact name then silently overwrote it with a table reference, which was confusing and diverged from the sibling `chart` block's `tableName`. Add a dedicated `tableName` attribute to stateful blocks and switch the data-table binding to it, aligning with the `chart` convention. `title` now consistently means the embedded artifact name across all block types. - schema + Tiptap node attr + node<->block round-trip carry `tableName` - renderer context exposes `tableName` / `onTableNameChange` - DataTableBlockRenderer reads/writes `tableName` instead of `title` - create-stateful-block command gains an optional `tableName` param - list-blocks summary surfaces `tableName`; tsdoc + README document the title / caption / tableName distinction Co-Authored-By: Claude Opus 4.8 <[email protected]>
…qlrooms into feat/block-ai-popover
…qlrooms into feat/block-ai-popover
Promote startBlockScopedChat, Ask AI header actions, point-map normalization, createOrUpdateDeckMapBlock, dataset-source utils, and map block registration so FSQ and CLI stop duplicating host glue. Co-authored-by: Cursor <[email protected]>
|
Note Reviews pausedIt 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 Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughThis PR adds shared Deck map create/update and normalization helpers, block-scoped Ask AI chat wiring, block-document agent validation, and related export, store, and package metadata updates. ChangesDeck map block create/update orchestration
Block-scoped Ask AI chat
Block-document agent tool targetBlock validation
Package metadata and exports
Estimated code review effort: 4 (Complex) | ~60 minutes Sequence Diagram(s)sequenceDiagram
participant CLI as CLI Command
participant Orchestrator as createOrUpdateDeckMapBlock
participant Host as CreateOrUpdateDeckMapBlockHost
participant Panel as Deck Map Panel
CLI->>Orchestrator: params (mapId, config, tableName)
Orchestrator->>Host: findMapBlock / findMapPanel
Orchestrator->>Host: findTable(tableName)
alt block exists
Orchestrator->>Host: updateBlockMetadata
else create new
Orchestrator->>Host: createMapBlock
end
Orchestrator->>Host: ensureDashboard / ensureMapState
Orchestrator->>Panel: build panel from prepared config
Orchestrator->>Host: addOrUpdateMapPanel
Orchestrator-->>CLI: result (blockId, panelId, selectedTable, created)
sequenceDiagram
participant UI as Worksheet Header Action
participant Chat as startBlockScopedChat
participant Actions as StartBlockScopedChatActions
participant Toast as toast.error
UI->>Chat: startBlockScopedChat(target, prompt)
Chat->>Actions: validate artifact / select artifact
Chat->>Actions: findAiSessionForArtifactWithContextItem(running)
alt session already running
Chat->>Toast: error("AI chat already running")
Chat->>Actions: switch to running session
else no running session
Chat->>Actions: reuse or create session
Chat->>Actions: set draft context item ids
Chat->>UI: revealAssistant()
Chat->>Actions: setPrompt / startAnalysisWhenReady
end
Possibly related PRs
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b3e56ceeb9
ℹ️ 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".
There was a problem hiding this comment.
Actionable comments posted: 12
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (2)
packages/deck/src/block.tsx (1)
343-361: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick winAdd
stopPropagationwrapper forheaderActionsto matchChartBlockHeader.At line 346,
{headerActions}is rendered directly without click propagation stopping.ChartBlockHeaderwrapsheaderActionsin a<div onClick={(event) => event.stopPropagation()}>to prevent triggeringBlockDocumentStatefulBlockNodeView'sonClick={handleClick}(which selects the block). SinceDeckMapBlockRendereris rendered inside the sameNodeViewWrapper, clicking AI actions on the map block will unintentionally trigger block selection.🔧 Proposed fix to stop propagation on map header actions
<div className="flex items-center gap-0.5"> - {headerActions} + {headerActions ? ( + <div + className="flex items-center gap-0.5" + onClick={(event) => event.stopPropagation()} + > + {headerActions} + </div> + ) : null} {HeaderActions ? <HeaderActions {...rendererProps} /> : null}🤖 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/block.tsx` around lines 343 - 361, `DeckMapBlockRenderer` is rendering `headerActions` directly, so clicks can bubble to `BlockDocumentStatefulBlockNodeView` and select the block. Update the header actions area in `block.tsx` to wrap `headerActions` with a click-stopping container, matching the pattern used in `ChartBlockHeader`, and keep `HeaderActions`/`Button` behavior unchanged.apps/sqlrooms-cli-ui/src/workspace/WorksheetArtifact.tsx (1)
167-282: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick winDocument
startBlockScopedChatinpackages/documents/README.md. The package exports this new public helper fromsrc/index.ts, but the README doesn’t mention it yet.🤖 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 `@apps/sqlrooms-cli-ui/src/workspace/WorksheetArtifact.tsx` around lines 167 - 282, The new public helper startBlockScopedChat is exported via src/index.ts but is missing from the package documentation. Update packages/documents/README.md to mention startBlockScopedChat alongside the other public APIs, using the same naming as the call site in WorksheetArtifact and the export surface in src/index.ts so consumers can discover it.
🧹 Nitpick comments (9)
apps/sqlrooms-cli-ui/src/context/getRunContext.ts (1)
28-28: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winExtract
resolveCliBlockLabelandCLI_BLOCK_CONTEXT_TYPESto a shared module.Both
resolveCliBlockLabelandCLI_BLOCK_CONTEXT_TYPESare duplicated identically inuseAssistantContextItems.ts(lines 31, 48-53). If the label resolution logic or supported block types change, both copies must be updated in sync. Extract these to a shared utility (e.g., instatefulBlockArtifactConfigs.tsor a newblockContextUtils.ts) and import from both call sites.♻️ Proposed extraction
# In a shared file, e.g. apps/sqlrooms-cli-ui/src/blockContextUtils.ts +import {CLI_AI_BLOCK_TYPES} from './artifactTypeIds'; +import { + getStatefulBlockArtifactConfig, + isStatefulBlockArtifactType, +} from './statefulBlockArtifactConfigs'; + +export const CLI_BLOCK_CONTEXT_TYPES = new Set<string>(CLI_AI_BLOCK_TYPES); + +export function resolveCliBlockLabel(blockType: string): string | undefined { + if (blockType === 'chart') return 'Chart'; + return isStatefulBlockArtifactType(blockType) + ? getStatefulBlockArtifactConfig(blockType).label + : undefined; +}Then in both
getRunContext.tsanduseAssistantContextItems.ts:-const CLI_BLOCK_CONTEXT_TYPES = new Set<string>(CLI_AI_BLOCK_TYPES); +import {CLI_BLOCK_CONTEXT_TYPES, resolveCliBlockLabel} from '../blockContextUtils';-function resolveCliBlockLabel(blockType: string): string | undefined { - if (blockType === 'chart') return 'Chart'; - return isStatefulBlockArtifactType(blockType) - ? getStatefulBlockArtifactConfig(blockType).label - : undefined; -}Also applies to: 87-92
🤖 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 `@apps/sqlrooms-cli-ui/src/context/getRunContext.ts` at line 28, `resolveCliBlockLabel` and `CLI_BLOCK_CONTEXT_TYPES` are duplicated in both `getRunContext` and `useAssistantContextItems`, so extract them into one shared utility module and import them from both places. Put the shared label-resolution logic and the `CLI_BLOCK_CONTEXT_TYPES` set in a common file such as `blockContextUtils` or `statefulBlockArtifactConfigs`, then update `getRunContext` and `useAssistantContextItems` to use the shared symbols instead of maintaining separate copies.packages/mosaic/src/ai/block-document/createBlockDocumentChartTools.ts (1)
79-82: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueRedundant type check after prior validation.
existingBlock?.type === 'chart'is redundant — line 72 already throws ifexistingBlock.type !== 'chart', and line 68 throws if!existingBlock. The optional chaining and type narrowing are unnecessary at this point.♻️ Simplify selectionGroupId extraction
- const selectionGroupId = - existingBlock?.type === 'chart' - ? existingBlock.selectionGroupId - : undefined; + const selectionGroupId = existingBlock.selectionGroupId;🤖 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/ai/block-document/createBlockDocumentChartTools.ts` around lines 79 - 82, Simplify the selectionGroupId logic in createBlockDocumentChartTools: after the existing validation in the same function already guarantees existingBlock is present and of type chart, remove the redundant optional chaining and chart type check when reading existingBlock.selectionGroupId. Update the assignment to access existingBlock.selectionGroupId directly so the code reflects the prior guards and stays easier to read.apps/sqlrooms-cli-ui/src/ai/createCliBlockDocumentAiTools.ts (1)
181-185: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winRemove unnecessary type assertion on
augmentBlockSummaryoptionsThe
as Parameters<typeof createListBlockDocumentBlocksTool>[0] & {...}cast is unnecessary. The callback({block}) => {...}is compatible with the exportedBlockDocumentBlockSummaryAugmentertype through contextual typing — TypeScript permits ignoring extra parameters (summary,index). The assertion also narrows the param type to only{block: BlockDocumentBlock}, bypassing the package's exported type and potentially masking future type errors.♻️ Proposed fix
augmentBlockSummary: ({block}) => { if ( !getState || block.type !== 'statefulBlock' || block.blockType !== 'map' || !block.blockInstanceId ) { return undefined; } const runtimeIssues = getMapBlockRuntimeIssues( getState(), block.blockInstanceId, ); return runtimeIssues.length > 0 ? {runtimeIssues} : undefined; }, - } as Parameters<typeof createListBlockDocumentBlocksTool>[0] & { - augmentBlockSummary: (params: { - block: BlockDocumentBlock; - }) => Record<string, unknown> | undefined; - }); + });🤖 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 `@apps/sqlrooms-cli-ui/src/ai/createCliBlockDocumentAiTools.ts` around lines 181 - 185, The `createCliBlockDocumentAiTools` setup is using an unnecessary `as Parameters<typeof createListBlockDocumentBlocksTool>[0] & {...}` assertion around `augmentBlockSummary`, which bypasses the exported `BlockDocumentBlockSummaryAugmenter` type. Remove the cast and let TypeScript infer the callback shape directly from `createListBlockDocumentBlocksTool`/`BlockDocumentBlockSummaryAugmenter`, keeping the `({ block }) => ...` implementation contextually typed while preserving the package’s public type contract.packages/documents/src/createListBlockDocumentBlocksTool.ts (1)
31-36: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winAdd tsdoc to exported
BlockDocumentBlockSummaryAugmenterAs per coding guidelines, exported types in
@sqlrooms/*packages should have tsdoc.BlockDocumentBlockSummaryAugmenteris a new public export from@sqlrooms/documentsbut lacks a tsdoc annotation.As per coding guidelines: "Add tsdoc to exported types and functions in
@sqlrooms/*packages."🤖 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/documents/src/createListBlockDocumentBlocksTool.ts` around lines 31 - 36, Add tsdoc for the exported BlockDocumentBlockSummaryAugmenter type in createListBlockDocumentBlocksTool.ts. Document that it is a callback used to augment a BlockDocumentBlockSummary, and describe the params block, summary, and index so the public API in `@sqlrooms/documents` follows the exported-type tsdoc guideline.Source: Coding guidelines
packages/pivot/src/PivotBlock.tsx (2)
25-63: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winAdd unit tests for the new
PivotBlockcomponent
PivotBlockis a new public export with non-trivial logic (useEffectcallingensurePivot, conditional fallback rendering). No test file was found in the provided changes.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/pivot/src/PivotBlock.tsx` around lines 25 - 63, Add unit tests for the new PivotBlock public export to cover its behavior. Verify PivotBlock calls useBaseRoomStore’s ensurePivot inside the useEffect with the resolved pivotId and the expected payload (title/defaultTitle, source, config), and that it falls back to the missing pivot id message when both pivotId and blockId are absent. Also assert it renders PivotView with the resolved pivotId when present, using the PivotBlock and PivotBlockProps symbols to locate the component.Source: Coding guidelines
25-63: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winAdd tsdoc to exported
PivotBlockPropsandPivotBlockAs per coding guidelines, exported types and functions in
@sqlrooms/*packages should have tsdoc. BothPivotBlockProps(line 25) andPivotBlock(line 32) are new public exports from@sqlrooms/pivotbut lack tsdoc annotations.As per coding guidelines: "Add tsdoc to exported types and functions in
@sqlrooms/*packages."🤖 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/pivot/src/PivotBlock.tsx` around lines 25 - 63, Add tsdoc comments for the new public exports in PivotBlock.tsx: document PivotBlockProps and PivotBlock so they comply with the `@sqlrooms` package guidelines. Place concise tsdoc directly above the PivotBlockProps type and the PivotBlock component declaration, describing their purpose and key props/behavior without changing runtime logic.Source: Coding guidelines
packages/ai-core/src/components/BlockAiPromptPopover.tsx (1)
19-39: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winAdd tsdoc to the exported type/function.
Neither
BlockAiPromptPopoverPropsnorBlockAiPromptPopoverhas tsdoc, but both are re-exported as public API from@sqlrooms/ai-core's index.As per coding guidelines, "Add tsdoc to exported types and functions in
@sqlrooms/*packages."📝 Example tsdoc addition
+/** + * Props for {`@link` BlockAiPromptPopover}. + */ export type BlockAiPromptPopoverProps = { trigger: ReactNode; onSubmit: (prompt: string) => void; placeholder?: string; label?: string; isRunning?: boolean; disabled?: boolean; open?: boolean; onOpenChange?: (open: boolean) => void; }; +/** + * A popover-based prompt input for triggering block-scoped Ask AI actions. + */ export function BlockAiPromptPopover({🤖 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-core/src/components/BlockAiPromptPopover.tsx` around lines 19 - 39, Add TSDoc comments to the public API symbols BlockAiPromptPopoverProps and BlockAiPromptPopover in BlockAiPromptPopover.tsx. Document the purpose of the props type and the component, including the main behavior and key props like trigger, onSubmit, open, and onOpenChange, so the re-exported `@sqlrooms/ai-core` API follows the package guideline for exported types/functions.Source: Coding guidelines
packages/deck/src/createOrUpdateDeckMapBlock.ts (1)
1-10: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value
DECK_MAP_DASHBOARD_PANEL_TYPEis imported but only re-exported, never used in the function body.The symbol is imported at line 4 and re-exported at line 254, but
createOrUpdateDeckMapBlocknever references it. Sinceindex.tsalready exportsDECK_MAP_DASHBOARD_PANEL_TYPEfrom./dashboardConfig(line 46), this re-export is redundant for package consumers. Consider removing both the import and the re-export to reduce confusion.♻️ Proposed cleanup
import { - DECK_MAP_DASHBOARD_PANEL_TYPE, type DeckMapDashboardPanelConfig, } from './dashboardConfig';And remove the re-export at the end:
-export {DECK_MAP_DASHBOARD_PANEL_TYPE};Also applies to: 254-254
🤖 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/createOrUpdateDeckMapBlock.ts` around lines 1 - 10, `DECK_MAP_DASHBOARD_PANEL_TYPE` is only being re-exported and never used inside `createOrUpdateDeckMapBlock`, so remove the unused import from the module header and delete the matching export at the end of `createOrUpdateDeckMapBlock` to avoid redundant re-exporting. Keep the function’s existing behavior intact; the symbol is already exported through `index.ts` via `dashboardConfig`, so no additional package-level export is needed here.packages/deck/__tests__/createOrUpdateDeckMapBlock.test.ts (1)
56-107: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winConsider adding tests for
missingMapBlockBehavior: 'create'and SQL-only source validation.The three tests cover the main create, update, and throw paths. Two important branches in
createOrUpdateDeckMapBlockare untested:
missingMapBlockBehavior: 'create'— generates a fresh mapId viacreateMapId()even whenparams.mapIdis provided but no block exists (FSQ path).- SQL-only dataset source validation (lines 172-181) — throws when updating with
sqlQuerysources and notableName.Adding these would improve confidence in the shared orchestration before both CLI and FSQ consume it.
🤖 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/__tests__/createOrUpdateDeckMapBlock.test.ts` around lines 56 - 107, Add tests for the uncovered branches in createOrUpdateDeckMapBlock: verify that when missingMapBlockBehavior is set to create and the provided mapId does not exist, the function uses createMapId() to create a new block instead of throwing, and verify the SQL-only source validation path by asserting that an update with sqlQuery sources and no tableName fails as expected. Use the existing createOrUpdateDeckMapBlock test setup, especially createHost, createMapId, and the mapId/blockId behavior, to keep the new cases consistent with the current create/update/throw coverage.
🤖 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 `@apps/sqlrooms-cli-ui/src/createCliBlockDocumentCommands.ts`:
- Around line 407-421: The updateBlockMetadata callback in
createCliBlockDocumentCommands is dropping the height field before forwarding
metadata updates. Update the async callback that calls invokeRequiredCommand so
it also destructures and passes height alongside blockDocumentId, blockId, and
caption, matching the BlockDocumentUpdateBlockMetadataInput schema and the
createOrUpdateDeckMapBlock caller’s payload.
In `@apps/sqlrooms-cli-ui/src/workspace/WorksheetPivotBlockRenderer.tsx`:
- Around line 25-30: The JSX for PivotBlock in WorksheetPivotBlockRenderer is
passing an unsupported blockType prop, which triggers a type error because
PivotBlockProps in PivotBlock does not declare it. Remove the blockType prop
from the PivotBlock usage here, or only reintroduce it if PivotBlock is updated
to accept and use that prop consistently.
In `@packages/ai-config/src/createBlockContextItem.ts`:
- Around line 1-60: Add documentation for the new block-scoped AI context APIs
exposed from `@sqlrooms/ai-config`. Update the package README to mention
BlockAiRunContextItemSchema, BlockAiRunContextItem, and createBlockContextItem,
and briefly describe that createBlockContextItem builds and validates a
block-level run context item via BlockAiRunContextItemSchema. Place this
alongside the existing exported symbols so users can discover the new block
context helpers easily.
In `@packages/ai-core/__tests__/BlockAiPromptPopover.test.tsx`:
- Around line 78-81: The test is clicking the wrong button by selecting the
first button[type="button"] in DOM order, which can hit “Close” instead of
“Open.” Update BlockAiPromptPopover.test.tsx to use a text-based query for the
intended “Open” button, matching the existing approach used later in the test,
so the interaction is explicit and resilient to DOM changes.
In `@packages/ai-core/src/components/createAskAiBlockHeaderAction.tsx`:
- Around line 1-78: The public API documentation in the ai-core README is
missing the new Ask AI header action symbols introduced by
createAskAiBlockHeaderAction.tsx. Update the README’s exported API list to
include createAskAiBlockHeaderAction, AskAiBlockHeaderActionRenderContext, and
CreateAskAiBlockHeaderActionOptions, matching the naming used in the
createAskAiBlockHeaderAction module.
In `@packages/ai/src/index.ts`:
- Around line 195-201: The public export surface in packages/ai/src/index.ts has
expanded, but packages/ai/README.md still documents the older API. Update the
README’s API/export section to mention the new re-exports, specifically
BlockAiPromptPopover, createAskAiBlockHeaderAction, createBlockContextItem, and
the BlockAiRunContextItem* types, so the documented public surface matches the
index exports.
In `@packages/deck/__tests__/normalizeDeckMapPointConfig.test.ts`:
- Around line 70-88: The test fixture passed to normalizeDeckMapPointConfig is
missing the required config.spec field from DeckMapDashboardPanelConfig, so make
the fixture type-safe by adding a minimal spec value or by defining it as an
explicit DeckMapDashboardPanelConfig. Update the object in
normalizeDeckMapPointConfig.test so the config used in the "skips datasets that
already have transformSql or sqlQuery" case satisfies the generic constraint
without changing the test behavior.
In `@packages/deck/src/blockDocumentRegistration.ts`:
- Around line 13-32: Add TSDoc to the exported
DeckMapBlockDocumentRegistrationOptions type and document the missing
defaultHeight, minHeight, and maxHeight fields. Update the type declaration in
blockDocumentRegistration.ts so the symbol itself has a top-level TSDoc, and add
concise field-level docs alongside the existing label, description,
defaultTitle, and afterEnsureState comments to match `@sqlrooms/`* documentation
conventions.
In `@packages/deck/src/index.ts`:
- Around line 55-60: The new public API in the deck package is exported from the
main index, but the README still omits several surfaced helpers. Update
`packages/deck/README.md` to document the full `@sqlrooms/deck` API surface,
explicitly covering `getFirstDatasetSourceTableName`, `hasSqlOnlyDatasetSource`,
`createOrUpdateDeckMapBlock`, `createDeckMapPointTransformSql`,
`normalizeDeckMapPointConfig`, and the block document registration helpers so
consumers can find the available entry points.
In `@packages/documents/src/BlockDocumentChartRendererContext.tsx`:
- Around line 70-73: The exported hook
useBlockDocumentChartRenderBlockHeaderActions is missing TSDoc, unlike the
similar useBlockDocumentRenderBlockHeaderActions in
BlockDocumentStatefulBlockRendererContext.tsx. Add a brief TSDoc comment
directly above useBlockDocumentChartRenderBlockHeaderActions describing that it
returns the renderBlockHeaderActions callback from
BlockDocumentChartRendererContext, and keep the style consistent with other
exported hooks in the `@sqlrooms/`* packages.
In `@packages/mosaic/src/ai/block-document/createBlockDocumentChartTools.ts`:
- Around line 84-95: The chart update payload in createBlockDocumentChartTools
should preserve the existing block’s intent, since updateBlock replaces the
stored block and currently drops that field. In the block update object built
for blockDocumentAdapter.updateBlock, carry over existingBlock.intent the same
way selectionGroupId is conditionally forwarded, so chart edits keep the durable
objective intact.
In `@packages/pivot/src/index.ts`:
- Around line 18-24: The package README is missing the newly exposed public
pivot API, so update packages/pivot/README.md to document the exports from the
package entrypoint in index.ts. Add PivotBlock and PivotBlockProps alongside
createPivotBlockDefinition in the public API section, using the same naming as
the exported symbols so the README matches the actual `@sqlrooms/pivot` surface.
---
Outside diff comments:
In `@apps/sqlrooms-cli-ui/src/workspace/WorksheetArtifact.tsx`:
- Around line 167-282: The new public helper startBlockScopedChat is exported
via src/index.ts but is missing from the package documentation. Update
packages/documents/README.md to mention startBlockScopedChat alongside the other
public APIs, using the same naming as the call site in WorksheetArtifact and the
export surface in src/index.ts so consumers can discover it.
In `@packages/deck/src/block.tsx`:
- Around line 343-361: `DeckMapBlockRenderer` is rendering `headerActions`
directly, so clicks can bubble to `BlockDocumentStatefulBlockNodeView` and
select the block. Update the header actions area in `block.tsx` to wrap
`headerActions` with a click-stopping container, matching the pattern used in
`ChartBlockHeader`, and keep `HeaderActions`/`Button` behavior unchanged.
---
Nitpick comments:
In `@apps/sqlrooms-cli-ui/src/ai/createCliBlockDocumentAiTools.ts`:
- Around line 181-185: The `createCliBlockDocumentAiTools` setup is using an
unnecessary `as Parameters<typeof createListBlockDocumentBlocksTool>[0] & {...}`
assertion around `augmentBlockSummary`, which bypasses the exported
`BlockDocumentBlockSummaryAugmenter` type. Remove the cast and let TypeScript
infer the callback shape directly from
`createListBlockDocumentBlocksTool`/`BlockDocumentBlockSummaryAugmenter`,
keeping the `({ block }) => ...` implementation contextually typed while
preserving the package’s public type contract.
In `@apps/sqlrooms-cli-ui/src/context/getRunContext.ts`:
- Line 28: `resolveCliBlockLabel` and `CLI_BLOCK_CONTEXT_TYPES` are duplicated
in both `getRunContext` and `useAssistantContextItems`, so extract them into one
shared utility module and import them from both places. Put the shared
label-resolution logic and the `CLI_BLOCK_CONTEXT_TYPES` set in a common file
such as `blockContextUtils` or `statefulBlockArtifactConfigs`, then update
`getRunContext` and `useAssistantContextItems` to use the shared symbols instead
of maintaining separate copies.
In `@packages/ai-core/src/components/BlockAiPromptPopover.tsx`:
- Around line 19-39: Add TSDoc comments to the public API symbols
BlockAiPromptPopoverProps and BlockAiPromptPopover in BlockAiPromptPopover.tsx.
Document the purpose of the props type and the component, including the main
behavior and key props like trigger, onSubmit, open, and onOpenChange, so the
re-exported `@sqlrooms/ai-core` API follows the package guideline for exported
types/functions.
In `@packages/deck/__tests__/createOrUpdateDeckMapBlock.test.ts`:
- Around line 56-107: Add tests for the uncovered branches in
createOrUpdateDeckMapBlock: verify that when missingMapBlockBehavior is set to
create and the provided mapId does not exist, the function uses createMapId() to
create a new block instead of throwing, and verify the SQL-only source
validation path by asserting that an update with sqlQuery sources and no
tableName fails as expected. Use the existing createOrUpdateDeckMapBlock test
setup, especially createHost, createMapId, and the mapId/blockId behavior, to
keep the new cases consistent with the current create/update/throw coverage.
In `@packages/deck/src/createOrUpdateDeckMapBlock.ts`:
- Around line 1-10: `DECK_MAP_DASHBOARD_PANEL_TYPE` is only being re-exported
and never used inside `createOrUpdateDeckMapBlock`, so remove the unused import
from the module header and delete the matching export at the end of
`createOrUpdateDeckMapBlock` to avoid redundant re-exporting. Keep the
function’s existing behavior intact; the symbol is already exported through
`index.ts` via `dashboardConfig`, so no additional package-level export is
needed here.
In `@packages/documents/src/createListBlockDocumentBlocksTool.ts`:
- Around line 31-36: Add tsdoc for the exported
BlockDocumentBlockSummaryAugmenter type in createListBlockDocumentBlocksTool.ts.
Document that it is a callback used to augment a BlockDocumentBlockSummary, and
describe the params block, summary, and index so the public API in
`@sqlrooms/documents` follows the exported-type tsdoc guideline.
In `@packages/mosaic/src/ai/block-document/createBlockDocumentChartTools.ts`:
- Around line 79-82: Simplify the selectionGroupId logic in
createBlockDocumentChartTools: after the existing validation in the same
function already guarantees existingBlock is present and of type chart, remove
the redundant optional chaining and chart type check when reading
existingBlock.selectionGroupId. Update the assignment to access
existingBlock.selectionGroupId directly so the code reflects the prior guards
and stays easier to read.
In `@packages/pivot/src/PivotBlock.tsx`:
- Around line 25-63: Add unit tests for the new PivotBlock public export to
cover its behavior. Verify PivotBlock calls useBaseRoomStore’s ensurePivot
inside the useEffect with the resolved pivotId and the expected payload
(title/defaultTitle, source, config), and that it falls back to the missing
pivot id message when both pivotId and blockId are absent. Also assert it
renders PivotView with the resolved pivotId when present, using the PivotBlock
and PivotBlockProps symbols to locate the component.
- Around line 25-63: Add tsdoc comments for the new public exports in
PivotBlock.tsx: document PivotBlockProps and PivotBlock so they comply with the
`@sqlrooms` package guidelines. Place concise tsdoc directly above the
PivotBlockProps type and the PivotBlock component declaration, describing their
purpose and key props/behavior without changing runtime logic.
🪄 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: a2ab8eff-c317-4986-a196-5b529ba5810f
📒 Files selected for processing (87)
apps/sqlrooms-cli-ui/src/__tests__/createCliBlockDocumentCommands.test.tsapps/sqlrooms-cli-ui/src/ai/__tests__/createCliBlockDocumentAgentTool.test.tsapps/sqlrooms-cli-ui/src/ai/__tests__/createCliBlockDocumentAiTools.test.tsapps/sqlrooms-cli-ui/src/ai/createCliBlockDocumentAgentTool.tsapps/sqlrooms-cli-ui/src/ai/createCliBlockDocumentAiTools.tsapps/sqlrooms-cli-ui/src/ai/getMapBlockRuntimeIssues.tsapps/sqlrooms-cli-ui/src/artifactTypeIds.tsapps/sqlrooms-cli-ui/src/components/useAssistantContextItems.tsapps/sqlrooms-cli-ui/src/components/useLocalFileLoader.tsapps/sqlrooms-cli-ui/src/context/formatRunContextInstructions.tsapps/sqlrooms-cli-ui/src/context/getRunContext.tsapps/sqlrooms-cli-ui/src/createBlockDocumentAgent.tsapps/sqlrooms-cli-ui/src/createCliBlockDocumentAiAdapter.tsapps/sqlrooms-cli-ui/src/createCliBlockDocumentCommands.tsapps/sqlrooms-cli-ui/src/statefulBlockArtifactConfigs.tsapps/sqlrooms-cli-ui/src/store.tsapps/sqlrooms-cli-ui/src/workspace/WorksheetArtifact.tsxapps/sqlrooms-cli-ui/src/workspace/WorksheetDashboardBlockRenderer.tsxapps/sqlrooms-cli-ui/src/workspace/WorksheetMapBlockRenderer.tsxapps/sqlrooms-cli-ui/src/workspace/WorksheetPivotBlockRenderer.tsxapps/sqlrooms-cli-ui/src/workspace/WorksheetSqlQueryBlockRenderer.tsxpackages/ai-config/__tests__/createBlockContextItem.test.tspackages/ai-config/src/createBlockContextItem.tspackages/ai-config/src/index.tspackages/ai-core/__tests__/BlockAiPromptPopover.test.tsxpackages/ai-core/src/AiSlice.tspackages/ai-core/src/components/BlockAiPromptPopover.tsxpackages/ai-core/src/components/context/ContextSelectorBadge.tsxpackages/ai-core/src/components/context/ContextSelectorItem.tsxpackages/ai-core/src/components/context/ContextSelectorSearchDropdown.tsxpackages/ai-core/src/components/context/ContextSelectorSortableChip.tsxpackages/ai-core/src/components/context/types.tspackages/ai-core/src/components/context/utils.tspackages/ai-core/src/components/createAskAiBlockHeaderAction.tsxpackages/ai-core/src/index.tspackages/ai/src/index.tspackages/app-runtime/src/html-app-block-document.tspackages/app-runtime/src/html-app.tsxpackages/artifacts/__tests__/artifactAiSessions.test.tspackages/artifacts/src/ai/artifactAiSessionHelpers.tspackages/artifacts/src/ai/index.tspackages/deck/__tests__/createOrUpdateDeckMapBlock.test.tspackages/deck/__tests__/datasetSourceUtils.test.tspackages/deck/__tests__/normalizeDeckMapPointConfig.test.tspackages/deck/src/ai.tspackages/deck/src/block.tsxpackages/deck/src/blockDocumentRegistration.tspackages/deck/src/createOrUpdateDeckMapBlock.tspackages/deck/src/datasetSourceUtils.tspackages/deck/src/index.tspackages/deck/src/mapConfigUtils.tspackages/documents/README.mdpackages/documents/__tests__/BlockAiTarget.test.tspackages/documents/__tests__/BlockDocumentAi.test.tspackages/documents/__tests__/BlockDocumentCommands.test.tspackages/documents/__tests__/BlockDocumentsSlice.test.tspackages/documents/__tests__/documentsCrdt.test.tspackages/documents/__tests__/startBlockScopedChat.test.tspackages/documents/src/BlockAiTarget.tspackages/documents/src/BlockDocumentAi.tspackages/documents/src/BlockDocumentBlockHeaderActions.tspackages/documents/src/BlockDocumentChartRendererContext.tsxpackages/documents/src/BlockDocumentCommands.tspackages/documents/src/BlockDocumentEditor/BlockDocumentBlockControls.tsxpackages/documents/src/BlockDocumentEditor/extensions/BlockDocumentStatefulBlockNode.tsxpackages/documents/src/BlockDocumentEditor/node-views/BlockDocumentChartNodeView.tsxpackages/documents/src/BlockDocumentEditor/node-views/BlockDocumentStatefulBlockNodeView.tsxpackages/documents/src/BlockDocumentSliceConfig.tspackages/documents/src/BlockDocumentStatefulBlockRendererContext.tsxpackages/documents/src/BlockDocumentsSlice.tspackages/documents/src/createListBlockDocumentBlocksTool.tspackages/documents/src/createMoveBlockDocumentBlockTool.tspackages/documents/src/index.tspackages/documents/src/startBlockScopedChat.tspackages/mosaic/__tests__/block-document-ai.test.tspackages/mosaic/src/ai/block-document/createBlockDocumentChartTools.tspackages/mosaic/src/charts/block-document/ChartBlockHeader.tsxpackages/mosaic/src/charts/block-document/ChartBlockRenderer.tsxpackages/mosaic/src/dashboard/DefaultMosaicDashboardBlock.tsxpackages/mosaic/src/dashboard/MosaicDashboard.tsxpackages/mosaic/src/dashboard/MosaicDashboardContext.tsxpackages/mosaic/src/dashboard/toolbar/MosaicDashboardToolbar.tsxpackages/mosaic/src/data-table-explorer/block-document/DataTableBlockRenderer.tsxpackages/mosaic/src/data-table-explorer/block-document/DataTableBlockSettings.tsxpackages/pivot/src/PivotBlock.tsxpackages/pivot/src/index.tspackages/sql-editor/src/SqlQueryBlock.tsx
💤 Files with no reviewable changes (4)
- packages/documents/src/BlockDocumentEditor/BlockDocumentBlockControls.tsx
- apps/sqlrooms-cli-ui/src/workspace/WorksheetSqlQueryBlockRenderer.tsx
- apps/sqlrooms-cli-ui/src/statefulBlockArtifactConfigs.ts
- packages/documents/src/BlockDocumentsSlice.ts
| <PivotBlock | ||
| blockId={blockInstanceId} | ||
| blockType={blockType} | ||
| pivotId={blockInstanceId} | ||
| defaultTitle="Embedded Pivot Table" | ||
| /> |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# Check if PivotBlockProps includes blockType
rg -n 'blockType' packages/pivot/src/PivotBlock.tsxRepository: sqlrooms/sqlrooms
Length of output: 155
🏁 Script executed:
#!/bin/bash
set -euo pipefail
# Locate PivotBlock implementation and its type definitions/usages.
fd -a 'PivotBlock.tsx|PivotBlock.ts|WorksheetPivotBlockRenderer.tsx|*PivotBlock*' apps packages
# Show concise structure of the pivot component file if found.
if [ -f packages/pivot/src/PivotBlock.tsx ]; then
wc -l packages/pivot/src/PivotBlock.tsx
ast-grep outline packages/pivot/src/PivotBlock.tsx --view expanded
fi
# Find usages of PivotBlock with blockType and without it.
rg -n "PivotBlock|blockType" apps packages --glob '!**/dist/**' --glob '!**/build/**'Repository: sqlrooms/sqlrooms
Length of output: 569
🏁 Script executed:
#!/bin/bash
set -euo pipefail
# Inspect the exact PivotBlockProps definition and component signature.
if [ -f packages/pivot/src/PivotBlock.tsx ]; then
nl -ba packages/pivot/src/PivotBlock.tsx | sed -n '1,220p'
fi
# Inspect the caller file around the reported lines.
if [ -f apps/sqlrooms-cli-ui/src/workspace/WorksheetPivotBlockRenderer.tsx ]; then
nl -ba apps/sqlrooms-cli-ui/src/workspace/WorksheetPivotBlockRenderer.tsx | sed -n '1,120p'
fiRepository: sqlrooms/sqlrooms
Length of output: 195
🏁 Script executed:
#!/bin/bash
set -euo pipefail
# Locate the PivotBlock implementation file and caller file.
fd -a --glob 'PivotBlock.tsx' packages apps
fd -a --glob 'WorksheetPivotBlockRenderer.tsx' apps
# Inspect the implementation and caller with line numbers.
if [ -f packages/pivot/src/PivotBlock.tsx ]; then
sed -n '1,220p' packages/pivot/src/PivotBlock.tsx | cat -n
fi
if [ -f apps/sqlrooms-cli-ui/src/workspace/WorksheetPivotBlockRenderer.tsx ]; then
sed -n '1,120p' apps/sqlrooms-cli-ui/src/workspace/WorksheetPivotBlockRenderer.tsx | cat -n
fi
# Search the repo for blockType-related PivotBlock usage and prop definitions.
rg -n "PivotBlockProps|blockType" packages apps --glob '!**/dist/**' --glob '!**/build/**'Repository: sqlrooms/sqlrooms
Length of output: 49545
Remove the extra blockType prop
packages/pivot/src/PivotBlock.tsx doesn’t declare blockType in PivotBlockProps, so this JSX prop causes a type error. Drop it here unless PivotBlock needs to consume it.
🤖 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 `@apps/sqlrooms-cli-ui/src/workspace/WorksheetPivotBlockRenderer.tsx` around
lines 25 - 30, The JSX for PivotBlock in WorksheetPivotBlockRenderer is passing
an unsupported blockType prop, which triggers a type error because
PivotBlockProps in PivotBlock does not declare it. Remove the blockType prop
from the PivotBlock usage here, or only reintroduce it if PivotBlock is updated
to accept and use that prop consistently.
| import {z} from 'zod'; | ||
| import {AiRunContextItemSchema} from './schema/ChatSessionSchema'; | ||
|
|
||
| /** | ||
| * AI run context item schema for a selected block inside a block document. | ||
| * | ||
| * The item captures the document id, document block id, block type, optional | ||
| * backing instance id, and optional panel id so agents can route edits to the | ||
| * exact surface the user invoked. | ||
| */ | ||
| export const BlockAiRunContextItemSchema = AiRunContextItemSchema.extend({ | ||
| kind: z.literal('block'), | ||
| blockDocumentId: z.string(), | ||
| blockId: z.string(), | ||
| blockType: z.string(), | ||
| blockInstanceId: z.string().optional(), | ||
| panelId: z.string().optional(), | ||
| }); | ||
|
|
||
| /** | ||
| * Context item describing a block-scoped AI request. | ||
| * | ||
| * Use this when a run starts from an individual worksheet/document block rather | ||
| * than from the whole artifact. | ||
| */ | ||
| export type BlockAiRunContextItem = z.infer<typeof BlockAiRunContextItemSchema>; | ||
|
|
||
| /** | ||
| * Create and validate a block-scoped AI run context item. | ||
| * | ||
| * The returned item is parsed through {@link BlockAiRunContextItemSchema} so | ||
| * omitted optional fields are normalized consistently with stored chat context. | ||
| */ | ||
| export function createBlockContextItem(fields: { | ||
| id: string; | ||
| blockDocumentId: string; | ||
| blockId: string; | ||
| blockType: string; | ||
| blockInstanceId?: string; | ||
| panelId?: string; | ||
| title: string; | ||
| subtitle?: string; | ||
| }): BlockAiRunContextItem { | ||
| const item = { | ||
| kind: 'block', | ||
| id: fields.id, | ||
| title: fields.title, | ||
| type: fields.blockType, | ||
| ...(fields.subtitle !== undefined ? {subtitle: fields.subtitle} : {}), | ||
| blockDocumentId: fields.blockDocumentId, | ||
| blockId: fields.blockId, | ||
| blockType: fields.blockType, | ||
| ...(fields.blockInstanceId !== undefined | ||
| ? {blockInstanceId: fields.blockInstanceId} | ||
| : {}), | ||
| ...(fields.panelId !== undefined ? {panelId: fields.panelId} : {}), | ||
| }; | ||
|
|
||
| return BlockAiRunContextItemSchema.parse(item); | ||
| } |
There was a problem hiding this comment.
📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# Check if ai-config README mentions the new exports
rg -n 'createBlockContextItem|BlockAiRunContextItem' packages/ai-config/README.mdRepository: sqlrooms/sqlrooms
Length of output: 155
🏁 Script executed:
#!/bin/bash
set -euo pipefail
echo "== package files =="
git ls-files packages/ai-config | sed 's#^`#-` #'
echo
echo "== README mention check =="
rg -n 'createBlockContextItem|BlockAiRunContextItem|BlockAiRunContextItemSchema' packages/ai-config/README.md || true
echo
echo "== exports check =="
rg -n 'createBlockContextItem|BlockAiRunContextItem|BlockAiRunContextItemSchema' packages/ai-config -g '!packages/ai-config/README.md'Repository: sqlrooms/sqlrooms
Length of output: 2295
Document the new ai-config exports in packages/ai-config/README.md
BlockAiRunContextItemSchema, BlockAiRunContextItem, and createBlockContextItem are exported from @sqlrooms/ai-config, but the package README doesn’t mention them yet.
🤖 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-config/src/createBlockContextItem.ts` around lines 1 - 60, Add
documentation for the new block-scoped AI context APIs exposed from
`@sqlrooms/ai-config`. Update the package README to mention
BlockAiRunContextItemSchema, BlockAiRunContextItem, and createBlockContextItem,
and briefly describe that createBlockContextItem builds and validates a
block-level run context item via BlockAiRunContextItemSchema. Place this
alongside the existing exported symbols so users can discover the new block
context helpers easily.
Source: Coding guidelines
| container | ||
| .querySelector<HTMLButtonElement>('button[type="button"]') | ||
| ?.click(); | ||
| }); |
There was a problem hiding this comment.
📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win
Fragile button selection by DOM order.
querySelector('button[type="button"]') returns the first matching button ("Close") by DOM order. The "Open" button at lines 86-89 is correctly found by text content. Consider using the same text-content approach for consistency and robustness.
🔧 Suggested fix
act(() => {
- container
- .querySelector<HTMLButtonElement>('button[type="button"]')
- ?.click();
+ const closeButton = Array.from(
+ container.querySelectorAll<HTMLButtonElement>('button'),
+ ).find((button) => button.textContent === 'Close');
+ closeButton?.click();
});📝 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.
| container | |
| .querySelector<HTMLButtonElement>('button[type="button"]') | |
| ?.click(); | |
| }); | |
| act(() => { | |
| const closeButton = Array.from( | |
| container.querySelectorAll<HTMLButtonElement>('button'), | |
| ).find((button) => button.textContent === 'Close'); | |
| closeButton?.click(); | |
| }); |
🤖 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-core/__tests__/BlockAiPromptPopover.test.tsx` around lines 78 -
81, The test is clicking the wrong button by selecting the first
button[type="button"] in DOM order, which can hit “Close” instead of “Open.”
Update BlockAiPromptPopover.test.tsx to use a text-based query for the intended
“Open” button, matching the existing approach used later in the test, so the
interaction is explicit and resilient to DOM changes.
|
|
||
| export function useBlockDocumentChartRenderBlockHeaderActions() { | ||
| return useContext(BlockDocumentChartRendererContext).renderBlockHeaderActions; | ||
| } |
There was a problem hiding this comment.
📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win
Add TSDoc to useBlockDocumentChartRenderBlockHeaderActions.
The exported hook lacks a TSDoc comment. The parallel hook useBlockDocumentRenderBlockHeaderActions in BlockDocumentStatefulBlockRendererContext.tsx has one. As per coding guidelines, exported functions in @sqlrooms/* packages should have TSDoc.
📝 Proposed TSDoc addition
+/** Returns the host-provided renderer for chart block header actions, when configured. */
export function useBlockDocumentChartRenderBlockHeaderActions() {
return useContext(BlockDocumentChartRendererContext).renderBlockHeaderActions;
}📝 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.
| export function useBlockDocumentChartRenderBlockHeaderActions() { | |
| return useContext(BlockDocumentChartRendererContext).renderBlockHeaderActions; | |
| } | |
| /** Returns the host-provided renderer for chart block header actions, when configured. */ | |
| export function useBlockDocumentChartRenderBlockHeaderActions() { | |
| return useContext(BlockDocumentChartRendererContext).renderBlockHeaderActions; | |
| } |
🤖 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/documents/src/BlockDocumentChartRendererContext.tsx` around lines 70
- 73, The exported hook useBlockDocumentChartRenderBlockHeaderActions is missing
TSDoc, unlike the similar useBlockDocumentRenderBlockHeaderActions in
BlockDocumentStatefulBlockRendererContext.tsx. Add a brief TSDoc comment
directly above useBlockDocumentChartRenderBlockHeaderActions describing that it
returns the renderBlockHeaderActions callback from
BlockDocumentChartRendererContext, and keep the style consistent with other
exported hooks in the `@sqlrooms/`* packages.
Source: Coding guidelines
| const updateResult = blockDocumentAdapter.updateBlock( | ||
| blockDocumentId, | ||
| blockIdToUpdate, | ||
| { | ||
| type: 'chart', | ||
| id: blockIdToUpdate, | ||
| config, | ||
| tableName: tableIdentity, | ||
| caption, | ||
| ...(selectionGroupId !== undefined ? {selectionGroupId} : {}), | ||
| }, | ||
| ); |
There was a problem hiding this comment.
🗄️ Data Integrity & Integration | 🟡 Minor | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# Check whether block-document.update-block replaces or merges block fields.
rg -n "update-block" --type=ts -g '!**/__tests__/**' -A 10 packages/documents/src/BlockDocumentCommands.tsRepository: sqlrooms/sqlrooms
Length of output: 2007
🏁 Script executed:
#!/bin/bash
set -euo pipefail
# Inspect updateBlock implementation and the chart tool call site context.
rg -n "updateBlock\\(" packages -g '!**/__tests__/**' -A 8 -B 4
printf '\n---\n'
# Read the command definition around update-block.
sed -n '430,480p' packages/documents/src/BlockDocumentCommands.ts
printf '\n---\n'
# Inspect the chart tool file around the reported lines.
sed -n '60,110p' packages/mosaic/src/ai/block-document/createBlockDocumentChartTools.tsRepository: sqlrooms/sqlrooms
Length of output: 12768
🏁 Script executed:
#!/bin/bash
set -euo pipefail
# Find the block type/schema for chart blocks and any `intent` field.
rg -n "\bintent\b" packages/documents packages/mosaic packages -g '!**/__tests__/**' -A 4 -B 4
printf '\n---\n'
# Inspect the block document block schema around relevant definitions.
ast-grep outline packages/documents/src/BlockDocumentsSlice.ts --view expanded
printf '\n---\n'
# Inspect block type/schema definitions if present in documents package.
fd -a "BlockDocument" packages/documents/srcRepository: sqlrooms/sqlrooms
Length of output: 50373
Preserve intent on chart updates.
updateBlock replaces the stored block, so this payload should carry over existingBlock.intent just like selectionGroupId; otherwise chart updates clear the block’s durable objective.
🤖 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/ai/block-document/createBlockDocumentChartTools.ts`
around lines 84 - 95, The chart update payload in createBlockDocumentChartTools
should preserve the existing block’s intent, since updateBlock replaces the
stored block and currently drops that field. In the block update object built
for blockDocumentAdapter.updateBlock, carry over existingBlock.intent the same
way selectionGroupId is conditionally forwarded, so chart edits keep the durable
objective intact.
| export { | ||
| PivotBlock, | ||
| createPivotBlockDefinition, | ||
| type CreatePivotBlockDefinitionOptions, | ||
| type PivotBlockProps, | ||
| type PivotBlockRenderProps, | ||
| } from './PivotBlock'; |
There was a problem hiding this comment.
📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# Check if pivot README mentions the new exports
rg -n 'PivotBlock\b|PivotBlockProps' packages/pivot/README.mdRepository: sqlrooms/sqlrooms
Length of output: 155
🏁 Script executed:
#!/bin/bash
set -euo pipefail
printf '\n-- packages/pivot/README.md --\n'
wc -l packages/pivot/README.md
cat -n packages/pivot/README.md | sed -n '1,220p'
printf '\n-- packages/pivot/src/index.ts --\n'
cat -n packages/pivot/src/index.ts | sed -n '1,120p'
printf '\n-- package metadata --\n'
cat -n packages/pivot/package.json | sed -n '1,220p'Repository: sqlrooms/sqlrooms
Length of output: 6417
🏁 Script executed:
#!/bin/bash
set -euo pipefail
printf '\n-- packages/pivot/README.md --\n'
wc -l packages/pivot/README.md
cat -n packages/pivot/README.md | sed -n '1,220p'
printf '\n-- packages/pivot/src/index.ts --\n'
cat -n packages/pivot/src/index.ts | sed -n '1,120p'
printf '\n-- packages/pivot/package.json --\n'
cat -n packages/pivot/package.json | sed -n '1,220p'Repository: sqlrooms/sqlrooms
Length of output: 6428
Add the new public pivot exports to the package README. packages/pivot/README.md still only documents createPivotBlockDefinition; PivotBlock and PivotBlockProps should be added alongside the new @sqlrooms/pivot public API.
🤖 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/pivot/src/index.ts` around lines 18 - 24, The package README is
missing the newly exposed public pivot API, so update packages/pivot/README.md
to document the exports from the package entrypoint in index.ts. Add PivotBlock
and PivotBlockProps alongside createPivotBlockDefinition in the public API
section, using the same naming as the exported symbols so the README matches the
actual `@sqlrooms/pivot` surface.
Source: Coding guidelines
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 5ceea58cfc
ℹ️ 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".
Stop onCreateOwnedStatefulBlock from re-ensuring with embeddedTitle (overwriting command-provided titles). Filter the running-session guard in startBlockScopedChat to isRunning sessions only so finished chats can be reused. Co-authored-by: Cursor <[email protected]>
|
Addressed the two new Codex findings:
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ec02b2103f
ℹ️ 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".
| if (!mapId || !panel) { | ||
| return; | ||
| } | ||
| clearPanelIssue(mapId, panel.id); |
There was a problem hiding this comment.
Do not clear fresh map render errors
When a changed map config still throws during the ErrorBoundary remount, componentDidCatch reports the render-error during commit, then this effect for the same committed render runs afterward and clears that same panel issue. In the inspected Deck map block flow, list_blocks and the block-repair prompt rely on this runtime issue, so broken retry configs can be reported as healthy and the agent can stop repairing them.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
🧹 Nitpick comments (3)
packages/documents/__tests__/startBlockScopedChat.test.ts (2)
153-188: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueConsider asserting
setPromptandrevealAssistantare not called in the blocking path.The test correctly verifies
toastErrorand thatstartAnalysisWhenReadyis not called, but doesn't assert thatsetPromptandrevealAssistantwere also skipped. Adding those negative assertions would fully lock the early-return contract.🤖 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/documents/__tests__/startBlockScopedChat.test.ts` around lines 153 - 188, The blocking-path test for startBlockScopedChat should also verify the early return skips UI updates. In the existing "blocks when a matching session is already running" case, add negative assertions that setPrompt and revealAssistant are not called, alongside the current toastError and startAnalysisWhenReady checks, to fully cover the contract in startBlockScopedChat.
111-151: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueConsider asserting
revealAssistantandsetSessionDraftContextItemIdsin the reuse path.The test verifies the key side effects (switchSession, setPrompt, startAnalysisWhenReady) but doesn't assert that
revealAssistantwas called or thatsetSessionDraftContextItemIdswas not called (since the context item id is already present in the draft). Adding these assertions would fully lock the reuse-path contract against regressions.🤖 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/documents/__tests__/startBlockScopedChat.test.ts` around lines 111 - 151, The reuse-path test for startBlockScopedChat should also cover the missing side effects. In the existing “reuses a finished session” case, assert that revealAssistant is called for the reused session and that setSessionDraftContextItemIds is not called because the draft already contains the context item. Use the existing startBlockScopedChat setup and the actions object methods to lock down this contract alongside switchSession, setPrompt, and startAnalysisWhenReady.apps/sqlrooms-cli-ui/src/ai/createCliBlockDocumentAgentTool.ts (1)
608-616: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winUse
STATEFUL_TARGET_BLOCK_TYPESconstant instead of inline array in the early guard.The early guard at line 610 uses
['dashboard', 'html-app', 'map'].includes(...)whilevalidateTargetBlockuses theSTATEFUL_TARGET_BLOCK_TYPESSet defined at line 328. If a new stateful block type is added to the Set but not the inline array, the early guard won't catch it, allowingensureBlockDocument/setCurrentBlockDocumentside effects beforevalidateTargetBlockthrows.♻️ Proposed fix
if ( targetBlock && - ['dashboard', 'html-app', 'map'].includes(targetBlock.blockType) && + STATEFUL_TARGET_BLOCK_TYPES.has(targetBlock.blockType) && !targetBlock.blockInstanceId ) {🤖 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 `@apps/sqlrooms-cli-ui/src/ai/createCliBlockDocumentAgentTool.ts` around lines 608 - 616, The early missing-blockInstanceId guard in createCliBlockDocumentAgentTool should use the same STATEFUL_TARGET_BLOCK_TYPES source as validateTargetBlock instead of an inline ['dashboard', 'html-app', 'map'] array. Update the guard to reference the STATEFUL_TARGET_BLOCK_TYPES Set so any newly added stateful block type is caught consistently before ensureBlockDocument or setCurrentBlockDocument can run.
🤖 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.
Nitpick comments:
In `@apps/sqlrooms-cli-ui/src/ai/createCliBlockDocumentAgentTool.ts`:
- Around line 608-616: The early missing-blockInstanceId guard in
createCliBlockDocumentAgentTool should use the same STATEFUL_TARGET_BLOCK_TYPES
source as validateTargetBlock instead of an inline ['dashboard', 'html-app',
'map'] array. Update the guard to reference the STATEFUL_TARGET_BLOCK_TYPES Set
so any newly added stateful block type is caught consistently before
ensureBlockDocument or setCurrentBlockDocument can run.
In `@packages/documents/__tests__/startBlockScopedChat.test.ts`:
- Around line 153-188: The blocking-path test for startBlockScopedChat should
also verify the early return skips UI updates. In the existing "blocks when a
matching session is already running" case, add negative assertions that
setPrompt and revealAssistant are not called, alongside the current toastError
and startAnalysisWhenReady checks, to fully cover the contract in
startBlockScopedChat.
- Around line 111-151: The reuse-path test for startBlockScopedChat should also
cover the missing side effects. In the existing “reuses a finished session”
case, assert that revealAssistant is called for the reused session and that
setSessionDraftContextItemIds is not called because the draft already contains
the context item. Use the existing startBlockScopedChat setup and the actions
object methods to lock down this contract alongside switchSession, setPrompt,
and startAnalysisWhenReady.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 05572963-9903-4f17-aa23-ff327ac59898
📒 Files selected for processing (14)
apps/sqlrooms-cli-ui/src/ai/__tests__/createCliBlockDocumentAgentTool.test.tsapps/sqlrooms-cli-ui/src/ai/createCliBlockDocumentAgentTool.tsapps/sqlrooms-cli-ui/src/createCliBlockDocumentCommands.tsapps/sqlrooms-cli-ui/src/store.tsapps/sqlrooms-cli-ui/src/workspace/WorksheetArtifact.tsxpackages/ai-core/README.mdpackages/deck/__tests__/createOrUpdateDeckMapBlock.test.tspackages/deck/__tests__/normalizeDeckMapPointConfig.test.tspackages/deck/src/block.tsxpackages/deck/src/blockDocumentRegistration.tspackages/deck/src/createOrUpdateDeckMapBlock.tspackages/documents/__tests__/startBlockScopedChat.test.tspackages/documents/src/startBlockScopedChat.tspackages/mosaic/src/dashboard/MosaicDashboard.tsx
✅ Files skipped from review due to trivial changes (1)
- packages/ai-core/README.md
🚧 Files skipped from review as they are similar to previous changes (8)
- packages/deck/tests/normalizeDeckMapPointConfig.test.ts
- packages/documents/src/startBlockScopedChat.ts
- packages/deck/src/block.tsx
- packages/deck/src/blockDocumentRegistration.ts
- packages/deck/src/createOrUpdateDeckMapBlock.ts
- packages/mosaic/src/dashboard/MosaicDashboard.tsx
- apps/sqlrooms-cli-ui/src/workspace/WorksheetArtifact.tsx
- apps/sqlrooms-cli-ui/src/createCliBlockDocumentCommands.ts
10eb74e to
ecfaab1
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ecfaab1271
ℹ️ 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".
| } from './datasetSourceUtils'; | ||
| export type {DeckMapDatasetSourceConfig} from './datasetSourceUtils'; | ||
| export { | ||
| createOrUpdateDeckMapBlock, |
There was a problem hiding this comment.
Add README docs for deck map APIs
This publishes createOrUpdateDeckMapBlock as a new @sqlrooms/deck public API, alongside the new normalization/dataset/block-registration helpers in this export block, but packages/deck/README.md has no corresponding usage or API entry. The repo AGENTS.md Documentation section requires updating a package README when adding public @sqlrooms/* APIs, and these helpers have non-obvious host-callback/title-preservation behavior that consumers need documented.
Useful? React with 👍 / 👎.
| type BlockAiTarget, | ||
| } from './BlockAiTarget'; | ||
| export { | ||
| startBlockScopedChat, |
There was a problem hiding this comment.
Add README docs for block-scoped chat
This exports startBlockScopedChat from @sqlrooms/documents, but packages/documents/README.md was not updated to explain the required action adapter and validation callback. The repo AGENTS.md Documentation section requires README updates for new public @sqlrooms/* APIs, and consumers otherwise have to infer the wiring contract from source.
Useful? React with 👍 / 👎.
ecfaab1 to
3ea4f63
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3ea4f633b5
ℹ️ 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".
| : undefined; | ||
| const tableName = | ||
| typeof source?.tableName === 'string' ? source.tableName : undefined; | ||
| if (!tableName || source?.sqlQuery || source?.transformSql) { |
There was a problem hiding this comment.
Preserve explicit geometry columns during normalization
When a valid table-backed map config already declares a dataset geometryColumn (for example a GeoJSON/spatial table using geom) and that table also contains longitude/latitude attributes, this condition still treats it as a lon/lat point dataset and rewrites the source/fit-to-data geometry to __sqlrooms_geom. Hosts using the exported normalizeDeckMapPointConfig(...) on AI-authored configs can therefore break existing geometry or polygon layers; skip datasets with an explicit geometry column, or only apply the transform after confirming a point layer targets the dataset.
Useful? React with 👍 / 👎.
3ea4f63 to
88943a6
Compare
There was a problem hiding this comment.
🧹 Nitpick comments (1)
packages/documents/__tests__/startBlockScopedChat.test.ts (1)
1-37: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winSolid test structure covering the main session paths.
The ESM mock setup,
createActionshelper with Map-backed draft context, and the four test cases map well to the implementation's primary control flow: creation, invalid artifact rejection, finished-session reuse, and running-session blocking. The finished-session test correctly asserts thatsetSessionDraftContextItemIdsis not called when the context item id is already present.Two error paths in the implementation are not covered:
createArtifactScopedSessionreturnsundefined→ toast error "Cannot start an AI chat for this block"startAnalysisWhenReadyreturnsfalse→ toast error "Could not start the AI chat"Consider adding tests for these branches 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/documents/__tests__/startBlockScopedChat.test.ts` around lines 1 - 37, The current `startBlockScopedChat` test suite covers the happy path and a few session states, but it misses the two toast-error branches in the `startBlockScopedChat` flow. Add tests using `createActions` for the cases where `createArtifactScopedSession` returns `undefined` and where `startAnalysisWhenReady` resolves to `false`, and assert that `toast.error` is called with the corresponding messages. Use the existing `startBlockScopedChat` import and the `toastError` mock to verify these fallback paths.
🤖 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.
Nitpick comments:
In `@packages/documents/__tests__/startBlockScopedChat.test.ts`:
- Around line 1-37: The current `startBlockScopedChat` test suite covers the
happy path and a few session states, but it misses the two toast-error branches
in the `startBlockScopedChat` flow. Add tests using `createActions` for the
cases where `createArtifactScopedSession` returns `undefined` and where
`startAnalysisWhenReady` resolves to `false`, and assert that `toast.error` is
called with the corresponding messages. Use the existing `startBlockScopedChat`
import and the `toastError` mock to verify these fallback paths.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 68bdbd17-11ac-4a74-b253-732875570c63
⛔ Files ignored due to path filters (1)
pnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (10)
apps/sqlrooms-cli-ui/src/ai/createCliBlockDocumentAgentTool.tspackages/artifacts/package.jsonpackages/deck/README.mdpackages/deck/__tests__/createOrUpdateDeckMapBlock.test.tspackages/deck/__tests__/normalizeDeckMapPointConfig.test.tspackages/deck/src/block.tsxpackages/deck/src/mapConfigUtils.tspackages/documents/README.mdpackages/documents/__tests__/startBlockScopedChat.test.tspackages/documents/package.json
✅ Files skipped from review due to trivial changes (3)
- packages/documents/README.md
- packages/artifacts/package.json
- packages/deck/README.md
🚧 Files skipped from review as they are similar to previous changes (6)
- packages/documents/package.json
- apps/sqlrooms-cli-ui/src/ai/createCliBlockDocumentAgentTool.ts
- packages/deck/tests/createOrUpdateDeckMapBlock.test.ts
- packages/deck/tests/normalizeDeckMapPointConfig.test.ts
- packages/deck/src/mapConfigUtils.ts
- packages/deck/src/block.tsx
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 2da183d77d
ℹ️ 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".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a1e5130018
ℹ️ 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".
| blockId = existingMapBlock.blockId; | ||
| resolvedMapId = existingMapBlock.mapId; | ||
| host.ensureMapState(resolvedMapId, title); | ||
| host.ensureDashboard(resolvedMapId, title); |
There was a problem hiding this comment.
Preserve dashboard titles on title-less edits
When updating an existing map and the AI omits title, title is still synthesized from the block caption or panel title and passed to ensureDashboard. The CLI adapter forwards this to mosaicDashboard.ensureDashboard, which renames existing dashboards whenever a non-empty title differs, so a title-less Ask AI config edit can overwrite the backing dashboard/map name even though only the panel config was meant to change. Pass undefined here unless params.title was explicitly provided, while still using the synthesized value for the panel title/caption.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 287997de2b
ℹ️ 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".
| params.caption ?? | ||
| existingCaption ?? | ||
| params.title?.trim() ?? |
There was a problem hiding this comment.
Apply explicit map titles to block captions
When an existing map block already has a caption and the update supplies title but no explicit caption, this fallback selects the old existingCaption before considering params.title. Later updateBlockMetadata persists that old caption, and the worksheet map header renders the caption before the panel title, so a rename like {mapId, title: 'Sales map'} updates the panel/dashboard but the visible block caption remains the previous title. Prefer the explicit title before the existing caption when no caption was supplied.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 0413dcae1d
ℹ️ 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".
| if ( | ||
| !tableName || | ||
| source?.sqlQuery || | ||
| source?.transformSql || | ||
| (typeof dataset.geometryColumn === 'string' && | ||
| dataset.geometryColumn.trim()) | ||
| ) { |
There was a problem hiding this comment.
Preserve inferred geometry datasets during point normalization
When normalizeDeckMapPointConfig(...) is run on a table-backed polygon/line config that relies on SQLRooms' existing geometry auto-detection (for example a GeoJSON table with a geom column) and that table also has lon/lat attribute columns, this guard only skips explicitly declared dataset.geometryColumn. The helper then rewrites the dataset to __sqlrooms_geom, so layers that would have rendered from the inferred native geometry can be converted to point geometry or get incorrect fit-to-data bounds. Fresh evidence after the earlier explicit-geometry fix: the current guard still does not check the resolved table for an inferred geometry column or confirm that a point layer targets this dataset before transforming it.
Useful? React with 👍 / 👎.
| <DeckMapBlockErrorBoundary | ||
| key={mapBoundaryKey} | ||
| onError={handleMapRenderError} | ||
| onRenderSuccess={handleMapRenderSuccess} |
There was a problem hiding this comment.
Clear stale map issues when rendering the empty state
This only clears a prior render issue through onRenderSuccess, but that boundary is not mounted when a repaired/updated map config has no datasets and the block renders DataTableSelectorEmptyState instead. In that case a previous render-error remains in panelIssuesByPanelId, so list_blocks and block-repair prompts can continue reporting the map as broken even though the current panel is just the no-dataset empty state. Fresh evidence after the earlier stale-issue fix: the current clear path is attached only to the success boundary on the hasDatasets branch.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 33364754b5
ℹ️ 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".
| requireTableNameForSqlOnlyUpdate && | ||
| params.mapId && | ||
| !tableName && | ||
| hasSqlOnlyDatasetSource(params.config) |
There was a problem hiding this comment.
Treat create-mode stale map IDs as creates
When a host opts into missingMapBlockBehavior: 'create' for a stale mapId, this branch still treats the call as an update solely because params.mapId is present. A SQL-only config that is valid when creating a new map without a selected table will throw before the helper reaches created = !existingMapBlock, so the documented soft-recovery path cannot create replacement maps for those configs. Gate this on existingMapBlock/the resolved update path rather than the presence of the stale parameter.
Useful? React with 👍 / 👎.
| } | ||
|
|
||
| const table = tableName ? host.findTable(tableName) : undefined; | ||
| if (requestedTableName && !table) { |
There was a problem hiding this comment.
Validate tables added by prepared configs
If prepareConfig merges or injects a table-backed dataset and the original params did not include a tableName or table-backed source, requestedTableName is undefined, so a missing prepared tableName is silently accepted even though tableName was resolved and findTable returned nothing. The helper then writes a panel that points at a nonexistent table and reports success with no selected table; this check should use the resolved tableName so prepared configs get the same validation as direct configs.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a73683cf9a
ℹ️ 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".
| createAskAiBlockHeaderAction, | ||
| type AskAiBlockHeaderActionRenderContext, | ||
| type CreateAskAiBlockHeaderActionOptions, |
There was a problem hiding this comment.
Document the re-exported Ask AI helpers
This adds createAskAiBlockHeaderAction and its related types to the public @sqlrooms/ai barrel, but packages/ai/README.md is unchanged; only @sqlrooms/ai-core documents the helper. The root AGENTS.md Documentation rule requires updating the package README when adding public @sqlrooms/* APIs, so consumers using the recommended high-level package won't see the new block Ask AI integration contract.
Useful? React with 👍 / 👎.
Summary
startBlockScopedChatinto@sqlrooms/documentsand Ask AI header helper into@sqlrooms/ai-core/@sqlrooms/aicreateOrUpdateDeckMapBlock, and map block registration helpers from@sqlrooms/deckFollow-up
This PR consolidates the current Mosaic-dashboard-backed worksheet-map implementation. The immediately subsequent Deck Map Resource Decoupling change will introduce canonical
deckMaps, a resource-nativecreateOrUpdateDeckMapResource, and a Mosaic adapter with no dashboard or panel concepts in the resource API. No legacy worksheet-map migration orpanelIdcompatibility will be required.Test plan
block-document.add-map-blockcreate/update still works (command path)transformSqlget WKB normalize vianormalizeDeckMapPointConfigstartBlockScopedChat,datasetSourceUtils,normalizeDeckMapPointConfig,createOrUpdateDeckMapBlockworksheetterms in package sourcesMade with Cursor
Summary by CodeRabbit
tableNamefor identity.