Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 20 additions & 5 deletions build/verification/browser/collectionViewFixtures.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,12 @@ import { type FixtureOutputs, type TypedRpcFixtures } from './core/fixtures';

type CollectionOutputs = FixtureOutputs['mongoClusters']['collectionView'];
type TablePageOutput = Exclude<CollectionOutputs['getCurrentPageAsTable'], ConnectionUnavailableResponse>;
type TreeNodesOutput = Exclude<CollectionOutputs['getCurrentPageAsTree'], ConnectionUnavailableResponse>;
type TreePageOutput = Exclude<CollectionOutputs['getCurrentPageAsTree'], ConnectionUnavailableResponse>;
type TreeNodesOutput = TreePageOutput['nodes'];

function treePage(nodes: TreeNodesOutput): TreePageOutput {
return { nodes, copyPageId: '51e26865-14ba-42ba-bedd-521816106bb5' };
}
type CollectionViewFixture = {
readonly config?: Partial<CollectionViewWebviewConfigurationType>;
readonly rpc: TypedRpcFixtures;
Expand Down Expand Up @@ -373,6 +378,7 @@ const emptyPage: TablePageOutput = {
};

const noIdPage: TablePageOutput = {
copyPageId: '4bf66698-74a7-4547-ad4c-607bc11a0f73',
path: [],
columns: [
{ key: ROOT_ID_COLUMN_KEY, label: '_id' },
Expand All @@ -382,13 +388,15 @@ const noIdPage: TablePageOutput = {
rows: [
{
rowKey: 'pos:0',
copyRowIndex: 0,
cells: {
[fieldColumnKey('name')]: { display: 'Browse only', type: 'string' },
[fieldColumnKey('details')]: { display: '{...}', type: 'object' },
},
},
{
rowKey: 'id:"ordinary-target"',
copyRowIndex: 1,
documentId: '"ordinary-target"',
cells: {
[ROOT_ID_COLUMN_KEY]: { display: 'ordinary-target', type: 'string' },
Expand Down Expand Up @@ -600,7 +608,7 @@ export const collectionViewFixtures = {
'mongoClusters.collectionView.runFindQuery': { type: 'query', results: [{ documentCount: 2 }] },
'mongoClusters.collectionView.getCurrentPageAsTree': {
type: 'query',
results: [deepNestingNodes],
results: [treePage(deepNestingNodes)],
},
},
},
Expand All @@ -611,7 +619,7 @@ export const collectionViewFixtures = {
'mongoClusters.collectionView.runFindQuery': { type: 'query', results: [{ documentCount: 1 }] },
'mongoClusters.collectionView.getCurrentPageAsTree': {
type: 'query',
results: [arrayNodes],
results: [treePage(arrayNodes)],
},
'mongoClusters.collectionView.getCurrentPageAsTable': { type: 'query', results: [arrayTablePage] },
'mongoClusters.collectionView.getCurrentPageAsJson': {
Expand Down Expand Up @@ -669,6 +677,7 @@ export const collectionViewFixtures = {
results: [noIdPage],
cases: [{ input: ['details'], results: [noIdNestedPage] }],
},
'mongoClusters.collectionView.copyGridCell': { type: 'mutation', results: [null] },
},
},
'first-load': {
Expand All @@ -695,7 +704,10 @@ export const collectionViewFixtures = {
rpc: {
'mongoClusters.collectionView.runFindQuery': { type: 'query', results: [{ documentCount: 3 }] },
'mongoClusters.collectionView.getCurrentPageAsTable': { type: 'query', results: [heterogeneousPage] },
'mongoClusters.collectionView.getCurrentPageAsTree': { type: 'query', results: [heterogeneousTreeNodes] },
'mongoClusters.collectionView.getCurrentPageAsTree': {
type: 'query',
results: [treePage(heterogeneousTreeNodes)],
},
},
},
identity: {
Expand Down Expand Up @@ -745,7 +757,10 @@ export const collectionViewFixtures = {
rpc: {
'mongoClusters.collectionView.runFindQuery': { type: 'query', results: [{ documentCount: 3 }] },
'mongoClusters.collectionView.getCurrentPageAsTable': { type: 'query', results: [heterogeneousPage] },
'mongoClusters.collectionView.getCurrentPageAsTree': { type: 'query', results: [heterogeneousTreeNodes] },
'mongoClusters.collectionView.getCurrentPageAsTree': {
type: 'query',
results: [treePage(heterogeneousTreeNodes)],
},
},
},
} as const satisfies Readonly<
Expand Down
12 changes: 12 additions & 0 deletions build/verification/browser/scenarios.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1068,6 +1068,18 @@ export const collectionViewContracts = {
},
],
'no-id': [
{
kind: 'calls',
name: 'Full-value shortcut targets the focused object cell without a document ID',
requiresGrid: 'grid',
path: 'mongoClusters.collectionView.copyGridCell',
input: { view: 'table', pageId: '4bf66698-74a7-4547-ad4c-607bc11a0f73', rowIndex: 0, columnIndex: 2 },
count: 1,
steps: [
{ action: 'focus', role: 'gridcell', name: '{...}' },
{ action: 'press', key: 'Alt+Shift+C' },
],
},
{
kind: 'attribute',
name: 'TDD: K1 no-ID rows remain selectable for browsing',
Expand Down
15 changes: 10 additions & 5 deletions docs/ai-and-plans/features/data-grid/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ released extension version or completion of the remaining handover gates.

- `react-data-grid@7.0.0-beta.64` renders the Table and the application-owned document Tree.
The independent JSON view remains separate.
- `src/utils/documentGrid/` defines grid-neutral `TablePage` and `TreeNode` shapes, BSON display
- `src/utils/documentGrid/` defines grid-neutral `TablePage`, `TreePage`, and `TreeNode` shapes, BSON display
values, and the identity helpers used by host shaping. `ClusterSession` creates those shapes;
React components do not depend on database documents directly.
- The Table supports nested-object step-in. The Tree flattens visible descendants from an
Expand All @@ -41,8 +41,12 @@ released extension version or completion of the remaining handover gates.
- Tree Field content is vertically centered with the other columns and uses Fluent's 2 px
label padding after the chevron slot. The whole expandable Field cell is a pointer target;
Value/Type cells and leaves do not toggle expansion.
- After keyboard step-in, focus moves to the same root row's `_id` cell after the matching Table
- After keyboard step-in, focus moves to the same row's first column after the matching Table
page is applied. Pointer step-in is unchanged.
- Projected Table pages merge executed-projection header hints with the union of fields returned
across rows. Selected headers remain even when every row lacks the field or the page is empty;
hints never create values or hide returned fields. The shared completion schema is not cleared,
seeded by hints or used as projected headers. See [decision 0010](./decisions.md#0010---additive-projection-header-hints).
- Long Table values ellipsize without hiding the BSON type indicator or adding per-cell Tab stops.
Defined values expose their full BSON type before the value in the accessible cell name; the
visual glyph is decorative and there is no BSON type hover tooltip.
Expand All @@ -64,8 +68,9 @@ released extension version or completion of the remaining handover gates.
or both Ctrl and Cmd does not resize a column.
- Embedded Table objects preview their first two fields without expanding nested values;
Table arrays retain `array[N]`. Tree containers show direct field/element counts.
- Native platform Copy copies the active cell's display text, including a preview, without
type decorations. Read-only cells do not offer substring selection; typed copy is future work.
- Native platform Copy copies the focused header, Tree Field, or Tree Type label, or a full Table
or Tree value as a shell literal. The native context menu targets the clicked cell and offers
**Copy As** on values. Value copy resolves the rendered page's cache without an ID or refetch.
- The hover opt-out setting or effective reduced motion suppresses Table/Tree hover highlights,
retaining focus and selection. A polite Escape hint is frozen once per confirmed grid entry.

Expand Down Expand Up @@ -141,7 +146,7 @@ Operator workbench feedback on 2026-11-30 accepted the hover checks and NVDA ent
hints. Narrator was not reported. Actual-host Ctrl+C initially retained the previous
clipboard contents because body-targeted Copy events bypassed RDG's grid-root handler.
The focused-cell document fallback in `e62dfff69` resolved this: the operator passed
all listed Table/Tree Copy, header-exclusion and JSON Copy checks. The correction's
all listed Table/Tree Copy, then-current header-exclusion and JSON Copy checks. The correction's
Case 1 build and 51 focused tests passed; temporary tracing was removed before commit.

R3's packaged checks are now earned from
Expand Down
30 changes: 30 additions & 0 deletions docs/ai-and-plans/features/data-grid/decisions.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ implementation remains subject to the planned work items and later gates.
| 0007 | Column-width hold release and width scope | Accepted | Remount by scope rejected; frozen widths deferred | 2026-12-01 | #1142 |
| 0008 | Position-based Tree node keys | Accepted | Replaces document-identity-based Tree keys | 2026-12-01 | #1142 |
| 0009 | Header-menu column sizing without dragging | Accepted | Fit uses RDG's double-click; Tree keeps auto sizing | 2026-12-02 | #1147 |
| 0010 | Additive projection header hints | Accepted | Selected headers remain on empty projected pages | 2026-12-03 | #1171 |

## 0001 - React Data Grid, beta candidate and document tree

Expand Down Expand Up @@ -272,6 +273,9 @@ and platform copy shortcuts such as Ctrl+Insert, rather than restricting the
implementation to a remembered Ctrl/Cmd+C keydown. This clarifies O3's input
route; typed copy and range selection remain out of scope.

The display-only restriction was superseded on the unified Table/Tree Copy branch. See
[the current design](./design.md) for native label and value Copy. Range selection remains out of scope.

## 0007 - Column-width hold release and width scope

**Status:** Accepted · **Date:** 2026-12-01
Expand Down Expand Up @@ -376,3 +380,29 @@ Recheck the synthetic double-click and the header DOM on any RDG upgrade; see
header rendered after mount, and focus return after focus moved elsewhere.
- An operator F5 pass on 2026-12-02 confirmed both commands, pointer and keyboard menus,
scrolled-in headers, Tree sizing and focus after Escape.

## 0010 - Additive projection header hints

**Status:** Accepted · **Date:** 2026-12-03 · **PR:** #1171

### Decision

Merge header hints from the executed projection with columns discovered from the current page.
Hints retain selected columns even when every returned document lacks the field or the result
is empty. They never hide fields returned by the data or manufacture rows, cell values,
document identities or shared completion-schema knowledge.

Root `_id` remains first when returned or hinted. Other hinted columns follow projection order,
then additional returned columns follow discovery order. Positive selections and computed
outputs contribute hints at the active nested path; exclusions do not. Inclusion projections
retain their implicit root `_id` unless explicitly excluded.

### Rationale and alternatives

The operator approved additive hints because "it's just a hint and fields in data will still
show up." This replaces the draft's result-only discovery and its no-columns-on-empty-result
behavior, while retaining real data as the source of cell values.

A dummy document was considered and rejected in favor of explicit column metadata: hints do
not need synthetic result rows and cannot contaminate row identity, copy addresses or schema
inference.
62 changes: 45 additions & 17 deletions docs/ai-and-plans/features/data-grid/design.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,19 @@ The Table and Tree use the exact-pinned `react-data-grid@7.0.0-beta.64` dependen
shapes fetched documents into the grid-neutral types in `src/utils/documentGrid/`; the React
components consume `TablePage` and `TreeNode` data rather than raw database documents.

`TablePage` contains the root `_id` column, the fields at the active nested path, and rows in
server order. Each cell has separate display text and BSON type metadata. `toTreeNodes` creates hierarchical nodes from documents; `useTreeRows` sorts siblings by field
`TablePage` contains the fields at the active nested path and rows in server order. A projected
page merges header hints from the executed projection with columns discovered in all returned
rows. Root `_id` stays first, followed by hinted columns in projection order and additional
returned fields in discovery order, deduplicated by column key. Positive selections, computed
outputs and the implicit `_id` of an inclusion projection supply hints; exclusions do not.
Dotted and nested selections supply hints at the active path without interpreting expression
arguments as output paths. Selected headers remain on empty pages, but hints never create rows,
cell values or document identities. Root and nested `_id` columns retain distinct keys.
An unprojected page keeps the root `_id` column and its collection-schema headers; projection
does not clear the shared completion schema, and hints never seed it.
See [decision 0010](./decisions.md#0010---additive-projection-header-hints).
Each cell has separate display text and BSON type
metadata. `toTreeNodes` creates hierarchical nodes from documents; `useTreeRows` sorts siblings by field
name and exposes only roots and descendants whose ancestors are expanded. Its node keys are
`JSON.stringify([index, ...segments])`, with a zero-based page index and typed string/number
path segments. The keys do not contain or depend on `_id`. The tree is application-owned rather
Expand Down Expand Up @@ -61,13 +72,13 @@ Plain click selects one row; Ctrl/Cmd-click toggles it; Shift-click extends the
toggles the focused row and Shift+Space extends from the selection anchor. Enter on a focused
object cell, or double-clicking that cell, steps into that field. For a valid keyboard step-in,
the successful response matching the current query, request, and destination path restores focus
once, after the Table page is committed, to column 0—the same row's root `_id` cell—using its
once, after the Table page is committed, to the same row's first column using its
`rowKey`, not its previous column or numeric index. It does not select the row.

The pending step-in focus restoration is permanently cancelled if focus leaves the initiating results
grid, the query or navigation supersedes the request, the load fails, the row disappears, or the
view unmounts. A stale intent cannot fire on a later load. Pointer step-in has no new focus
behavior. The handler rejects stale pages, the root `_id` column, `_id` fields, and non-object
behavior. The handler rejects stale pages, the root `_id` column, and non-object
values before changing the nested path.

Level Up returns one level. The ancestor breadcrumb jumps to that level, and Root Level returns to
Expand Down Expand Up @@ -95,17 +106,34 @@ Embedded objects use a bounded, shallow preview of the first two own enumerable
Nested objects and arrays use placeholders rather than recursive formatting; a third field
adds an omission marker without reading its value. Table arrays retain `array[N]`.

Native platform Copy, including Ctrl/Cmd+C, copies the active body cell's full display string,
not the type glyph, accessible type label or selected rows. A missing field copies empty text.
Preview copy is not typed BSON/EJSON export. Read-only Table/Tree cells disable native substring
selection and the text cursor. Tree Copy shares the Field/Value/Type rendering text.

A document-level native Copy fallback covers desktop-host events targeted at the
document body, which do not reach RDG's grid-root handler. It acts only while an actual
body gridcell in the current grid has focus; headers, editors, outside focus and
already-handled events are excluded. In-grid events still use RDG. The fallback resolves
the current Table page or visible Tree rows, not DOM text containing type decorations.
Its ARIA index mapping assumes the existing single header row and no summary rows.
Native platform Copy targets the focused Table or Tree cell. Column headers (even with no rows),
Tree Field cells, and Tree Type cells copy their visible labels. Table data and Tree Value cells
copy the full returned value as a shell literal by default, including collapsed containers and
the whole returned document at a Tree root. Alt+Shift+C (Option+Shift+C on macOS) is an alias
for default value copy. Missing and stale values leave the clipboard unchanged.

A single native document-level Copy listener covers both grid-origin events and desktop-host
events targeted at the document body. It resolves the actual focused header or cell and never
copies from Monaco, JSON View, inputs, or focus outside the grid. It uses model text rather than
DOM text with decorations. The ARIA index mapping assumes one header row and no summary rows.

The native context menu targets the clicked cell independently of grid focus or row selection.
Shift+F10 and the Context Menu key use the native menu bridge. For body cells the grid explicitly
dispatches the event on the focused cell because desktop VS Code does not always dispatch it there.
On menu close, restore the former grid focus only if the workbench leaves focus on the body
and the target still belongs to the current grid.
Header resize actions remain alongside **Copy Column Name**. Field and type labels offer only
their label action. Populated values offer **Copy Cell Value** and **Copy As**: **Shell Literal**,
**Display Text**, and **Extended JSON (Canonical)**. Value copy shares a host formatter across
menu and keyboard, using display text only when explicitly requested. Canonical Extended JSON
preserves the driver-returned BSON type information, not types already promoted by the driver.

Menu metadata carries opaque addresses, not document contents. Table addresses use the rendered
page ID, original row index, and column index. Tree addresses use the rendered page ID and a node
index in the complete Tree, not its visible row index. The host resolves that node's typed path
segments against the cached documents, preserving literal dots in field names. Neither view
requires an `_id` or refetches values. Display-only native Copy and header exclusion are superseded;
copy remains a single target, not a row or range export.

In Table and Tree headers, Ctrl/Cmd+Left/Right Arrow resizes the focused column only
when no other modifiers are held. Shift, Alt, or holding both Ctrl and Cmd suppresses
Expand Down Expand Up @@ -188,8 +216,8 @@ chosen from the entry view/selection and stays frozen during cell moves or selec
so delayed delivery is not cancelled. A known focus destination outside the grid rearms it;
null focus targets, including window/webview switching, do not. Re-entry gets a fresh keyed
Announcer. Existing selection-first Escape and popup precedence are unchanged.
The operator passed NVDA entry-hint delivery and, after the document-Copy correction,
the listed Table/Tree/header/JSON host clipboard checks. Narrator remains unreported.
The operator passed NVDA entry-hint delivery and the previous Table/Tree/header/JSON clipboard
contract after the document-Copy correction. Narrator remains unreported.

## Verification and limits

Expand Down
Loading
Loading