From 2ee2af244a7881d241d779f84bfd38b16cf8d911 Mon Sep 17 00:00:00 2001 From: Tomasz Naumowicz Date: Thu, 26 Nov 2026 11:13:52 +0100 Subject: [PATCH 001/148] wip: initial assessment --- .../ai-and-plans/features/data-grid/README.md | 26 +- .../features/data-grid/migration-parity.md | 159 +++++++++ .../features/data-grid/migration-research.md | 302 ++++++++++++++++++ .../data-grid/react-data-grid-capabilities.md | 139 ++++++++ .../features/data-grid/slickgrid-removal.md | 9 + .../data-grid/slickgrid-update-assessment.md | 102 ++++++ 6 files changed, 735 insertions(+), 2 deletions(-) create mode 100644 docs/ai-and-plans/features/data-grid/migration-parity.md create mode 100644 docs/ai-and-plans/features/data-grid/migration-research.md create mode 100644 docs/ai-and-plans/features/data-grid/react-data-grid-capabilities.md create mode 100644 docs/ai-and-plans/features/data-grid/slickgrid-update-assessment.md diff --git a/docs/ai-and-plans/features/data-grid/README.md b/docs/ai-and-plans/features/data-grid/README.md index 90579c202..c2dc3146e 100644 --- a/docs/ai-and-plans/features/data-grid/README.md +++ b/docs/ai-and-plans/features/data-grid/README.md @@ -15,6 +15,27 @@ code: **Status:** planned. No shipped feature currently owns the Collection View grid as a durable design surface, so this folder is its home. +## Migration research + +Preparation for [#1101](https://github.com/microsoft/vscode-documentdb/issues/1101), researched +2026-11-26: + +- [Migration report](./migration-research.md): the Cosmos DB migration PR, subsequent fixes and + feature integrations, gains/losses, and recommended direction. +- [No-loss contract](./migration-parity.md): current DocumentDB behavior, especially object + step-in, BSON type indicators, selection/document actions, paging and the tree. +- [SlickGrid update assessment](./slickgrid-update-assessment.md): relevant accessibility and + resizing changes shipped since our pinned 9.13.0, through 11.0.0. +- [React Data Grid capabilities](./react-data-grid-capabilities.md): current releases, cheap + additions, integration costs and runtime/API caveats. + +The recommendation is to evaluate `react-data-grid` with a deliberate tree implementation, not +to drop tree or BSON behavior. The final library/version/tree decision is not yet approved. +Cosmos DB currently pins beta.61; the upstream latest is beta.64, so partner experience is not +proof of compatibility with the newest beta. + +## Current architecture + The current table and tree use SlickGrid. Modernization deliberately kept that implementation while moving the webviews to Vite and the tests to Vitest. SlickGrid now has its own lazy JavaScript chunk, which gives the replacement iteration a size baseline without mixing two changes in Collection View. @@ -27,7 +48,8 @@ loading behavior. ## Plan -See [slickgrid-removal.md](./slickgrid-removal.md) for the measured footprint, behavior contract, -candidate directions, sequential gates, and explicit non-scope. The build rationale for the current +See [slickgrid-removal.md](./slickgrid-removal.md) for the earlier footprint snapshot, +candidate directions, sequential gates, and explicit non-scope. Use the newer research and parity +checklist above for current upstream facts and the expanded behavior inventory. The build rationale for the current SlickGrid chunk is in the [build-and-test-stack design](../build-and-test-stack/design.md#code-splitting-groups-run-from-most-shared-to-least-shared). diff --git a/docs/ai-and-plans/features/data-grid/migration-parity.md b/docs/ai-and-plans/features/data-grid/migration-parity.md new file mode 100644 index 000000000..23b4fabb4 --- /dev/null +++ b/docs/ai-and-plans/features/data-grid/migration-parity.md @@ -0,0 +1,159 @@ +--- +feature: data-grid +kind: checklist +status: active +created: 2026-11-26 +verified: 2026-11-26 +code: + - src/webviews/documentdb/collectionView/** + - src/utils/slickgrid/** + - src/webviews/utils/slickgrid/** + - src/documentdb/ClusterSession.ts + - packages/documentdb-js-schema-analyzer/src/** +--- + +# Grid migration: no-loss contract + +Companion to [the migration research](./migration-research.md), for +[#1101](https://github.com/microsoft/vscode-documentdb/issues/1101). +Inventory read at DocumentDB commit +[`8f81840d`](https://github.com/microsoft/vscode-documentdb/tree/8f81840d5aeeccece79321699e94d4789755a1fa). +This is a source-backed checklist, **not a claim that the current grid passes accessibility +testing**, nor that the replacement has been implemented or verified. + +**Classification:** preserve = existing behavior; improve = an explicit migration acceptance +requirement or necessary accessibility equivalent; follow-up = optional new functionality. +Preserve the user outcome, not an implementation accident or a defect. + +## 1. Table, nested documents and types + +| ID | Classification | Contract and evidence | +| --- | --- | --- | +| T01 | Preserve | Dynamic columns come from the schema at the current object path, not just the first document. Keep heterogeneous rows and fields absent from individual documents. `ClusterSession.getCurrentPageAsTable`, `SchemaStore.getPropertyNamesAtLevel`. | +| T02 | Preserve | Include the root document's `_id` at nested levels; inject an `_id` header if absent. Nested inspection must not change which root document View/Edit/Delete acts on. `getDataAtPath`, `CollectionView.getDataForView`. | +| T03 | Preserve | Double-click an **object** cell to step into that field across the page, not just expand that one row. Other documents remain rows even if the path is missing. `_id` is deliberately not a step-in target. Arrays are not currently table step-in targets. | +| T04 | Preserve | Append the actual field name to the current path; allow Level up and direct jumps to Root Level or any breadcrumb ancestor. Retain the path-driven data reload and step-in telemetry. `ToolbarTableNavigation`, `CollectionView.handleStepInRequest`. | +| T05 | Improve | Provide a keyboard-equivalent step-in action and discoverable instruction, with predictable return focus. A mouse-only double-click handler is not an accessibility contract worth preserving unchanged. | +| T06 | Preserve | Display the formatted value **and** a distinct data-type indicator. Currently indicators are CSS-generated short text (`Ab`, `i32`, `d128`, `{ }`, `[ ]`, `ID`, `U`, `U~`, etc.), with a full type-name tooltip. They are not images. A new icon/badge must retain the information and have an accessible textual type description. | +| T07 | Preserve | Keep ordinary numbers, Int32, Double, Decimal128 and Long distinct; do not convert everything to JavaScript `number`. Preserve date, Boolean, ObjectId, binary, regex, timestamp and other BSON-aware display formatting. Reuse schema-analyzer formatters rather than a JSON-only partner formatter. | +| T08 | Preserve | Retain UUID and UUID (Legacy) type annotations. These were explicitly added in [commit `02a8ae29`](https://github.com/microsoft/vscode-documentdb/commit/02a8ae29175fcdeb6b768a0916616905cd083d27); do not lose them in a generic JSON cell renderer. | +| T09 | Preserve | A missing field is blank with "This field is not set"; an explicit `null` is a typed value. Keep missing, null, empty string, false and zero distinguishable. Do not equate a blank display string with absent data. | +| T10 | Preserve | Table arrays summarize as `array[N]`. Objects use the shared formatter; tree containers use their own summaries. Preserve full-value access through document views; truncation must not become data loss. | +| T11 | Preserve | Native text selection inside cells remains possible, without accidentally starting editing or invoking a document action. | +| T12 | Improve | Cell content and field names are data, never HTML. Render React text safely; expose tooltip/type information on keyboard focus as well as hover, without duplicate announcements. | + +Primary sources: +[table](../../../../src/webviews/documentdb/collectionView/components/resultsTab/DataViewPanelTable.tsx), +[type styles](../../../../src/webviews/documentdb/collectionView/components/resultsTab/dataViewPanelTable.scss), +[type labels](../../../../src/webviews/utils/slickgrid/typeToDisplayString.ts), +[table shaping](../../../../src/utils/slickgrid/mongo/toSlickGridTable.ts), +[value formatting](../../../../packages/documentdb-js-schema-analyzer/src/ValueFormatters.ts), +[type inference](../../../../packages/documentdb-js-schema-analyzer/src/BSONTypes.ts), +[Collection View](../../../../src/webviews/documentdb/collectionView/CollectionView.tsx). + +## 2. Selection and document actions + +| ID | Classification | Contract | +| --- | --- | --- | +| S01 | Preserve | Single and multiple root documents can be selected. No selection disables Delete; View/Edit require exactly one selected row. Add remains available under its existing command rules. | +| S02 | Preserve | Keep selected document indexes and canonical BSON/EJSON root identifiers synchronized with the current rows. Sorting, paging, deleting or replacing results must never redirect an action to another document. | +| S03 | Preserve | View/Edit open the existing document workflow; the current table is **not** an inline database editor. Add and multi-document Delete remain host-owned operations, including their existing errors and confirmations. | +| S04 | Preserve | After acknowledged deletion, remove the deleted rows locally and clear selection. Do not unnecessarily reload/reset widths or focus. | +| S05 | Preserve | Leaving/unmounting the table clears selection. Returning must not leave toolbar actions pointing at invisible old rows. | +| S06 | Improve | Separate focused/active cell from selected documents. Arrow navigation must not silently change a multi-document deletion target. Announce selection and provide keyboard multi-selection. | +| S07 | Improve | Use stable row identities and column keys for callbacks. Current timestamp-suffixed presentation IDs are not durable document identities; `x-objectid` carries the actual EJSON identifier. | +| S08 | Follow-up | A checkbox column/select-all is desirable, but **not current working behavior**: explicitly disabled because dynamic column replacement broke it. Define select-all as the current loaded page, not the entire collection. | + +Evidence: `DataViewPanelTable.onSelectedRowsChanged` and its cleanup; +`CollectionView.handleDeleteDocumentRequest`, `handleViewDocumentRequest`, +`handleEditDocumentRequest`; [document toolbar](../../../../src/webviews/documentdb/collectionView/components/toolbar/ToolbarDocumentManipulation.tsx); +`ClusterSession.deleteDocuments`. + +**Adapter hazard:** current row objects mix document fields with `id` and `x-objectid` metadata. +The shaper itself records a collision TODO. Keep metadata separate in a neutral view model rather +than introducing another reserved user-field name. Do not use display strings as database IDs. +Test null/zero/false/empty-string and composite `_id` values: the current shaper's `if (doc._id)` +is a pre-existing truthiness limitation, not an approved behavior to reproduce. + +## 3. Tree view is a separate release gate + +| ID | Classification | Contract | +| --- | --- | --- | +| R01 | Preserve | Retain Table / Tree / JSON view switching. Tree is not dispensable because the table migrates successfully. JSON remains the existing Monaco view. | +| R02 | Preserve | Arbitrary parent/child hierarchy with Field, Value and Type columns. Each document has a synthetic root labelled by its `_id`, with the document fields underneath, including `_id`. | +| R03 | Preserve | Nodes initially collapsed; visible hierarchy, indentation and an obvious expand/collapse affordance. Current indentation is 15 px; exact pixels are less important than intelligible hierarchy. | +| R04 | Preserve | Nested objects show `{...}`. Arrays show `(elements: N)`; elements are materialized only for arrays of **at most 10** elements (the comparison is `<= 10`, despite the comment saying "less than"). Larger arrays retain their count. | +| R05 | Improve | Keyboard expand/collapse, parent/child movement, visible focus, `aria-expanded` and correct hierarchy semantics. These are acceptance requirements, not verified claims about today's SlickGrid implementation. | +| R06 | Preserve | Tree does not gain a separate server query, sort order or filter merely because a new component offers them. The current component enables filtering internally for tree rendering but hides the filter row and disables sorting. | +| R07 | Improve | Virtualize large expanded trees; keep focus meaningful when a parent collapses or data refreshes. Do not simply render every nested field in the DOM. | + +Evidence: +[tree component](../../../../src/webviews/documentdb/collectionView/components/resultsTab/DataViewPanelTree.tsx), +[tree shaping](../../../../src/utils/slickgrid/mongo/toSlickGridTree.ts). +`react-data-grid`'s `TreeDataGrid` groups records by keys; it is **not** a drop-in reader of this +`parentId` document hierarchy. Its separate TreeView example demonstrates application-owned +flattening/expansion, not a complete arbitrary-depth accessible document tree. + +## 4. Surrounding workflows and layout + +| ID | Classification | Contract | +| --- | --- | --- | +| W01 | Preserve | Server-side filter, projection, sort, skip and limit remain in the query layer. The grid displays the current page; no accidental page-local replacement of database semantics. | +| W02 | Preserve | First/previous/next page, page-size choices 10/50/100/500 and current page label. Query execution and page-size changes reset to page one as today. Query limit continues to cap the result window. | +| W03 | Preserve | Schema accumulation/shared completion data continue to work across results. Column-policy improvements must not be hidden inside a grid-library swap. | +| W04 | Preserve | First-load skeleton, loading indicator, completion/empty-result announcements and user-visible host errors. Empty results still leave the query and navigation UI usable. | +| W05 | Improve | Column resizing works reliably with pointer and keyboard; widths survive ordinary result updates according to an explicit policy. Container/side-panel resizing works without clipping the last row or introducing page-wide overflow. | +| W06 | Preserve | Virtualized browsing of wide and long pages, horizontal scrolling and min-width protection. Measure against the current grid; "React-native" alone does not establish a performance improvement. | +| W07 | Improve | Light, dark and VS Code high-contrast themes, focus visibility, browser zoom and Windows forced colors. Map grid variables to VS Code/Fluent tokens; a grid with its own CSS is not automatically Fluent-themed. | +| W08 | Preserve | Documents/Indexes/Query Insights tabs, query editor, cancellation, import/export commands and document editors continue independently. Do not confuse a grid's visible-row export with the extension's collection export service. | +| W09 | Improve | Keep focus by logical cell identity when possible after refresh. If that field/row disappears, move to a predictable surviving cell and announce the change. Never leave focus on a removed DOM node. | + +Evidence: `CollectionView`, `ClusterSession.find` and `getCurrentPageAsTable`, +[paging toolbar](../../../../src/webviews/documentdb/collectionView/components/toolbar/ToolbarViewNavigation.tsx), +[current theme](../../../../src/webviews/slickgrid.scss). +The table currently sets a 100 px minimum and enables SlickGrid autosizing; retaining usability is +the contract, not forcing every width to reset on each render. + +## 5. Existing tests are a starting point, not parity proof + +The table-shaping tests currently have three cases: root, one nested level, two nested levels. +The tree-shaping tests have single-document and multi-document cases. Neither suite proves +interaction, focus, type indicators, pointer resizing or screen-reader behavior. +The production browser fixture contains two simple rows and asserts SlickGrid-specific styles +(including a 7 px resize handle); those are implementation smoke checks, not migration contracts. + +Keep the shaping tests. Add grid-neutral callback/selection/formatting contracts before replacing +the renderer, and change old CSS smoke assertions only alongside equivalent behavior checks. + +## 6. Required migration evidence + +Unchecked items below are **future work**; none was executed by this research task. + +- [ ] A mixed-type page: every BSON enum member, explicit null, absent field, empty string, false, + zero, long Unicode strings, escaped field names and values that look like HTML. +- [ ] Heterogeneous results with at least 50 columns; fields appear/disappear after queries, + projection, paging and drilling two levels; `_id` remains associated with the root document. +- [ ] Select one/many rows, then reorder columns, resize, refresh, delete, change page and switch + view; View/Edit/Delete always receive the correct canonical IDs. +- [ ] Step in by mouse and keyboard; step out and jump breadcrumbs; do not drill into scalar, + array or `_id` cells. A missing nested object must not remove its document row. +- [ ] Deep tree, multiple roots, empty objects/arrays, arrays of 0/10/11 elements, nested arrays, + and a very large array. Keyboard collapse returns focus to the appropriate ancestor. +- [ ] 1,000-row stress fixture (beyond the current UI's 500-row page choice), 50+ columns and a + large expanded tree; measure first usable render, scroll responsiveness, DOM counts, memory + trend and production JS/CSS size against the current build under the same conditions. +- [ ] Pointer resize, double-click fit where offered, keyboard resize, horizontal scroll, + narrow panel, sidebar resize and zoom in light/dark/high-contrast themes. +- [ ] Keyboard-only full journey; NVDA and Windows Narrator in installed VS Code. Verify names, + value/type descriptions, virtualized row/column indexes, selection announcements, no keyboard + trap, refresh focus and nested-cell actions. Browser accessibility snapshots are supplementary. +- [ ] Existing find/query, paging, add/view/edit/delete, JSON view, import/export, Indexes and + Query Insights journeys still work. No new CSP exceptions or runtime errors. + +## 7. Deliberately not current functionality + +Column picker/reorder, grid/header/context menus and checkbox selection are explicitly disabled +in the table. Sorting is currently a query-editor operation, not a table-header operation. +Focused-cell clipboard copying needs a defined value contract; selecting text is not the same +feature. Inline editing, bulk paste, fill handles and array drill-in are new features, not parity +requirements. Evaluate them separately rather than letting grid defaults enable database writes. diff --git a/docs/ai-and-plans/features/data-grid/migration-research.md b/docs/ai-and-plans/features/data-grid/migration-research.md new file mode 100644 index 000000000..d3c79055a --- /dev/null +++ b/docs/ai-and-plans/features/data-grid/migration-research.md @@ -0,0 +1,302 @@ +--- +feature: data-grid +kind: research +status: active +created: 2026-11-26 +verified: 2026-11-26 +code: + - src/webviews/documentdb/collectionView/** + - src/utils/slickgrid/** + - src/webviews/utils/slickgrid/** + - src/documentdb/ClusterSession.ts +--- + +# Collection View grid migration research + +Preparation for [#1101](https://github.com/microsoft/vscode-documentdb/issues/1101). +**Recommendation: migrate to `react-data-grid`, with a DocumentDB-specific cell renderer and an +explicitly engineered tree implementation.** The partner's experience supports the direction, +but copying its original migration without its follow-up fixes would reproduce avoidable issues. +Do not trade away nested-document navigation, BSON types or selection safety to simplify the swap. + +This is a research recommendation, **not an approved implementation decision or a completed +evaluation spike**. No production code, dependencies or remote state were changed. + +## Reading guide + +| Document | Purpose | +| --- | --- | +| This report | Recommendation, partner migration/history, gains, losses and implementation implications | +| [SlickGrid update assessment](./slickgrid-update-assessment.md) | What versions 10/11 actually fixed, and whether an upgrade remains credible | +| [No-loss contract](./migration-parity.md) | Detailed inventory of our current features and required migration acceptance checks | +| [React Data Grid capabilities](./react-data-grid-capabilities.md) | Current library releases, inexpensive additions, API/runtime caveats and features that are not cheap | +| [Earlier removal plan](./slickgrid-removal.md) | Existing staged approach; its September snapshot is not the current upstream assessment | + +## 1. Executive findings + +1. **SlickGrid has improved materially.** We ship 9.13.0; 11.0.0 is now published. Versions 10/11 + contain relevant keyboard/ARIA work, resize auto-scroll fixes and a particularly relevant + stable resize-handle hit-box fix. "No upstream progress" is not a valid migration argument. +2. **Cosmos DB really did migrate**, in + [microsoft/vscode-cosmosdb#2960](https://github.com/microsoft/vscode-cosmosdb/pull/2960), + merged 2026-03-26. It replaced `slickgrid-react ~9.13.0` with + `react-data-grid ~7.0.0-beta.59`. Its March release history describes the migration as + addressing accessibility and theming. +3. **The partner gained a better integration foundation, not a finished JSON database browser.** + Its row selection, header menu/resize dialog, VS Code theme and hierarchical tree remain + custom application code. The mature asset to borrow is that integration and its lessons, + not just the package name. +4. **Eight months of use produced useful corrective evidence.** Follow-ups address Space-key + selection, hidden-menu focus, selected-document actions, one-row copy/export scope and stale + results after changing connections. Several are cross-feature state bugs, not proven RDG + regressions; they still define migration tests we should adopt from day one. +5. **Our requirements exceed the partner's table.** We must retain cross-row object step-in, + breadcrumbs, root BSON identifiers, type annotations including UUID variants, missing-value + semantics and our arbitrary document tree. None comes for free from RDG. +6. **There are cheap gains**, especially pinning `_id`, display-value copy, checkbox selection, + controlled widths/reset and better type-aware React cells. Server sorting, inline writes, + bulk paste/fill and arbitrary tree exploration are not simple enablement flags. +7. **Do not equate latest with partner-tested.** Cosmos DB currently pins beta.61; upstream + publishes beta.64. Evaluate beta.64, but require our own runtime/parity checks. Its newer + accessibility fixes have not been established as shipping in the partner. + +## 2. Evidence and limits + +Research date: **2026-11-26**. + +| Baseline | Snapshot | +| --- | --- | +| DocumentDB worktree | Clean at start; branch `dev/tnaum/table-redesign`, commit [`8f81840d`](https://github.com/microsoft/vscode-documentdb/tree/8f81840d5aeeccece79321699e94d4789755a1fa) | +| Cosmos DB default branch | [`9a585583`](https://github.com/microsoft/vscode-cosmosdb/tree/9a585583e7a2b70076a2f7081045871d2170ac86), 2026-11-25 | +| Current SlickGrid release | [11.0.0](https://github.com/ghiscoding/slickgrid-universal/releases/tag/v11.0.0), 2026-11-10 | +| Current RDG release | [7.0.0-beta.64](https://github.com/Comcast/react-data-grid/releases/tag/v7.0.0-beta.64), 2026-11-05 | + +Evidence comes from the original migration diff, pre/post source, subsequent component/path history, +related feature-fix PRs, manifests/lockfiles, upstream release notes and tagged APIs. +The history below selects meaningful changes, not every dependency/tooling commit. +**No installed-extension exercise, screen-reader test, UX comparison or performance benchmark +was performed.** "Verified" in frontmatter means sources were checked on that date, not that +the proposed replacement passes the release gates. + +Package metadata was also read through the environment's preconfigured npm registry; its `latest` +tags agreed with the GitHub releases. **Direct npmjs.org access is not permitted.** No dependency +was installed, no public tarball was inspected, and no further npmjs.org access is part of this +research. Published-artifact/runtime verification remains an implementation gate using approved +sources and tooling. + +## 3. What the partner migrated + +### Investigation and original change + +The bake-off was +[microsoft/vscode-cosmosdb#2958](https://github.com/microsoft/vscode-cosmosdb/pull/2958), +opened 2026-03-13 and closed unmerged 2026-04-16. It compared SlickGrid v10, SVAR, +React Data Grid and Material React Table because of accessibility limitations in SlickGrid v9. +The merged implementation was the separate +[microsoft/vscode-cosmosdb#2960](https://github.com/microsoft/vscode-cosmosdb/pull/2960) +(merge [`84e98b16`](https://github.com/microsoft/vscode-cosmosdb/commit/84e98b1644e332c2c75e28d9b979dc0e7596f273)). +Thus "they never considered updating SlickGrid" would be incorrect. + +The 17-file migration removed the old table/tree/column-menu implementations and SlickGrid theme, +added a `ReactDataGrid/` component folder, rewrote tree conversion, changed dependencies and +localization, and allowed the library's stylesheet import. +The new table, tree and header menu together contained over 700 lines of TSX, plus a separate +VS Code theme. This was an integration project, not a three-line dependency swap. + +Immutable comparison sources: +[old table](https://github.com/microsoft/vscode-cosmosdb/blob/c93192680d7650f2708e8583c394e6a956318b74/src/webviews/cosmosdb/QueryEditor/ResultPanel/ResultTabViewTable.tsx), +[old tree](https://github.com/microsoft/vscode-cosmosdb/blob/c93192680d7650f2708e8583c394e6a956318b74/src/webviews/cosmosdb/QueryEditor/ResultPanel/ResultTabViewTree.tsx), +[new table](https://github.com/microsoft/vscode-cosmosdb/blob/84e98b1644e332c2c75e28d9b979dc0e7596f273/src/webviews/cosmosdb/QueryEditor/ResultPanel/ReactDataGrid/ResultTabViewTable.tsx), +[new tree](https://github.com/microsoft/vscode-cosmosdb/blob/84e98b1644e332c2c75e28d9b979dc0e7596f273/src/webviews/cosmosdb/QueryEditor/ResultPanel/ReactDataGrid/ResultTabViewTree.tsx), +[new header menu](https://github.com/microsoft/vscode-cosmosdb/blob/84e98b1644e332c2c75e28d9b979dc0e7596f273/src/webviews/cosmosdb/QueryEditor/ResultPanel/ReactDataGrid/ColumnHeaderMenu.tsx). + +### What changed architecturally + +| Area | SlickGrid implementation | RDG integration | +| --- | --- | --- | +| Cell rendering | Imperative formatters, string/HTML output | React `renderCell`, shared string conversion and empty-value styling | +| Selection | Built-in row selection, debounced event handler | Application-owned selected-ID set, anchor/range logic and keyboard/mouse handlers | +| Sizing | Autosize/content estimates and imperative container resize configuration | Controlled column-width state, resizable columns, custom Fluent content-fit and numeric resize menu | +| Accessibility | Delayed DOM ARIA patches and custom active-cell live announcements | Library grid semantics, custom keyboard handling, accessible grid names and native tree expander buttons | +| Tree | SlickGrid flat `parentId` tree | Nested `TreeRow.children` model with custom expansion/flattened visible rows in ordinary `DataGrid` | +| Theme | SlickGrid SCSS override layer | `--rdg-*` to `--vscode-*` mapping; still a custom grid theme | +| Integration | Grid callbacks dispatch selected row indexes to Query Editor | Same surrounding state/action architecture, with a different selection adapter | + +Important details: click selects one row; Ctrl/Meta-click toggles; Shift-click selects a range; +Space/Shift-Space and Shift-arrows implement keyboard selection. The final merged table does +**not** use a checkbox column. Early review raised checkbox-only selection and light-theme styling; +the final implementation contains custom selection instead. Do not copy an early PR screenshot as +the final design. + +## 4. Evolution after migration + +| Date | Evidence | Change and consequence | +| --- | --- | --- | +| 2026-02-13, before migration | [microsoft/vscode-cosmosdb#2934](https://github.com/microsoft/vscode-cosmosdb/pull/2934) | Added SlickGrid ARIA row/column counts after wrong NVDA/Narrator counts. The partner was already paying an accessibility-adapter cost. | +| 2026-03-26 | [microsoft/vscode-cosmosdb#2960](https://github.com/microsoft/vscode-cosmosdb/pull/2960) | Migrated both table and tree; kept JSON outside the grid. Added custom selection and header controls rather than relying solely on RDG defaults. | +| 2026-03-31 | [v0.33.2 release](https://github.com/microsoft/vscode-cosmosdb/releases/tag/v0.33.2) | First verified shipped version: release notes explicitly mention the migration; tag `c90f0f11ca8e7b2133743c030cce56a17480b1f9` contains the merge and beta.59 dependency. The nearby v0.33.3 preparation PR is not the first-release evidence. | +| 2026-05-05 / 05-13 | [microsoft/vscode-cosmosdb#3005](https://github.com/microsoft/vscode-cosmosdb/pull/3005), [microsoft/vscode-cosmosdb#3011](https://github.com/microsoft/vscode-cosmosdb/pull/3011) | String-helper import movement and minor stylesheet cleanup; not a new grid or major user-visible redesign. | +| 2026-05-18 | [microsoft/vscode-cosmosdb#3037](https://github.com/microsoft/vscode-cosmosdb/pull/3037) | Restored packaged webview rendering after Vite migration: preserved the render export and injected emitted CSS for RDG, Monaco and the splitter. Grid styling is a packaging dependency, not just a successful development import. Not caused by the original grid migration. | +| 2026-06-22 | [microsoft/vscode-cosmosdb#3168](https://github.com/microsoft/vscode-cosmosdb/pull/3168) | Hotkey cleanup and View/Edit/Delete fixes. A strict record guard discarded otherwise valid selected rows; selection consumers needed a less restrictive document-ID extractor. Not demonstrated to originate in RDG. | +| 2026-08-18 | [microsoft/vscode-cosmosdb#3272](https://github.com/microsoft/vscode-cosmosdb/pull/3272), reverted by [microsoft/vscode-cosmosdb#3281](https://github.com/microsoft/vscode-cosmosdb/pull/3281) | Tried beta.61, adapting keyboard event mode from `SELECT` to `ACTIVE` and guarding absent rows. Reverted the dependency batch the same day. The revert says CI trouble was determined to be Azure DevOps-side; do not describe it as an RDG failure. | +| 2026-09-07 | [microsoft/vscode-cosmosdb#3342](https://github.com/microsoft/vscode-cosmosdb/pull/3342) | Large Table-to-JSON switches could freeze/crash; added JSON size warning, preview cap and chunked streaming. This is a Monaco/JSON-view issue, not evidence that the new grid handles all large-result workflows automatically. | +| 2026-09-11 | [microsoft/vscode-cosmosdb#3346](https://github.com/microsoft/vscode-cosmosdb/pull/3346) | Exactly one selected row was treated as no selection by converters, so copy/export used the entire page. A concrete selection-to-feature regression to test, but introduction at the grid migration is not established. | +| 2026-09-16 | [microsoft/vscode-cosmosdb#3351](https://github.com/microsoft/vscode-cosmosdb/pull/3351) | Adopted the shared Fluent webview theming provider. This did not eliminate RDG's separate VS Code CSS-variable theme. | +| 2026-09-23 | [microsoft/vscode-cosmosdb#3359](https://github.com/microsoft/vscode-cosmosdb/pull/3359) | Added table tests, restored the `ACTIVE` event-mode adaptation and prevented native Space-key scrolling. Lockfile now resolved beta.61 while manifest still said `~beta.59`. The PR title does not reveal the grid changes. | +| 2026-09-25 | [microsoft/vscode-cosmosdb#3362](https://github.com/microsoft/vscode-cosmosdb/pull/3362) | Prevented stale results from a previous connection/container from enabling actions against another container. Double-click handling now checks connection/execution/edit state and carries the current execution ID. A crucial ownership invariant, not just a rendering detail. | +| 2026-10-11 | [microsoft/vscode-cosmosdb#3407](https://github.com/microsoft/vscode-cosmosdb/pull/3407) | Custom column-menu trigger could receive programmatic focus while `aria-hidden`. Removed that attribute while retaining `tabIndex=-1`, and added a regression test. Accessibility work remained necessary in the migration's own components. | +| 2026-11-03 | [microsoft/vscode-cosmosdb#3449](https://github.com/microsoft/vscode-cosmosdb/pull/3449) | Exact-pinned beta.61. Recorded concerns include newer beta header-renderer API changes and an unsupported Map method. The latter rationale needs source/runtime qualification; see the capabilities document. | +| 2026-11-04 | [microsoft/vscode-cosmosdb#3522](https://github.com/microsoft/vscode-cosmosdb/pull/3522) | Added JSON folding controls. A surrounding results feature, not a built-in benefit of the RDG migration. | + +### Actual dependency trajectory + +| Point | Manifest | Lockfile | +| --- | --- | --- | +| Original March migration | `~7.0.0-beta.59` | beta.59 | +| August update attempt | exact beta.61 | beta.61 | +| August revert | `~7.0.0-beta.59` | beta.59 | +| September 23 onward | `~7.0.0-beta.59` | beta.61 | +| November 3 through inspected HEAD | exact `7.0.0-beta.61` | beta.61 | + +The prerelease range allowed movement without the manifest text changing. +For reproducible evaluation, record **both** manifest and lockfile, and exact-pin the candidate. +The partner has not established beta.64 compatibility merely by using a 7.0 beta. + +## 5. What they gained, and what they may have lost + +| Area | Evidence-backed gain | Loss, risk or qualification | +| --- | --- | --- | +| Accessibility | Native grid semantics replaced manual DOM patching. A reviewer [reported the relevant accessibility bugs fixed](https://github.com/microsoft/vscode-cosmosdb/pull/2960#issuecomment-4110304284): [microsoft/vscode-cosmosdb#2926](https://github.com/microsoft/vscode-cosmosdb/issues/2926), [microsoft/vscode-cosmosdb#2929](https://github.com/microsoft/vscode-cosmosdb/issues/2929), [microsoft/vscode-cosmosdb#2930](https://github.com/microsoft/vscode-cosmosdb/issues/2930). | The March 23 comment predates merge and does not specify the test environment. This is reported validation, not our own test result or a conformance claim. Custom header-menu focus still needed the October fix. | +| React integration | Cell/header controls and selection live in ordinary React; fewer SlickGrid-specific services/formatters and delayed DOM edits. | Application selection/range logic and custom tree are now maintained by the extension. React does not make lifecycle/focus errors impossible. | +| Resize UX | Controlled widths, pointer resize and explicit content/numeric resize controls. | Initial sizing changed: the old explicit first-load content-fit configuration is gone. Equivalent initial fit has not been demonstrated by this research. | +| Theme control | Direct CSS-variable mapping to VS Code; native Fluent menu/dialog controls. | Still two style domains: RDG CSS and Fluent. No evidence that it automatically follows every VS Code contrast theme correctly. | +| Selection | Familiar click/modifier/keyboard gestures implemented in the merged code. | Not a free library default. Custom key handling required an API adaptation and `preventDefault`; indexes still have to map to the correct documents. | +| Tree | Native button expanders and a simpler React-visible-row implementation. | Old tree sort/filter configuration and bespoke level/state live announcements were removed. The new component does not declare the old hierarchy through `aria-level`/`treegrid` in that file. Actual screen-reader equivalence remains unverified. | +| Visible columns | The bake-off described cleaner default presentation. | The migration also changed converter defaults: hide service columns; do not inject partition-key columns except for `SELECT *`. This is a real presentation reduction, not required by RDG. Do not copy it into our BSON/`_id` column policy. | +| Performance/size | RDG supports row/column virtualization; wrapper/plugin dependencies are removed. | SlickGrid already virtualized. No extension-specific before/after timings or byte reduction were established. Expanded-tree and JSON payload costs remain application problems. | +| Feature integration | Existing View/Edit/Delete, copy/export and external paging remained attached to Query Editor state. | Later selection-scope and result-ownership bugs show how easy it is to preserve the appearance but break the action target. Their causes must not all be attributed to migration without evidence. | + +**Removed announcements are not automatically regressions.** Native grid semantics may make a +custom live region redundant or noisy. Test the actual spoken outcome; do not restore the old live +region merely to make the source diff look feature-equivalent. Conversely, hierarchical tree +context must not silently disappear because a flat grid announces cell values correctly. + +### Feature coupling worth copying carefully + +The partner's current table assigns synthetic row IDs `index + 1`, then dispatches `id - 1` as +indexes into raw `queryResult.documents`. +[`getSelectedDocumentIds`](https://github.com/microsoft/vscode-cosmosdb/blob/9a585583e7a2b70076a2f7081045871d2170ac86/src/webviews/cosmosdb/QueryEditor/ResultPanel/getSelectedDocumentIds.ts#L10-L37) +explicitly depends on converter order matching raw-document order. Its table disables sorting, +so adding local row sorting without changing this adapter would risk wrong-document actions. +We should use canonical identity instead. + +Copy/export use those selected indexes with the **raw results**, not rendered/truncated cells or +the list of visible columns. The one-selected-row correction and explicit current-page/selected +scope labels are therefore important outside the grid component. This is different from the cheap +focused-cell **display-value** copy opportunity proposed for our extension. + +The visibility change is verifiable in +[current table conversion](https://github.com/microsoft/vscode-cosmosdb/blob/9a585583e7a2b70076a2f7081045871d2170ac86/src/utils/convertors/table.ts#L212-L270): +`ShowPartitionKey` changed from `first` to `none`, and `ShowServiceColumns` from `last` to `none` +in the migration. `SELECT *` overrides partition-key presentation back to `first`. +The results panel calls the converter without exposing those options as a user control. + +[microsoft/vscode-cosmosdb#3406](https://github.com/microsoft/vscode-cosmosdb/pull/3406) +proposed fixes for empty partition-key/unnamed-projection cells, but was closed **unmerged**. +The current renderer already strips a leading slash from partition-key headers, so the PR's +description is not sufficient to establish that symptom on current HEAD. Treat header/data-key +agreement and unnamed projections as required fixtures, not as confirmed current partner bugs. +No evidence was established here about CSV inclusion of hidden service columns or selection +lifetime across every partner view switch. + +At inspected HEAD, open partner requests also include +[microsoft/vscode-cosmosdb#3194](https://github.com/microsoft/vscode-cosmosdb/issues/3194) +(add-to-filter/query cell context menu), +[microsoft/vscode-cosmosdb#3440](https://github.com/microsoft/vscode-cosmosdb/issues/3440) +(displayed result count), and +[microsoft/vscode-cosmosdb#3298](https://github.com/microsoft/vscode-cosmosdb/issues/3298) / +[microsoft/vscode-cosmosdb#3179](https://github.com/microsoft/vscode-cosmosdb/issues/3179) +(copy selected text versus broader results). These are evidence that such affordances are not +automatically delivered by adopting RDG, not proof all were caused by migration. + +Current code: +[table](https://github.com/microsoft/vscode-cosmosdb/blob/9a585583e7a2b70076a2f7081045871d2170ac86/src/webviews/cosmosdb/QueryEditor/ResultPanel/ReactDataGrid/ResultTabViewTable.tsx#L145-L277), +[tree](https://github.com/microsoft/vscode-cosmosdb/blob/9a585583e7a2b70076a2f7081045871d2170ac86/src/webviews/cosmosdb/QueryEditor/ResultPanel/ReactDataGrid/ResultTabViewTree.tsx), +[header menu](https://github.com/microsoft/vscode-cosmosdb/blob/9a585583e7a2b70076a2f7081045871d2170ac86/src/webviews/cosmosdb/QueryEditor/ResultPanel/ReactDataGrid/ColumnHeaderMenu.tsx), +[theme](https://github.com/microsoft/vscode-cosmosdb/blob/9a585583e7a2b70076a2f7081045871d2170ac86/src/webviews/cosmosdb/QueryEditor/ResultPanel/ReactDataGrid/vscodeTheme.scss). + +## 6. What we must not lose + +The [complete parity checklist](./migration-parity.md) is the implementation acceptance input. +The highest-risk items are: + +- Object-cell step-in **across the page**, with Level up/breadcrumb navigation, not merely a + row-details popup. Add its missing keyboard equivalent. +- BSON-aware values and type markers, including UUID/legacy UUID; missing versus null; root + `_id` retained at nested paths; correct canonical IDs for View/Edit/Delete. +- Multi-row selection, exact command enablement and safe selection invalidation after refresh, + paging, deletion or a connection change. +- Both the table and arbitrary-depth tree, plus the untouched Monaco JSON alternative. +- Server query/projection/sort/skip/limit and existing paging; loading/empty/error states; wide + result virtualization, usable resizing, focus visibility and refresh focus. + +Our current formatted `CellValue` payload is not raw JSON. Do not copy Cosmos DB's generic +string renderer and lose BSON distinctions, or use its row-index arithmetic as document identity. +Changing column order must use logical field keys; today's step-in callback uses column indexes +and would otherwise navigate into the wrong field after reorder. + +## 7. Recommended direction and staged gates + +**Prefer RDG for the table; budget real engineering for the tree.** A custom tree on `DataGrid` +can share virtualization and cell rendering, but must implement proper arbitrary hierarchy, +keyboard behavior and focus/ARIA. Alternatively use a dedicated virtualized accessible tree/treegrid +behind the same feature-level contract. The partner's flat-row example is a starting point, not +proof this requirement is solved. Do not ship removal of SlickGrid until the tree gate passes. + +The original staged plan still provides a useful sequence: + +1. **Capture contracts and neutral result shapes.** Preserve schema analysis/BSON formatting + while separating display cells, root identifiers and grid metadata. Keep backend query and + column-policy decisions outside the renderer. Avoid creating a general-purpose grid framework. +2. **Make a parity-first table/tree spike.** Evaluate exact beta.64 against the partner's + beta.61 reference; adapt to the selected API. Reuse the partner's header-menu/resize ideas and + post-migration fixes, not its NoSQL-specific data conversion or stale execution assumptions. +3. **Exercise behavior before judging appearance.** Use the parity fixtures for nested values, + all type categories, sparse/projection-changing results, multi-selection and stale-result + actions. Expose field-keyed column-rebuild and focused-cell hooks required by #1101 without + silently implementing a new column policy or clipboard format. +4. **Measure and test in the actual runtime.** Compare current SlickGrid and candidate production + bundles with identical large/wide/deep fixtures. Record timings/bytes and agree budgets before + acceptance; run keyboard and screen-reader journeys in packaged VS Code, not only jsdom. + Include minimum supported VS Code/Electron, narrow panels, zoom and contrast themes. +5. **Choose and record the pin/tree approach after evidence.** An operator decision should record + why RDG plus the selected tree was preferred over SlickGrid 11 and the alternatives. This + report does not pre-empt that gate or invent the operator's rationale. +6. **Swap without optional features, then add inexpensive wins separately.** Remove SlickGrid + dependencies/theme/workarounds only once both views pass. Preserve the existing query/document + plumbing. Follow-up features should be independently reviewable and not obscure parity defects. + +If needed, SlickGrid 11 is a legitimate temporary fallback, especially for a blocked tree +implementation. It also has breaking integration changes; the fallback is not "just bump npm". +Since migration effort is not the operator's main concern, do not choose a weaker tree, truncated +type model or mouse-only interaction merely to minimize changed lines. + +## 8. Suggested inexpensive follow-up shortlist + +After parity: **pin `_id`; focused-cell display-value copy; checkbox/page selection; remember/reset +widths; a proper type-aware value/badge renderer**. Column reorder/hide is next, once logical keys +and changing-schema layout state are proven. The +[capability/effort table](./react-data-grid-capabilities.md#2-what-is-actually-cheap) separates +actual built-ins from the small amount of integration required. + +Not included in "cheap": safe inline database editing, bulk paste/fill, whole-collection +grouping/aggregates, server sorting integration or replacing collection export with visible-row +serialization. Keep these out of #1101's groundwork scope. + +## Outcome + +The preparation now has an upstream comparison, partner migration/follow-up history, a source-backed +no-loss inventory and a version-aware opportunity list. **Implementation, benchmarks, packaged +runtime compatibility and assistive-technology validation remain future work.** The evidence favors +migration, but does not support a promise of zero regressions or universal accessibility merely +from selecting the partner's library. diff --git a/docs/ai-and-plans/features/data-grid/react-data-grid-capabilities.md b/docs/ai-and-plans/features/data-grid/react-data-grid-capabilities.md new file mode 100644 index 000000000..7f9d387c1 --- /dev/null +++ b/docs/ai-and-plans/features/data-grid/react-data-grid-capabilities.md @@ -0,0 +1,139 @@ +--- +feature: data-grid +kind: research +status: active +created: 2026-11-26 +verified: 2026-11-26 +code: + - src/webviews/documentdb/collectionView/** + - src/utils/slickgrid/** +--- + +# React Data Grid: current capabilities and inexpensive additions + +Companion to [the migration report](./migration-research.md). +This assesses **`react-data-grid`**, not Fluent UI's similarly named `DataGrid`. +The former `adazzle/react-data-grid` GitHub location now redirects to +[`Comcast/react-data-grid`](https://github.com/Comcast/react-data-grid). + +## 1. Version matters more than the beta label alone + +On **2026-11-26**, the latest GitHub release and the preconfigured npm registry's `latest` are +**[7.0.0-beta.64](https://github.com/Comcast/react-data-grid/releases/tag/v7.0.0-beta.64)**, +published 2026-11-05. The npm `beta` dist-tag still points to beta.58; do not install `@beta` +assuming it means the newest release. Pin the evaluated version explicitly. + +The [beta.64 package](https://github.com/Comcast/react-data-grid/blob/v7.0.0-beta.64/package.json) +is MIT licensed, declares React/React DOM `^19.2` peers and no runtime `dependencies`. +Our `~19.2.4` peers are compatible. That does not make the feature bundle weight zero: the grid, +CSS and any adapters still have to be measured in our production build. + +The beta API **has changed** since the partner's original integration; using a mature integration +does not exempt us from version-specific adaptation. Verified release milestones: + +| Version | Published | Changes that matter to an adopter | +| --- | --- | --- | +| [beta.59](https://github.com/Comcast/react-data-grid/releases/tag/v7.0.0-beta.59) | 2025-12-04 | The partner's original migration version, also mentioned in our September removal plan. It already requires React/React DOM `^19.2`; its API differs from beta.64. | +| [beta.60](https://github.com/Comcast/react-data-grid/releases/tag/v7.0.0-beta.60) | 2026-07-09 | Made rows focusable and removed the focus sink; changed selected-position terminology to active-position; reworked frozen shadows and added start/end column pinning. Significant focus/API evolution, not only dependency updates. See [Comcast/react-data-grid#3963](https://github.com/Comcast/react-data-grid/pull/3963), [Comcast/react-data-grid#3979](https://github.com/Comcast/react-data-grid/pull/3979), [Comcast/react-data-grid#4034](https://github.com/Comcast/react-data-grid/pull/4034). | +| [beta.61](https://github.com/Comcast/react-data-grid/releases/tag/v7.0.0-beta.61) | 2026-07-14 | Packaging fix removes a dangling `ecij` import after the build-tool change: [Comcast/react-data-grid#4100](https://github.com/Comcast/react-data-grid/pull/4100). This is the partner's current exact pin, incorporating the preceding focus/API changes. | +| [beta.62](https://github.com/Comcast/react-data-grid/releases/tag/v7.0.0-beta.62) | 2026-10-19 | React Compiler build work; cross-window support; tree parent focus on Left Arrow. See [Comcast/react-data-grid#4161](https://github.com/Comcast/react-data-grid/pull/4161), [Comcast/react-data-grid#4194](https://github.com/Comcast/react-data-grid/pull/4194), [Comcast/react-data-grid#4202](https://github.com/Comcast/react-data-grid/pull/4202). | +| [beta.63](https://github.com/Comcast/react-data-grid/releases/tag/v7.0.0-beta.63) | 2026-10-25 | Broad naming changes, event cancellation fixes, PageUp/PageDown fixes, and grouping API changes (`rowGrouper` to `getRowGroupKey`, `groupIdGetter` to `getGroupId`). See [Comcast/react-data-grid#3967](https://github.com/Comcast/react-data-grid/pull/3967), [Comcast/react-data-grid#4217](https://github.com/Comcast/react-data-grid/pull/4217), [Comcast/react-data-grid#4159](https://github.com/Comcast/react-data-grid/pull/4159). | +| beta.64 | 2026-11-05 | `rowKeyGetter` becomes `getRowKey`; keyboard resize ends on keyup/blur; selection-update and frozen-cell scrolling fixes; forced-colors support; editor/resize/reduced-motion accessibility fixes. See [Comcast/react-data-grid#4261](https://github.com/Comcast/react-data-grid/pull/4261), [Comcast/react-data-grid#4249](https://github.com/Comcast/react-data-grid/pull/4249), [Comcast/react-data-grid#4239](https://github.com/Comcast/react-data-grid/pull/4239), [Comcast/react-data-grid#4247](https://github.com/Comcast/react-data-grid/pull/4247), [Comcast/react-data-grid#4244](https://github.com/Comcast/react-data-grid/pull/4244), [Comcast/react-data-grid#4246](https://github.com/Comcast/react-data-grid/pull/4246). | + +Current upstream main was also checked at +[`d6942fd6`](https://github.com/Comcast/react-data-grid/tree/d6942fd60d1cf1045442055b7fff231c351d21a0) +(2026-11-25), but the capabilities below are grounded in **released beta.64** source/docs, not +assumed available from unreleased main. + +### The partner's runtime warning needs a version-specific check + +[microsoft/vscode-cosmosdb#3449](https://github.com/microsoft/vscode-cosmosdb/pull/3449) +records a reason to pin beta.61: beta.63 renamed a header-renderer type and was reported to use +`getOrInsertComputed`, unavailable in their runtime. Treat that as the partner's recorded +compatibility constraint, **not proof that beta.64 requires that method**. +Upstream [Comcast/react-data-grid#4227](https://github.com/Comcast/react-data-grid/pull/4227) +explicitly replaced the grouping implementation's `getOrInsertComputed` with `get`/`set`, and is +included in beta.63's release notes. The tagged beta.63 and beta.64 `TreeDataGrid.tsx` show that +replacement (the method name remains in an explanatory comment). + +This is a mismatch between the partner's rationale and the inspected upstream source, not a basis +for declaring the newer package safe. Check the actual published bundle and run it inside our +minimum supported VS Code/Electron runtime before choosing the final pin. A published-bundle +inspection was not completed; direct npmjs.org access is not permitted. Use approved artifact +sources/tooling for that gate. Runtime compatibility was not established by this research. + +## 2. What is actually cheap? + +Effort below is **incremental after a parity-complete table migration**, not an estimate for the +migration itself. XS = a prop/default plus styling/checks; S = a small renderer/state callback; +M = a separate behavior design or cross-layer integration. These are engineering judgments, not +time commitments. All new user-facing features remain follow-up work under #1101's scope. + +| Opportunity | Effort | Built-in support and remaining work | Important limit | +| --- | --- | --- | --- | +| Reliable pointer **and keyboard** column resize | XS | Set `resizable: true`; header Ctrl/Meta+Left/Right changes width. The handle supports pointer capture and double-click `max-content` fitting. | Verify in VS Code, not just the demo. Fitting virtualized content is not a guarantee of inspecting every value in the database. Core resizing is also a migration acceptance requirement, not merely a bonus. | +| Pin `_id` while scrolling wide results | XS | `frozen: 'start'` (or `true`) on the identifier column. beta.64 also supports `'end'` for a trailing action column. | Frozen columns consume space in narrow panels. This was possible in SlickGrid too, but is not enabled in our current table. | +| Remember manual widths and reset them | S | `columnWidths` plus `onColumnWidthsChange` gives controlled width state. Add a reset action. | Key by field/path and reconcile disappearing columns. In-session retention is cheap; durable per-collection persistence needs an explicit storage policy. | +| Checkbox multi-selection and select current page | S | `SelectColumn`, `selectedRows`, `onSelectedRowsChange` and `getRowKey`. | Integrate command enablement and canonical IDs; specify "current page". Do not count checked/focused cells as selected documents. | +| Copy focused cell's **displayed** value | S | `onCellCopy` supplies the logical row/column and clipboard event. Write text with the existing clipboard route if needed. | Current payload has display values: arrays are `array[N]`. Copying canonical BSON/EJSON or raw nested data needs additional host data and is **not** the same cheap feature. | +| Keyboard step-in and an explicit object-cell affordance | S | `renderCell`, `onCellDoubleClick`, `onCellKeyDown` and active-position hooks. | Custom DocumentDB behavior, not a built-in JSON explorer. Preserve event/default navigation and accessible names. Keyboard equivalence belongs in parity. | +| Better datatype badge/icon plus full description | S | Render a small React value/type component with existing type metadata. | Do not discard UUID/BSON distinctions or encode type only in color. An icon font/CSS pseudo-element alone is not an accessible name. | +| Column drag/reorder | S | `draggable: true` and `onColumnsReorder` provide native interaction; apply the new column order in state. | Actions must use field keys, never old column indexes. Supply a keyboard alternative if exposing reorder. Persistence is separate. | +| Hide/show columns and reset layout | S-M | Keep a full column model and pass a filtered visible list; add a small Fluent menu. | There is no turnkey column-picker prop in the cited API. Distinguish presentation hiding from server projection; never hide `_id` metadata from document actions. | +| Wrap long values / larger or variable rows | S | Row-height options and custom cell rendering/styles. | Test virtualization, truncation, density and keyboard visibility. Arbitrarily measuring all document heights is not free. | +| Empty-results content | XS | `renderers.noRowsFallback`. | Keep query controls and existing empty/loading announcements; avoid redundant announcements. | +| Read-only cell context actions | S-M | `onCellContextMenu` plus a Fluent menu; reuse View/Edit/Copy/Step in handlers. | The menu, its focus lifecycle and keyboard invocation are application code, not an included polished menu component. | + +Sources for the table: +[beta.64 README/API](https://github.com/Comcast/react-data-grid/blob/v7.0.0-beta.64/README.md), +[column types](https://github.com/Comcast/react-data-grid/blob/v7.0.0-beta.64/src/types.ts), +[header/resize implementation](https://github.com/Comcast/react-data-grid/blob/v7.0.0-beta.64/src/HeaderCell.tsx), +[DataGrid callbacks](https://github.com/Comcast/react-data-grid/blob/v7.0.0-beta.64/src/DataGrid.tsx), +[controlled reordering example](https://github.com/Comcast/react-data-grid/blob/v7.0.0-beta.64/website/routes/ColumnsReordering.tsx). + +**Suggested inexpensive follow-up bundle:** pin `_id`, display-value copy, checkbox selection, +width retention/reset, and a type-aware cell renderer. Reorder/hide can follow once key-based +actions and column reconciliation are proven. None is automatically enabled by changing imports. + +## 3. Available library features that are not cheap database features + +| Feature | Why it is not just a switch for us | +| --- | --- | +| Header sorting / multi-sort | The grid supplies sort state and gestures; the application supplies ordering. Sorting only the loaded page would misleadingly differ from the query editor's server sort. Integrate with query execution, paging, BSON comparisons and refresh semantics. | +| Grouping / summary rows | `TreeDataGrid` groups records by column values, and summary rows display application-computed values. A loaded page is not the whole collection. Labels and scope must be truthful. | +| Inline editing | Editors and `onRowsChange` do not implement database validation, BSON round-tripping, optimistic concurrency, `_id` restrictions, write errors or undo. Keep the existing document editor initially. | +| Paste / fill handle / spreadsheet bulk changes | `onCellPaste` and `onFill` can return changed local rows. Safe database writes, validation and confirmation remain ours. Do not enable them implicitly. `TreeDataGrid` does not support fill. | +| Whole-collection export | Grid examples can serialize rendered/application rows; they do not replace our host-side collection export, query window or BSON serialization. | +| Arbitrary nested document tree | `TreeDataGrid` takes `groupBy` and `getRowGroupKey`, not our `parentId` tree. It groups data rather than interpreting object/array fields. | +| Full accessible context/column/filter menu system | Event hooks and renderers are available, but a complete menu/filter product is not provided by those hooks. | + +The upstream +[TreeView example](https://github.com/Comcast/react-data-grid/blob/v7.0.0-beta.64/website/routes/TreeView.tsx) +uses ordinary `DataGrid` with application-managed flattened children, expansion and cell controls. +It demonstrates feasibility, not a ready-made arbitrary-depth document explorer with complete +treegrid semantics. Porting it without tree keyboard/ARIA work would be a regression. + +## 4. Accessibility and integration caveats + +The built-in keyboard model includes arrows, Home/End, Ctrl/Meta+Home/End, PageUp/PageDown, +Tab boundaries, Shift+Space row selection and keyboard header resizing. These are a stronger +starting point than rebuilding a grid from bare HTML, **not proof our custom cells are accessible**. + +beta.64's forced-colors work is particularly relevant to Windows users. Its PR explicitly notes +that browser emulation is not a real Windows contrast-theme check. Custom overrides of +`--rdg-selection-color` and `--rdg-checkbox-focus-color` can override forced-color values; scope +ordinary theme overrides appropriately and verify with the actual OS theme. + +Keep the grid's own stylesheet and adapt its variables to VS Code tokens. It is not themed +automatically by our `VSCodeFluentProvider`. The README flags a Lightning CSS `light-dark()` +minification issue with Vite 8+; inspect our actual build path and packaged CSS before adding a +workaround. Do not add a build change merely because another application's build needed it. + +The current grid has its own memoization expectations: keep column arrays stable, update rows +immutably and retain unchanged row objects. Replacing SlickGrid removes its particular imperative +event binding; it does not eliminate every possible stale closure, focus bug or expensive rerender. + +**Version recommendation:** evaluate beta.64 as the primary spike pin and compare against the +partner's exact pinned version documented in the main report. Adopt it only after parity, +accessibility and packaging gates pass. Partner experience on an older beta does not establish +that newer renamed APIs or fixes have already been battle-tested there. diff --git a/docs/ai-and-plans/features/data-grid/slickgrid-removal.md b/docs/ai-and-plans/features/data-grid/slickgrid-removal.md index db528aa7f..4cb7f774b 100644 --- a/docs/ai-and-plans/features/data-grid/slickgrid-removal.md +++ b/docs/ai-and-plans/features/data-grid/slickgrid-removal.md @@ -14,6 +14,15 @@ code: # Removing SlickGrid from the Collection View +> **2026-11-26 research update:** see [migration-research.md](./migration-research.md), +> [migration-parity.md](./migration-parity.md) and +> [slickgrid-update-assessment.md](./slickgrid-update-assessment.md). This document retains its +> September snapshot and proposed sequence. SlickGrid now has relevant v10/v11 accessibility, +> resizing and Fluent-theme improvements; Cosmos DB now exact-pins RDG beta.61 rather than the +> beta.59 range below. Claims about current keyboard/tree accessibility still require testing. +> The weight note saying SlickGrid loads in every webview predates the completed lazy split; +> the README describes the current split. Use the newer documents for current facts. + **Status:** guidance for a future iteration. Not scheduled. Written 2026-09-30 during the modernization re-review ([build-and-test-stack.md, execution plan](../build-and-test-stack/iterations/01-modernization/build-and-test-stack.md#execution-plan)). diff --git a/docs/ai-and-plans/features/data-grid/slickgrid-update-assessment.md b/docs/ai-and-plans/features/data-grid/slickgrid-update-assessment.md new file mode 100644 index 000000000..69e618b35 --- /dev/null +++ b/docs/ai-and-plans/features/data-grid/slickgrid-update-assessment.md @@ -0,0 +1,102 @@ +--- +feature: data-grid +kind: research +status: active +created: 2026-11-26 +verified: 2026-11-26 +code: + - package.json + - src/webviews/documentdb/collectionView/components/resultsTab/DataViewPanelTable.tsx + - src/webviews/documentdb/collectionView/components/resultsTab/DataViewPanelTree.tsx + - src/webviews/slickgrid.scss +--- + +# Has SlickGrid addressed our pain points? + +**Yes: there have been substantial, directly relevant accessibility and column-resizing +improvements since our pinned version.** Staying on SlickGrid is not the same as staying on +today's implementation. This makes an upgrade a credible comparison option, not the preferred +long-term recommendation in [the migration report](./migration-research.md). + +Research date: **2026-11-26**. Our manifest uses `slickgrid-react ~9.13.0`; the lockfile resolves +9.13.0. That release dates to 2026-01-30. At research time, both the configured registry's `latest` tag and the +current monorepo's latest stable release are **11.0.0**, released 2026-11-10. +Registry metadata here came from the environment's preconfigured registry; direct npmjs.org +access is not permitted, and no published tarball was inspected. +`~9.13.0` will not receive 10.x or 11.x changes. + +## 1. Follow the correct upstream project + +The old [`ghiscoding/slickgrid-react`](https://github.com/ghiscoding/slickgrid-react/releases/tag/v5.14.1) +repository's latest release is 5.14.1 from 2025-05-08. Its release note explicitly says the +framework wrappers are moving into +[`ghiscoding/slickgrid-universal`](https://github.com/ghiscoding/slickgrid-universal). +It is **not** evidence that development stopped at v5. Follow the monorepo's +[9.13.0](https://github.com/ghiscoding/slickgrid-universal/releases/tag/v9.13.0), +[10.0.0](https://github.com/ghiscoding/slickgrid-universal/releases/tag/v10.0.0), +[10.2.0](https://github.com/ghiscoding/slickgrid-universal/releases/tag/v10.2.0), +[10.10.0](https://github.com/ghiscoding/slickgrid-universal/releases/tag/v10.10.0) and +[11.0.0](https://github.com/ghiscoding/slickgrid-universal/releases/tag/v11.0.0) releases. +The similarly named `6pac/SlickGrid` is a related implementation; a fix there must not be assumed +to exist in our wrapper until it is ported into Slickgrid-Universal. + +## 2. Relevant shipped improvements + +Dates below are release dates; links identify the implementation work. Relevance is assessed +against our actual options, not the entire SlickGrid feature catalogue. + +| Released | Change | Relevance to DocumentDB | +| --- | --- | --- | +| 10.0.0, 2026-03-03 | [ghiscoding/slickgrid-universal#2393](https://github.com/ghiscoding/slickgrid-universal/pull/2393): focusable headers/menus/select-all, arrow-key menu navigation, Enter/Space sorting, focus-visible styling. [ghiscoding/slickgrid-universal#2404](https://github.com/ghiscoding/slickgrid-universal/pull/2404): ARIA row/column counts. | Core focus and structural metadata matter. Menu/select-all improvements are largely latent because our table disables menus and its checkbox selector. | +| 10.0.0 | [ghiscoding/slickgrid-universal#2405](https://github.com/ghiscoding/slickgrid-universal/pull/2405): resize-handle/cursor styling; [ghiscoding/slickgrid-universal#2402](https://github.com/ghiscoding/slickgrid-universal/pull/2402): grid-menu overlap with resize handles. | Handle usability is relevant; our menu is disabled, so do not claim the overlap fix explains our particular symptom. | +| 10.2.0, 2026-03-24 | [ghiscoding/slickgrid-universal#2456](https://github.com/ghiscoding/slickgrid-universal/pull/2456): focus-sink/focus-mode refinement; [ghiscoding/slickgrid-universal#2457](https://github.com/ghiscoding/slickgrid-universal/pull/2457): menu-focus restoration; [ghiscoding/slickgrid-universal#2448](https://github.com/ghiscoding/slickgrid-universal/pull/2448): Space/Left/Right tree/group expansion. | Tree keyboard behavior and core focus handling are especially relevant. The previous plan must not treat today's tree keyboard behavior as already proven. | +| 10.5.0, 2026-04-18; 10.5.1, 2026-04-22 | [ghiscoding/slickgrid-universal#2531](https://github.com/ghiscoding/slickgrid-universal/pull/2531): resize beyond the viewport with automatic scrolling; [ghiscoding/slickgrid-universal#2538](https://github.com/ghiscoding/slickgrid-universal/pull/2538): follow-up outside-webview behavior. | Addresses wide-grid pointer resizing. It is not a fix for our manual container `ResizeObserver`, nor evidence of keyboard resize support. | +| 10.7.0, 2026-05-09 | [ghiscoding/slickgrid-universal#2573](https://github.com/ghiscoding/slickgrid-universal/pull/2573): respect `multiSelect` in checkbox and keyboard row selection. | Relevant to retaining predictable single/multi-row actions after upgrading. | +| 10.8.3, 2026-07-04 | [ghiscoding/slickgrid-universal#2631](https://github.com/ghiscoding/slickgrid-universal/pull/2631): custom-tooltip accessibility; [ghiscoding/slickgrid-universal#2632](https://github.com/ghiscoding/slickgrid-universal/pull/2632): frozen-column/resize auto-scroll interaction. | Tooltip work may help if that plugin is used; our formatter currently supplies `toolTip`. Frozen-column behavior is not a current enabled feature. | +| 10.10.0, 2026-08-28 | [ghiscoding/slickgrid-universal#2694](https://github.com/ghiscoding/slickgrid-universal/pull/2694): missing header ARIA row/rowgroup structure; [ghiscoding/slickgrid-universal#2773](https://github.com/ghiscoding/slickgrid-universal/pull/2773): prevent resize auto-scroll jumps. | Both are directly relevant. The resize fix clamps the pointer at the viewport edge and paces scrolling rather than immediately jumping hundreds of pixels. | +| 11.0.0, 2026-11-10 | [ghiscoding/slickgrid-universal#2872](https://github.com/ghiscoding/slickgrid-universal/pull/2872), merged 2026-10-27: stable resize-handle hit box on hover. | Particularly close to "hard to grab" resizing: previously the hovered handle itself shrank, could lose hover and flicker; the visual pill now uses a pseudo-element. This is a plausible contributor, not a diagnosis of our unrecorded repro. | +| 11.0.0 | [ghiscoding/slickgrid-universal#2884](https://github.com/ghiscoding/slickgrid-universal/pull/2884), merged 2026-10-30: content sizing uses canvas text measurements, CSS font/padding and distributed row sampling; optional inclusion of header width. | More accurate than length-times-average-character estimates. Our table enables autosizing, but these **resize-by-content** improvements require checking which sizing path/options we actually use. Not every auto-size mode is content fitting. | +| 11.0.0 | [ghiscoding/slickgrid-universal#2906](https://github.com/ghiscoding/slickgrid-universal/pull/2906), merged 2026-11-05: synchronize `aria-selected`, expose primary visible `aria-sort`, preserve existing tooltip descriptions, resolve header key events from nested controls, ignore row-detail toggle keys from inside panels. | Selection/header semantics are directly useful. Row-detail work does not affect our current tree/table because we do not enable that plugin. Menu focus after commands was explicitly deferred, so this is not a blanket accessibility completion claim. | +| 11.0.0 | Single-viewport pinning replaces frozen panes; sticky docking, tree multi-column sorting and tree lookup/performance changes. | Potential improvements, but not migration prerequisites. Our existing grid does not enable freezing and explicitly disables tree sorting. Upstream benchmarks are not measurements of our extension. | + +The v10 guide also documents a **Fluent UI visual theme**, and v11 adds a Fluent icon-set option. +This weakens the old argument that a SlickGrid refresh necessarily leaves us with only its default +visual theme. It does **not** turn the imperative wrapper into Fluent React components or remove +our VS Code token integration. + +## 3. Is upgrading a small alternative? + +Smaller than replacing both renderers, but **not a dependency-only bump**: + +1. Follow both tagged migration guides: + [v10](https://github.com/ghiscoding/slickgrid-universal/blob/v11.0.0/frameworks/slickgrid-react/docs/migrations/migration-to-10.x.md) + and [v11](https://github.com/ghiscoding/slickgrid-universal/blob/v11.0.0/frameworks/slickgrid-react/docs/migrations/migration-to-11.x.md). + The v10 selection change directly touches us: `enableRowSelection` becomes `enableSelection`; + `rowSelectionOptions` becomes `selectionOptions`; the hybrid model replaces the separate models. + Explicitly preserve row-selection behavior rather than accepting new mixed-selection defaults. +2. Audit dynamic column replacement, hidden-column semantics, formatter/tree classes, CSS/SASS + overrides and tests. v10 keeps hidden columns in the complete column list; v11 changes tree + toggle classes and renderer DOM. Our build fixture asserts version-specific SlickGrid styles. +3. Check resizing modes and all custom theme overrides. Some v11 sizing options were renamed or + removed; handle hover decoration moved to `::after`. Do not transplant selectors blindly. +4. React is not an immediate blocker: our manifest uses React/React DOM `~19.2.4`, while + [Slickgrid React v11](https://github.com/ghiscoding/slickgrid-universal/blob/v11.0.0/frameworks/slickgrid-react/package.json) + declares React `>=19.0.0`. The migration guide's i18next/react-i18next minimums matter **if + using that translation integration**; they are not both declared React wrapper peer dependencies. + Preserve our existing `@vscode/l10n` localization rather than assuming a second translation + stack is required. +5. Run the same [parity and accessibility gates](./migration-parity.md) as a replacement. The + upstream fixes do not remove our object drill-in/type-indicator responsibilities, stale-event + handling, explicit rerender workaround or chosen manual container resizing. + +## 4. Assessment + +**Do not justify migration by saying "SlickGrid has not improved." It has.** In particular, +the v11 handle-hover and v10 resize-jump fixes deserve a brief reproducible comparison if we want +to identify the current resizing problem's cause. + +The stronger reasons to migrate remain React integration, a smaller imperative adapter surface, +sharing a partner's maintained approach, and owning cell interactions in ordinary React. +An upgrade is a credible fallback or temporary mitigation if replacing the tree blocks release. +No evidence here establishes WCAG conformance for either option, and no screen reader, packaged +extension, resize repro or performance benchmark was run as part of this source research. From 95a0455d67d4514c1e426aedb1ddbd89b1970d49 Mon Sep 17 00:00:00 2001 From: Tomasz Naumowicz Date: Thu, 26 Nov 2026 16:26:48 +0100 Subject: [PATCH 002/148] finalized grids assessment --- .../ai-and-plans/features/data-grid/README.md | 20 +- .../data-grid/grid-options-evaluation.md | 280 +++++++++++ .../features/data-grid/grid-scorecard.md | 453 ++++++++++++++++++ .../features/data-grid/migration-parity.md | 110 ++--- .../features/data-grid/migration-research.md | 144 +++--- .../data-grid/react-data-grid-capabilities.md | 62 +-- .../data-grid/slickgrid-update-assessment.md | 26 +- 7 files changed, 926 insertions(+), 169 deletions(-) create mode 100644 docs/ai-and-plans/features/data-grid/grid-options-evaluation.md create mode 100644 docs/ai-and-plans/features/data-grid/grid-scorecard.md diff --git a/docs/ai-and-plans/features/data-grid/README.md b/docs/ai-and-plans/features/data-grid/README.md index c2dc3146e..c3c4518f6 100644 --- a/docs/ai-and-plans/features/data-grid/README.md +++ b/docs/ai-and-plans/features/data-grid/README.md @@ -20,8 +20,15 @@ surface, so this folder is its home. Preparation for [#1101](https://github.com/microsoft/vscode-documentdb/issues/1101), researched 2026-11-26: +- [Grid evaluation](./grid-scorecard.md): **current recommendation**. Our priorities, how we + tested while looking for a way to stay on SlickGrid (including a hands-on Narrator check of both + grids' demos), 1–10 ratings in 15 weighted categories with accessibility as a hard gate, feature + mapping, and how we could help SlickGrid close the gaps we found. +- [Grid options evaluation](./grid-options-evaluation.md): SlickGrid 11 versus React Data Grid + evidence (maintainers, releases, range selection, accessibility, features); its second-pass + SlickGrid recommendation is superseded by the scorecard. - [Migration report](./migration-research.md): the Cosmos DB migration PR, subsequent fixes and - feature integrations, gains/losses, and recommended direction. + feature integrations, gains/losses (its first-pass recommendation is superseded). - [No-loss contract](./migration-parity.md): current DocumentDB behavior, especially object step-in, BSON type indicators, selection/document actions, paging and the tree. - [SlickGrid update assessment](./slickgrid-update-assessment.md): relevant accessibility and @@ -29,10 +36,13 @@ Preparation for [#1101](https://github.com/microsoft/vscode-documentdb/issues/11 - [React Data Grid capabilities](./react-data-grid-capabilities.md): current releases, cheap additions, integration costs and runtime/API caveats. -The recommendation is to evaluate `react-data-grid` with a deliberate tree implementation, not -to drop tree or BSON behavior. The final library/version/tree decision is not yet approved. -Cosmos DB currently pins beta.61; the upstream latest is beta.64, so partner experience is not -proof of compatibility with the newest beta. +The current recommendation is to **migrate to React Data Grid, exact-pinned to a beta**, because +accessibility (keyboard navigation in particular) is a hard requirement and RDG passes that gate on +its own foundation, while SlickGrid 11 needs our additions to reach it. Range selection with Excel +copy is buildable on RDG beta.64's public APIs without a fork (about 2–3 developer-weeks). Both +projects have one dominant maintainer; RDG has been in 7.0 pre-release since 2019, so expect to +budget for API renames on upgrades. The final decision is not yet approved; record it in +`decisions.md` once taken. ## Current architecture diff --git a/docs/ai-and-plans/features/data-grid/grid-options-evaluation.md b/docs/ai-and-plans/features/data-grid/grid-options-evaluation.md new file mode 100644 index 000000000..f7691f8d3 --- /dev/null +++ b/docs/ai-and-plans/features/data-grid/grid-options-evaluation.md @@ -0,0 +1,280 @@ +--- +feature: data-grid +kind: research +status: active +created: 2026-11-26 +verified: 2026-11-26 +code: + - src/webviews/documentdb/collectionView/components/resultsTab/** + - src/utils/slickgrid/** + - src/webviews/slickgrid.scss + - package.json +--- + +# Grid options: SlickGrid 11 versus React Data Grid + +Decision support for [#1101](https://github.com/microsoft/vscode-documentdb/issues/1101). +This document **re-evaluates** the first-pass recommendation in +[migration-research.md](./migration-research.md), adding two inputs that the first pass did not +weigh: **project health and governance**, and a stated future requirement for +**mouse rectangular cell-range selection with copy to Excel**. + +No prototype was built. Everything below is source, release, issue and commit evidence collected +on 2026-11-26. Package metadata came from GitHub and the environment's preconfigured registry; +direct npmjs.org access was not used. + +## TL;DR + +> **Superseded (third pass, 2026-11-26):** the operator then made accessibility a hard requirement, +> ruled out forking, and judged a custom tree manageable. Under those rules the current +> recommendation is **migrate to React Data Grid (exact-pinned beta)**; see +> [grid-scorecard.md](./grid-scorecard.md). Range selection is buildable on RDG beta.64 without a +> fork. The second-pass reasoning below is kept as history. + +**Second-pass recommendation: upgrade to SlickGrid 11 (`slickgrid-react` 11.x) and restructure our +integration behind a grid-neutral boundary, rather than migrate to React Data Grid now.** + +The first pass leaned towards React Data Grid (RDG) mainly because our partner extension uses it. +Re-weighed against our own requirements: + +1. **Cell-range selection is the deciding factor.** SlickGrid ships mouse-drag rectangular + selection, Shift+arrow keyboard range extension, _simultaneous_ row selection for document + actions, and Excel-compatible TSV copy behind one option. RDG has **no** range selection; the + request has been open since 2020, a community PR since 2022, and one consumer + (pgAdmin) **forked RDG** to get it. With RDG we would build and own this feature entirely. +2. **The maintenance-risk difference is smaller than the beta label suggests.** Both projects + are effectively maintained by one person. SlickGrid's maintainer is more active, ships stable + semver releases with migration guides, and has one open issue. RDG has been in 7.0 pre-release + for **7.7 years** (alpha since 2019-03, beta since 2021-07), renames APIs between betas, and + our partner has pinned to an older beta to avoid churn. +3. **SlickGrid's accessibility work since our pinned 9.13 is substantial**, and much of it + landed _after_ the partner's March 2026 evaluation of v10. Our partner's rejection of SlickGrid + is therefore partly out of date. +4. **What we give up** is real: a React-idiomatic grid, alignment with the partner, a smaller + dependency, and some of the partner's accessibility validation. These are listed honestly in §6. + +The recommendation is **conditional** on an accessibility gate (§7). If SlickGrid 11 fails that +gate on keyboard or screen-reader behaviour in the packaged extension, the decision should be +revisited, with the range-selection cost of RDG made explicit. + +## 1. Requirements used for this evaluation + +| Requirement | Source | +| ------------------------------------------------------------------------------------------------------- | -------------------------------------------- | +| No functional loss (step-in, BSON type indicators, tree, multi-row document actions, paging) | [migration-parity.md](./migration-parity.md) | +| Fix known accessibility problems and unreliable column resizing | #1101, #263 | +| **Future: drag a rectangle of cells with the mouse, then copy to clipboard in an Excel-pasteable form** | Operator, 2026-11-26 | +| Control over selection semantics (cells vs rows vs documents) | Operator, 2026-11-26 | +| Migration effort is not a constraint | Operator, 2026-11-26 | +| Long-term maintainability; the beta status of RDG is a concern | Operator, 2026-11-26 | + +Because effort is not a constraint, it is not used as a tie-breaker anywhere below. + +## 2. Project health and governance + +Counts cover **2025-11-26 to 2026-11-26** unless noted. Commit counts come from the GitHub +commits API (default branch); issue/PR counts come from GitHub search. + +| | **SlickGrid** ([ghiscoding/slickgrid-universal](https://github.com/ghiscoding/slickgrid-universal)) | **React Data Grid** ([Comcast/react-data-grid](https://github.com/Comcast/react-data-grid)) | +| -------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------- | +| Owner | Personal account (`ghiscoding`) | Comcast organisation | +| Lead maintainer | Ghislain B. (`ghiscoding`, plus `ghiscoding-SE` work account); profile lists **Schneider Electric** | Nicolas Stepien (`nstepien`); no affiliation listed | +| Second-most-active human | `zewa666` (Vildan Softic): 9 commits in 12 months | `amanmahajan7` (Aman Mahajan, **FreeWheel/Comcast**): 9 commits in 12 months | +| Human commits, last 12 months | ~1,025, of which `ghiscoding` **~1,009 (98%)** | ~162, of which `nstepien` **152 (94%)** | +| Merged PRs, last 12 months | 616 (18 not from the lead or bots) | 295 (10 not from the lead or bots) | +| Issues opened / closed, last 12 months | 31 / 33 | 12 / 10 | +| Open issues today | **1** | **47** | +| Latest release | **11.0.0 stable**, 2026-11-10 | **7.0.0-beta.64**, 2026-11-05 | +| Last stable release | 11.0.0 (2026-11-10) | **5.0.4 (2018-11-14)** | +| Pre-release span | none; major versions ship stable | 7.0.0-alpha.0 2019-03-19, beta.0 2021-07-22, still beta | +| Release style | Stable semver, roughly one major per 6–9 months (9.0 2025-05, 10.0 2026-03, 11.0 2026-11), per-framework migration guides, AI migration skills | Frequent betas; breaking renames between betas (e.g. `rowKeyGetter`→`getRowKey` in beta.64, `rowGrouper`→`getRowGroupKey` in beta.63); release notes only | +| Licence | MIT (licence text; GitHub reports `NOASSERTION` because of the extra attribution header) | MIT (same GitHub reporting quirk) | +| Stars / forks | 181 / 49 (the wrappers predate the monorepo; the original 6pac/SlickGrid lineage is much larger) | 7,690 / 2,202 | +| Runtime dependencies | `slickgrid-react` pulls 6 `@slickgrid-universal/*` packages plus `dequal` | none | + +### What this means + +- **Bus factor is ≈1 for both.** Comcast's organisational ownership of RDG does not translate + into a team: over the last year one person wrote 94% of human commits, and the Comcast-affiliated + contributor wrote 9. SlickGrid's single maintainer is backed by an employer that appears to use + the grid (a dedicated work account contributes). Neither situation is a guarantee. +- **Responsiveness favours SlickGrid.** One open issue versus 47; a lead who closes issues at + about the rate they arrive. RDG's most-requested missing feature (see §3) has had a reviewed + community PR waiting since 2022, with public comments complaining about the lack of response. +- **The beta concern is about API stability, not abandonment.** RDG is actively developed + (React Compiler, forced-colours support, accessibility fixes in October–November 2026), and + beta.64 is tagged `latest`. But there is no stable contract: our partner + [pinned exactly to beta.61](https://github.com/microsoft/vscode-cosmosdb/pull/3449) and has + not moved, partly because newer betas renamed types. Adopting RDG means accepting a moving API + with no deprecation policy, possibly for years more. +- **SlickGrid's churn is real but managed.** Three majors in 18 months, each with breaking + changes, but with migration guides and stable releases between them. Upgrading 9 → 11 is a + bounded, documented exercise; staying current afterwards is roughly one migration per year. + +## 3. Cell-range selection and Excel copy (the new requirement) + +### SlickGrid: built in + +- **Hybrid selection model** (since 9.10, sole model from 10.0): + `enableSelection: true, selectionOptions: { selectionType: 'mixed' }` supports **cell ranges + and row selection in the same grid**. `rowSelectColumnIds` designates which columns select whole + rows, so a document-selection column and free cell-range selection can coexist. + Source: [`slickHybridSelectionModel.ts`](https://github.com/ghiscoding/slickgrid-universal/blob/v11.0.0/packages/common/src/extensions/slickHybridSelectionModel.ts), + [row-selection docs](https://github.com/ghiscoding/slickgrid-universal/blob/v11.0.0/frameworks/slickgrid-react/docs/grid-functionalities/row-selection.md). +- **Mouse rectangle** via + [`slickCellRangeSelector.ts`](https://github.com/ghiscoding/slickgrid-universal/blob/v11.0.0/packages/common/src/extensions/slickCellRangeSelector.ts) + and visual feedback via `slickCellRangeDecorator.ts`. +- **Keyboard range extension** in the same model: Shift+arrows, Shift+Home/End, + Ctrl+Shift+arrows/Home/End. +- **Excel copy**: `enableExcelCopyBuffer: true` registers + [`slickCellExternalCopyManager.ts`](https://github.com/ghiscoding/slickgrid-universal/blob/v11.0.0/packages/common/src/extensions/slickCellExternalCopyManager.ts); + Ctrl+C copies the selected range as tab-separated text that Excel pastes as cells. + `copyToClipboard()` can be called from a toolbar or context-menu command, and + `exportWithFormatter` chooses formatted versus raw values per column + ([docs](https://github.com/ghiscoding/slickgrid-universal/blob/v11.0.0/frameworks/slickgrid-react/docs/grid-functionalities/excel-copy-buffer.md)). +- v11's [ghiscoding/slickgrid-universal#2906](https://github.com/ghiscoding/slickgrid-universal/pull/2906) + keeps `aria-selected` synchronised on selected cells. + +**Our remaining work:** decide what a copied BSON cell contains (display string, EJSON, or the +raw value) and supply it through the copy manager's value hooks; route the clipboard write through +the webview's permitted path; make the paste direction read-only (no accidental writes); and keep +document actions bound to the row-selection column rather than to arbitrary cell ranges. + +### React Data Grid: not provided + +- beta.64 has a single **active cell** plus a **selected rows** set. There is no range concept in + [`DataGrid.tsx`](https://github.com/Comcast/react-data-grid/blob/v7.0.0-beta.64/src/DataGrid.tsx); + `onCellCopy` supplies only the active cell. +- Requests: [Comcast/react-data-grid#2260](https://github.com/Comcast/react-data-grid/issues/2260) + (open since 2020-12, 22 reactions), + [Comcast/react-data-grid#2753](https://github.com/Comcast/react-data-grid/issues/2753) (2021), + [Comcast/react-data-grid#3609](https://github.com/Comcast/react-data-grid/issues/3609) (2024). + Older range-selection support existed in early 7.0 canaries and was dropped + ([Comcast/react-data-grid#1930](https://github.com/Comcast/react-data-grid/issues/1930)). +- Community implementation [Comcast/react-data-grid#2865](https://github.com/Comcast/react-data-grid/pull/2865) + has been **open since 2022-03-26** (50 reactions). Recent comments ask maintainers for a timeline + without response. A participant answered a 2024 request with "this is something you're gonna + have to implement yourself." +- pgAdmin [forked RDG](https://github.com/pgadmin-org/react-data-grid) and applied that PR to get + range selection (stated in a 2024-07-31 PR comment). + +**Our work with RDG:** implement range state, mouse drag with auto-scroll across a virtualised +viewport, Shift+arrow extension, hit-testing that survives column virtualisation, frozen columns +and resizing, decoration CSS (including forced colours), `aria-selected` on cells, TSV serialisation +and clipboard handling — and keep it working across beta API renames. This is a feature-sized +project in itself, not an incremental hook. Forking RDG, as pgAdmin did, trades that for owning a +fork of a moving beta. + +Cosmos DB's integration does not help here: it has row selection only. + +**Without a fork:** beta.64 exposes enough public API (`onCellMouseDown`, a custom +`renderers.renderCell` wrapping the exported `Cell`, `onCellKeyDown`, `onCellCopy`) to build range +selection outside the library, which pgAdmin's older base could not. Estimated 500–700 lines plus +tests, about 2–3 developer-weeks, plus a check on every beta upgrade. Details and the scored +comparison are in [grid-scorecard.md](./grid-scorecard.md#can-we-build-range-selection-on-rdg-without-forking). + +## 4. Accessibility + +| | SlickGrid 11 | RDG beta.64 | +| ---------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- | +| Grid semantics | `role=grid`, row/rowgroup structure on headers (10.10), `aria-rowcount`/`aria-colcount` (10.0), `aria-sort` and `aria-selected` sync (11.0) | Native `role=grid`/`treegrid`, row/column indexes under virtualisation | +| Keyboard navigation | Cell navigation, Tab into headers/menus, Enter/Space sort, refined focus sink (10.2) | Comprehensive documented model: arrows, Home/End, PageUp/Down, Tab boundaries, Shift+Space row selection | +| Keyboard column resize | **Not found** in the documented keyboard model. Pointer resize fixed in 10.5/10.10/11.0 | **Yes**: Ctrl/Meta+Left/Right on a header | +| Tree keyboard | Space/Left/Right expand and collapse (10.2) | `TreeDataGrid` only for grouping; an arbitrary tree is application code | +| Forced colours (Windows contrast themes) | Not established | Explicit support added in beta.64 | +| Independent validation | None found for v10/v11 | Partner reviewer reported three screen-reader bugs fixed on the beta.59 integration | +| History | Partner rejected v9 for accessibility; most of the a11y work above landed _after_ that bake-off | Accessibility is a design goal of the library | + +**Assessment:** RDG is ahead on a documented keyboard model, keyboard column resizing and forced +colours. SlickGrid has closed much of the gap and has a stronger tree story. Neither has been +tested by us. A keyboard alternative for column resizing would be our work on SlickGrid +(for example a Fluent header-menu "Resize column…" dialog, as Cosmos DB built anyway on RDG). + +## 5. Feature coverage against our requirements + +Ratings: **Built-in** = configuration only; **Hooks** = library provides events/renderers, we +write moderate code; **Ours** = we build it. + +| Capability | SlickGrid 11 | RDG beta.64 | +| --------------------------------------------------------- | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------ | +| Dynamic columns, virtualised rows and columns | Built-in | Built-in | +| BSON value plus type indicator | Hooks (formatter returning classes/text, as today) | Hooks (React `renderCell`) | +| Object-cell step-in with keyboard equivalent | Hooks (`onDblClick` + key handler) | Hooks (`onCellDoubleClick` + `onCellKeyDown`) | +| Multi-row document selection | Built-in (checkbox column, Ctrl/Shift click) | Built-in checkbox column; Cosmos built click/Shift/Ctrl selection itself | +| **Rectangular cell-range selection (mouse and keyboard)** | **Built-in** | **Ours** (or fork) | +| **Copy range to Excel** | **Built-in** | **Ours** | +| Rows and cell ranges selected together | Built-in (`selectionType: 'mixed'`) | Ours | +| Arbitrary-depth document tree | **Built-in** tree data (`parentId`), already used today | **Ours** (TreeDataGrid groups by key; not a document tree) | +| Pointer column resize | Built-in (several 2026 fixes) | Built-in | +| Keyboard column resize | Ours (menu/dialog) | Built-in | +| Pin `_id` column | Built-in (`pinning`, v11) | Built-in (`frozen`) | +| Column reorder / picker / header menu / context menu | Built-in (currently disabled by us) | Reorder built-in; picker and menus are ours | +| Export visible rows (CSV/Excel) | Built-in plugins | Ours | +| Theming | SCSS/CSS variables; a **Fluent theme** exists since v10, Fluent icon set in v11 | CSS variables with `light-dark()`; we map to VS Code tokens | +| React integration | Imperative wrapper; refs for handlers (stale-closure pattern) | Native React props and renderers | +| Bundle weight | Heavier; already isolated in its own lazy chunk | Lighter, zero runtime dependencies | + +## 6. What each path gives up + +### Choosing SlickGrid 11 + +- **Not React-idiomatic.** The imperative wrapper keeps the ref-based handler pattern, the explicit + `renderGrid()` workaround and SlickGrid-specific DOM. A cleaner integration reduces but does not + remove this. +- **Diverges from the partner.** No shared code or bug fixes with Cosmos DB's grid. Mitigation: + the partner's integration is mostly app-specific anyway (selection, header menu, tree, + theme); its transferable lessons are behavioural tests (§4 of the migration report), which apply + to either library. +- **Annual migrations.** Expect a v12 (the v11 notes already announce deferred CSS anchor + positioning and Sanitizer API work). +- **Heavier bundle and a second theme system**, partially offset by the Fluent theme. +- **Keyboard column resizing and forced colours** must be added or verified by us. + +### Choosing React Data Grid + +- **Cell-range selection and Excel copy become a project we own**, with no upstream path in sight. +- **Arbitrary document tree becomes ours**, as it did for the partner. +- **Indefinite beta.** Breaking renames between betas; pinning to avoid them, as the partner does, + forgoes later accessibility fixes. +- **Larger open-issue backlog and slow review of community contributions.** +- **No export, column picker, header/context menu built-ins.** + +## 7. Recommended path and the gate that could reverse it + +1. **Introduce the grid-neutral boundary first** (the existing plan's G1/G2): neutral result + shapes, `ResultsTable`/`ResultsTree` interfaces, canonical document identity separate from row + index, field-keyed (not index-keyed) step-in. This is valuable for either library and keeps a + later swap possible. +2. **Upgrade 9.13 → 10 → 11** following both migration guides. Explicitly configure + `enableSelection` with `selectionType: 'row'` to preserve today's behaviour, then evaluate + `'mixed'`. +3. **Accessibility gate (decisive):** in packaged VS Code with NVDA and Narrator, verify table and + tree keyboard navigation, header reachability, row-count announcements, selection + announcements, focus retention after refresh, and the three bugs the partner reported + ([microsoft/vscode-cosmosdb#2926](https://github.com/microsoft/vscode-cosmosdb/issues/2926), + [microsoft/vscode-cosmosdb#2929](https://github.com/microsoft/vscode-cosmosdb/issues/2929), + [microsoft/vscode-cosmosdb#2930](https://github.com/microsoft/vscode-cosmosdb/issues/2930)) + against SlickGrid 11. Add a keyboard path to column resizing. Check Windows contrast themes. + **If SlickGrid 11 cannot meet this gate with reasonable application-side fixes, switch to + RDG** and plan range selection as its own work item. +4. **Resizing gate:** reproduce our current resizing complaints on 9.13, then confirm they are gone + on 11 (handle hit-box fix, auto-scroll fixes). If not, record why. +5. **Then the range-selection feature:** enable `'mixed'` selection with a dedicated row-selection + column for document actions, `enableExcelCopyBuffer`, and a defined BSON copy format. + +Because effort is not a constraint, the stronger long-term alternative to evaluate if the gate +fails is not "RDG as-is" but "RDG plus an owned range-selection layer" — and that should be costed +before committing. + +## 8. What the first pass got wrong or under-weighted + +- It treated **partner alignment** as a strong reason to migrate. The partner's grid code is + largely application-specific; the shareable value is mainly lessons and tests. +- It did not consider **range selection**, which is a decisive capability gap. +- It did not assess **governance**: "Comcast organisation" suggested a team; the commit record + shows one maintainer, the same risk profile as SlickGrid but with a larger backlog and no stable + release. +- It noted that SlickGrid improved, but still treated the partner's March 2026 rejection as + current. Most of SlickGrid's accessibility work landed after that evaluation. + +The [no-loss contract](./migration-parity.md) is unaffected and applies to either path. diff --git a/docs/ai-and-plans/features/data-grid/grid-scorecard.md b/docs/ai-and-plans/features/data-grid/grid-scorecard.md new file mode 100644 index 000000000..cfb6061cd --- /dev/null +++ b/docs/ai-and-plans/features/data-grid/grid-scorecard.md @@ -0,0 +1,453 @@ +--- +feature: data-grid +kind: research +status: active +created: 2026-11-26 +verified: 2026-11-26 +code: + - src/webviews/documentdb/collectionView/components/resultsTab/** + - package.json +--- + +# Grid evaluation: SlickGrid 11 vs React Data Grid + +Decision support for [#1101](https://github.com/microsoft/vscode-documentdb/issues/1101), comparing +`slickgrid-react` **11.0.0** (stable, 2026-11-10), which we already use at 9.13, with +`react-data-grid` **7.0.0-beta.64** (2026-11-05), which our partner extension Cosmos DB adopted. +Detailed evidence and sources are in [grid-options-evaluation.md](./grid-options-evaluation.md) and +[migration-research.md](./migration-research.md); this file states what we needed, how we checked +it, and the result. No prototype was built. + +**Outcome:** migrate to React Data Grid, pinned to an exact beta. The deciding factor was +accessibility in row selection, a hard requirement for us. SlickGrid did well in many other +categories, and the last chapter describes how we might help it close the gaps we found. + +## Our priorities + +Stated by the operator on 2026-11-26, in order of weight: + +1. **Accessibility is a hard requirement**, keyboard navigation in particular. It is applied as a + gate: an option that cannot meet it is out, whatever its other scores. Our open accessibility + bugs for this grid include a Sev1 for keyboard access to the table and tree + ([#383](https://github.com/microsoft/vscode-documentdb/issues/383)). +2. **No functional loss** from today's Collection View: dynamic columns, BSON values and type + markers, stepping into nested objects, multi-row selection for View/Edit/Delete, the Tree View, + paging ([no-loss contract](./migration-parity.md)). +3. **Planned features** soon after the choice: pin `_id` (and more columns from the header), + multi-cell selection with Shift+arrows or the mouse with copy to Excel, a context menu aware of + that selection, and later in-cell editing. +4. **No fork.** We want to stay on upstream releases. +5. **Long-term maintainability:** release stability, maintainer activity, bus factor. +6. Migration effort is **not** a constraint. Column header grouping is **not** a deciding factor. + A custom tree on React Data Grid is considered manageable. + +## How we evaluated: looking for a way to stay on SlickGrid + +We started from the position that **not migrating** was preferable: SlickGrid is already in place, +has stable releases, a very active maintainer, and built-in features we want (range selection, +Excel copy, tree data, editors). Each step below tried to confirm that staying was viable. + +1. **Upstream review of SlickGrid 10 and 11.** Release notes and source since our pinned 9.13 + showed substantial accessibility and resizing work + ([slickgrid-update-assessment.md](./slickgrid-update-assessment.md)). Our partner's March 2026 + rejection of SlickGrid predates most of it, so it could not be relied on. +2. **Partner history.** Cosmos DB's migration and its eight months of follow-up fixes + ([migration-research.md](./migration-research.md)) showed what React Data Grid did and did not + solve for them; it is evidence, not a reason in itself. +3. **Our own reported accessibility bugs.** Of four grid-related issues, two come from our own + styling (focus outline and type-marker contrast) and one (resizing without dragging) needs app + work on either grid. Only the keyboard Sev1 depends on the grid choice. +4. **Feature and cost mapping** of today's features and the planned ones onto both grids (see + [Feature support](#feature-support-what-we-have-today-and-what-comes-next)). SlickGrid covers + more out of the box; nothing is lost with either. +5. **Hands-on screen-reader check.** The operator tested the live demos of both grids with Windows + Narrator in Edge (NVDA could not attach to the browser in this environment). This was a quick + pass, not a full audit, using the libraries' own demos rather than our extension. + +### Hands-on results + +**SlickGrid 11** ([live demos](https://ghiscoding.github.io/slickgrid-react-demos/)): + +| Demo | Configuration ([source](https://github.com/ghiscoding/slickgrid-universal/blob/v11.0.0/demos/react/src/examples/slickgrid/Example48.tsx)) | Result | +| ---------- | ----------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------- | +| 48, grid 1 | `selectionType: 'mixed'` (cell ranges plus row selection on the `id` column), editable, Excel copy | **Pass**: cell contents announced while navigating | +| 48, grid 2 | Same, plus `enableCheckboxSelector` and `selectionType: 'row'` | **Fail**: navigation not narrated correctly | +| 10 | Row selection with checkbox column, multi-select | **Issues**, apparently around multi-row selection | +| 27 | Tree data (`parentId`), our Tree View's setup | **Fail**: no meaningful narration | + +**React Data Grid** ([live demos](https://comcast.github.io/react-data-grid/)): + +| Demo | Result | +| -------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| [CommonFeatures](https://comcast.github.io/react-data-grid/#/CommonFeatures) (row selection) | **Pass**: the selected checkbox state is announced, and header cells are narrated with position ("column x of y") | +| [TreeView](https://comcast.github.io/react-data-grid/#/TreeView) | **Partial**: narration of rows and cells is good, but Enter or Space on the expand (chevron) button does nothing, so the tree cannot be expanded by keyboard | + +**What we concluded from the tests:** + +- **Row selection**, which drives our document actions, is the deciding difference: it narrated + well on React Data Grid and did not on SlickGrid 11. This behaviour sits inside the library, so + we cannot fix it in our own code. +- **Tree:** SlickGrid's tree data gave no meaningful narration. React Data Grid's tree demo + narrated well, but its expand button did not respond to the keyboard; that button is example + code in the demo + ([`TreeView.tsx`](https://github.com/Comcast/react-data-grid/blob/v7.0.0-beta.64/website/routes/TreeView.tsx)), + not part of the library. We would build our own tree either way, and **an accessible document + tree is the main piece of work we take on**. +- SlickGrid's cell and range mode narrated well, which shows the foundation is there. + +Limits: these were the libraries' own demo configurations in a browser, with one screen reader. A +final check must run inside our packaged extension, ideally with NVDA as well. + +## Scorecard + +Scores are **1–10 judgments**, higher is better for us. Weight 5 = hard requirement, 3 = deciding, +2 = important, 1 = nice to have. + +| # | Category | Weight | SlickGrid 11 | RDG beta.64 | Edge | +| --- | ----------------------------------------------------- | :----: | :-------------------------------: | :------------------------------------------------------: | -------------- | +| 1 | Cell-range selection + Excel copy | 3 | **9** | 5 | SlickGrid | +| 2 | Accessibility (average of 9 sub-scores) | **5** | 5.8 | **7.6** | RDG | +| 3 | Release stability / API churn | 3 | **8** | 3 | SlickGrid | +| 4 | Document (row) selection and actions | 2 | **8** | 7 | SlickGrid | +| 5 | Tree view | 2 | **8** | 6 | SlickGrid | +| 6 | In-cell editing | 2 | **8** | 6 | SlickGrid | +| 7 | Column resizing (pointer, keyboard, width stability) | 2 | 6 | **8** | RDG | +| 8 | Maintainer activity and responsiveness | 2 | **8** | 5 | SlickGrid | +| 9 | Bus factor / governance | 2 | 4 | **5** | RDG (slightly) | +| 10 | React integration / developer experience | 2 | 4 | **9** | RDG | +| 11 | Look and feel in VS Code | 2 | 6 | **7** | RDG | +| 12 | Partner alignment / proven in a VS Code extension | 1 | 5 | **8** | RDG | +| 13 | Bundle size and runtime footprint | 1 | 6 | **8** | RDG | +| 14 | Built-in extras (export, menus, picker, row grouping) | 1 | **9** | 4 | SlickGrid | +| 15 | Column header grouping | 1 | 5 | **8** | RDG | +| | **Weighted average** (total weight 31) | | 6.7 | 6.3 | SlickGrid | +| | Unweighted average | | 6.7 | 6.4 | close | +| | **Accessibility gate (hands-on)** | | **Not yet** (row selection, tree) | **Pass** (row selection hands-on; tree is ours to build) | **RDG** | + +**Reading:** the weighted average slightly favours SlickGrid, because it adds up many categories in +which SlickGrid is strong: built-in range selection, editing, tree, extras, release stability and +maintainer activity. With accessibility as a hard requirement, the gate decides instead: React Data +Grid passed it for the configurations we need, and SlickGrid 11 did not yet. + +### Sensitivity + +| Change | SlickGrid | RDG | Result | +| ------------------------------------------------------ | :-------: | :-: | --------- | +| As scored | 6.7 | 6.3 | SlickGrid | +| Range-selection cost on RDG accepted (RDG cat. 1 → 7) | 6.7 | 6.5 | SlickGrid | +| Release churn not a concern (both cat. 3 → 7) | 6.6 | 6.7 | RDG | +| Developer experience weighted 3 instead of 2 | 6.7 | 6.4 | SlickGrid | +| Accessibility applied as a gate (operator's rule) | — | — | **RDG** | +| SlickGrid 11 surprises positively in real a11y testing | — | — | Re-open | + +The weighted ranking flips only if the beta concern is dropped. Under the accessibility gate, +React Data Grid is the choice unless SlickGrid's row selection and tree pass a future check. + +## Category details + +### 1. Cell-range selection + Excel copy (weight 3) — SlickGrid 9, RDG 5 + +**SlickGrid:** built in. Hybrid selection (`selectionType: 'mixed'`) gives mouse-drag rectangles, +Shift+arrow extension and row selection in the same grid; `enableExcelCopyBuffer` copies TSV that +pastes into Excel. Live demo: +[Example 3](https://ghiscoding.github.io/slickgrid-react-demos/#/Example3). Our work: BSON copy +format, disable paste-to-write, keep document actions on the row-selection column. Estimate +**2–4 days**. Not 10 because the copy format and paste safety are ours. + +**RDG:** not provided; requested since 2020 (Comcast/react-data-grid#2260), community PR open since +2022 (Comcast/react-data-grid#2865), pgAdmin forked. Scored 5 because, **unlike pgAdmin's base +version, beta.64 makes it possible without a fork** (next section), at a real cost. + +#### Can we build range selection on RDG without forking? + +**Yes, using public beta.64 APIs.** pgAdmin forked because it needed per-cell `onMouseEnter`, +range-aware cell classes and `aria-selected` inside the grid's `Cell` and `Row` components +(their diff adds exactly those). beta.64 exposes enough to do that from outside: + +| Need | Public beta.64 mechanism | +| --------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| Start a drag | `onCellMouseDown` (gives row and column), `preventGridDefault()` to suppress default handling | +| Extend while dragging | Custom cell renderer: `renderers.renderCell(key, props)` returning the exported ``. `Cell` spreads extra props onto the cell element. | +| Highlight the range | Same wrapper: add a class and `aria-selected` for cells in range. `Cell` applies `{...props}` after its own `aria-selected`, so our value wins. A small store read with `useSyncExternalStore` re-renders only affected cells despite row memoisation. | +| Keyboard extension | `onCellKeyDown` (Shift+arrows, Shift+Home/End, Ctrl+A) with `preventGridDefault()`, plus `setActivePosition` | +| Auto-scroll when dragging past the edge | `DataGridHandle.element` scroll plus `scrollToCell`; ours to implement | +| Copy | `onCellCopy` or a `copy` listener on the grid; serialise the range from row data (works with virtualised rows) | + +Sources: [types.ts](https://github.com/Comcast/react-data-grid/blob/v7.0.0-beta.64/src/types.ts), +[Cell.tsx](https://github.com/Comcast/react-data-grid/blob/v7.0.0-beta.64/src/Cell.tsx), +[index.ts exports](https://github.com/Comcast/react-data-grid/blob/v7.0.0-beta.64/src/index.ts), +[DataGrid.tsx](https://github.com/Comcast/react-data-grid/blob/v7.0.0-beta.64/src/DataGrid.tsx); +pgAdmin's change: [pgadmin-org/react-data-grid@8ddaa7be](https://github.com/pgadmin-org/react-data-grid/commit/8ddaa7be). + +**Estimated cost (engineering judgment, not measured):** + +| Part | Production code | Notes | +| ------------------------------------------------ | --------------- | ---------------------------------------------------------------------- | +| Range state, mouse drag, highlight wrapper | 150–250 lines | Interaction with active cell, row selection and editing | +| Keyboard extension and select-all | ~100 lines | Must not fight RDG's own Shift+Space row selection | +| Drag auto-scroll across virtualised rows/columns | ~80 lines | Frozen `_id` column complicates hit-testing | +| TSV serialisation and clipboard | ~80 lines | Same BSON format decision as SlickGrid | +| Range announcement for screen readers | ~50 lines | `aria-selected` on cells plus a live summary ("3 by 4 cells selected") | +| Browser tests | ~300 lines | Drag, keyboard, scroll, copy, virtualisation | + +Roughly **500–700 lines plus tests, about 2–3 developer-weeks** including accessibility review, +versus 2–4 days on SlickGrid. Ongoing cost: re-verify on every beta upgrade (about half a day to a +day each), because the wrapper depends on `RenderCellProps`, `Cell`'s prop spreading and +`CellMouseArgs`, all of which have been renamed in recent betas. That dependency, not the initial +build, is the main risk. + +### 2. Accessibility (weight 5, hard requirement and gate) — SlickGrid 5.8, RDG 7.6 + +Sub-scores are judgments from source, release notes and issues. The hands-on Narrator check is +described in [How we evaluated](#how-we-evaluated-looking-for-a-way-to-stay-on-slickgrid); its +results are reflected in the gate, not in these sub-scores. + +| Sub-category | SlickGrid 11 | RDG beta.64 | Evidence | +| ------------------------------------ | :----------: | :---------: | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| Keyboard navigation in cells | 8 | **9** | Both: arrows, Home/End, Ctrl+Home/End, PageUp/PageDown, Tab, Enter/Escape. RDG documents the model in its README and its tests fail if page focus is lost. | +| Header keyboard access (focus, sort) | 8 | **9** | SlickGrid: Tab into headers and menus, Enter/Space sort (10.0). RDG: headers in the roving tab order, Enter/Space sort, Ctrl+Enter multi-sort. | +| Keyboard column resize | 2 | **9** | RDG: Ctrl+Left/Right on a header. SlickGrid: none found in source or issues; we would add a header-menu "Resize column…" dialog. | +| Screen-reader semantics | 7 | **8** | SlickGrid: `role=grid`, header row/rowgroup (10.10), row/column counts (10.0), `aria-sort` and `aria-selected` sync (11.0). RDG: `grid`/`treegrid`, row and column indexes under virtualisation; open PR Comcast/react-data-grid#4267 stops misusing `aria-selected` for the focused cell. | +| Focus management and visible focus | 6 | **9** | SlickGrid: focus-visible styles and refined focus sink (10.0/10.2). RDG: rows focusable, focus sink removed (beta.60), focus contrast raised (Nov 2026), focus-loss tests. | +| High contrast / forced colours | 4 | **8** | RDG: explicit forced-colours support (beta.64). SlickGrid: not established; would rely on our VS Code token mapping, to be verified in High Contrast themes. | +| Tree keyboard and semantics | **7** | 5 | SlickGrid: Space/Left/Right expand and collapse (10.2), built in; but no meaningful Narrator output in the hands-on check. RDG: our own document tree; `aria-level`/`aria-expanded`/focus on collapse are ours. | +| Range selection accessibility | **7** | 5 | SlickGrid: Shift+arrow ranges, `aria-selected` on range cells. RDG: ours, via the `Cell` wrapper; `aria-selected` on range cells plus a live summary. | +| Independent validation | 3 | **6** | RDG: partner reviewer reported three screen-reader bugs fixed. SlickGrid v10/v11: none found; the partner rejected v9 for accessibility. | +| **Average** | **5.8** | **7.6** | | + +**Gate result (after the hands-on check):** + +- **React Data Grid: pass for the library.** Row selection, headers and navigation were narrated + well. What remains is our own work: the document tree, range selection and a keyboard way to + step into objects must be built accessibly, and each beta upgrade re-checked. +- **SlickGrid 11: not yet.** Cell and range mode narrated well, but row selection and tree data, + the two configurations we depend on, did not. Both sit inside the library, so we cannot fix them + in our own code. Several sub-scores above also depend on work we would add ourselves (keyboard + column resizing, high-contrast styles). + +SlickGrid's accessibility has improved a great deal across 10.x and 11.0, and much of that work is +recent. The gaps we found are specific and look addressable; see +[How we could help SlickGrid](#how-we-could-help-slickgrid-pass-these-checks). + +#### Accessibility issues already reported against our grid + +Four of the 23 `a11y`-labelled issues in this repository concern the Collection View grid; all are +open (checked 2026-11-26). + +| Issue | WCAG / severity | Cause | Depends on grid choice? | +| ---------------------------------------------------------------------------------------------------------- | --------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| [#383](https://github.com/microsoft/vscode-documentdb/issues/383) Table and tree not keyboard accessible | 2.1.1, **Sev1** | SlickGrid 9.13 focus and tree keyboard behaviour, plus ours (no keyboard step-in; active-cell border removed in our theme). A later comment says the **Tree View** is worse than the table. | **Yes.** RDG's table foundation is stronger; SlickGrid 11 has a built-in keyboard tree, while on RDG the tree's keyboard support is ours. | +| [#775](https://github.com/microsoft/vscode-documentdb/issues/775) Cell focus indicator contrast below 3:1 | 1.4.11, Sev2 | **Ours**: 1 px `#aaaaaa` active-cell shadow in `slickgrid.scss` | No; fix in our theme either way (RDG's 2 px default helps). | +| [#776](https://github.com/microsoft/vscode-documentdb/issues/776) Column width only adjustable by dragging | **2.5.7**, Sev2 | No single-pointer alternative | No; needs a header menu with "Resize column…" and "Fit to content" on **either** grid. RDG's Ctrl+arrow resize is keyboard, not single-pointer. Cosmos DB fixed the same bug on SlickGrid v9 ([microsoft/vscode-cosmosdb#2666](https://github.com/microsoft/vscode-cosmosdb/issues/2666), [microsoft/vscode-cosmosdb#2723](https://github.com/microsoft/vscode-cosmosdb/pull/2723)). | +| [#382](https://github.com/microsoft/vscode-documentdb/issues/382) "AB" type marker contrast 2.85:1 | 1.4.3, Sev2 | **Ours**: `.typedTableCell::before` at `opacity: 0.4` | No; fix in CSS, or replace with the planned type badge. | + +**Effect on the scores:** none applied. Because #776 forces a header-menu resize dialog on both grids, +SlickGrid's "keyboard column resize" gap narrows in practice (that dialog is keyboard-operable); +raising that sub-score from 2 to 4 would move SlickGrid's accessibility average from 5.8 to 6.0 and +its weighted total by under 0.1, without changing the gate result. The Sev1 (#383) is the one that +matters: it confirms keyboard navigation of **both** table and tree is the acceptance test, and that +on RDG the accessible document tree is the highest-risk item we would own. + +### 3. Release stability / API churn (weight 3) — SlickGrid 8, RDG 3 + +SlickGrid: stable semver, majors roughly every 6–9 months with migration guides (and AI migration +skills). RDG: 7.0 pre-release since 2019, last stable 2018, ~12 API renames between betas in the +last year, 7-month release gap, partner pinned to beta.61. RDG gets 3 rather than lower because +pinning is workable and the code is well tested. + +### 4. Document (row) selection and actions (weight 2) — SlickGrid 8, RDG 7 + +Both support multi-row selection. SlickGrid's hybrid model lets row selection coexist with cell +ranges. RDG has a checkbox column; Cosmos DB still wrote click/Shift/Ctrl selection itself. + +### 5. Tree view (weight 2) — SlickGrid 8, RDG 6 + +SlickGrid: `parentId` tree data, what we use today, keyboard expand/collapse since 10.2. RDG: +`TreeDataGrid` groups by key; an arbitrary document tree is application code, as in the +[TreeView demo](https://comcast.github.io/react-data-grid/#/TreeView) and Cosmos DB's tree. +Manageable, but ours to build and keep accessible (`aria-level`, expand state, focus on collapse). + +### 6. In-cell editing (weight 2) — SlickGrid 8, RDG 6 + +SlickGrid: many editors, per-column validators, undo via edit command handler, composite row +editor. RDG: `renderEditCell`, text editor, `onRowsChange`; validation, undo and typed editors are +ours. The BSON round-trip and database write are ours either way. + +### 7. Column resizing (weight 2) — SlickGrid 6, RDG 8 + +RDG: pointer and keyboard resize, double-click fit, controlled widths that survive paging. SlickGrid: +pointer resize fixed in 10.5/10.10/11.0, content sizing rewritten in 11.0, no keyboard resize. The +"headers resize when paging" problem is a width-retention policy we need with either grid. + +### 8. Maintainer activity and responsiveness (weight 2) — SlickGrid 8, RDG 5 + +Last 12 months: SlickGrid ~1,025 human commits, 27 releases, 48 features, 182 fixes, 1 open issue. +RDG ~162 human commits (about two-thirds tooling), 6 releases, 47 open issues, community range PR +unreviewed for years. RDG's October–November 2026 work was strong, hence 5. + +### 9. Bus factor / governance (weight 2) — SlickGrid 4, RDG 5 + +Both ≈1: SlickGrid 98% one person (personal repository; employer Schneider Electric appears to use +it); RDG 94% one person. RDG scores one point higher only because the repository belongs to the +Comcast organisation, which could appoint new maintainers; there is little evidence it would. + +### 10. React integration / developer experience (weight 2) — SlickGrid 4, RDG 9 + +RDG is a React component with props and renderers. SlickGrid's React wrapper is a thin layer over +the framework-independent core: handlers are bound at initialisation (hence our ref workaround), we +call `renderGrid()` manually, and formatters return strings or HTML. That design lets one maintainer +support five frameworks, and he has said React is not his main focus; it is a fair trade-off for +the project, but it costs us more glue code. + +### 11. Look and feel in VS Code (weight 2) — SlickGrid 6, RDG 7 + +Both need a VS Code token mapping. RDG's CSS variables are small and modern (`light-dark()`, forced +colours); its cells are React, so Fluent badges and icons fit naturally. SlickGrid has a Fluent theme +and Fluent icon set, but a larger SCSS surface and HTML-string formatters. + +### 12. Partner alignment (weight 1) — SlickGrid 5, RDG 8 + +Same grid and visual language as Cosmos DB, with eight months of their fixes as lessons. Not higher +because their selection, tree, menus and theme are app-specific and reusable mostly as ideas and +tests. SlickGrid gets 5 because we already run it in production. + +### 13. Bundle size and runtime footprint (weight 1) — SlickGrid 6, RDG 8 + +RDG has no runtime dependencies. SlickGrid brings seven packages, already isolated in a lazy chunk. +Not measured in our build. + +### 14. Built-in extras (weight 1) — SlickGrid 9, RDG 4 + +SlickGrid: CSV/Excel/PDF export, header/context/grid menus, column picker, row grouping with +aggregators, pinning. RDG: reorder and summary rows; menus, picker and export are ours. + +### 15. Column header grouping (weight 1) — SlickGrid 5, RDG 8 + +RDG supports nested header groups of any depth; SlickGrid one pre-header level. Not a deciding +factor for us. + +## Feature support: what we have today, and what comes next + +Not scored above; this chapter maps the Collection View's **current** features, and the additions +planned right after the grid choice, onto `slickgrid-react` 11.0.0 and `react-data-grid` +7.0.0-beta.64. Current behaviour is taken from the +[no-loss contract](./migration-parity.md) (IDs in brackets). + +Legend: **Built-in** = configuration; **Hooks** = the grid provides events or renderers and we write +moderate code; **Ours** = we build it; **App** = lives outside the grid either way. Effort +estimates are judgments for one developer, not measurements. + +### Features we ship today + +| Today's feature | SlickGrid 11 | RDG beta.64 | +| ------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| Columns built from the schema at the current path, heterogeneous rows (T01) | Built-in. Same as today; avoid the v10 `hidden`-column changes affecting our dynamic `setColumns` use. | Built-in. Columns are a memoised array keyed by field path. | +| BSON value with a short type marker and type-name tooltip (T06–T08) | Hooks. Today's formatter (`text`, `addClasses`, `toolTip`) keeps working; markers stay CSS `::before` text unless we move to HTML formatters. | Hooks. A React `renderCell` can render a proper Fluent badge/icon with an accessible type description; tooltip via Fluent. **Better fit for the planned type icon.** | +| Missing field ≠ `null` ≠ empty string (T09) | Hooks (formatter, as today) | Hooks (`renderCell`) | +| Double-click an object cell to step in, breadcrumbs, Level up (T03–T04) | Hooks. `onDblClick`, as today; add a key handler for a keyboard equivalent. Breadcrumbs are App. | Hooks. `onCellDoubleClick` plus `onCellKeyDown` (for example Enter) for the keyboard equivalent. Breadcrumbs are App. | +| Native text selection inside a cell (T11) | Built-in (`enableTextSelectionOnCells`) | Verify; not a documented option. See the conflict note below. | +| Multi-row selection → enables View / Edit / Delete (S01–S02) | Built-in. v10 renames `enableRowSelection` → `enableSelection`, `rowSelectionOptions` → `selectionOptions`. | Hooks. `SelectColumn` checkbox column built-in; click/Ctrl/Shift row gestures are ours (Cosmos DB wrote them). | +| Delete removes rows locally and clears selection; clear on unmount (S04–S05) | App | App | +| Tree View: Field / Value / Type, collapsed initially, indentation, arrays ≤ 10 expanded (R01–R04) | Built-in tree data over our `parentId` list, as today. v11 drops the old `.slick-group-toggle` class. | Ours. Flattened visible rows with an expander cell, as in the TreeView demo and Cosmos DB; `aria-level`/`aria-expanded` ours. | +| JSON View (Monaco) | Not a grid feature | Not a grid feature | +| Paging, page size, query, schema accumulation (W01–W03) | App | App | +| First-load skeleton, empty result, announcements (W04) | App (plus an optional empty-data warning component) | App (plus `renderers.noRowsFallback`) | +| Grid follows the container size (W06) | Hooks. Today's `ResizeObserver` + `resizeGrid()`; v11 autoResize improvements. | Built-in. The grid sizes with CSS and observes itself. | +| Minimum column width, auto-size columns | Built-in (`minWidth`, auto-size; v11 canvas-based content sizing) | Built-in `minWidth`; content-fit on double-click of the resize handle. No automatic fit on load. | +| Keyboard cell navigation (T05, W09) | Built-in | Built-in | +| VS Code theming, light/dark/high contrast (W07) | Hooks. SCSS variable overrides, as today, or the Fluent theme. | Hooks. Map `--rdg-*` variables to VS Code tokens, as Cosmos DB did. | + +**Conclusion for today's features:** nothing we ship today is lost with either grid. SlickGrid covers +more of it with configuration, especially the tree. RDG needs the tree and row gestures written by +us, but is the better base for the planned richer type icon. + +### Planned additions after the grid choice + +| Planned feature | SlickGrid 11 | RDG beta.64 | +| -------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| **Pin `_id` by default** | Built-in: `pinned: 'left'` on the `_id` column (v11 pinning). **XS**, under a day. | Built-in: `frozen: 'start'` on the `_id` column. **XS**, under a day. | +| **Pin more columns from the header** (pin icon) | Built-in commands: the v11 Header Menu includes "Pin to Left / Pin to Right / Unpin" by default; `pinnable: false` keeps `_id` locked. A pin icon in the header itself is the Header Buttons plugin. We keep pinned field paths across schema/page changes. Menu text needs our `l10n` strings via the `locales` option. **S**, 2–3 days. | Hooks: a pin toggle button in `renderHeaderCell` (Fluent icon button, `aria-pressed`), state in React, `frozen` set per column. Frozen columns move to the edge, so the visible order changes. Header buttons must use the cell's `tabIndex` to join the header's keyboard model, as Cosmos DB's header menu does. **S**, 2–4 days. | +| **Multi-cell selection** with Shift+arrows or mouse drag | Built-in: hybrid selection (`selectionType: 'mixed'`), range decorator, Shift/Ctrl+Shift keys, Excel copy. Keep document actions on a row-selection column (`rowSelectColumnIds`). **S**, 2–4 days incl. BSON copy format. | Ours, without a fork (see [category 1](#can-we-build-range-selection-on-rdg-without-forking)): drag, Shift+arrow, highlight via a `Cell` wrapper, auto-scroll, copy, announcements. **M–L**, 2–3 weeks, plus re-checking on each beta upgrade. | +| **Context menu aware of the multi-selection** | Built-in plugin: `enableContextMenu` with `commandItems`; `itemVisibilityOverride` / `itemUsabilityOverride` and `onCommand` can read `grid.getSelectionModel().getSelectedRanges()` to show, for example, "Copy 12 cells", "Copy as JSON", or hide single-cell commands. Menu keyboard navigation improved in 10.x. Caveats: it is SlickGrid's own menu DOM (Fluent icon set available, not Fluent React components); opening via the keyboard Context Menu key / Shift+F10 needs checking. **S**, 2–4 days. | Hooks: `onCellContextMenu` opens a Fluent `Menu` positioned at the pointer; Shift+F10 / Context Menu key via `onCellKeyDown`; selection awareness from our own range store (right-clicking inside the range must not collapse it: `preventGridDefault`). Fully Fluent, consistent with the rest of the webview. **S–M**, 3–5 days, after the range work. | + +**Conflict to design for (both grids):** once mouse dragging selects cell ranges, the same gesture +can no longer select text inside a cell. Decide which wins (for example drag selects cells; double-click +or F2 enters a cell to select text), and keep copying a single value easy. + +**Rough totals for the four planned additions:** + +| | SlickGrid 11 | RDG beta.64 | +| ---------------------------- | ------------------------------------------------------------- | --------------------------------------------------------- | +| Pinning (`_id` + header pin) | 2–3 days | 2–4 days | +| Multi-cell selection + copy | 2–4 days | 2–3 weeks | +| Selection-aware context menu | 2–4 days | 3–5 days | +| **Total** | **~1.5–2 weeks** | **~3.5–4.5 weeks** | +| Result | Mostly configuration of built-ins; menus are SlickGrid-styled | Mostly our React code; fully Fluent and under our control | + +On SlickGrid the planned work is cheaper; on RDG it costs about 2–3 extra weeks but produces Fluent +menus and selection behaviour we control end to end. That difference is mainly range selection, and +it is a one-time cost plus upgrade checks, not a blocker. + +## Conclusion + +**Recommendation: migrate to React Data Grid, pinned to an exact beta.** + +- **Accessibility decides it.** In the hands-on check, React Data Grid's row selection narrated + well and SlickGrid 11's did not; that is library behaviour we cannot fix ourselves. +- **Range selection does not need a fork.** beta.64's public renderer and event APIs are enough: + about 2–3 developer-weeks, plus a check on each beta upgrade. +- **What we take on:** an accessible document tree, range selection, editing extras such as + validation and undo, pinning a beta and budgeting for API renames, and one dominant maintainer + (as with SlickGrid). +- **Planned additions** (pinning, multi-cell selection, a selection-aware context menu) cost about + 1.5–2 weeks on SlickGrid and 3.5–4.5 weeks on React Data Grid, almost all of the difference + being range selection. +- **What would reverse this:** SlickGrid's row selection and tree passing a screen-reader check in a + future release, or React Data Grid stalling or breaking APIs badly enough that pinning stops + being workable. + +Build a grid-neutral boundary in our code first either way; it keeps the other option open. + +## How we could help SlickGrid pass these checks + +SlickGrid is maintained essentially by one person, who has been generous with his time towards our +team (every issue we previously opened was fixed) and who has shipped a large amount of +accessibility work across 10.x and 11.0. Nothing here is a request or an expectation. It records +the criteria we used, where SlickGrid 11 fell short of them in our check, and paths that might +resolve each gap, so that we can offer help (issues with reproduction steps, or pull requests) if +that is welcome. + +### Criteria we used + +- A keyboard-only user can reach the grid, move between cells and headers, and always see where + focus is. +- A screen reader announces each cell with its column, the row position, and any selection state. +- **Row selection** (checkbox column and keyboard) announces selected and not selected, and + navigation keeps being narrated while it is enabled. +- **Tree data** announces each row's level and expanded or collapsed state, and can be expanded and + collapsed from the keyboard. +- Column widths can be changed without dragging (WCAG 2.5.7) and from the keyboard. +- Focus, selection and range highlights stay visible in Windows high-contrast themes. + +### What we observed, and possible paths + +| Area | What we observed (SlickGrid 11.0.0) | Possible path | +| ------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| Row selection | In demo 48, grid 2 (`selectionType: 'row'` with a checkbox column) and in demo 10, Narrator did not narrate navigation correctly, while grid 1 (`'mixed'`) did. | Compare the accessibility tree of grid 1 and grid 2 (for example in `edge://accessibility` or with Accessibility Insights) to find what the row-selection mode changes: focus target, roles on the checkbox cell, or `aria-selected` on rows versus cells. A small reproduction and an issue would be the first step; a fix may be local to the row-selection path. | +| Tree data | Demo 27 gave no meaningful narration. In the v11 source, `aria-expanded` is on the toggle icon inside the cell, and rows carry no `aria-level`, `aria-setsize` or `aria-posinset`; the grid role stays `grid`. | Expose tree state on the row: `aria-level`, `aria-expanded`, and optionally `aria-setsize`/`aria-posinset`, with the grid role switched to `treegrid` when tree data is enabled. The tree service already knows each item's level, so this may be a contained change. A good candidate for a pull request from us. | +| Keyboard column resize | The resize handle has `role="separator"` but is not focusable, and no keys resize a column. | Either support Ctrl+Left/Right on a focused header (as some other grids do), or make the handle focusable with `aria-valuenow` and arrow-key handling. Worth discussing first, since it touches header and resize design. | +| Resizing without dragging | The header menu offers "Resize by content" but no way to enter a width. | An optional "Resize column…" header-menu command that opens a small dialog for a width in pixels. It would help every SlickGrid user meet WCAG 2.5.7; we would need it in our own app regardless. | +| High contrast | No `forced-colors` rules in the v11 stylesheets. | A `@media (forced-colors: active)` block mapping the active cell, selected rows and range highlight to system colours (`Highlight`, `CanvasText`, `SelectedItem`). Self-contained and low risk; another good candidate for a pull request. | +| Documentation | The [accessibility page](https://github.com/ghiscoding/slickgrid-universal/blob/v11.0.0/frameworks/slickgrid-react/docs/features/accessibility.md) lists the main keys and roles. | Add tree keys (Space, Left, Right), range keys (Shift and Ctrl+Shift with arrows), header and menu keys, and which configurations have been checked with a screen reader. | + +### How we might offer it + +1. Share these observations as separate, specific issues with the demo, the keys pressed and what + Narrator said, so each can be judged on its own. +2. Offer pull requests where the change is contained (tree row semantics, high-contrast styles, + documentation), and ask before proposing anything that touches header or resize design. +3. Re-run the same Narrator check, plus NVDA, on any release that includes changes, and share the + results back. + +If row selection and tree data pass that check in a future release, we would reopen this decision, +since SlickGrid would then meet our hard requirement with more built in. diff --git a/docs/ai-and-plans/features/data-grid/migration-parity.md b/docs/ai-and-plans/features/data-grid/migration-parity.md index 23b4fabb4..1369fcc02 100644 --- a/docs/ai-and-plans/features/data-grid/migration-parity.md +++ b/docs/ai-and-plans/features/data-grid/migration-parity.md @@ -27,20 +27,20 @@ Preserve the user outcome, not an implementation accident or a defect. ## 1. Table, nested documents and types -| ID | Classification | Contract and evidence | -| --- | --- | --- | -| T01 | Preserve | Dynamic columns come from the schema at the current object path, not just the first document. Keep heterogeneous rows and fields absent from individual documents. `ClusterSession.getCurrentPageAsTable`, `SchemaStore.getPropertyNamesAtLevel`. | -| T02 | Preserve | Include the root document's `_id` at nested levels; inject an `_id` header if absent. Nested inspection must not change which root document View/Edit/Delete acts on. `getDataAtPath`, `CollectionView.getDataForView`. | -| T03 | Preserve | Double-click an **object** cell to step into that field across the page, not just expand that one row. Other documents remain rows even if the path is missing. `_id` is deliberately not a step-in target. Arrays are not currently table step-in targets. | -| T04 | Preserve | Append the actual field name to the current path; allow Level up and direct jumps to Root Level or any breadcrumb ancestor. Retain the path-driven data reload and step-in telemetry. `ToolbarTableNavigation`, `CollectionView.handleStepInRequest`. | -| T05 | Improve | Provide a keyboard-equivalent step-in action and discoverable instruction, with predictable return focus. A mouse-only double-click handler is not an accessibility contract worth preserving unchanged. | -| T06 | Preserve | Display the formatted value **and** a distinct data-type indicator. Currently indicators are CSS-generated short text (`Ab`, `i32`, `d128`, `{ }`, `[ ]`, `ID`, `U`, `U~`, etc.), with a full type-name tooltip. They are not images. A new icon/badge must retain the information and have an accessible textual type description. | -| T07 | Preserve | Keep ordinary numbers, Int32, Double, Decimal128 and Long distinct; do not convert everything to JavaScript `number`. Preserve date, Boolean, ObjectId, binary, regex, timestamp and other BSON-aware display formatting. Reuse schema-analyzer formatters rather than a JSON-only partner formatter. | -| T08 | Preserve | Retain UUID and UUID (Legacy) type annotations. These were explicitly added in [commit `02a8ae29`](https://github.com/microsoft/vscode-documentdb/commit/02a8ae29175fcdeb6b768a0916616905cd083d27); do not lose them in a generic JSON cell renderer. | -| T09 | Preserve | A missing field is blank with "This field is not set"; an explicit `null` is a typed value. Keep missing, null, empty string, false and zero distinguishable. Do not equate a blank display string with absent data. | -| T10 | Preserve | Table arrays summarize as `array[N]`. Objects use the shared formatter; tree containers use their own summaries. Preserve full-value access through document views; truncation must not become data loss. | -| T11 | Preserve | Native text selection inside cells remains possible, without accidentally starting editing or invoking a document action. | -| T12 | Improve | Cell content and field names are data, never HTML. Render React text safely; expose tooltip/type information on keyboard focus as well as hover, without duplicate announcements. | +| ID | Classification | Contract and evidence | +| --- | -------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| T01 | Preserve | Dynamic columns come from the schema at the current object path, not just the first document. Keep heterogeneous rows and fields absent from individual documents. `ClusterSession.getCurrentPageAsTable`, `SchemaStore.getPropertyNamesAtLevel`. | +| T02 | Preserve | Include the root document's `_id` at nested levels; inject an `_id` header if absent. Nested inspection must not change which root document View/Edit/Delete acts on. `getDataAtPath`, `CollectionView.getDataForView`. | +| T03 | Preserve | Double-click an **object** cell to step into that field across the page, not just expand that one row. Other documents remain rows even if the path is missing. `_id` is deliberately not a step-in target. Arrays are not currently table step-in targets. | +| T04 | Preserve | Append the actual field name to the current path; allow Level up and direct jumps to Root Level or any breadcrumb ancestor. Retain the path-driven data reload and step-in telemetry. `ToolbarTableNavigation`, `CollectionView.handleStepInRequest`. | +| T05 | Improve | Provide a keyboard-equivalent step-in action and discoverable instruction, with predictable return focus. A mouse-only double-click handler is not an accessibility contract worth preserving unchanged. | +| T06 | Preserve | Display the formatted value **and** a distinct data-type indicator. Currently indicators are CSS-generated short text (`Ab`, `i32`, `d128`, `{ }`, `[ ]`, `ID`, `U`, `U~`, etc.), with a full type-name tooltip. They are not images. A new icon/badge must retain the information and have an accessible textual type description. | +| T07 | Preserve | Keep ordinary numbers, Int32, Double, Decimal128 and Long distinct; do not convert everything to JavaScript `number`. Preserve date, Boolean, ObjectId, binary, regex, timestamp and other BSON-aware display formatting. Reuse schema-analyzer formatters rather than a JSON-only partner formatter. | +| T08 | Preserve | Retain UUID and UUID (Legacy) type annotations. These were explicitly added in [commit `02a8ae29`](https://github.com/microsoft/vscode-documentdb/commit/02a8ae29175fcdeb6b768a0916616905cd083d27); do not lose them in a generic JSON cell renderer. | +| T09 | Preserve | A missing field is blank with "This field is not set"; an explicit `null` is a typed value. Keep missing, null, empty string, false and zero distinguishable. Do not equate a blank display string with absent data. | +| T10 | Preserve | Table arrays summarize as `array[N]`. Objects use the shared formatter; tree containers use their own summaries. Preserve full-value access through document views; truncation must not become data loss. | +| T11 | Preserve | Native text selection inside cells remains possible, without accidentally starting editing or invoking a document action. | +| T12 | Improve | Cell content and field names are data, never HTML. Render React text safely; expose tooltip/type information on keyboard focus as well as hover, without duplicate announcements. | Primary sources: [table](../../../../src/webviews/documentdb/collectionView/components/resultsTab/DataViewPanelTable.tsx), @@ -53,16 +53,16 @@ Primary sources: ## 2. Selection and document actions -| ID | Classification | Contract | -| --- | --- | --- | -| S01 | Preserve | Single and multiple root documents can be selected. No selection disables Delete; View/Edit require exactly one selected row. Add remains available under its existing command rules. | -| S02 | Preserve | Keep selected document indexes and canonical BSON/EJSON root identifiers synchronized with the current rows. Sorting, paging, deleting or replacing results must never redirect an action to another document. | -| S03 | Preserve | View/Edit open the existing document workflow; the current table is **not** an inline database editor. Add and multi-document Delete remain host-owned operations, including their existing errors and confirmations. | -| S04 | Preserve | After acknowledged deletion, remove the deleted rows locally and clear selection. Do not unnecessarily reload/reset widths or focus. | -| S05 | Preserve | Leaving/unmounting the table clears selection. Returning must not leave toolbar actions pointing at invisible old rows. | -| S06 | Improve | Separate focused/active cell from selected documents. Arrow navigation must not silently change a multi-document deletion target. Announce selection and provide keyboard multi-selection. | -| S07 | Improve | Use stable row identities and column keys for callbacks. Current timestamp-suffixed presentation IDs are not durable document identities; `x-objectid` carries the actual EJSON identifier. | -| S08 | Follow-up | A checkbox column/select-all is desirable, but **not current working behavior**: explicitly disabled because dynamic column replacement broke it. Define select-all as the current loaded page, not the entire collection. | +| ID | Classification | Contract | +| --- | -------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| S01 | Preserve | Single and multiple root documents can be selected. No selection disables Delete; View/Edit require exactly one selected row. Add remains available under its existing command rules. | +| S02 | Preserve | Keep selected document indexes and canonical BSON/EJSON root identifiers synchronized with the current rows. Sorting, paging, deleting or replacing results must never redirect an action to another document. | +| S03 | Preserve | View/Edit open the existing document workflow; the current table is **not** an inline database editor. Add and multi-document Delete remain host-owned operations, including their existing errors and confirmations. | +| S04 | Preserve | After acknowledged deletion, remove the deleted rows locally and clear selection. Do not unnecessarily reload/reset widths or focus. | +| S05 | Preserve | Leaving/unmounting the table clears selection. Returning must not leave toolbar actions pointing at invisible old rows. | +| S06 | Improve | Separate focused/active cell from selected documents. Arrow navigation must not silently change a multi-document deletion target. Announce selection and provide keyboard multi-selection. | +| S07 | Improve | Use stable row identities and column keys for callbacks. Current timestamp-suffixed presentation IDs are not durable document identities; `x-objectid` carries the actual EJSON identifier. | +| S08 | Follow-up | A checkbox column/select-all is desirable, but **not current working behavior**: explicitly disabled because dynamic column replacement broke it. Define select-all as the current loaded page, not the entire collection. | Evidence: `DataViewPanelTable.onSelectedRowsChanged` and its cleanup; `CollectionView.handleDeleteDocumentRequest`, `handleViewDocumentRequest`, @@ -77,15 +77,15 @@ is a pre-existing truthiness limitation, not an approved behavior to reproduce. ## 3. Tree view is a separate release gate -| ID | Classification | Contract | -| --- | --- | --- | -| R01 | Preserve | Retain Table / Tree / JSON view switching. Tree is not dispensable because the table migrates successfully. JSON remains the existing Monaco view. | -| R02 | Preserve | Arbitrary parent/child hierarchy with Field, Value and Type columns. Each document has a synthetic root labelled by its `_id`, with the document fields underneath, including `_id`. | -| R03 | Preserve | Nodes initially collapsed; visible hierarchy, indentation and an obvious expand/collapse affordance. Current indentation is 15 px; exact pixels are less important than intelligible hierarchy. | -| R04 | Preserve | Nested objects show `{...}`. Arrays show `(elements: N)`; elements are materialized only for arrays of **at most 10** elements (the comparison is `<= 10`, despite the comment saying "less than"). Larger arrays retain their count. | -| R05 | Improve | Keyboard expand/collapse, parent/child movement, visible focus, `aria-expanded` and correct hierarchy semantics. These are acceptance requirements, not verified claims about today's SlickGrid implementation. | -| R06 | Preserve | Tree does not gain a separate server query, sort order or filter merely because a new component offers them. The current component enables filtering internally for tree rendering but hides the filter row and disables sorting. | -| R07 | Improve | Virtualize large expanded trees; keep focus meaningful when a parent collapses or data refreshes. Do not simply render every nested field in the DOM. | +| ID | Classification | Contract | +| --- | -------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| R01 | Preserve | Retain Table / Tree / JSON view switching. Tree is not dispensable because the table migrates successfully. JSON remains the existing Monaco view. | +| R02 | Preserve | Arbitrary parent/child hierarchy with Field, Value and Type columns. Each document has a synthetic root labelled by its `_id`, with the document fields underneath, including `_id`. | +| R03 | Preserve | Nodes initially collapsed; visible hierarchy, indentation and an obvious expand/collapse affordance. Current indentation is 15 px; exact pixels are less important than intelligible hierarchy. | +| R04 | Preserve | Nested objects show `{...}`. Arrays show `(elements: N)`; elements are materialized only for arrays of **at most 10** elements (the comparison is `<= 10`, despite the comment saying "less than"). Larger arrays retain their count. | +| R05 | Improve | Keyboard expand/collapse, parent/child movement, visible focus, `aria-expanded` and correct hierarchy semantics. These are acceptance requirements, not verified claims about today's SlickGrid implementation. | +| R06 | Preserve | Tree does not gain a separate server query, sort order or filter merely because a new component offers them. The current component enables filtering internally for tree rendering but hides the filter row and disables sorting. | +| R07 | Improve | Virtualize large expanded trees; keep focus meaningful when a parent collapses or data refreshes. Do not simply render every nested field in the DOM. | Evidence: [tree component](../../../../src/webviews/documentdb/collectionView/components/resultsTab/DataViewPanelTree.tsx), @@ -96,17 +96,17 @@ flattening/expansion, not a complete arbitrary-depth accessible document tree. ## 4. Surrounding workflows and layout -| ID | Classification | Contract | -| --- | --- | --- | -| W01 | Preserve | Server-side filter, projection, sort, skip and limit remain in the query layer. The grid displays the current page; no accidental page-local replacement of database semantics. | -| W02 | Preserve | First/previous/next page, page-size choices 10/50/100/500 and current page label. Query execution and page-size changes reset to page one as today. Query limit continues to cap the result window. | -| W03 | Preserve | Schema accumulation/shared completion data continue to work across results. Column-policy improvements must not be hidden inside a grid-library swap. | -| W04 | Preserve | First-load skeleton, loading indicator, completion/empty-result announcements and user-visible host errors. Empty results still leave the query and navigation UI usable. | -| W05 | Improve | Column resizing works reliably with pointer and keyboard; widths survive ordinary result updates according to an explicit policy. Container/side-panel resizing works without clipping the last row or introducing page-wide overflow. | -| W06 | Preserve | Virtualized browsing of wide and long pages, horizontal scrolling and min-width protection. Measure against the current grid; "React-native" alone does not establish a performance improvement. | -| W07 | Improve | Light, dark and VS Code high-contrast themes, focus visibility, browser zoom and Windows forced colors. Map grid variables to VS Code/Fluent tokens; a grid with its own CSS is not automatically Fluent-themed. | -| W08 | Preserve | Documents/Indexes/Query Insights tabs, query editor, cancellation, import/export commands and document editors continue independently. Do not confuse a grid's visible-row export with the extension's collection export service. | -| W09 | Improve | Keep focus by logical cell identity when possible after refresh. If that field/row disappears, move to a predictable surviving cell and announce the change. Never leave focus on a removed DOM node. | +| ID | Classification | Contract | +| --- | -------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| W01 | Preserve | Server-side filter, projection, sort, skip and limit remain in the query layer. The grid displays the current page; no accidental page-local replacement of database semantics. | +| W02 | Preserve | First/previous/next page, page-size choices 10/50/100/500 and current page label. Query execution and page-size changes reset to page one as today. Query limit continues to cap the result window. | +| W03 | Preserve | Schema accumulation/shared completion data continue to work across results. Column-policy improvements must not be hidden inside a grid-library swap. | +| W04 | Preserve | First-load skeleton, loading indicator, completion/empty-result announcements and user-visible host errors. Empty results still leave the query and navigation UI usable. | +| W05 | Improve | Column resizing works reliably with pointer and keyboard; widths survive ordinary result updates according to an explicit policy. Container/side-panel resizing works without clipping the last row or introducing page-wide overflow. | +| W06 | Preserve | Virtualized browsing of wide and long pages, horizontal scrolling and min-width protection. Measure against the current grid; "React-native" alone does not establish a performance improvement. | +| W07 | Improve | Light, dark and VS Code high-contrast themes, focus visibility, browser zoom and Windows forced colors. Map grid variables to VS Code/Fluent tokens; a grid with its own CSS is not automatically Fluent-themed. | +| W08 | Preserve | Documents/Indexes/Query Insights tabs, query editor, cancellation, import/export commands and document editors continue independently. Do not confuse a grid's visible-row export with the extension's collection export service. | +| W09 | Improve | Keep focus by logical cell identity when possible after refresh. If that field/row disappears, move to a predictable surviving cell and announce the change. Never leave focus on a removed DOM node. | Evidence: `CollectionView`, `ClusterSession.find` and `getCurrentPageAsTable`, [paging toolbar](../../../../src/webviews/documentdb/collectionView/components/toolbar/ToolbarViewNavigation.tsx), @@ -130,25 +130,25 @@ the renderer, and change old CSS smoke assertions only alongside equivalent beha Unchecked items below are **future work**; none was executed by this research task. - [ ] A mixed-type page: every BSON enum member, explicit null, absent field, empty string, false, - zero, long Unicode strings, escaped field names and values that look like HTML. + zero, long Unicode strings, escaped field names and values that look like HTML. - [ ] Heterogeneous results with at least 50 columns; fields appear/disappear after queries, - projection, paging and drilling two levels; `_id` remains associated with the root document. + projection, paging and drilling two levels; `_id` remains associated with the root document. - [ ] Select one/many rows, then reorder columns, resize, refresh, delete, change page and switch - view; View/Edit/Delete always receive the correct canonical IDs. + view; View/Edit/Delete always receive the correct canonical IDs. - [ ] Step in by mouse and keyboard; step out and jump breadcrumbs; do not drill into scalar, - array or `_id` cells. A missing nested object must not remove its document row. + array or `_id` cells. A missing nested object must not remove its document row. - [ ] Deep tree, multiple roots, empty objects/arrays, arrays of 0/10/11 elements, nested arrays, - and a very large array. Keyboard collapse returns focus to the appropriate ancestor. + and a very large array. Keyboard collapse returns focus to the appropriate ancestor. - [ ] 1,000-row stress fixture (beyond the current UI's 500-row page choice), 50+ columns and a - large expanded tree; measure first usable render, scroll responsiveness, DOM counts, memory - trend and production JS/CSS size against the current build under the same conditions. + large expanded tree; measure first usable render, scroll responsiveness, DOM counts, memory + trend and production JS/CSS size against the current build under the same conditions. - [ ] Pointer resize, double-click fit where offered, keyboard resize, horizontal scroll, - narrow panel, sidebar resize and zoom in light/dark/high-contrast themes. + narrow panel, sidebar resize and zoom in light/dark/high-contrast themes. - [ ] Keyboard-only full journey; NVDA and Windows Narrator in installed VS Code. Verify names, - value/type descriptions, virtualized row/column indexes, selection announcements, no keyboard - trap, refresh focus and nested-cell actions. Browser accessibility snapshots are supplementary. + value/type descriptions, virtualized row/column indexes, selection announcements, no keyboard + trap, refresh focus and nested-cell actions. Browser accessibility snapshots are supplementary. - [ ] Existing find/query, paging, add/view/edit/delete, JSON view, import/export, Indexes and - Query Insights journeys still work. No new CSP exceptions or runtime errors. + Query Insights journeys still work. No new CSP exceptions or runtime errors. ## 7. Deliberately not current functionality diff --git a/docs/ai-and-plans/features/data-grid/migration-research.md b/docs/ai-and-plans/features/data-grid/migration-research.md index d3c79055a..2176d112b 100644 --- a/docs/ai-and-plans/features/data-grid/migration-research.md +++ b/docs/ai-and-plans/features/data-grid/migration-research.md @@ -14,23 +14,32 @@ code: # Collection View grid migration research Preparation for [#1101](https://github.com/microsoft/vscode-documentdb/issues/1101). -**Recommendation: migrate to `react-data-grid`, with a DocumentDB-specific cell renderer and an -explicitly engineered tree implementation.** The partner's experience supports the direction, -but copying its original migration without its follow-up fixes would reproduce avoidable issues. -Do not trade away nested-document navigation, BSON types or selection safety to simplify the swap. + +> **Recommendation revised (2026-11-26):** see [grid-scorecard.md](./grid-scorecard.md) for the +> current recommendation (third pass: migrate to React Data Grid, with accessibility as a hard +> gate) and [grid-options-evaluation.md](./grid-options-evaluation.md) for the second-pass +> evidence. The partner history and findings below remain valid evidence; the first-pass +> conclusion drawn from them in §1 item 7 and §7 is superseded. + +**First-pass recommendation (superseded):** migrate to `react-data-grid`, with a DocumentDB-specific +cell renderer and an explicitly engineered tree implementation. The partner's experience supports +the direction, but copying its original migration without its follow-up fixes would reproduce +avoidable issues. Do not trade away nested-document navigation, BSON types or selection safety to +simplify the swap. This is a research recommendation, **not an approved implementation decision or a completed evaluation spike**. No production code, dependencies or remote state were changed. ## Reading guide -| Document | Purpose | -| --- | --- | -| This report | Recommendation, partner migration/history, gains, losses and implementation implications | -| [SlickGrid update assessment](./slickgrid-update-assessment.md) | What versions 10/11 actually fixed, and whether an upgrade remains credible | -| [No-loss contract](./migration-parity.md) | Detailed inventory of our current features and required migration acceptance checks | -| [React Data Grid capabilities](./react-data-grid-capabilities.md) | Current library releases, inexpensive additions, API/runtime caveats and features that are not cheap | -| [Earlier removal plan](./slickgrid-removal.md) | Existing staged approach; its September snapshot is not the current upstream assessment | +| Document | Purpose | +| ----------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------ | +| [Grid options evaluation](./grid-options-evaluation.md) | **Current recommendation**: SlickGrid 11 vs RDG on governance, range selection, accessibility and feature coverage | +| This report | Partner migration/history, gains, losses and implementation implications (first-pass recommendation superseded) | +| [SlickGrid update assessment](./slickgrid-update-assessment.md) | What versions 10/11 actually fixed, and whether an upgrade remains credible | +| [No-loss contract](./migration-parity.md) | Detailed inventory of our current features and required migration acceptance checks | +| [React Data Grid capabilities](./react-data-grid-capabilities.md) | Current library releases, inexpensive additions, API/runtime caveats and features that are not cheap | +| [Earlier removal plan](./slickgrid-removal.md) | Existing staged approach; its September snapshot is not the current upstream assessment | ## 1. Executive findings @@ -64,12 +73,12 @@ evaluation spike**. No production code, dependencies or remote state were change Research date: **2026-11-26**. -| Baseline | Snapshot | -| --- | --- | -| DocumentDB worktree | Clean at start; branch `dev/tnaum/table-redesign`, commit [`8f81840d`](https://github.com/microsoft/vscode-documentdb/tree/8f81840d5aeeccece79321699e94d4789755a1fa) | -| Cosmos DB default branch | [`9a585583`](https://github.com/microsoft/vscode-cosmosdb/tree/9a585583e7a2b70076a2f7081045871d2170ac86), 2026-11-25 | -| Current SlickGrid release | [11.0.0](https://github.com/ghiscoding/slickgrid-universal/releases/tag/v11.0.0), 2026-11-10 | -| Current RDG release | [7.0.0-beta.64](https://github.com/Comcast/react-data-grid/releases/tag/v7.0.0-beta.64), 2026-11-05 | +| Baseline | Snapshot | +| ------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| DocumentDB worktree | Clean at start; branch `dev/tnaum/table-redesign`, commit [`8f81840d`](https://github.com/microsoft/vscode-documentdb/tree/8f81840d5aeeccece79321699e94d4789755a1fa) | +| Cosmos DB default branch | [`9a585583`](https://github.com/microsoft/vscode-cosmosdb/tree/9a585583e7a2b70076a2f7081045871d2170ac86), 2026-11-25 | +| Current SlickGrid release | [11.0.0](https://github.com/ghiscoding/slickgrid-universal/releases/tag/v11.0.0), 2026-11-10 | +| Current RDG release | [7.0.0-beta.64](https://github.com/Comcast/react-data-grid/releases/tag/v7.0.0-beta.64), 2026-11-05 | Evidence comes from the original migration diff, pre/post source, subsequent component/path history, related feature-fix PRs, manifests/lockfiles, upstream release notes and tagged APIs. @@ -112,15 +121,15 @@ Immutable comparison sources: ### What changed architecturally -| Area | SlickGrid implementation | RDG integration | -| --- | --- | --- | -| Cell rendering | Imperative formatters, string/HTML output | React `renderCell`, shared string conversion and empty-value styling | -| Selection | Built-in row selection, debounced event handler | Application-owned selected-ID set, anchor/range logic and keyboard/mouse handlers | -| Sizing | Autosize/content estimates and imperative container resize configuration | Controlled column-width state, resizable columns, custom Fluent content-fit and numeric resize menu | -| Accessibility | Delayed DOM ARIA patches and custom active-cell live announcements | Library grid semantics, custom keyboard handling, accessible grid names and native tree expander buttons | -| Tree | SlickGrid flat `parentId` tree | Nested `TreeRow.children` model with custom expansion/flattened visible rows in ordinary `DataGrid` | -| Theme | SlickGrid SCSS override layer | `--rdg-*` to `--vscode-*` mapping; still a custom grid theme | -| Integration | Grid callbacks dispatch selected row indexes to Query Editor | Same surrounding state/action architecture, with a different selection adapter | +| Area | SlickGrid implementation | RDG integration | +| -------------- | ------------------------------------------------------------------------ | -------------------------------------------------------------------------------------------------------- | +| Cell rendering | Imperative formatters, string/HTML output | React `renderCell`, shared string conversion and empty-value styling | +| Selection | Built-in row selection, debounced event handler | Application-owned selected-ID set, anchor/range logic and keyboard/mouse handlers | +| Sizing | Autosize/content estimates and imperative container resize configuration | Controlled column-width state, resizable columns, custom Fluent content-fit and numeric resize menu | +| Accessibility | Delayed DOM ARIA patches and custom active-cell live announcements | Library grid semantics, custom keyboard handling, accessible grid names and native tree expander buttons | +| Tree | SlickGrid flat `parentId` tree | Nested `TreeRow.children` model with custom expansion/flattened visible rows in ordinary `DataGrid` | +| Theme | SlickGrid SCSS override layer | `--rdg-*` to `--vscode-*` mapping; still a custom grid theme | +| Integration | Grid callbacks dispatch selected row indexes to Query Editor | Same surrounding state/action architecture, with a different selection adapter | Important details: click selects one row; Ctrl/Meta-click toggles; Shift-click selects a range; Space/Shift-Space and Shift-arrows implement keyboard selection. The final merged table does @@ -130,33 +139,33 @@ the final design. ## 4. Evolution after migration -| Date | Evidence | Change and consequence | -| --- | --- | --- | -| 2026-02-13, before migration | [microsoft/vscode-cosmosdb#2934](https://github.com/microsoft/vscode-cosmosdb/pull/2934) | Added SlickGrid ARIA row/column counts after wrong NVDA/Narrator counts. The partner was already paying an accessibility-adapter cost. | -| 2026-03-26 | [microsoft/vscode-cosmosdb#2960](https://github.com/microsoft/vscode-cosmosdb/pull/2960) | Migrated both table and tree; kept JSON outside the grid. Added custom selection and header controls rather than relying solely on RDG defaults. | -| 2026-03-31 | [v0.33.2 release](https://github.com/microsoft/vscode-cosmosdb/releases/tag/v0.33.2) | First verified shipped version: release notes explicitly mention the migration; tag `c90f0f11ca8e7b2133743c030cce56a17480b1f9` contains the merge and beta.59 dependency. The nearby v0.33.3 preparation PR is not the first-release evidence. | -| 2026-05-05 / 05-13 | [microsoft/vscode-cosmosdb#3005](https://github.com/microsoft/vscode-cosmosdb/pull/3005), [microsoft/vscode-cosmosdb#3011](https://github.com/microsoft/vscode-cosmosdb/pull/3011) | String-helper import movement and minor stylesheet cleanup; not a new grid or major user-visible redesign. | -| 2026-05-18 | [microsoft/vscode-cosmosdb#3037](https://github.com/microsoft/vscode-cosmosdb/pull/3037) | Restored packaged webview rendering after Vite migration: preserved the render export and injected emitted CSS for RDG, Monaco and the splitter. Grid styling is a packaging dependency, not just a successful development import. Not caused by the original grid migration. | -| 2026-06-22 | [microsoft/vscode-cosmosdb#3168](https://github.com/microsoft/vscode-cosmosdb/pull/3168) | Hotkey cleanup and View/Edit/Delete fixes. A strict record guard discarded otherwise valid selected rows; selection consumers needed a less restrictive document-ID extractor. Not demonstrated to originate in RDG. | -| 2026-08-18 | [microsoft/vscode-cosmosdb#3272](https://github.com/microsoft/vscode-cosmosdb/pull/3272), reverted by [microsoft/vscode-cosmosdb#3281](https://github.com/microsoft/vscode-cosmosdb/pull/3281) | Tried beta.61, adapting keyboard event mode from `SELECT` to `ACTIVE` and guarding absent rows. Reverted the dependency batch the same day. The revert says CI trouble was determined to be Azure DevOps-side; do not describe it as an RDG failure. | -| 2026-09-07 | [microsoft/vscode-cosmosdb#3342](https://github.com/microsoft/vscode-cosmosdb/pull/3342) | Large Table-to-JSON switches could freeze/crash; added JSON size warning, preview cap and chunked streaming. This is a Monaco/JSON-view issue, not evidence that the new grid handles all large-result workflows automatically. | -| 2026-09-11 | [microsoft/vscode-cosmosdb#3346](https://github.com/microsoft/vscode-cosmosdb/pull/3346) | Exactly one selected row was treated as no selection by converters, so copy/export used the entire page. A concrete selection-to-feature regression to test, but introduction at the grid migration is not established. | -| 2026-09-16 | [microsoft/vscode-cosmosdb#3351](https://github.com/microsoft/vscode-cosmosdb/pull/3351) | Adopted the shared Fluent webview theming provider. This did not eliminate RDG's separate VS Code CSS-variable theme. | -| 2026-09-23 | [microsoft/vscode-cosmosdb#3359](https://github.com/microsoft/vscode-cosmosdb/pull/3359) | Added table tests, restored the `ACTIVE` event-mode adaptation and prevented native Space-key scrolling. Lockfile now resolved beta.61 while manifest still said `~beta.59`. The PR title does not reveal the grid changes. | -| 2026-09-25 | [microsoft/vscode-cosmosdb#3362](https://github.com/microsoft/vscode-cosmosdb/pull/3362) | Prevented stale results from a previous connection/container from enabling actions against another container. Double-click handling now checks connection/execution/edit state and carries the current execution ID. A crucial ownership invariant, not just a rendering detail. | -| 2026-10-11 | [microsoft/vscode-cosmosdb#3407](https://github.com/microsoft/vscode-cosmosdb/pull/3407) | Custom column-menu trigger could receive programmatic focus while `aria-hidden`. Removed that attribute while retaining `tabIndex=-1`, and added a regression test. Accessibility work remained necessary in the migration's own components. | -| 2026-11-03 | [microsoft/vscode-cosmosdb#3449](https://github.com/microsoft/vscode-cosmosdb/pull/3449) | Exact-pinned beta.61. Recorded concerns include newer beta header-renderer API changes and an unsupported Map method. The latter rationale needs source/runtime qualification; see the capabilities document. | -| 2026-11-04 | [microsoft/vscode-cosmosdb#3522](https://github.com/microsoft/vscode-cosmosdb/pull/3522) | Added JSON folding controls. A surrounding results feature, not a built-in benefit of the RDG migration. | +| Date | Evidence | Change and consequence | +| ---------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| 2026-02-13, before migration | [microsoft/vscode-cosmosdb#2934](https://github.com/microsoft/vscode-cosmosdb/pull/2934) | Added SlickGrid ARIA row/column counts after wrong NVDA/Narrator counts. The partner was already paying an accessibility-adapter cost. | +| 2026-03-26 | [microsoft/vscode-cosmosdb#2960](https://github.com/microsoft/vscode-cosmosdb/pull/2960) | Migrated both table and tree; kept JSON outside the grid. Added custom selection and header controls rather than relying solely on RDG defaults. | +| 2026-03-31 | [v0.33.2 release](https://github.com/microsoft/vscode-cosmosdb/releases/tag/v0.33.2) | First verified shipped version: release notes explicitly mention the migration; tag `c90f0f11ca8e7b2133743c030cce56a17480b1f9` contains the merge and beta.59 dependency. The nearby v0.33.3 preparation PR is not the first-release evidence. | +| 2026-05-05 / 05-13 | [microsoft/vscode-cosmosdb#3005](https://github.com/microsoft/vscode-cosmosdb/pull/3005), [microsoft/vscode-cosmosdb#3011](https://github.com/microsoft/vscode-cosmosdb/pull/3011) | String-helper import movement and minor stylesheet cleanup; not a new grid or major user-visible redesign. | +| 2026-05-18 | [microsoft/vscode-cosmosdb#3037](https://github.com/microsoft/vscode-cosmosdb/pull/3037) | Restored packaged webview rendering after Vite migration: preserved the render export and injected emitted CSS for RDG, Monaco and the splitter. Grid styling is a packaging dependency, not just a successful development import. Not caused by the original grid migration. | +| 2026-06-22 | [microsoft/vscode-cosmosdb#3168](https://github.com/microsoft/vscode-cosmosdb/pull/3168) | Hotkey cleanup and View/Edit/Delete fixes. A strict record guard discarded otherwise valid selected rows; selection consumers needed a less restrictive document-ID extractor. Not demonstrated to originate in RDG. | +| 2026-08-18 | [microsoft/vscode-cosmosdb#3272](https://github.com/microsoft/vscode-cosmosdb/pull/3272), reverted by [microsoft/vscode-cosmosdb#3281](https://github.com/microsoft/vscode-cosmosdb/pull/3281) | Tried beta.61, adapting keyboard event mode from `SELECT` to `ACTIVE` and guarding absent rows. Reverted the dependency batch the same day. The revert says CI trouble was determined to be Azure DevOps-side; do not describe it as an RDG failure. | +| 2026-09-07 | [microsoft/vscode-cosmosdb#3342](https://github.com/microsoft/vscode-cosmosdb/pull/3342) | Large Table-to-JSON switches could freeze/crash; added JSON size warning, preview cap and chunked streaming. This is a Monaco/JSON-view issue, not evidence that the new grid handles all large-result workflows automatically. | +| 2026-09-11 | [microsoft/vscode-cosmosdb#3346](https://github.com/microsoft/vscode-cosmosdb/pull/3346) | Exactly one selected row was treated as no selection by converters, so copy/export used the entire page. A concrete selection-to-feature regression to test, but introduction at the grid migration is not established. | +| 2026-09-16 | [microsoft/vscode-cosmosdb#3351](https://github.com/microsoft/vscode-cosmosdb/pull/3351) | Adopted the shared Fluent webview theming provider. This did not eliminate RDG's separate VS Code CSS-variable theme. | +| 2026-09-23 | [microsoft/vscode-cosmosdb#3359](https://github.com/microsoft/vscode-cosmosdb/pull/3359) | Added table tests, restored the `ACTIVE` event-mode adaptation and prevented native Space-key scrolling. Lockfile now resolved beta.61 while manifest still said `~beta.59`. The PR title does not reveal the grid changes. | +| 2026-09-25 | [microsoft/vscode-cosmosdb#3362](https://github.com/microsoft/vscode-cosmosdb/pull/3362) | Prevented stale results from a previous connection/container from enabling actions against another container. Double-click handling now checks connection/execution/edit state and carries the current execution ID. A crucial ownership invariant, not just a rendering detail. | +| 2026-10-11 | [microsoft/vscode-cosmosdb#3407](https://github.com/microsoft/vscode-cosmosdb/pull/3407) | Custom column-menu trigger could receive programmatic focus while `aria-hidden`. Removed that attribute while retaining `tabIndex=-1`, and added a regression test. Accessibility work remained necessary in the migration's own components. | +| 2026-11-03 | [microsoft/vscode-cosmosdb#3449](https://github.com/microsoft/vscode-cosmosdb/pull/3449) | Exact-pinned beta.61. Recorded concerns include newer beta header-renderer API changes and an unsupported Map method. The latter rationale needs source/runtime qualification; see the capabilities document. | +| 2026-11-04 | [microsoft/vscode-cosmosdb#3522](https://github.com/microsoft/vscode-cosmosdb/pull/3522) | Added JSON folding controls. A surrounding results feature, not a built-in benefit of the RDG migration. | ### Actual dependency trajectory -| Point | Manifest | Lockfile | -| --- | --- | --- | -| Original March migration | `~7.0.0-beta.59` | beta.59 | -| August update attempt | exact beta.61 | beta.61 | -| August revert | `~7.0.0-beta.59` | beta.59 | -| September 23 onward | `~7.0.0-beta.59` | beta.61 | -| November 3 through inspected HEAD | exact `7.0.0-beta.61` | beta.61 | +| Point | Manifest | Lockfile | +| --------------------------------- | --------------------- | -------- | +| Original March migration | `~7.0.0-beta.59` | beta.59 | +| August update attempt | exact beta.61 | beta.61 | +| August revert | `~7.0.0-beta.59` | beta.59 | +| September 23 onward | `~7.0.0-beta.59` | beta.61 | +| November 3 through inspected HEAD | exact `7.0.0-beta.61` | beta.61 | The prerelease range allowed movement without the manifest text changing. For reproducible evaluation, record **both** manifest and lockfile, and exact-pin the candidate. @@ -164,17 +173,17 @@ The partner has not established beta.64 compatibility merely by using a 7.0 beta ## 5. What they gained, and what they may have lost -| Area | Evidence-backed gain | Loss, risk or qualification | -| --- | --- | --- | -| Accessibility | Native grid semantics replaced manual DOM patching. A reviewer [reported the relevant accessibility bugs fixed](https://github.com/microsoft/vscode-cosmosdb/pull/2960#issuecomment-4110304284): [microsoft/vscode-cosmosdb#2926](https://github.com/microsoft/vscode-cosmosdb/issues/2926), [microsoft/vscode-cosmosdb#2929](https://github.com/microsoft/vscode-cosmosdb/issues/2929), [microsoft/vscode-cosmosdb#2930](https://github.com/microsoft/vscode-cosmosdb/issues/2930). | The March 23 comment predates merge and does not specify the test environment. This is reported validation, not our own test result or a conformance claim. Custom header-menu focus still needed the October fix. | -| React integration | Cell/header controls and selection live in ordinary React; fewer SlickGrid-specific services/formatters and delayed DOM edits. | Application selection/range logic and custom tree are now maintained by the extension. React does not make lifecycle/focus errors impossible. | -| Resize UX | Controlled widths, pointer resize and explicit content/numeric resize controls. | Initial sizing changed: the old explicit first-load content-fit configuration is gone. Equivalent initial fit has not been demonstrated by this research. | -| Theme control | Direct CSS-variable mapping to VS Code; native Fluent menu/dialog controls. | Still two style domains: RDG CSS and Fluent. No evidence that it automatically follows every VS Code contrast theme correctly. | -| Selection | Familiar click/modifier/keyboard gestures implemented in the merged code. | Not a free library default. Custom key handling required an API adaptation and `preventDefault`; indexes still have to map to the correct documents. | -| Tree | Native button expanders and a simpler React-visible-row implementation. | Old tree sort/filter configuration and bespoke level/state live announcements were removed. The new component does not declare the old hierarchy through `aria-level`/`treegrid` in that file. Actual screen-reader equivalence remains unverified. | -| Visible columns | The bake-off described cleaner default presentation. | The migration also changed converter defaults: hide service columns; do not inject partition-key columns except for `SELECT *`. This is a real presentation reduction, not required by RDG. Do not copy it into our BSON/`_id` column policy. | -| Performance/size | RDG supports row/column virtualization; wrapper/plugin dependencies are removed. | SlickGrid already virtualized. No extension-specific before/after timings or byte reduction were established. Expanded-tree and JSON payload costs remain application problems. | -| Feature integration | Existing View/Edit/Delete, copy/export and external paging remained attached to Query Editor state. | Later selection-scope and result-ownership bugs show how easy it is to preserve the appearance but break the action target. Their causes must not all be attributed to migration without evidence. | +| Area | Evidence-backed gain | Loss, risk or qualification | +| ------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| Accessibility | Native grid semantics replaced manual DOM patching. A reviewer [reported the relevant accessibility bugs fixed](https://github.com/microsoft/vscode-cosmosdb/pull/2960#issuecomment-4110304284): [microsoft/vscode-cosmosdb#2926](https://github.com/microsoft/vscode-cosmosdb/issues/2926), [microsoft/vscode-cosmosdb#2929](https://github.com/microsoft/vscode-cosmosdb/issues/2929), [microsoft/vscode-cosmosdb#2930](https://github.com/microsoft/vscode-cosmosdb/issues/2930). | The March 23 comment predates merge and does not specify the test environment. This is reported validation, not our own test result or a conformance claim. Custom header-menu focus still needed the October fix. | +| React integration | Cell/header controls and selection live in ordinary React; fewer SlickGrid-specific services/formatters and delayed DOM edits. | Application selection/range logic and custom tree are now maintained by the extension. React does not make lifecycle/focus errors impossible. | +| Resize UX | Controlled widths, pointer resize and explicit content/numeric resize controls. | Initial sizing changed: the old explicit first-load content-fit configuration is gone. Equivalent initial fit has not been demonstrated by this research. | +| Theme control | Direct CSS-variable mapping to VS Code; native Fluent menu/dialog controls. | Still two style domains: RDG CSS and Fluent. No evidence that it automatically follows every VS Code contrast theme correctly. | +| Selection | Familiar click/modifier/keyboard gestures implemented in the merged code. | Not a free library default. Custom key handling required an API adaptation and `preventDefault`; indexes still have to map to the correct documents. | +| Tree | Native button expanders and a simpler React-visible-row implementation. | Old tree sort/filter configuration and bespoke level/state live announcements were removed. The new component does not declare the old hierarchy through `aria-level`/`treegrid` in that file. Actual screen-reader equivalence remains unverified. | +| Visible columns | The bake-off described cleaner default presentation. | The migration also changed converter defaults: hide service columns; do not inject partition-key columns except for `SELECT *`. This is a real presentation reduction, not required by RDG. Do not copy it into our BSON/`_id` column policy. | +| Performance/size | RDG supports row/column virtualization; wrapper/plugin dependencies are removed. | SlickGrid already virtualized. No extension-specific before/after timings or byte reduction were established. Expanded-tree and JSON payload costs remain application problems. | +| Feature integration | Existing View/Edit/Delete, copy/export and external paging remained attached to Query Editor state. | Later selection-scope and result-ownership bugs show how easy it is to preserve the appearance but break the action target. Their causes must not all be attributed to migration without evidence. | **Removed announcements are not automatically regressions.** Native grid semantics may make a custom live region redundant or noisy. Test the actual spoken outcome; do not restore the old live @@ -245,7 +254,10 @@ string renderer and lose BSON distinctions, or use its row-index arithmetic as d Changing column order must use logical field keys; today's step-in callback uses column indexes and would otherwise navigate into the wrong field after reorder. -## 7. Recommended direction and staged gates +## 7. Recommended direction and staged gates (first pass, superseded) + +> Superseded by [grid-options-evaluation.md §7](./grid-options-evaluation.md#7-recommended-path-and-the-gate-that-could-reverse-it). +> Kept because the staged gates below also apply if the accessibility gate sends us to RDG. **Prefer RDG for the table; budget real engineering for the tree.** A custom tree on `DataGrid` can share virtualization and cell rendering, but must implement proper arbitrary hierarchy, @@ -297,6 +309,8 @@ serialization. Keep these out of #1101's groundwork scope. The preparation now has an upstream comparison, partner migration/follow-up history, a source-backed no-loss inventory and a version-aware opportunity list. **Implementation, benchmarks, packaged -runtime compatibility and assistive-technology validation remain future work.** The evidence favors -migration, but does not support a promise of zero regressions or universal accessibility merely -from selecting the partner's library. +runtime compatibility and assistive-technology validation remain future work.** The first pass +concluded the evidence favored migration; the second pass +([grid-options-evaluation.md](./grid-options-evaluation.md)) reverses that once range selection +and maintainer concentration are weighed. Neither path supports a promise of zero regressions or +universal accessibility without our own testing. diff --git a/docs/ai-and-plans/features/data-grid/react-data-grid-capabilities.md b/docs/ai-and-plans/features/data-grid/react-data-grid-capabilities.md index 7f9d387c1..ec955f9d3 100644 --- a/docs/ai-and-plans/features/data-grid/react-data-grid-capabilities.md +++ b/docs/ai-and-plans/features/data-grid/react-data-grid-capabilities.md @@ -31,14 +31,14 @@ CSS and any adapters still have to be measured in our production build. The beta API **has changed** since the partner's original integration; using a mature integration does not exempt us from version-specific adaptation. Verified release milestones: -| Version | Published | Changes that matter to an adopter | -| --- | --- | --- | -| [beta.59](https://github.com/Comcast/react-data-grid/releases/tag/v7.0.0-beta.59) | 2025-12-04 | The partner's original migration version, also mentioned in our September removal plan. It already requires React/React DOM `^19.2`; its API differs from beta.64. | -| [beta.60](https://github.com/Comcast/react-data-grid/releases/tag/v7.0.0-beta.60) | 2026-07-09 | Made rows focusable and removed the focus sink; changed selected-position terminology to active-position; reworked frozen shadows and added start/end column pinning. Significant focus/API evolution, not only dependency updates. See [Comcast/react-data-grid#3963](https://github.com/Comcast/react-data-grid/pull/3963), [Comcast/react-data-grid#3979](https://github.com/Comcast/react-data-grid/pull/3979), [Comcast/react-data-grid#4034](https://github.com/Comcast/react-data-grid/pull/4034). | -| [beta.61](https://github.com/Comcast/react-data-grid/releases/tag/v7.0.0-beta.61) | 2026-07-14 | Packaging fix removes a dangling `ecij` import after the build-tool change: [Comcast/react-data-grid#4100](https://github.com/Comcast/react-data-grid/pull/4100). This is the partner's current exact pin, incorporating the preceding focus/API changes. | -| [beta.62](https://github.com/Comcast/react-data-grid/releases/tag/v7.0.0-beta.62) | 2026-10-19 | React Compiler build work; cross-window support; tree parent focus on Left Arrow. See [Comcast/react-data-grid#4161](https://github.com/Comcast/react-data-grid/pull/4161), [Comcast/react-data-grid#4194](https://github.com/Comcast/react-data-grid/pull/4194), [Comcast/react-data-grid#4202](https://github.com/Comcast/react-data-grid/pull/4202). | -| [beta.63](https://github.com/Comcast/react-data-grid/releases/tag/v7.0.0-beta.63) | 2026-10-25 | Broad naming changes, event cancellation fixes, PageUp/PageDown fixes, and grouping API changes (`rowGrouper` to `getRowGroupKey`, `groupIdGetter` to `getGroupId`). See [Comcast/react-data-grid#3967](https://github.com/Comcast/react-data-grid/pull/3967), [Comcast/react-data-grid#4217](https://github.com/Comcast/react-data-grid/pull/4217), [Comcast/react-data-grid#4159](https://github.com/Comcast/react-data-grid/pull/4159). | -| beta.64 | 2026-11-05 | `rowKeyGetter` becomes `getRowKey`; keyboard resize ends on keyup/blur; selection-update and frozen-cell scrolling fixes; forced-colors support; editor/resize/reduced-motion accessibility fixes. See [Comcast/react-data-grid#4261](https://github.com/Comcast/react-data-grid/pull/4261), [Comcast/react-data-grid#4249](https://github.com/Comcast/react-data-grid/pull/4249), [Comcast/react-data-grid#4239](https://github.com/Comcast/react-data-grid/pull/4239), [Comcast/react-data-grid#4247](https://github.com/Comcast/react-data-grid/pull/4247), [Comcast/react-data-grid#4244](https://github.com/Comcast/react-data-grid/pull/4244), [Comcast/react-data-grid#4246](https://github.com/Comcast/react-data-grid/pull/4246). | +| Version | Published | Changes that matter to an adopter | +| --------------------------------------------------------------------------------- | ---------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| [beta.59](https://github.com/Comcast/react-data-grid/releases/tag/v7.0.0-beta.59) | 2025-12-04 | The partner's original migration version, also mentioned in our September removal plan. It already requires React/React DOM `^19.2`; its API differs from beta.64. | +| [beta.60](https://github.com/Comcast/react-data-grid/releases/tag/v7.0.0-beta.60) | 2026-07-09 | Made rows focusable and removed the focus sink; changed selected-position terminology to active-position; reworked frozen shadows and added start/end column pinning. Significant focus/API evolution, not only dependency updates. See [Comcast/react-data-grid#3963](https://github.com/Comcast/react-data-grid/pull/3963), [Comcast/react-data-grid#3979](https://github.com/Comcast/react-data-grid/pull/3979), [Comcast/react-data-grid#4034](https://github.com/Comcast/react-data-grid/pull/4034). | +| [beta.61](https://github.com/Comcast/react-data-grid/releases/tag/v7.0.0-beta.61) | 2026-07-14 | Packaging fix removes a dangling `ecij` import after the build-tool change: [Comcast/react-data-grid#4100](https://github.com/Comcast/react-data-grid/pull/4100). This is the partner's current exact pin, incorporating the preceding focus/API changes. | +| [beta.62](https://github.com/Comcast/react-data-grid/releases/tag/v7.0.0-beta.62) | 2026-10-19 | React Compiler build work; cross-window support; tree parent focus on Left Arrow. See [Comcast/react-data-grid#4161](https://github.com/Comcast/react-data-grid/pull/4161), [Comcast/react-data-grid#4194](https://github.com/Comcast/react-data-grid/pull/4194), [Comcast/react-data-grid#4202](https://github.com/Comcast/react-data-grid/pull/4202). | +| [beta.63](https://github.com/Comcast/react-data-grid/releases/tag/v7.0.0-beta.63) | 2026-10-25 | Broad naming changes, event cancellation fixes, PageUp/PageDown fixes, and grouping API changes (`rowGrouper` to `getRowGroupKey`, `groupIdGetter` to `getGroupId`). See [Comcast/react-data-grid#3967](https://github.com/Comcast/react-data-grid/pull/3967), [Comcast/react-data-grid#4217](https://github.com/Comcast/react-data-grid/pull/4217), [Comcast/react-data-grid#4159](https://github.com/Comcast/react-data-grid/pull/4159). | +| beta.64 | 2026-11-05 | `rowKeyGetter` becomes `getRowKey`; keyboard resize ends on keyup/blur; selection-update and frozen-cell scrolling fixes; forced-colors support; editor/resize/reduced-motion accessibility fixes. See [Comcast/react-data-grid#4261](https://github.com/Comcast/react-data-grid/pull/4261), [Comcast/react-data-grid#4249](https://github.com/Comcast/react-data-grid/pull/4249), [Comcast/react-data-grid#4239](https://github.com/Comcast/react-data-grid/pull/4239), [Comcast/react-data-grid#4247](https://github.com/Comcast/react-data-grid/pull/4247), [Comcast/react-data-grid#4244](https://github.com/Comcast/react-data-grid/pull/4244), [Comcast/react-data-grid#4246](https://github.com/Comcast/react-data-grid/pull/4246). | Current upstream main was also checked at [`d6942fd6`](https://github.com/Comcast/react-data-grid/tree/d6942fd60d1cf1045442055b7fff231c351d21a0) @@ -69,20 +69,20 @@ migration itself. XS = a prop/default plus styling/checks; S = a small renderer/ M = a separate behavior design or cross-layer integration. These are engineering judgments, not time commitments. All new user-facing features remain follow-up work under #1101's scope. -| Opportunity | Effort | Built-in support and remaining work | Important limit | -| --- | --- | --- | --- | -| Reliable pointer **and keyboard** column resize | XS | Set `resizable: true`; header Ctrl/Meta+Left/Right changes width. The handle supports pointer capture and double-click `max-content` fitting. | Verify in VS Code, not just the demo. Fitting virtualized content is not a guarantee of inspecting every value in the database. Core resizing is also a migration acceptance requirement, not merely a bonus. | -| Pin `_id` while scrolling wide results | XS | `frozen: 'start'` (or `true`) on the identifier column. beta.64 also supports `'end'` for a trailing action column. | Frozen columns consume space in narrow panels. This was possible in SlickGrid too, but is not enabled in our current table. | -| Remember manual widths and reset them | S | `columnWidths` plus `onColumnWidthsChange` gives controlled width state. Add a reset action. | Key by field/path and reconcile disappearing columns. In-session retention is cheap; durable per-collection persistence needs an explicit storage policy. | -| Checkbox multi-selection and select current page | S | `SelectColumn`, `selectedRows`, `onSelectedRowsChange` and `getRowKey`. | Integrate command enablement and canonical IDs; specify "current page". Do not count checked/focused cells as selected documents. | -| Copy focused cell's **displayed** value | S | `onCellCopy` supplies the logical row/column and clipboard event. Write text with the existing clipboard route if needed. | Current payload has display values: arrays are `array[N]`. Copying canonical BSON/EJSON or raw nested data needs additional host data and is **not** the same cheap feature. | -| Keyboard step-in and an explicit object-cell affordance | S | `renderCell`, `onCellDoubleClick`, `onCellKeyDown` and active-position hooks. | Custom DocumentDB behavior, not a built-in JSON explorer. Preserve event/default navigation and accessible names. Keyboard equivalence belongs in parity. | -| Better datatype badge/icon plus full description | S | Render a small React value/type component with existing type metadata. | Do not discard UUID/BSON distinctions or encode type only in color. An icon font/CSS pseudo-element alone is not an accessible name. | -| Column drag/reorder | S | `draggable: true` and `onColumnsReorder` provide native interaction; apply the new column order in state. | Actions must use field keys, never old column indexes. Supply a keyboard alternative if exposing reorder. Persistence is separate. | -| Hide/show columns and reset layout | S-M | Keep a full column model and pass a filtered visible list; add a small Fluent menu. | There is no turnkey column-picker prop in the cited API. Distinguish presentation hiding from server projection; never hide `_id` metadata from document actions. | -| Wrap long values / larger or variable rows | S | Row-height options and custom cell rendering/styles. | Test virtualization, truncation, density and keyboard visibility. Arbitrarily measuring all document heights is not free. | -| Empty-results content | XS | `renderers.noRowsFallback`. | Keep query controls and existing empty/loading announcements; avoid redundant announcements. | -| Read-only cell context actions | S-M | `onCellContextMenu` plus a Fluent menu; reuse View/Edit/Copy/Step in handlers. | The menu, its focus lifecycle and keyboard invocation are application code, not an included polished menu component. | +| Opportunity | Effort | Built-in support and remaining work | Important limit | +| ------------------------------------------------------- | ------ | --------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| Reliable pointer **and keyboard** column resize | XS | Set `resizable: true`; header Ctrl/Meta+Left/Right changes width. The handle supports pointer capture and double-click `max-content` fitting. | Verify in VS Code, not just the demo. Fitting virtualized content is not a guarantee of inspecting every value in the database. Core resizing is also a migration acceptance requirement, not merely a bonus. | +| Pin `_id` while scrolling wide results | XS | `frozen: 'start'` (or `true`) on the identifier column. beta.64 also supports `'end'` for a trailing action column. | Frozen columns consume space in narrow panels. This was possible in SlickGrid too, but is not enabled in our current table. | +| Remember manual widths and reset them | S | `columnWidths` plus `onColumnWidthsChange` gives controlled width state. Add a reset action. | Key by field/path and reconcile disappearing columns. In-session retention is cheap; durable per-collection persistence needs an explicit storage policy. | +| Checkbox multi-selection and select current page | S | `SelectColumn`, `selectedRows`, `onSelectedRowsChange` and `getRowKey`. | Integrate command enablement and canonical IDs; specify "current page". Do not count checked/focused cells as selected documents. | +| Copy focused cell's **displayed** value | S | `onCellCopy` supplies the logical row/column and clipboard event. Write text with the existing clipboard route if needed. | Current payload has display values: arrays are `array[N]`. Copying canonical BSON/EJSON or raw nested data needs additional host data and is **not** the same cheap feature. **Only the single active cell**: RDG has no rectangular cell-range selection (see [grid-options-evaluation.md §3](./grid-options-evaluation.md#3-cell-range-selection-and-excel-copy-the-new-requirement)). | +| Keyboard step-in and an explicit object-cell affordance | S | `renderCell`, `onCellDoubleClick`, `onCellKeyDown` and active-position hooks. | Custom DocumentDB behavior, not a built-in JSON explorer. Preserve event/default navigation and accessible names. Keyboard equivalence belongs in parity. | +| Better datatype badge/icon plus full description | S | Render a small React value/type component with existing type metadata. | Do not discard UUID/BSON distinctions or encode type only in color. An icon font/CSS pseudo-element alone is not an accessible name. | +| Column drag/reorder | S | `draggable: true` and `onColumnsReorder` provide native interaction; apply the new column order in state. | Actions must use field keys, never old column indexes. Supply a keyboard alternative if exposing reorder. Persistence is separate. | +| Hide/show columns and reset layout | S-M | Keep a full column model and pass a filtered visible list; add a small Fluent menu. | There is no turnkey column-picker prop in the cited API. Distinguish presentation hiding from server projection; never hide `_id` metadata from document actions. | +| Wrap long values / larger or variable rows | S | Row-height options and custom cell rendering/styles. | Test virtualization, truncation, density and keyboard visibility. Arbitrarily measuring all document heights is not free. | +| Empty-results content | XS | `renderers.noRowsFallback`. | Keep query controls and existing empty/loading announcements; avoid redundant announcements. | +| Read-only cell context actions | S-M | `onCellContextMenu` plus a Fluent menu; reuse View/Edit/Copy/Step in handlers. | The menu, its focus lifecycle and keyboard invocation are application code, not an included polished menu component. | Sources for the table: [beta.64 README/API](https://github.com/Comcast/react-data-grid/blob/v7.0.0-beta.64/README.md), @@ -97,15 +97,15 @@ actions and column reconciliation are proven. None is automatically enabled by c ## 3. Available library features that are not cheap database features -| Feature | Why it is not just a switch for us | -| --- | --- | -| Header sorting / multi-sort | The grid supplies sort state and gestures; the application supplies ordering. Sorting only the loaded page would misleadingly differ from the query editor's server sort. Integrate with query execution, paging, BSON comparisons and refresh semantics. | -| Grouping / summary rows | `TreeDataGrid` groups records by column values, and summary rows display application-computed values. A loaded page is not the whole collection. Labels and scope must be truthful. | -| Inline editing | Editors and `onRowsChange` do not implement database validation, BSON round-tripping, optimistic concurrency, `_id` restrictions, write errors or undo. Keep the existing document editor initially. | -| Paste / fill handle / spreadsheet bulk changes | `onCellPaste` and `onFill` can return changed local rows. Safe database writes, validation and confirmation remain ours. Do not enable them implicitly. `TreeDataGrid` does not support fill. | -| Whole-collection export | Grid examples can serialize rendered/application rows; they do not replace our host-side collection export, query window or BSON serialization. | -| Arbitrary nested document tree | `TreeDataGrid` takes `groupBy` and `getRowGroupKey`, not our `parentId` tree. It groups data rather than interpreting object/array fields. | -| Full accessible context/column/filter menu system | Event hooks and renderers are available, but a complete menu/filter product is not provided by those hooks. | +| Feature | Why it is not just a switch for us | +| ------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| Header sorting / multi-sort | The grid supplies sort state and gestures; the application supplies ordering. Sorting only the loaded page would misleadingly differ from the query editor's server sort. Integrate with query execution, paging, BSON comparisons and refresh semantics. | +| Grouping / summary rows | `TreeDataGrid` groups records by column values, and summary rows display application-computed values. A loaded page is not the whole collection. Labels and scope must be truthful. | +| Inline editing | Editors and `onRowsChange` do not implement database validation, BSON round-tripping, optimistic concurrency, `_id` restrictions, write errors or undo. Keep the existing document editor initially. | +| Paste / fill handle / spreadsheet bulk changes | `onCellPaste` and `onFill` can return changed local rows. Safe database writes, validation and confirmation remain ours. Do not enable them implicitly. `TreeDataGrid` does not support fill. | +| Whole-collection export | Grid examples can serialize rendered/application rows; they do not replace our host-side collection export, query window or BSON serialization. | +| Arbitrary nested document tree | `TreeDataGrid` takes `groupBy` and `getRowGroupKey`, not our `parentId` tree. It groups data rather than interpreting object/array fields. | +| Full accessible context/column/filter menu system | Event hooks and renderers are available, but a complete menu/filter product is not provided by those hooks. | The upstream [TreeView example](https://github.com/Comcast/react-data-grid/blob/v7.0.0-beta.64/website/routes/TreeView.tsx) diff --git a/docs/ai-and-plans/features/data-grid/slickgrid-update-assessment.md b/docs/ai-and-plans/features/data-grid/slickgrid-update-assessment.md index 69e618b35..e69e09099 100644 --- a/docs/ai-and-plans/features/data-grid/slickgrid-update-assessment.md +++ b/docs/ai-and-plans/features/data-grid/slickgrid-update-assessment.md @@ -45,19 +45,19 @@ to exist in our wrapper until it is ported into Slickgrid-Universal. Dates below are release dates; links identify the implementation work. Relevance is assessed against our actual options, not the entire SlickGrid feature catalogue. -| Released | Change | Relevance to DocumentDB | -| --- | --- | --- | -| 10.0.0, 2026-03-03 | [ghiscoding/slickgrid-universal#2393](https://github.com/ghiscoding/slickgrid-universal/pull/2393): focusable headers/menus/select-all, arrow-key menu navigation, Enter/Space sorting, focus-visible styling. [ghiscoding/slickgrid-universal#2404](https://github.com/ghiscoding/slickgrid-universal/pull/2404): ARIA row/column counts. | Core focus and structural metadata matter. Menu/select-all improvements are largely latent because our table disables menus and its checkbox selector. | -| 10.0.0 | [ghiscoding/slickgrid-universal#2405](https://github.com/ghiscoding/slickgrid-universal/pull/2405): resize-handle/cursor styling; [ghiscoding/slickgrid-universal#2402](https://github.com/ghiscoding/slickgrid-universal/pull/2402): grid-menu overlap with resize handles. | Handle usability is relevant; our menu is disabled, so do not claim the overlap fix explains our particular symptom. | -| 10.2.0, 2026-03-24 | [ghiscoding/slickgrid-universal#2456](https://github.com/ghiscoding/slickgrid-universal/pull/2456): focus-sink/focus-mode refinement; [ghiscoding/slickgrid-universal#2457](https://github.com/ghiscoding/slickgrid-universal/pull/2457): menu-focus restoration; [ghiscoding/slickgrid-universal#2448](https://github.com/ghiscoding/slickgrid-universal/pull/2448): Space/Left/Right tree/group expansion. | Tree keyboard behavior and core focus handling are especially relevant. The previous plan must not treat today's tree keyboard behavior as already proven. | -| 10.5.0, 2026-04-18; 10.5.1, 2026-04-22 | [ghiscoding/slickgrid-universal#2531](https://github.com/ghiscoding/slickgrid-universal/pull/2531): resize beyond the viewport with automatic scrolling; [ghiscoding/slickgrid-universal#2538](https://github.com/ghiscoding/slickgrid-universal/pull/2538): follow-up outside-webview behavior. | Addresses wide-grid pointer resizing. It is not a fix for our manual container `ResizeObserver`, nor evidence of keyboard resize support. | -| 10.7.0, 2026-05-09 | [ghiscoding/slickgrid-universal#2573](https://github.com/ghiscoding/slickgrid-universal/pull/2573): respect `multiSelect` in checkbox and keyboard row selection. | Relevant to retaining predictable single/multi-row actions after upgrading. | -| 10.8.3, 2026-07-04 | [ghiscoding/slickgrid-universal#2631](https://github.com/ghiscoding/slickgrid-universal/pull/2631): custom-tooltip accessibility; [ghiscoding/slickgrid-universal#2632](https://github.com/ghiscoding/slickgrid-universal/pull/2632): frozen-column/resize auto-scroll interaction. | Tooltip work may help if that plugin is used; our formatter currently supplies `toolTip`. Frozen-column behavior is not a current enabled feature. | -| 10.10.0, 2026-08-28 | [ghiscoding/slickgrid-universal#2694](https://github.com/ghiscoding/slickgrid-universal/pull/2694): missing header ARIA row/rowgroup structure; [ghiscoding/slickgrid-universal#2773](https://github.com/ghiscoding/slickgrid-universal/pull/2773): prevent resize auto-scroll jumps. | Both are directly relevant. The resize fix clamps the pointer at the viewport edge and paces scrolling rather than immediately jumping hundreds of pixels. | -| 11.0.0, 2026-11-10 | [ghiscoding/slickgrid-universal#2872](https://github.com/ghiscoding/slickgrid-universal/pull/2872), merged 2026-10-27: stable resize-handle hit box on hover. | Particularly close to "hard to grab" resizing: previously the hovered handle itself shrank, could lose hover and flicker; the visual pill now uses a pseudo-element. This is a plausible contributor, not a diagnosis of our unrecorded repro. | -| 11.0.0 | [ghiscoding/slickgrid-universal#2884](https://github.com/ghiscoding/slickgrid-universal/pull/2884), merged 2026-10-30: content sizing uses canvas text measurements, CSS font/padding and distributed row sampling; optional inclusion of header width. | More accurate than length-times-average-character estimates. Our table enables autosizing, but these **resize-by-content** improvements require checking which sizing path/options we actually use. Not every auto-size mode is content fitting. | -| 11.0.0 | [ghiscoding/slickgrid-universal#2906](https://github.com/ghiscoding/slickgrid-universal/pull/2906), merged 2026-11-05: synchronize `aria-selected`, expose primary visible `aria-sort`, preserve existing tooltip descriptions, resolve header key events from nested controls, ignore row-detail toggle keys from inside panels. | Selection/header semantics are directly useful. Row-detail work does not affect our current tree/table because we do not enable that plugin. Menu focus after commands was explicitly deferred, so this is not a blanket accessibility completion claim. | -| 11.0.0 | Single-viewport pinning replaces frozen panes; sticky docking, tree multi-column sorting and tree lookup/performance changes. | Potential improvements, but not migration prerequisites. Our existing grid does not enable freezing and explicitly disables tree sorting. Upstream benchmarks are not measurements of our extension. | +| Released | Change | Relevance to DocumentDB | +| -------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| 10.0.0, 2026-03-03 | [ghiscoding/slickgrid-universal#2393](https://github.com/ghiscoding/slickgrid-universal/pull/2393): focusable headers/menus/select-all, arrow-key menu navigation, Enter/Space sorting, focus-visible styling. [ghiscoding/slickgrid-universal#2404](https://github.com/ghiscoding/slickgrid-universal/pull/2404): ARIA row/column counts. | Core focus and structural metadata matter. Menu/select-all improvements are largely latent because our table disables menus and its checkbox selector. | +| 10.0.0 | [ghiscoding/slickgrid-universal#2405](https://github.com/ghiscoding/slickgrid-universal/pull/2405): resize-handle/cursor styling; [ghiscoding/slickgrid-universal#2402](https://github.com/ghiscoding/slickgrid-universal/pull/2402): grid-menu overlap with resize handles. | Handle usability is relevant; our menu is disabled, so do not claim the overlap fix explains our particular symptom. | +| 10.2.0, 2026-03-24 | [ghiscoding/slickgrid-universal#2456](https://github.com/ghiscoding/slickgrid-universal/pull/2456): focus-sink/focus-mode refinement; [ghiscoding/slickgrid-universal#2457](https://github.com/ghiscoding/slickgrid-universal/pull/2457): menu-focus restoration; [ghiscoding/slickgrid-universal#2448](https://github.com/ghiscoding/slickgrid-universal/pull/2448): Space/Left/Right tree/group expansion. | Tree keyboard behavior and core focus handling are especially relevant. The previous plan must not treat today's tree keyboard behavior as already proven. | +| 10.5.0, 2026-04-18; 10.5.1, 2026-04-22 | [ghiscoding/slickgrid-universal#2531](https://github.com/ghiscoding/slickgrid-universal/pull/2531): resize beyond the viewport with automatic scrolling; [ghiscoding/slickgrid-universal#2538](https://github.com/ghiscoding/slickgrid-universal/pull/2538): follow-up outside-webview behavior. | Addresses wide-grid pointer resizing. It is not a fix for our manual container `ResizeObserver`, nor evidence of keyboard resize support. | +| 10.7.0, 2026-05-09 | [ghiscoding/slickgrid-universal#2573](https://github.com/ghiscoding/slickgrid-universal/pull/2573): respect `multiSelect` in checkbox and keyboard row selection. | Relevant to retaining predictable single/multi-row actions after upgrading. | +| 10.8.3, 2026-07-04 | [ghiscoding/slickgrid-universal#2631](https://github.com/ghiscoding/slickgrid-universal/pull/2631): custom-tooltip accessibility; [ghiscoding/slickgrid-universal#2632](https://github.com/ghiscoding/slickgrid-universal/pull/2632): frozen-column/resize auto-scroll interaction. | Tooltip work may help if that plugin is used; our formatter currently supplies `toolTip`. Frozen-column behavior is not a current enabled feature. | +| 10.10.0, 2026-08-28 | [ghiscoding/slickgrid-universal#2694](https://github.com/ghiscoding/slickgrid-universal/pull/2694): missing header ARIA row/rowgroup structure; [ghiscoding/slickgrid-universal#2773](https://github.com/ghiscoding/slickgrid-universal/pull/2773): prevent resize auto-scroll jumps. | Both are directly relevant. The resize fix clamps the pointer at the viewport edge and paces scrolling rather than immediately jumping hundreds of pixels. | +| 11.0.0, 2026-11-10 | [ghiscoding/slickgrid-universal#2872](https://github.com/ghiscoding/slickgrid-universal/pull/2872), merged 2026-10-27: stable resize-handle hit box on hover. | Particularly close to "hard to grab" resizing: previously the hovered handle itself shrank, could lose hover and flicker; the visual pill now uses a pseudo-element. This is a plausible contributor, not a diagnosis of our unrecorded repro. | +| 11.0.0 | [ghiscoding/slickgrid-universal#2884](https://github.com/ghiscoding/slickgrid-universal/pull/2884), merged 2026-10-30: content sizing uses canvas text measurements, CSS font/padding and distributed row sampling; optional inclusion of header width. | More accurate than length-times-average-character estimates. Our table enables autosizing, but these **resize-by-content** improvements require checking which sizing path/options we actually use. Not every auto-size mode is content fitting. | +| 11.0.0 | [ghiscoding/slickgrid-universal#2906](https://github.com/ghiscoding/slickgrid-universal/pull/2906), merged 2026-11-05: synchronize `aria-selected`, expose primary visible `aria-sort`, preserve existing tooltip descriptions, resolve header key events from nested controls, ignore row-detail toggle keys from inside panels. | Selection/header semantics are directly useful. Row-detail work does not affect our current tree/table because we do not enable that plugin. Menu focus after commands was explicitly deferred, so this is not a blanket accessibility completion claim. | +| 11.0.0 | Single-viewport pinning replaces frozen panes; sticky docking, tree multi-column sorting and tree lookup/performance changes. | Potential improvements, but not migration prerequisites. Our existing grid does not enable freezing and explicitly disables tree sorting. Upstream benchmarks are not measurements of our extension. | The v10 guide also documents a **Fluent UI visual theme**, and v11 adds a Fluent icon-set option. This weakens the old argument that a SlickGrid refresh necessarily leaves us with only its default From ce857939ebf273dbe763edd4a94aea40defd855b Mon Sep 17 00:00:00 2001 From: Tomasz Naumowicz Date: Thu, 26 Nov 2026 16:39:46 +0100 Subject: [PATCH 003/148] wip: initial dev plan --- .../ai-and-plans/features/data-grid/README.md | 4 + .../iterations/01-rdg-migration-plan.md | 304 ++++++++++++++++++ 2 files changed, 308 insertions(+) create mode 100644 docs/ai-and-plans/features/data-grid/iterations/01-rdg-migration-plan.md diff --git a/docs/ai-and-plans/features/data-grid/README.md b/docs/ai-and-plans/features/data-grid/README.md index c3c4518f6..fe55a6c00 100644 --- a/docs/ai-and-plans/features/data-grid/README.md +++ b/docs/ai-and-plans/features/data-grid/README.md @@ -58,6 +58,10 @@ loading behavior. ## Plan +**Current proposal:** [iterations/01-rdg-migration-plan.md](./iterations/01-rdg-migration-plan.md), +ordered work items for the React Data Grid migration (high level; detailed interfaces follow in the +next iteration). + See [slickgrid-removal.md](./slickgrid-removal.md) for the earlier footprint snapshot, candidate directions, sequential gates, and explicit non-scope. Use the newer research and parity checklist above for current upstream facts and the expanded behavior inventory. The build rationale for the current diff --git a/docs/ai-and-plans/features/data-grid/iterations/01-rdg-migration-plan.md b/docs/ai-and-plans/features/data-grid/iterations/01-rdg-migration-plan.md new file mode 100644 index 000000000..dba3373b7 --- /dev/null +++ b/docs/ai-and-plans/features/data-grid/iterations/01-rdg-migration-plan.md @@ -0,0 +1,304 @@ +--- +feature: data-grid +kind: plan +status: active +created: 2026-11-26 +code: + - src/webviews/documentdb/collectionView/components/resultsTab/** + - src/webviews/documentdb/collectionView/CollectionView.tsx + - src/webviews/slickgrid.scss + - src/webviews/utils/slickgrid/** + - src/utils/slickgrid/** + - src/documentdb/ClusterSession.ts + - vite.config.views.mjs + - build/verification/** +--- + +# Iteration 1: migrate the Collection View grid to React Data Grid + +**Status:** proposal, high level. Ordered work items with pointers to the research; interfaces, +file layouts and test lists are deliberately left to the next planning iteration. Tracks +[#1101](https://github.com/microsoft/vscode-documentdb/issues/1101). + +**Basis:** the [grid scorecard](../grid-scorecard.md) recommendation (React Data Grid, exact-pinned +beta, accessibility as a hard gate) and the [no-loss contract](../migration-parity.md). The +sequence reuses the gates of the earlier [removal plan](../slickgrid-removal.md#5-the-plan-sequential) +(G1–G6) and the staged gates in +[migration-research.md §7](../migration-research.md#7-recommended-direction-and-staged-gates-first-pass-superseded), +re-ordered for an RDG decision. + +## Guiding rules + +These come from the operator's priorities in the research +([grid-scorecard.md, Our priorities](../grid-scorecard.md#our-priorities)) and apply to every item. + +1. **Accessibility is a gate, not a score.** Keyboard navigation of table _and_ tree, verified with + Narrator and NVDA in packaged VS Code, decides whether a phase is done + ([#383](https://github.com/microsoft/vscode-documentdb/issues/383) is the Sev1 acceptance test). +2. **No functional loss.** Every _preserve_ and _improve_ row in + [migration-parity.md](../migration-parity.md) is in scope; _follow-up_ rows are not. +3. **Parity first, features after.** No optional feature (pinning, range selection, menus, + editing) is enabled during the swap + ([migration-parity.md §7](../migration-parity.md#7-deliberately-not-current-functionality)). +4. **No fork; exact pin.** Upstream `react-data-grid` only, exact version in manifest and lockfile + ([react-data-grid-capabilities.md §1](../react-data-grid-capabilities.md#1-version-matters-more-than-the-beta-label-alone)). +5. **Grid-neutral boundary first.** Host shapes and the webview contract do not name the grid; this + keeps SlickGrid 11 available as a fallback + ([grid-scorecard.md, Conclusion](../grid-scorecard.md#conclusion)). +6. **Identity by key, never by index.** Documents by canonical root `_id`, columns by field path + ([migration-parity.md §2, adapter hazard](../migration-parity.md#2-selection-and-document-actions); + [migration-research.md §5, feature coupling](../migration-research.md#feature-coupling-worth-copying-carefully)). +7. **Learn from Cosmos DB's follow-ups; do not copy its code.** Its fixes become our day-one tests + ([migration-research.md §4](../migration-research.md#4-evolution-after-migration)). + +## Overview + +| Phase | Items | Ships to users? | Exit gate | +| ----- | ------------- | ----------------------------- | ------------------------------------------------------- | +| 0 | WI-0 – WI-1 | No | Decision recorded; exact version chosen | +| A | WI-2 – WI-5 | Yes, no visible change | Contract tests green on SlickGrid; baseline measured | +| B | WI-6 – WI-12 | Not yet (behind the boundary) | Table passes parity, performance and accessibility gate | +| C | WI-13 – WI-15 | Not yet | Tree passes parity and accessibility gate | +| D | WI-16 – WI-18 | Yes | SlickGrid removed; full release gate | +| E | F-1 – F-8 | Yes, one PR each | Per feature | + +Phase A items can merge to `main` one by one while SlickGrid still ships. SlickGrid is not removed +until **both** table and tree pass +([migration-research.md §7](../migration-research.md#7-recommended-direction-and-staged-gates-first-pass-superseded)). + +--- + +## Phase 0: decide and pin + +### WI-0: record the grid decision + +- **Goal:** turn the scorecard recommendation into an approved entry in a new `decisions.md` for + this feature: React Data Grid, exact beta pin, tree built by us, reversal triggers. +- **Pointers:** [grid-scorecard.md, Conclusion](../grid-scorecard.md#conclusion) (what would reverse + it); [grid-options-evaluation.md §6](../grid-options-evaluation.md#6-what-each-path-gives-up) + (what each path gives up, i.e. the rejected alternative). +- **Gate:** operator approval. The rationale is the operator's; do not invent it. + +### WI-1: version and runtime compatibility check + +- **Goal:** choose the exact pin (beta.64 primary, Cosmos DB's beta.61 as reference) after checking + the published bundle and running it in our minimum supported VS Code/Electron. +- **Covers:** the partner's `getOrInsertComputed` concern, the Lightning CSS `light-dark()` + minification note for Vite 8+, CSP, packaged CSS emission (the partner's + [microsoft/vscode-cosmosdb#3037](https://github.com/microsoft/vscode-cosmosdb/pull/3037) lesson). +- **Pointers:** [react-data-grid-capabilities.md §1](../react-data-grid-capabilities.md#the-partners-runtime-warning-needs-a-version-specific-check) + and [§4](../react-data-grid-capabilities.md#4-accessibility-and-integration-caveats). +- **Constraint:** no direct npmjs.org access; use the approved registry and tooling. +- **Output:** the pinned version and a short beta-upgrade procedure (re-verify the APIs our + renderers wrap; budget half a day to a day per upgrade). + +## Phase A: grid-neutral groundwork (no visible change) + +### WI-2: neutral host result shapes + +- **Goal:** the host no longer knows which grid renders its data. +- **Scope:** move and rename `src/utils/slickgrid/**` (`toSlickGridTable`, `toSlickGridTree`, + `CellValue`) and `src/webviews/utils/slickgrid/typeToDisplayString`; separate row metadata (row + key, canonical root `_id`) from document fields instead of mixing `id`/`x-objectid` into rows; + keep BSON formatting in the schema analyzer. +- **Pointers:** [slickgrid-removal.md G1](../slickgrid-removal.md#g1-make-the-host-grid-neutral-no-ui-change); + parity T01, T02, T07, S07 and the adapter hazard in + [migration-parity.md §2](../migration-parity.md#2-selection-and-document-actions) + (falsy and composite `_id` cases). +- **Gate:** existing shaping tests pass with renames only; build. + +### WI-3: internal table and tree contracts + +- **Goal:** `DataViewPanelTable` and `DataViewPanelTree` become SlickGrid-backed implementations of + grid-neutral table and tree components; `slickgrid-react` is imported only behind them. +- **Scope highlights:** selection reported as canonical IDs; step-in reported by **field key**, not + column index; loading and empty states; container sizing owned by the component. +- **Pointers:** [slickgrid-removal.md G2 and §2](../slickgrid-removal.md#g2-one-internal-grid-interface); + [migration-research.md §6](../migration-research.md#6-what-we-must-not-lose). +- **Gate:** build; L2 Collection View scenario unchanged; quick visual check of both views. + +### WI-4: behavior contracts and fixtures + +- **Goal:** tests that describe today's behavior against the WI-3 contracts, green on SlickGrid + before any swap. +- **Scope:** Vitest contract tests (selection, step-in, type display, missing versus `null`, tree + shape) and browser scenario fixtures for `collectionView` (mixed BSON types, 50+ heterogeneous + columns, deep nesting, arrays of 0/10/11 elements, 1,000 rows, HTML-looking values). Add the + partner's regressions as tests: one selected row treated as none, stale results acting on another + collection, Space-key scrolling, focusable `aria-hidden` controls. +- **Pointers:** [migration-parity.md §5–§6](../migration-parity.md#5-existing-tests-are-a-starting-point-not-parity-proof); + [slickgrid-removal.md G3](../slickgrid-removal.md#g3-behavior-tests-before-the-swap); + [migration-research.md §4](../migration-research.md#4-evolution-after-migration); + `build/verification/browser/scenarios.ts` and the L2 runner in + [build/verification/README.md](../../../../../build/verification/README.md). +- **Gate:** operator reviews the test list against the parity contract. + +### WI-5: baseline measurements on SlickGrid + +- **Goal:** numbers and observations to compare against, captured once. +- **Scope:** chunk size, first usable render, scroll responsiveness and DOM counts on the WI-4 + fixtures; a Narrator and NVDA pass of table and tree in packaged VS Code (the "before" for #383); + a reproduction of today's resizing complaints, including header widths changing on paging. +- **Pointers:** [migration-parity.md §6](../migration-parity.md#6-required-migration-evidence); + [grid-scorecard.md, Hands-on results](../grid-scorecard.md#hands-on-results); + [slickgrid-update-assessment.md §4](../slickgrid-update-assessment.md#4-assessment). +- **Gate:** size and performance budgets agreed with the operator. + +## Phase B: table on React Data Grid + +Built behind the WI-3 contracts. How the two implementations coexist until Phase D (branch, +development switch or setting) is an open decision below. + +### WI-6: dependency, build and theme foundation + +- **Scope:** add the exact pin; give RDG its own lazy chunk beside the SlickGrid group in + `vite.config.views.mjs`; extend the bundle inspection; map `--rdg-*` variables to VS Code tokens; + forced colours and focus visibility (fixes our own + [#775](https://github.com/microsoft/vscode-documentdb/issues/775)). +- **Pointers:** [react-data-grid-capabilities.md §4](../react-data-grid-capabilities.md#4-accessibility-and-integration-caveats); + parity W07; [build/vite/README.md](../../../../../build/vite/README.md) (chunk groups); + `build/verification/inspect.cjs`. + +### WI-7: table core + +- **Scope:** dynamic columns keyed by field path, minimum width, virtualization, container sizing, + first-load skeleton and empty results, native text selection in cells, pointer and keyboard + resize, and an explicit column-width retention policy across paging and schema changes. +- **Pointers:** parity T01, T09–T11, W04–W06, W09; + [grid-scorecard.md category 7](../grid-scorecard.md#7-column-resizing-weight-2--slickgrid-6-rdg-8). + +### WI-8: typed value cell + +- **Scope:** BSON-aware value rendering plus an accessible type badge with a textual description + (keyboard-reachable, not colour-only, not CSS `::before` text); keep UUID/legacy UUID and the + Int32/Double/Decimal128/Long distinctions. Resolves + [#382](https://github.com/microsoft/vscode-documentdb/issues/382). +- **Pointers:** parity T06–T10, T12; `packages/documentdb-js-schema-analyzer` value formatters. + +### WI-9: document selection and actions + +- **Scope:** row-selection gestures (click, Ctrl/Shift-click, Space/Shift+Space, Shift+arrows), the + active cell kept separate from selected documents, selection announcements, command enablement, + and invalidation on refresh, paging, deletion, view switch and unmount. +- **Pointers:** parity S01–S07; Cosmos DB's custom selection and its follow-up fixes + ([migration-research.md §3](../migration-research.md#3-what-the-partner-migrated) and + [§4](../migration-research.md#4-evolution-after-migration)). +- **Decision inside the item:** custom gestures (as Cosmos DB did) versus `SelectColumn` checkboxes. + +### WI-10: step-in to nested objects + +- **Scope:** double-click plus a keyboard equivalent and a visible affordance on object cells; + breadcrumbs and Level up unchanged; predictable focus after stepping in or out; telemetry kept. +- **Pointers:** parity T03–T05; `CollectionView.handleStepInRequest`, `ToolbarTableNavigation`. + +### WI-11: resizing without dragging + +- **Scope:** a minimal header action offering "Resize column…" and "Fit to content", required by + WCAG 2.5.7 on either grid ([#776](https://github.com/microsoft/vscode-documentdb/issues/776)). + Limited to resizing; a general header menu is follow-up work. +- **Pointers:** [grid-scorecard.md, reported accessibility issues](../grid-scorecard.md#accessibility-issues-already-reported-against-our-grid); + the partner's resize dialog in + [microsoft/vscode-cosmosdb#2723](https://github.com/microsoft/vscode-cosmosdb/pull/2723). + +### WI-12: table gate + +- **Automated:** WI-4 contracts unchanged and green on RDG; L2 scenarios clean (no console errors, + no CSP violations, no overflow at narrow width); bundle within the WI-5 budget. +- **Operator:** keyboard-only journey; Narrator and NVDA in packaged VS Code; light, dark, high + contrast and Windows contrast themes; zoom; a real cluster with wide and deep data. + +## Phase C: tree on React Data Grid + +The highest-risk part. The RDG TreeView demo narrated well but could not be expanded from the +keyboard, and that behavior is ours to build +([grid-scorecard.md, Hands-on results](../grid-scorecard.md#hands-on-results)). + +### WI-13: tree model and rendering + +- **Scope:** application-owned flattened visible rows over the neutral tree shape, expansion state, + Field/Value/Type columns using the WI-8 cell, synthetic `_id` roots, the arrays-of-at-most-10 + rule, virtualization of large expanded trees, no new sort or filter. +- **Pointers:** parity R01–R04, R06–R07; the upstream + [TreeView example](https://github.com/Comcast/react-data-grid/blob/v7.0.0-beta.64/website/routes/TreeView.tsx) + and Cosmos DB's tree, as starting points only. + +### WI-14: tree accessibility + +- **Scope:** `treegrid` semantics; `aria-level`, `aria-expanded`, `aria-setsize`, `aria-posinset`; + keyboard expand and collapse (Left/Right, Enter/Space); parent/child movement; focus moves to the + ancestor on collapse and survives refresh. +- **Pointers:** parity R05, R07, W09; the treegrid target described for SlickGrid in + [grid-scorecard.md, observed gaps](../grid-scorecard.md#what-we-observed-and-possible-paths). + +### WI-15: tree gate + +- Same shape as WI-12, plus the tree evidence in + [migration-parity.md §6](../migration-parity.md#6-required-migration-evidence) (deep tree, + multiple roots, empty containers, very large arrays, focus after keyboard collapse). + +## Phase D: swap and clean up + +### WI-16: switch and remove SlickGrid + +- **Scope:** RDG implementations become the only ones. Remove `slickgrid-react`, `slickgrid.scss` + and its use in `collectionView.scss`, the `slickgrid` chunk group and `optimizeDeps` entry, + SlickGrid assertions in `build/verification/inspect.cjs` and the browser fixtures, and the + stale-closure refs with their lint suppression. Recheck `allowSyntheticDefaultImports` and + `useHideScrollbarsDuringResize`. +- **Pointers:** [slickgrid-removal.md §1](../slickgrid-removal.md#1-current-footprint-measured) + and G5–G6; `git grep -i slickgrid` for the full set. + +### WI-17: documentation + +- **Scope:** this feature's README (current architecture), a `design.md` for the grid boundary, the + SlickGrid notes in the [e2e testing strategy](../../e2e-testing/strategy.md) and + `build/vite/README.md`, release notes; close #383, #382, #775 and #776 where verified. + +### WI-18: release gate + +- Case 2 verification from `.github/copilot-instructions.md`, the full + [migration-parity.md §6](../migration-parity.md#6-required-migration-evidence) checklist in a + packaged VSIX, and a before/after comparison with the WI-5 baseline. + +## Phase E: follow-up features (after parity, one PR each) + +Ordered by the operator's stated priorities. Effort figures are the research's judgments. + +| ID | Feature | Effort | Pointer | +| --- | ------------------------------------------------------------- | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| F-1 | Pin `_id` by default | XS | [grid-scorecard.md, Planned additions](../grid-scorecard.md#planned-additions-after-the-grid-choice) | +| F-2 | Pin more columns from a header pin button | S | same | +| F-3 | Cell-range selection (mouse and Shift+arrows) with Excel copy | 2–3 wks | [grid-scorecard.md, range selection without a fork](../grid-scorecard.md#can-we-build-range-selection-on-rdg-without-forking); settle the drag-versus-text-selection conflict | +| F-4 | Context menu aware of the multi-selection | S–M | [grid-scorecard.md, Planned additions](../grid-scorecard.md#planned-additions-after-the-grid-choice) | +| F-5 | Remember and reset column widths | S | [react-data-grid-capabilities.md §2](../react-data-grid-capabilities.md#2-what-is-actually-cheap) | +| F-6 | Checkbox selection and select current page | S | parity S08 | +| F-7 | Column reorder and hide/show | S–M | [react-data-grid-capabilities.md §2](../react-data-grid-capabilities.md#2-what-is-actually-cheap) | +| F-8 | In-cell editing | M+ | [grid-scorecard.md category 6](../grid-scorecard.md#6-in-cell-editing-weight-2--slickgrid-8-rdg-6); [capabilities §3](../react-data-grid-capabilities.md#3-available-library-features-that-are-not-cheap-database-features) | + +Not planned: header sorting of the loaded page, grouping, paste/fill writes and visible-row export +([react-data-grid-capabilities.md §3](../react-data-grid-capabilities.md#3-available-library-features-that-are-not-cheap-database-features)). + +## Cross-cutting + +- **Beta upgrades:** each upgrade re-runs the WI-4 contracts, the accessibility journey and a check + of the RDG APIs our renderers wrap (`Cell` prop spreading, `RenderCellProps`, mouse event args). +- **Reversal trigger:** if WI-12 or WI-15 fails for reasons inside RDG, or RDG stalls, the WI-3 + boundary lets SlickGrid 11 be re-evaluated + ([grid-scorecard.md, Sensitivity](../grid-scorecard.md#sensitivity)). +- **SlickGrid contributions** (upstream issues or pull requests) are out of scope here + ([grid-scorecard.md, How we could help](../grid-scorecard.md#how-we-could-help-slickgrid-pass-these-checks)). + +## Open decisions for the next iteration + +1. Exact pin: beta.64 or beta.61 (WI-1). +2. Coexistence during Phases B–C: long-lived branch, development-only switch, or user setting. +3. Row-selection model: custom gestures versus checkbox column (WI-9). +4. Keyboard step-in key and affordance (WI-10). +5. Column-width retention policy across paging, queries and step-in (WI-7). +6. Tree implementation: custom rows on `DataGrid` versus a separate accessible tree component + behind the same contract (WI-13). +7. PR slicing: which items merge together, and which reach `main` before the swap. + +# Outcome + +Not started. Record progress inline against each work item as it lands. From 9d867419c4f8b002920c81284b0c60310fb3612e Mon Sep 17 00:00:00 2001 From: Tomasz Naumowicz Date: Thu, 26 Nov 2026 17:01:30 +0100 Subject: [PATCH 004/148] initial dev plan --- .../ai-and-plans/features/data-grid/README.md | 2 +- .../iterations/01-rdg-migration-plan.md | 449 ++++++++++-------- 2 files changed, 251 insertions(+), 200 deletions(-) diff --git a/docs/ai-and-plans/features/data-grid/README.md b/docs/ai-and-plans/features/data-grid/README.md index fe55a6c00..728cc704e 100644 --- a/docs/ai-and-plans/features/data-grid/README.md +++ b/docs/ai-and-plans/features/data-grid/README.md @@ -58,7 +58,7 @@ loading behavior. ## Plan -**Current proposal:** [iterations/01-rdg-migration-plan.md](./iterations/01-rdg-migration-plan.md), +**Accepted plan:** [iterations/01-rdg-migration-plan.md](./iterations/01-rdg-migration-plan.md), ordered work items for the React Data Grid migration (high level; detailed interfaces follow in the next iteration). diff --git a/docs/ai-and-plans/features/data-grid/iterations/01-rdg-migration-plan.md b/docs/ai-and-plans/features/data-grid/iterations/01-rdg-migration-plan.md index dba3373b7..0d7972218 100644 --- a/docs/ai-and-plans/features/data-grid/iterations/01-rdg-migration-plan.md +++ b/docs/ai-and-plans/features/data-grid/iterations/01-rdg-migration-plan.md @@ -16,251 +16,300 @@ code: # Iteration 1: migrate the Collection View grid to React Data Grid -**Status:** proposal, high level. Ordered work items with pointers to the research; interfaces, -file layouts and test lists are deliberately left to the next planning iteration. Tracks +**Status:** accepted by the operator on 2026-11-26. High level: ordered work items with pointers to +the research; interfaces, file layouts and test lists are deliberately left to the next planning +iteration. Tracks [#1101](https://github.com/microsoft/vscode-documentdb/issues/1101). +**Goal:** the migration itself, plus whatever the migration fixes on its own. Remaining +accessibility issues and new features are later iterations (see +[After this feature](#after-this-feature)). + **Basis:** the [grid scorecard](../grid-scorecard.md) recommendation (React Data Grid, exact-pinned beta, accessibility as a hard gate) and the [no-loss contract](../migration-parity.md). The -sequence reuses the gates of the earlier [removal plan](../slickgrid-removal.md#5-the-plan-sequential) -(G1–G6) and the staged gates in -[migration-research.md §7](../migration-research.md#7-recommended-direction-and-staged-gates-first-pass-superseded), -re-ordered for an RDG decision. +[earlier removal plan](../slickgrid-removal.md#5-the-plan-sequential) assumed both grids would +ship side by side behind an interface, with an operator gate per stage. This plan drops that: it is +a straight replacement on a feature branch, verified mostly by automation. + +## How the work is organised + +- **One feature branch.** All work items merge into a `feature/` branch; the branch merges into + `main` once, when the migration is complete and SlickGrid is gone. Nothing ships before that. +- **No coexistence.** SlickGrid is removed at the start, not the end. The Collection View may be + broken between work items; there is no interface layer, switch or setting to keep both grids + running. +- **Automation first.** The agent explores and verifies with Playwright against the L2-dev + scenarios (`npm run watch:views`, `/scenarios/collectionView/...`, `run-all.js`; see + [build/verification/README.md, L2-dev](../../../../../build/verification/README.md#l2-dev-source-scenarios)). + Playwright covers rendering, ARIA structure, keyboard journeys, focus, selection, resizing, + narrow widths, zoom, the three VS Code themes and emulated forced colours. +- **Three operator gates only:** approve the start (G1), a hands-on check once both views work + (G2), and the final acceptance (G3). Only what automation cannot judge goes to the operator: + real screen readers, Windows contrast themes, a real cluster and overall feel. +- **Native context menus.** Any grid menu uses VS Code's `webview/context` contribution with + `data-vscode-context` on the target element, with commands executed on the host, as the Cluster + Dashboard does ([cluster-dashboard decision 0016](../../cluster-dashboard/decisions.md#0016--row-context-menu-entries-run-on-the-host); + `src/webviews/documentdb/clusterDashboard/clusterDashboardContextMenu.ts`). No Fluent or grid + menus. This feature adds no menus; the rule applies to the later iterations. ## Guiding rules -These come from the operator's priorities in the research -([grid-scorecard.md, Our priorities](../grid-scorecard.md#our-priorities)) and apply to every item. +From the operator's priorities in the research +([grid-scorecard.md, Our priorities](../grid-scorecard.md#our-priorities)). -1. **Accessibility is a gate, not a score.** Keyboard navigation of table _and_ tree, verified with - Narrator and NVDA in packaged VS Code, decides whether a phase is done - ([#383](https://github.com/microsoft/vscode-documentdb/issues/383) is the Sev1 acceptance test). -2. **No functional loss.** Every _preserve_ and _improve_ row in - [migration-parity.md](../migration-parity.md) is in scope; _follow-up_ rows are not. -3. **Parity first, features after.** No optional feature (pinning, range selection, menus, - editing) is enabled during the swap +1. **Accessibility is a gate, not a score.** Keyboard navigation of table _and_ tree + ([#383](https://github.com/microsoft/vscode-documentdb/issues/383), Sev1) is the acceptance test. +2. **Replicate outcomes, not SlickGrid.** The scope is the [list below](#scope-what-the-migration-replicates), + not the parity contract wholesale. Where RDG's default is good enough, take it. Tests assert + what the user can do, never SlickGrid's DOM, classes, pixel values or timing. +3. **Parity first, features after** ([migration-parity.md §7](../migration-parity.md#7-deliberately-not-current-functionality)). -4. **No fork; exact pin.** Upstream `react-data-grid` only, exact version in manifest and lockfile +4. **No fork; exact pin** in manifest and lockfile ([react-data-grid-capabilities.md §1](../react-data-grid-capabilities.md#1-version-matters-more-than-the-beta-label-alone)). -5. **Grid-neutral boundary first.** Host shapes and the webview contract do not name the grid; this - keeps SlickGrid 11 available as a fallback - ([grid-scorecard.md, Conclusion](../grid-scorecard.md#conclusion)). -6. **Identity by key, never by index.** Documents by canonical root `_id`, columns by field path +5. **Identity by key, never by index.** Documents by canonical root `_id`, columns by field path ([migration-parity.md §2, adapter hazard](../migration-parity.md#2-selection-and-document-actions); - [migration-research.md §5, feature coupling](../migration-research.md#feature-coupling-worth-copying-carefully)). -7. **Learn from Cosmos DB's follow-ups; do not copy its code.** Its fixes become our day-one tests + [migration-research.md §5](../migration-research.md#feature-coupling-worth-copying-carefully)). +6. **Learn from Cosmos DB's follow-ups; do not copy its code.** Its fixes become our tests ([migration-research.md §4](../migration-research.md#4-evolution-after-migration)). -## Overview +## Scope: what the migration replicates + +The [no-loss contract](../migration-parity.md) inventories everything today's grid does. Much of it +is SlickGrid behavior nobody asked for. This list is what the plan **proposes** to carry over; the +operator confirms it at G1 (see [operator scope check](#operator-scope-check)). IDs in brackets +point to the contract. + +**Must work** (named by the operator; keyboard support is part of the migration): + +| ID | Feature | Parity | +| --- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------- | +| M1 | Step into an object field across the whole page by double-clicking an object cell (`_id` and arrays are not step-in targets) | T03 | +| M2 | Step out: Level up and jumps to any breadcrumb, including Root | T04 | +| M3 | Paging: first/previous/next, page sizes 10/50/100/500, reset to page one on a new query. Owned by the app; the grid shows one page | W01–W02 | +| M4 | Tree view: Table/Tree/JSON switch; Field/Value/Type; one root per document labelled by `_id`; collapsed at start; `{...}` and `(elements: N)` summaries; arrays of at most 10 elements expandable | R01–R04 | +| M5 | Tree keyboard: expand/collapse, move between parent and child, `treegrid` semantics | R05 | +| M6 | Table keyboard navigation between cells and headers (RDG default) | #383 | +| M7 | A keyboard way to step in on object cells | T05 | + +**Proposed to keep** (today's workflows break without them): + +| ID | Feature | Parity | Why | +| --- | ---------------------------------------------------------------------------------------------------------------------- | ----------------- | ----------------------------------------- | +| K1 | Select one or more documents; View/Edit need exactly one, Delete at least one | S01, S03 | Toolbar document actions depend on it | +| K2 | Actions always hit the right document: selection keyed by `_id`, cleared after delete, paging, refresh and view switch | S02, S04–S05, S07 | A wrong-document delete is data loss | +| K3 | Columns come from the documents at the current level, heterogeneous documents allowed | T01 | Without it the table cannot show the data | +| K4 | Root `_id` column stays visible at nested levels | T02 | Shows which document a nested row is from | +| K5 | BSON-aware values (Int32/Long/Double/Decimal128, dates, ObjectId, UUID and legacy UUID), arrays as `array[N]` | T07–T08, T10 | Plain JSON loses type information | +| K6 | A missing field looks different from `null` | T09 | Different data, different meaning | +| K7 | A type indicator per cell, as today's short text (`i32`, `Ab`, …); a badge is F-9 | T06 | Existing, visible feature | +| K8 | Cell content is text, never HTML | T12 | Security; a React default | +| K9 | Loading state on first load, empty-results state | W04 | Otherwise the view looks broken | +| K10 | Follows VS Code light, dark and high-contrast themes | W07 | Otherwise unreadable in some themes | +| K11 | A 500-row page scrolls without noticeable lag (virtualization, RDG default) | W06 | Largest page size offered | + +**RDG default is enough** (no replication work, no dedicated tests): + +| ID | Today | Proposal | +| --- | ---------------------------------------------------------- | ---------------------------------------------------------- | +| D1 | 100 px minimum width, autosized columns | RDG's initial widths and minimum | +| D2 | Pointer resize; widths reset on paging (a known complaint) | RDG resize; whatever width behaviour it gives across pages | +| D3 | No keyboard column resize | RDG's Ctrl+Left/Right on a header | +| D4 | Custom active-cell and selection styling | RDG styling mapped to VS Code tokens | +| D5 | Text selection inside cells (T11) | Whatever RDG allows | +| D6 | Focus after refresh (W09) | RDG behaviour, unless keyboard use breaks | +| D7 | 15 px tree indentation, SlickGrid chevrons (R03) | Any clear indentation and expander | +| D8 | Type-name tooltip on hover | Optional if the type indicator is readable on its own | +| D9 | No selection announcements (S06) | RDG grid semantics, no custom live regions | +| D10 | No forced-colours support | RDG's built-in forced-colours support | + +**Not carried over** (SlickGrid artefacts; not replicated and not tested): `typedTableCell type-*` +classes, the 7 px resize handle and other SlickGrid DOM details; the 100 ms selection debounce, the +manual `renderGrid()` and `ResizeObserver`, the hidden tree filter row; exact pixel values; a +before/after performance comparison with SlickGrid (K11 replaces it). + +**Not in this feature:** fixing accessibility gaps the migration does not close by itself +(resizing without dragging, contrast bugs) and new features. Both are listed in +[After this feature](#after-this-feature). + +### Operator scope check + +Part of **G1**, before any test or code is written. The operator goes through the tables above and, +per row, keeps it, moves it to "RDG default", or drops it. The agent then sizes +WI-3's tests and the work items to the confirmed list: **M** and **K** rows get Playwright checks +of the user outcome; **D** rows get none beyond "nothing is broken". Record the confirmed list in +`decisions.md` (WI-0), so later reviews do not re-raise SlickGrid behaviors that were deliberately +dropped. -| Phase | Items | Ships to users? | Exit gate | -| ----- | ------------- | ----------------------------- | ------------------------------------------------------- | -| 0 | WI-0 – WI-1 | No | Decision recorded; exact version chosen | -| A | WI-2 – WI-5 | Yes, no visible change | Contract tests green on SlickGrid; baseline measured | -| B | WI-6 – WI-12 | Not yet (behind the boundary) | Table passes parity, performance and accessibility gate | -| C | WI-13 – WI-15 | Not yet | Tree passes parity and accessibility gate | -| D | WI-16 – WI-18 | Yes | SlickGrid removed; full release gate | -| E | F-1 – F-8 | Yes, one PR each | Per feature | +## Overview -Phase A items can merge to `main` one by one while SlickGrid still ships. SlickGrid is not removed -until **both** table and tree pass -([migration-research.md §7](../migration-research.md#7-recommended-direction-and-staged-gates-first-pass-superseded)). +| Step | Work items | Who | Ends with | +| ---- | ------------- | ------------------ | ---------------------------------------------------------------- | +| 0 | WI-0 – WI-1 | Agent, then **G1** | Scope confirmed, decision recorded, version pinned, branch ready | +| 1 | WI-2 – WI-4 | Agent | Neutral data, tests and fixtures written, SlickGrid out | +| 2 | WI-5 – WI-8 | Agent | Table scope rows pass in Playwright | +| 3 | WI-9 | Agent, then **G2** | Tree scope rows pass; operator hands-on | +| 4 | WI-10 – WI-11 | Agent, then **G3** | Automated sweep, clean-up; acceptance; merge to `main` | +| — | — | Later iterations | Remaining accessibility issues, then new features | --- -## Phase 0: decide and pin +## Step 0: decide and pin -### WI-0: record the grid decision +### WI-0: record the decision and create the branch -- **Goal:** turn the scorecard recommendation into an approved entry in a new `decisions.md` for - this feature: React Data Grid, exact beta pin, tree built by us, reversal triggers. -- **Pointers:** [grid-scorecard.md, Conclusion](../grid-scorecard.md#conclusion) (what would reverse - it); [grid-options-evaluation.md §6](../grid-options-evaluation.md#6-what-each-path-gives-up) - (what each path gives up, i.e. the rejected alternative). -- **Gate:** operator approval. The rationale is the operator's; do not invent it. +- **Goal:** an entry in a new `decisions.md` for this feature (React Data Grid, exact beta pin, tree + built by us, reversal triggers), a second for the way of working above (feature branch, no + coexistence, automation-first, native menus), and a third for the confirmed scope list. Create + the `feature/` branch. +- **Pointers:** [grid-scorecard.md, Conclusion](../grid-scorecard.md#conclusion); + [grid-options-evaluation.md §6](../grid-options-evaluation.md#6-what-each-path-gives-up) (the + rejected alternative). -### WI-1: version and runtime compatibility check +### WI-1: version and runtime check -- **Goal:** choose the exact pin (beta.64 primary, Cosmos DB's beta.61 as reference) after checking - the published bundle and running it in our minimum supported VS Code/Electron. -- **Covers:** the partner's `getOrInsertComputed` concern, the Lightning CSS `light-dark()` - minification note for Vite 8+, CSP, packaged CSS emission (the partner's - [microsoft/vscode-cosmosdb#3037](https://github.com/microsoft/vscode-cosmosdb/pull/3037) lesson). +- **Goal:** choose the exact pin (beta.64 primary, Cosmos DB's beta.61 as reference) from the + published bundle and a smoke run in our minimum supported VS Code/Electron. +- **Covers:** the partner's `getOrInsertComputed` concern, the Lightning CSS `light-dark()` note, + CSP, packaged CSS emission + ([microsoft/vscode-cosmosdb#3037](https://github.com/microsoft/vscode-cosmosdb/pull/3037)). - **Pointers:** [react-data-grid-capabilities.md §1](../react-data-grid-capabilities.md#the-partners-runtime-warning-needs-a-version-specific-check) and [§4](../react-data-grid-capabilities.md#4-accessibility-and-integration-caveats). -- **Constraint:** no direct npmjs.org access; use the approved registry and tooling. -- **Output:** the pinned version and a short beta-upgrade procedure (re-verify the APIs our - renderers wrap; budget half a day to a day per upgrade). +- **Constraint:** no direct npmjs.org access; use the approved registry. + +**G1 (operator):** the [operator scope check](#operator-scope-check); approve the decision entries, +the pin and this plan; settle the open decisions marked _before G1_ below. -## Phase A: grid-neutral groundwork (no visible change) +## Step 1: foundation -### WI-2: neutral host result shapes +### WI-2: neutral host shapes and identity -- **Goal:** the host no longer knows which grid renders its data. - **Scope:** move and rename `src/utils/slickgrid/**` (`toSlickGridTable`, `toSlickGridTree`, `CellValue`) and `src/webviews/utils/slickgrid/typeToDisplayString`; separate row metadata (row - key, canonical root `_id`) from document fields instead of mixing `id`/`x-objectid` into rows; - keep BSON formatting in the schema analyzer. + key, canonical root `_id`) from document fields; keep BSON formatting in the schema analyzer; + step-in addressed by field key. - **Pointers:** [slickgrid-removal.md G1](../slickgrid-removal.md#g1-make-the-host-grid-neutral-no-ui-change); - parity T01, T02, T07, S07 and the adapter hazard in - [migration-parity.md §2](../migration-parity.md#2-selection-and-document-actions) - (falsy and composite `_id` cases). -- **Gate:** existing shaping tests pass with renames only; build. - -### WI-3: internal table and tree contracts - -- **Goal:** `DataViewPanelTable` and `DataViewPanelTree` become SlickGrid-backed implementations of - grid-neutral table and tree components; `slickgrid-react` is imported only behind them. -- **Scope highlights:** selection reported as canonical IDs; step-in reported by **field key**, not - column index; loading and empty states; container sizing owned by the component. -- **Pointers:** [slickgrid-removal.md G2 and §2](../slickgrid-removal.md#g2-one-internal-grid-interface); - [migration-research.md §6](../migration-research.md#6-what-we-must-not-lose). -- **Gate:** build; L2 Collection View scenario unchanged; quick visual check of both views. - -### WI-4: behavior contracts and fixtures - -- **Goal:** tests that describe today's behavior against the WI-3 contracts, green on SlickGrid - before any swap. -- **Scope:** Vitest contract tests (selection, step-in, type display, missing versus `null`, tree - shape) and browser scenario fixtures for `collectionView` (mixed BSON types, 50+ heterogeneous - columns, deep nesting, arrays of 0/10/11 elements, 1,000 rows, HTML-looking values). Add the - partner's regressions as tests: one selected row treated as none, stale results acting on another - collection, Space-key scrolling, focusable `aria-hidden` controls. + parity T01, T02, T07, S07 and the falsy/composite `_id` cases in + [migration-parity.md §2](../migration-parity.md#2-selection-and-document-actions). +- **Check:** shaping unit tests updated and green. + +### WI-3: fixtures and scenario tests + +- **Scope:** Collection View L2-dev scenarios with fake host payloads (mixed BSON types, missing vs + `null`, heterogeneous columns, deep nesting, arrays of 0/10/11 elements, a 500-row page, + HTML-looking values, empty results). Playwright checks only for the confirmed **M** and **K** + rows, written as user outcomes ("after stepping in, the breadcrumb shows the field and the rows + show its sub-fields"), plus the partner's relevant regressions (one selected row treated as none, + stale results acting on another collection). They fail until the new grid lands. - **Pointers:** [migration-parity.md §5–§6](../migration-parity.md#5-existing-tests-are-a-starting-point-not-parity-proof); - [slickgrid-removal.md G3](../slickgrid-removal.md#g3-behavior-tests-before-the-swap); [migration-research.md §4](../migration-research.md#4-evolution-after-migration); - `build/verification/browser/scenarios.ts` and the L2 runner in - [build/verification/README.md](../../../../../build/verification/README.md). -- **Gate:** operator reviews the test list against the parity contract. - -### WI-5: baseline measurements on SlickGrid - -- **Goal:** numbers and observations to compare against, captured once. -- **Scope:** chunk size, first usable render, scroll responsiveness and DOM counts on the WI-4 - fixtures; a Narrator and NVDA pass of table and tree in packaged VS Code (the "before" for #383); - a reproduction of today's resizing complaints, including header widths changing on paging. -- **Pointers:** [migration-parity.md §6](../migration-parity.md#6-required-migration-evidence); - [grid-scorecard.md, Hands-on results](../grid-scorecard.md#hands-on-results); - [slickgrid-update-assessment.md §4](../slickgrid-update-assessment.md#4-assessment). -- **Gate:** size and performance budgets agreed with the operator. - -## Phase B: table on React Data Grid - -Built behind the WI-3 contracts. How the two implementations coexist until Phase D (branch, -development switch or setting) is an open decision below. + `build/verification/browser/scenarios.ts`, `build/verification/browser/fixtures.ts`. -### WI-6: dependency, build and theme foundation +### WI-4: remove SlickGrid, add React Data Grid -- **Scope:** add the exact pin; give RDG its own lazy chunk beside the SlickGrid group in - `vite.config.views.mjs`; extend the bundle inspection; map `--rdg-*` variables to VS Code tokens; - forced colours and focus visibility (fixes our own - [#775](https://github.com/microsoft/vscode-documentdb/issues/775)). -- **Pointers:** [react-data-grid-capabilities.md §4](../react-data-grid-capabilities.md#4-accessibility-and-integration-caveats); - parity W07; [build/vite/README.md](../../../../../build/vite/README.md) (chunk groups); - `build/verification/inspect.cjs`. +- **Scope:** remove `slickgrid-react`, `slickgrid.scss` and its use in `collectionView.scss`, the + `slickgrid` chunk group and `optimizeDeps` entry, SlickGrid assertions in + `build/verification/inspect.cjs`, `prove-inspection.cjs` and fixtures, stale-closure refs and + their lint suppression; recheck `allowSyntheticDefaultImports` and + `useHideScrollbarsDuringResize`. Add the pinned dependency with its own lazy chunk, and the theme: + `--rdg-*` mapped to VS Code tokens (K10, D4, D10). +- **Pointers:** [slickgrid-removal.md §1](../slickgrid-removal.md#1-current-footprint-measured); + `git grep -i slickgrid`; [build/vite/README.md](../../../../../build/vite/README.md). +- **Check:** build and bundle inspection green; the views may render placeholders. -### WI-7: table core +## Step 2: table -- **Scope:** dynamic columns keyed by field path, minimum width, virtualization, container sizing, - first-load skeleton and empty results, native text selection in cells, pointer and keyboard - resize, and an explicit column-width retention policy across paging and schema changes. -- **Pointers:** parity T01, T09–T11, W04–W06, W09; - [grid-scorecard.md category 7](../grid-scorecard.md#7-column-resizing-weight-2--slickgrid-6-rdg-8). +Each item ends when its WI-3 scenario checks pass in Playwright. -### WI-8: typed value cell +### WI-5: table core -- **Scope:** BSON-aware value rendering plus an accessible type badge with a textual description - (keyboard-reachable, not colour-only, not CSS `::before` text); keep UUID/legacy UUID and the - Int32/Double/Decimal128/Long distinctions. Resolves - [#382](https://github.com/microsoft/vscode-documentdb/issues/382). -- **Pointers:** parity T06–T10, T12; `packages/documentdb-js-schema-analyzer` value formatters. +- **Scope:** columns from the current level keyed by field path, root `_id` at nested levels, + loading and empty states, keyboard navigation and virtualization; widths and resizing as RDG + ships them. Paging keeps working (it is app-owned; the grid only has to accept a new page). +- **Scope list:** M3, M6, K3, K4, K9, K11; D1–D3, D5–D6. -### WI-9: document selection and actions +### WI-6: typed value cell -- **Scope:** row-selection gestures (click, Ctrl/Shift-click, Space/Shift+Space, Shift+arrows), the - active cell kept separate from selected documents, selection announcements, command enablement, - and invalidation on refresh, paging, deletion, view switch and unmount. -- **Pointers:** parity S01–S07; Cosmos DB's custom selection and its follow-up fixes - ([migration-research.md §3](../migration-research.md#3-what-the-partner-migrated) and - [§4](../migration-research.md#4-evolution-after-migration)). -- **Decision inside the item:** custom gestures (as Cosmos DB did) versus `SelectColumn` checkboxes. +- **Scope:** BSON-aware values, missing versus `null`, today's short type text, content rendered + as text. +- **Scope list:** K5–K8; D8. +- **Pointers:** `packages/documentdb-js-schema-analyzer` formatters; today's labels in + `typeToDisplayString`. -### WI-10: step-in to nested objects +### WI-7: document selection and actions -- **Scope:** double-click plus a keyboard equivalent and a visible affordance on object cells; - breadcrumbs and Level up unchanged; predictable focus after stepping in or out; telemetry kept. -- **Pointers:** parity T03–T05; `CollectionView.handleStepInRequest`, `ToolbarTableNavigation`. +- **Scope:** select one or more documents with mouse and keyboard; toolbar View/Edit/Delete enabled + accordingly and acting on the selected `_id`s; selection cleared when the rows change. Use RDG's + selection support where it is enough; the gesture set is the agent's proposal at G2. +- **Scope list:** K1–K2; D9. +- **Pointers:** Cosmos DB's selection and later fixes + ([migration-research.md §3–§4](../migration-research.md#3-what-the-partner-migrated)). -### WI-11: resizing without dragging +### WI-8: step in and out -- **Scope:** a minimal header action offering "Resize column…" and "Fit to content", required by - WCAG 2.5.7 on either grid ([#776](https://github.com/microsoft/vscode-documentdb/issues/776)). - Limited to resizing; a general header menu is follow-up work. -- **Pointers:** [grid-scorecard.md, reported accessibility issues](../grid-scorecard.md#accessibility-issues-already-reported-against-our-grid); - the partner's resize dialog in - [microsoft/vscode-cosmosdb#2723](https://github.com/microsoft/vscode-cosmosdb/pull/2723). +- **Scope:** double-click and a keyboard equivalent on object cells; breadcrumbs and Level up as + today; telemetry kept. +- **Scope list:** M1–M2, M7. +- **Pointers:** `CollectionView.handleStepInRequest`, `ToolbarTableNavigation`. -### WI-12: table gate +## Step 3: tree -- **Automated:** WI-4 contracts unchanged and green on RDG; L2 scenarios clean (no console errors, - no CSP violations, no overflow at narrow width); bundle within the WI-5 budget. -- **Operator:** keyboard-only journey; Narrator and NVDA in packaged VS Code; light, dark, high - contrast and Windows contrast themes; zoom; a real cluster with wide and deep data. +### WI-9: accessible document tree -## Phase C: tree on React Data Grid +The highest-risk item: the RDG TreeView demo narrated well but could not be expanded from the +keyboard ([grid-scorecard.md, Hands-on results](../grid-scorecard.md#hands-on-results)). -The highest-risk part. The RDG TreeView demo narrated well but could not be expanded from the -keyboard, and that behavior is ours to build -([grid-scorecard.md, Hands-on results](../grid-scorecard.md#hands-on-results)). - -### WI-13: tree model and rendering - -- **Scope:** application-owned flattened visible rows over the neutral tree shape, expansion state, - Field/Value/Type columns using the WI-8 cell, synthetic `_id` roots, the arrays-of-at-most-10 - rule, virtualization of large expanded trees, no new sort or filter. -- **Pointers:** parity R01–R04, R06–R07; the upstream +- **Scope:** flattened visible rows over the neutral tree shape, expansion state, Field/Value/Type + columns with the WI-6 cell, synthetic `_id` roots, the arrays-of-at-most-10 rule; `treegrid` + semantics (`aria-level`, `aria-expanded`), keyboard expand/collapse and parent/child movement, + focus to the parent on collapse. +- **Scope list:** M4–M5; D7. +- **Pointers:** upstream [TreeView example](https://github.com/Comcast/react-data-grid/blob/v7.0.0-beta.64/website/routes/TreeView.tsx) - and Cosmos DB's tree, as starting points only. + and Cosmos DB's tree as starting points only; the treegrid target in + [grid-scorecard.md, observed gaps](../grid-scorecard.md#what-we-observed-and-possible-paths). -### WI-14: tree accessibility +**G2 (operator, short):** both views in a dev build or packaged VSIX against a real cluster; +direction check on look, selection, step-in and the tree. A quick Narrator pass on the tree is +recommended here because it is the riskiest piece. Findings become fixes before Step 4. -- **Scope:** `treegrid` semantics; `aria-level`, `aria-expanded`, `aria-setsize`, `aria-posinset`; - keyboard expand and collapse (Left/Right, Enter/Space); parent/child movement; focus moves to the - ancestor on collapse and survives refresh. -- **Pointers:** parity R05, R07, W09; the treegrid target described for SlickGrid in - [grid-scorecard.md, observed gaps](../grid-scorecard.md#what-we-observed-and-possible-paths). +## Step 4: harden and hand over -### WI-15: tree gate +### WI-10: automated sweep -- Same shape as WI-12, plus the tree evidence in - [migration-parity.md §6](../migration-parity.md#6-required-migration-evidence) (deep tree, - multiple roots, empty containers, very large arrays, focus after keyboard collapse). +- **Scope:** every confirmed **M** and **K** row through Playwright: keyboard-only journeys for + table and tree, step in and out, paging, selection and document actions; light, dark and + high-contrast themes; no console errors or CSP violations; L1 and L3 VSIX checks. **D** rows only + need to not be broken. +- **Output:** a short report of what was verified and what was not, for G3. -## Phase D: swap and clean up +### WI-11: clean-up and documentation -### WI-16: switch and remove SlickGrid +- **Scope:** this feature's README and a `design.md` for the grid integration, SlickGrid notes in + the [e2e testing strategy](../../e2e-testing/strategy.md) and `build/vite/README.md`, release + notes. -- **Scope:** RDG implementations become the only ones. Remove `slickgrid-react`, `slickgrid.scss` - and its use in `collectionView.scss`, the `slickgrid` chunk group and `optimizeDeps` entry, - SlickGrid assertions in `build/verification/inspect.cjs` and the browser fixtures, and the - stale-closure refs with their lint suppression. Recheck `allowSyntheticDefaultImports` and - `useHideScrollbarsDuringResize`. -- **Pointers:** [slickgrid-removal.md §1](../slickgrid-removal.md#1-current-footprint-measured) - and G5–G6; `git grep -i slickgrid` for the full set. +**G3 (operator, final):** NVDA and Narrator in packaged VS Code, Windows contrast themes, a real +cluster with wide and deep data, then the Case 2 checks from `.github/copilot-instructions.md`. +Merge the feature branch into `main`. Comment on #383 and the other grid `a11y` issues with what +the migration fixed; whatever remains goes to the next iteration. -### WI-17: documentation +## After this feature -- **Scope:** this feature's README (current architecture), a `design.md` for the grid boundary, the - SlickGrid notes in the [e2e testing strategy](../../e2e-testing/strategy.md) and - `build/vite/README.md`, release notes; close #383, #382, #775 and #776 where verified. +Two later iterations, each planned separately once the migration is merged. -### WI-18: release gate +### Next: remaining accessibility issues -- Case 2 verification from `.github/copilot-instructions.md`, the full - [migration-parity.md §6](../migration-parity.md#6-required-migration-evidence) checklist in a - packaged VSIX, and a before/after comparison with the WI-5 baseline. +Whatever the G3 screen-reader pass and the open `a11y` issues still show after the migration. +Known candidates today: -## Phase E: follow-up features (after parity, one PR each) +| Item | Pointer | +| -------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| Resizing without dragging (WCAG 2.5.7) | [#776](https://github.com/microsoft/vscode-documentdb/issues/776); "Resize column…" and "Fit to content" from a native header context menu, width asked by the host in an input box | +| Focus indicator contrast | [#775](https://github.com/microsoft/vscode-documentdb/issues/775), unless RDG's default focus styling already fixes it | +| Type marker contrast | [#382](https://github.com/microsoft/vscode-documentdb/issues/382) | +| Selection announcements, focus after refresh | Parity S06, W09, if the G3 pass finds RDG's defaults insufficient | + +### Later: new features Ordered by the operator's stated priorities. Effort figures are the research's judgments. @@ -269,35 +318,37 @@ Ordered by the operator's stated priorities. Effort figures are the research's j | F-1 | Pin `_id` by default | XS | [grid-scorecard.md, Planned additions](../grid-scorecard.md#planned-additions-after-the-grid-choice) | | F-2 | Pin more columns from a header pin button | S | same | | F-3 | Cell-range selection (mouse and Shift+arrows) with Excel copy | 2–3 wks | [grid-scorecard.md, range selection without a fork](../grid-scorecard.md#can-we-build-range-selection-on-rdg-without-forking); settle the drag-versus-text-selection conflict | -| F-4 | Context menu aware of the multi-selection | S–M | [grid-scorecard.md, Planned additions](../grid-scorecard.md#planned-additions-after-the-grid-choice) | +| F-4 | Native context menu aware of the multi-selection | S | `data-vscode-context` carries the selection summary; commands run on the host (see _How the work is organised_) | | F-5 | Remember and reset column widths | S | [react-data-grid-capabilities.md §2](../react-data-grid-capabilities.md#2-what-is-actually-cheap) | | F-6 | Checkbox selection and select current page | S | parity S08 | | F-7 | Column reorder and hide/show | S–M | [react-data-grid-capabilities.md §2](../react-data-grid-capabilities.md#2-what-is-actually-cheap) | | F-8 | In-cell editing | M+ | [grid-scorecard.md category 6](../grid-scorecard.md#6-in-cell-editing-weight-2--slickgrid-8-rdg-6); [capabilities §3](../react-data-grid-capabilities.md#3-available-library-features-that-are-not-cheap-database-features) | +| F-9 | Type badge or icon instead of short type text | S | [react-data-grid-capabilities.md §2](../react-data-grid-capabilities.md#2-what-is-actually-cheap) | Not planned: header sorting of the loaded page, grouping, paste/fill writes and visible-row export ([react-data-grid-capabilities.md §3](../react-data-grid-capabilities.md#3-available-library-features-that-are-not-cheap-database-features)). ## Cross-cutting -- **Beta upgrades:** each upgrade re-runs the WI-4 contracts, the accessibility journey and a check - of the RDG APIs our renderers wrap (`Cell` prop spreading, `RenderCellProps`, mouse event args). -- **Reversal trigger:** if WI-12 or WI-15 fails for reasons inside RDG, or RDG stalls, the WI-3 - boundary lets SlickGrid 11 be re-evaluated - ([grid-scorecard.md, Sensitivity](../grid-scorecard.md#sensitivity)). -- **SlickGrid contributions** (upstream issues or pull requests) are out of scope here +- **Beta upgrades** re-run the WI-3 scenarios and a check of the RDG APIs our renderers wrap + (`Cell` prop spreading, `RenderCellProps`, mouse event args); half a day to a day each. +- **Reversal trigger:** if the tree or selection cannot meet the accessibility gate for reasons + inside RDG, stop and re-evaluate SlickGrid 11 + ([grid-scorecard.md, Sensitivity](../grid-scorecard.md#sensitivity)). The neutral shapes from WI-2 + keep that option open; the feature branch means `main` is never affected. +- **SlickGrid contributions** upstream are out of scope ([grid-scorecard.md, How we could help](../grid-scorecard.md#how-we-could-help-slickgrid-pass-these-checks)). -## Open decisions for the next iteration +## Open decisions + +_Before G1:_ 1. Exact pin: beta.64 or beta.61 (WI-1). -2. Coexistence during Phases B–C: long-lived branch, development-only switch, or user setting. -3. Row-selection model: custom gestures versus checkbox column (WI-9). -4. Keyboard step-in key and affordance (WI-10). -5. Column-width retention policy across paging, queries and step-in (WI-7). -6. Tree implementation: custom rows on `DataGrid` versus a separate accessible tree component - behind the same contract (WI-13). -7. PR slicing: which items merge together, and which reach `main` before the swap. +2. Whether the Playwright scenario checks run only on demand by the agent, or are also added to CI. + +_During the work (agent proposes, operator confirms at G2):_ + +3. Row-selection gestures (WI-7). # Outcome From 1cba23be7ade27871dfd7f9b0e342f40799d8f20 Mon Sep 17 00:00:00 2001 From: Tomasz Naumowicz Date: Thu, 26 Nov 2026 17:12:39 +0100 Subject: [PATCH 005/148] initial dev plan --- .../features/data-grid/iterations/01-rdg-migration-plan.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/docs/ai-and-plans/features/data-grid/iterations/01-rdg-migration-plan.md b/docs/ai-and-plans/features/data-grid/iterations/01-rdg-migration-plan.md index 0d7972218..c56ccf90a 100644 --- a/docs/ai-and-plans/features/data-grid/iterations/01-rdg-migration-plan.md +++ b/docs/ai-and-plans/features/data-grid/iterations/01-rdg-migration-plan.md @@ -240,6 +240,9 @@ Each item ends when its WI-3 scenario checks pass in Playwright. - **Scope:** select one or more documents with mouse and keyboard; toolbar View/Edit/Delete enabled accordingly and acting on the selected `_id`s; selection cleared when the rows change. Use RDG's selection support where it is enough; the gesture set is the agent's proposal at G2. +- **Edge cases with automated checks:** a row without a trustworthy root `_id` stays browsable but + is never a View/Edit/Delete target; a delete acknowledgement that arrives late applies only to + the documents it was issued for, never to a newer selection. - **Scope list:** K1–K2; D9. - **Pointers:** Cosmos DB's selection and later fixes ([migration-research.md §3–§4](../migration-research.md#3-what-the-partner-migrated)). @@ -288,7 +291,8 @@ recommended here because it is the riskiest piece. Findings become fixes before the [e2e testing strategy](../../e2e-testing/strategy.md) and `build/vite/README.md`, release notes. -**G3 (operator, final):** NVDA and Narrator in packaged VS Code, Windows contrast themes, a real +**G3 (operator, final):** NVDA and Narrator in packaged VS Code (including that focus and +selection are announced distinctly, and tree navigation), Windows contrast themes, a real cluster with wide and deep data, then the Case 2 checks from `.github/copilot-instructions.md`. Merge the feature branch into `main`. Comment on #383 and the other grid `a11y` issues with what the migration fixed; whatever remains goes to the next iteration. From 40d894704d1aa8b1b7fc74970f7ce6f81a956802 Mon Sep 17 00:00:00 2001 From: Tomasz Naumowicz Date: Thu, 26 Nov 2026 17:47:06 +0100 Subject: [PATCH 006/148] detailed dev plan --- .../ai-and-plans/features/data-grid/README.md | 4 + .../iterations/02-rdg-execution-plan.md | 634 ++++++++++++++++++ 2 files changed, 638 insertions(+) create mode 100644 docs/ai-and-plans/features/data-grid/iterations/02-rdg-execution-plan.md diff --git a/docs/ai-and-plans/features/data-grid/README.md b/docs/ai-and-plans/features/data-grid/README.md index 728cc704e..e54c44cce 100644 --- a/docs/ai-and-plans/features/data-grid/README.md +++ b/docs/ai-and-plans/features/data-grid/README.md @@ -62,6 +62,10 @@ loading behavior. ordered work items for the React Data Grid migration (high level; detailed interfaces follow in the next iteration). +**Execution plan (proposed):** [iterations/02-rdg-execution-plan.md](./iterations/02-rdg-execution-plan.md), +the same scope as work items with owned files, parallel lanes, operator and automated gates, +interfaces, a model per item, and the choice between `/lead` and Copilot Fusion. + See [slickgrid-removal.md](./slickgrid-removal.md) for the earlier footprint snapshot, candidate directions, sequential gates, and explicit non-scope. Use the newer research and parity checklist above for current upstream facts and the expanded behavior inventory. The build rationale for the current diff --git a/docs/ai-and-plans/features/data-grid/iterations/02-rdg-execution-plan.md b/docs/ai-and-plans/features/data-grid/iterations/02-rdg-execution-plan.md new file mode 100644 index 000000000..f2f405c46 --- /dev/null +++ b/docs/ai-and-plans/features/data-grid/iterations/02-rdg-execution-plan.md @@ -0,0 +1,634 @@ +--- +feature: data-grid +kind: plan +status: proposed +created: 2026-11-26 +code: + - src/webviews/documentdb/collectionView/components/resultsTab/** + - src/webviews/documentdb/collectionView/CollectionView.tsx + - src/webviews/documentdb/collectionView/collectionViewContext.ts + - src/webviews/slickgrid.scss + - src/webviews/utils/slickgrid/** + - src/utils/slickgrid/** + - src/documentdb/ClusterSession.ts + - vite.config.views.mjs + - build/verification/** +--- + +# Iteration 2: execution plan for the React Data Grid migration + +**Status:** proposed, awaiting the operator at **G1**. This turns the accepted +[iteration 1 plan](./01-rdg-migration-plan.md) into work items an agent run can execute: owned +files, order, parallel lanes, interfaces, checks, gates and a model per item. It does **not** change +iteration 1's scope, guiding rules or the three operator gates. Where it reorders or splits items, +the change is listed in [What changed from iteration 1](#what-changed-from-iteration-1) and needs +approval at G1. Tracks [#1101](https://github.com/microsoft/vscode-documentdb/issues/1101). + +The last section [evaluates how to run it](#evaluation-lead-or-copilot-fusion): with `/lead`, or with +Copilot Fusion at high or max effort. + +## What changed from iteration 1 + +All of these are ordering or splitting; none adds product scope. + +| # | Change | Why | +| --- | --------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| C1 | **WI-1c (new):** the advisor drafts the exact interfaces before G1 | The `lead` skill requires interfaces that span items to be fixed before the first prompt. WI-2, WI-3 and WI-5–WI-9 all depend on them. | +| C2 | **WI-2 split** into WI-2a (types only) and WI-2b (host shaping) | A types-only commit lets the removal, fixtures and host work run in parallel against one contract. | +| C3 | **WI-3 split** into WI-3a (scenario runner), WI-3b (fixtures) and WI-3c (contract checks) | The runner only has `click` and `fill` steps today (`build/verification/browser/scenarios.ts:49-53`). Keyboard journeys (M5–M7) need `press`, `dblclick` and a focus assertion first. | +| C4 | **WI-4 moves ahead of WI-2b** and is split into WI-4a (remove SlickGrid, add RDG) and WI-4b (theme) | Iteration 1 says SlickGrid goes "at the start". Removing it first means WI-2b adapts placeholders, not SlickGrid code that is deleted a day later. | +| C5 | **WI-9a (new):** a throwaway tree keyboard spike right after Step 1 | WI-9 is the highest-risk item and the [reversal trigger](./01-rdg-migration-plan.md#cross-cutting) sits on it. Hit it before the table work, not after. | +| C6 | **Gestures provisionally decided at G1**, confirmed at G2 | Iteration 1 leaves row-selection gestures (open decision 3) to G2. WI-3c writes the keyboard checks _before_ the implementation, so it needs the selection and step-in keys earlier. G2 still confirms them hands-on. | +| C7 | **WI-12 (new):** the AI pre-review required by [CONTRIBUTING.md §6](../../../../../CONTRIBUTING.md#6-ai-assisted-review-workflow) | Repository rule for handover. Its "author decisions" stage is an operator decision, so **G3 splits into G3a (review decisions) and G3b (acceptance)**. It is still the third operator gate, in two sittings. | +| C8 | **Draft PR opened at G2** | The CONTRIBUTING review merges Copilot reviewer comments from the PR, so the PR must exist before WI-12. Pushing is an always-ask action, so it is authorised at G2. | + +## Gates + +There are four kinds. Only the first two stop work for the operator. + +| Kind | Released by | Form in chat | +| -------------------------- | ------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------- | +| **Operator decision gate** | The operator's reply `G released`, with any changes per row | **[OPERATOR DECISION NEEDED] G: …** with options, recommendation, what it blocks | +| **Operator test gate** | The operator's reply `G released` plus findings (or "no findings") | **[OPERATOR TEST NEEDED] G: …** with numbered steps and the build to use | +| **Automated gate (A)** | The leader, on recorded evidence (command and result in the done note). No operator reply. | Progress checkpoint line `A passed: ` | +| **Escalation (E)** | Conditional. Raised only if its trigger fires; then it is an operator decision gate. | **[OPERATOR DECISION NEEDED] E/WI-x: …** | + +Rules that apply to every gate: + +- Silence is not approval. A question tool that reports the operator unavailable leaves the gate + pending. +- While an operator gate is pending, only the work listed under "May continue" runs. Everything + else is parked with a note. +- A gate is released for the evidence shown. If that evidence changes (for example a new pin), the + gate is raised again. +- The leader records each release in this document under the gate, with the date and the + operator's changes, in a docs-only commit. + +### G1: scope, pin, interfaces, gestures (operator decision gate) + +- **When:** WI-0a, WI-1 and WI-1c have returned. +- **Evidence package:** the WI-1 pin report; the iteration 1 [scope tables](./01-rdg-migration-plan.md#scope-what-the-migration-replicates); + the WI-1c interface spec with the advisor's verdict; this plan; the draft decision entries. +- **Operator decides:** + 1. Each scope row (M, K, D): keep, move to "RDG default", or drop. + 2. The exact pin: beta.64 or beta.61 (iteration 1 open decision 1). + 3. Playwright contract checks: on demand only, or also in CI (open decision 2). If CI, WI-3c + also owns the workflow change. + 4. Provisional gestures (C6): row selection (recommendation: click selects one row, + Ctrl/Cmd+click toggles, Shift+click extends, Space on a focused row toggles, Shift+Space + extends with the keyboard) and the keyboard step-in key on an object cell (recommendation: + Enter, since the grid has no cell editors; alternative Alt+Down). + 5. The changes C1–C8 above, and the per-item models below. +- **Release:** `G1 released` plus any per-row changes. The leader then runs WI-0b. +- **Blocks:** all code on the feature branch. +- **May continue:** nothing except answering questions about the evidence. + +### G2: hands-on direction check (operator test gate) + +- **When:** A2–A8 have passed (WI-5 to WI-9 done) and the VSIX for G2 is built (A9). +- **Steps for the operator:** install the VSIX in VS Code; against a real cluster, open a + collection with wide and nested data; in Table view step into an object by double-click and by + the G1 key, step out by Level up and a breadcrumb; select one, several and no rows and try + View/Edit/Delete on a throwaway collection; page through 10/50/100/500; switch to Tree view, + expand and collapse with arrow keys, check Narrator reads level and expanded state; switch the + three VS Code themes. +- **Operator decides:** the gestures (confirms or changes the G1 provisional choice); whether the + look is acceptable; whether to open the draft PR now (C8). +- **Release:** `G2 released` plus a numbered findings list. Findings become items WI-G2-1, WI-G2-2, + … before Step 4. +- **Blocks:** WI-10, WI-11, WI-12 and the draft PR push. +- **May continue:** nothing on the branch; the leader may prepare the WI-10 sweep prompt. + +### G3a: review decisions (operator decision gate) + +- **When:** WI-12 has produced the review file + (`docs/ai-and-plans/features/data-grid/iterations/03-rdg-migration-review.md`). +- **Operator decides:** per finding, fix now, issue for later, or reject, with reasoning + (CONTRIBUTING §6.2). The leader records the decisions verbatim in the review file. +- **Release:** `G3a released`. Accepted fixes become WI-G3-1, WI-G3-2, … +- **Blocks:** the fixes and G3b. + +### G3b: final acceptance (operator test gate) + +- **When:** the G3a fixes are committed and the Case 2 list has run and passed (A11). +- **Steps for the operator:** NVDA and Narrator in packaged VS Code, table and tree (focus and + selection announced distinctly, tree level and expansion); Windows contrast themes; a real cluster + with wide and deep data; the WI-10 report's "not verified" list. +- **Release:** `G3b released`. The operator merges the PR (the agent does not merge) and comments on + #383 and the other grid `a11y` issues, or asks the leader to draft those comments. + +### Automated gates + +| Gate | After | Passes when | +| ---- | ---------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| A1 | WI-1c | Advisor approves the interface spec at ≥ 80 % confidence. Before G1, because G1 shows it. | +| A2 | Step 1 (WI-2a – WI-4b) | `npm run build` green; L1 inspection green with no SlickGrid assertions left; `git grep -i slickgrid -- src build package.json vite.config.views.mjs` returns only intended history mentions; shaping unit tests green. | +| A3 | WI-3c | Every contract check runs without harness errors (`data-ready` not `failed` for setup reasons) and fails only because the grid is missing. A check that passes against a placeholder is rewritten. | +| A4 | WI-9a | In the spike, Right/Left expand and collapse a tree row from the keyboard and `aria-expanded`/`aria-level` update. If not: raise **E1**. | +| A5 | WI-5, WI-6 | Their scope rows' contract checks pass; no earlier passing check regresses; build green. | +| A6 | WI-7 | K1–K2 checks pass, including the late-delete and missing-`_id` cases; advisor logic review approved. | +| A7 | WI-8 | M1, M2, M7 checks pass; step-in telemetry still fires (unit test or harness call log). | +| A8 | WI-9 | M4–M5 checks pass; advisor logic review approved. | +| A9 | Before G2 | `npm run package` succeeds; L1 and L3 checks green; a VSIX path is in the G2 message. | +| A10 | WI-10 | Sweep report written with "verified" and "not verified" lists; no console errors or CSP violations in any Collection View route. | +| A11 | Before G3b | Full Case 2 list from `.github/copilot-instructions.md` ran and passed, each result reported separately. | + +### Escalations + +| ID | Trigger | Operator chooses | +| --- | ------------------------------------------------------------------------------------------------------------------------------------------ | --------------------------------------------------------------------------------------------------------- | +| E1 | Reversal trigger: tree (A4/A8) or selection (A6) cannot meet the accessibility gate for reasons inside RDG, after one advisor-guided retry | Retry with a stronger model (see [models](#models)), patch upstream, or stop and re-evaluate SlickGrid 11 | +| E2 | The pin must change after G1 (a blocking RDG bug, a needed fix in a later beta) | New pin, or a workaround | +| E3 | A `TDD:` contract check from WI-3c needs to change | Change the contract or fix the implementation (repository rule) | +| E4 | A **M** or **K** row cannot be met with RDG's defaults and needs custom behaviour not in the spec, or a **D** row turns out broken | Build it, move it to "RDG default", or drop it | +| E5 | Any always-ask trigger from the `lead` skill: new user-visible wording or behaviour, persisted data, settings, CI workflow, push | As asked | + +## Work items + +### Overview and order + +`∥` marks items that may run at the same time. Their owned files do not overlap. + +| Step | Items | Lane notes | Gate after | +| ---- | --------------------- | --------------------------------------------------------------------------------------------------------------------- | ------------ | +| 0 | WI-0a ∥ WI-1 ∥ WI-1c | WI-1 in a scratch worktree; WI-1c read-only | A1, **G1** | +| 0 | WI-0b | Records G1 | — | +| 1 | WI-2a ∥ WI-4a ∥ WI-3a | Disjoint files | — | +| 1 | WI-2b ∥ WI-4b | WI-2b after WI-4a (placeholders); WI-4b owns a new theme file | — | +| 1 | WI-3b | After WI-2b, WI-3a, WI-4a (shares `fixtures.ts` and `scenarios.ts`) | A2 | +| 1 | WI-3c ∥ WI-9a | WI-9a in a scratch worktree | A3, A4 | +| 2 | WI-5 ∥ WI-6 ∥ WI-9 | WI-6 owns the cell; WI-5 the table; WI-9 the tree. WI-6's last step wires the cell into the table after WI-5 commits. | A5, A8 | +| 2 | WI-7 → WI-8 | Same files; one after the other | A6, A7 | +| 3 | (build) | — | A9, **G2** | +| 3 | WI-G2-n | Findings from G2, sized by the leader | — | +| 4 | WI-10 ∥ WI-11 | WI-10 owns checks; WI-11 owns docs | A10 | +| 4 | WI-12 | Needs the draft PR | **G3a** | +| 4 | WI-G3-n, then Case 2 | — | A11, **G3b** | + +Critical path: G1 → WI-4a → WI-2b → WI-3b → WI-3c → WI-5 → WI-7 → WI-8 → G2 → WI-10 → WI-12 → G3a +→ G3b. The tree (WI-9a, WI-9) runs beside the table and must not become the critical path; if A4 +fails, it does, through E1. + +### Models + +Roles follow the `lead` skill. Full model IDs; the reason is per item below. + +| Role | Model | Notes | +| --------------------- | ------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| Leader | `gpt-6.1-sol` | The session model. CONTRIBUTING §6.3 recommends Sol as leader. Coordination only; it should not need a stronger model. | +| Advisor | `claude-opus-5.5` | Used as advisor in earlier `/lead` runs here (for example [local-quickstart 11](../../local-quickstart/iterations/11-setup-stage-details.md#execution-summary)). A different vendor from the Sol workers, so its reviews are independent. | +| Coding, high risk | `gpt-6.1-sol` | Data identity, selection, the tree's keyboard and ARIA semantics, and the `TDD:` contracts. A mistake here deletes the wrong document or breaks the accessibility gate. | +| Coding, standard | `mai-code-2` | **Operator override.** Takes the simpler Sol items and all Terra items: UI components, test infrastructure, fixtures, mechanical removal. Each has an automated gate (A2–A10); the theme's look is also judged at G2. See [MAI Code 2](#mai-code-2-what-we-know). | +| Coding, small or docs | `gpt-6-luna` | Types copied from a spec, docs, decision entries. | +| Fallback coding | `gpt-6.1-sol` / `gpt-6.1-terra` | Used when a `mai-code-2` item fails (rule below). Each item names its fallback. | +| Checks and builds | `mai-code-2-flash` | **Operator override.** Runs `npm run build`, focused Vitest, the browser scenario suite, L2-dev `run-all`, `npm run package`, L1/L3. Returns pass/fail and failure output only. | +| Exploration | `mai-code-2-flash` | Same override, for broad reads that return summaries. | +| Escalation (E1 only) | `hydrafusion-max` | Only if the operator names it for WI-9 or WI-7 after a failed attempt. The skill forbids giving a coder a model as strong as the advisor without asking. | +| AI pre-review (WI-12) | see WI-12 | Two vendors, as CONTRIBUTING §6.1 requires. | + +**Fallback rule for `mai-code-2`.** If an item fails its acceptance (its automated gate, the +leader's review or the advisor's review) and one corrective turn on `mai-code-2` does not fix it, +the leader reruns the item on its named fallback and records the substitution in the done note. A +call that fails before any work is retried once on the same model, as the skill says. The other +fallbacks follow the skill: the next tier down for a failed or unavailable model; +`gpt-6.1-terra` replaces `mai-code-2-flash` for checks if it cannot drive Playwright or misreports +results. `gpt-6.2-sol` is listed by the host but has no track record here; do not substitute it +without the operator naming it. + +**Reasoning effort.** Host default for every subagent unless the operator names one. Microsoft +measured MAI Code 2 at max effort, so default-effort results may be lower than its published +figures. + +### MAI Code 2: what we know + +From Microsoft's announcement and model card (both dated 2026-11-17; vendor claims, not +independent measurements): + +| Model | Claimed position | Context | +| ------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------- | +| `mai-code-2` | About 98 % of `gpt-6.1-sol`'s score at about 40 % of its cost, and 96 % of `claude-opus-5.5`'s at about 5 %, averaged over four coding benchmarks. Cost figures use a 50 % promotional price. Strong on multi-file work and UI: developers preferred its frontend results over GPT-6 Sol 64 % of the time. | 1M tokens; effort low to max | +| `mai-code-2-flash` | Comparable to `gpt-6-luna` and `claude-haiku-5.5` at about 65 % and 20 % of their cost. Built for targeted edits, routine fixes and fast iterations. | 1M tokens; effort low to max | + +What we do not know: how either model performs in this repository. The operator's session history +has three `mai-code-2` calls and seven `mai-code-2-flash` calls, too few to judge. So: + +- `mai-code-2` gets the items where a mistake is caught before it can matter, by an automated gate + or, for the theme's look, by the operator at G2: UI components (its claimed strength), test + infrastructure, fixtures, the removal, the sweep. +- Sol keeps the six items where a subtle mistake can pass the tests or no test exists: the pin + report (WI-1), which has no automated gate and on which the operator bases the pin at G1; data + identity (WI-2b); the contracts that every later item is judged by (WI-3c); selection and delete + (WI-7); and the tree (WI-9a, WI-9). +- The run's usage report (per model and role, from `agent-stats.mjs`) is the measurement. Compare + `mai-code-2` items with the Sol items and with earlier Terra runs before keeping this split for + the next iteration. + +Sources: [Introducing MAI Code 2 and MAI Code 2 Flash](https://microsoft.ai/news/introducing-mai-code-2-and-mai-code-2-flash/), +[model card (PDF)](https://microsoft.ai/pdf/MAI-Code-2-And-MAI-Code-2-Flash-Model-Card.pdf?v=3). + +### Per-item model assignment + +| Item | Title | Model | Fallback | Why | +| ----- | -------------------------------------- | ------------------------------------- | --------------- | ------------------------------------------------------------------------------------------- | +| WI-0a | Draft decisions and branch | `gpt-6-luna` | — | Writes three entries from existing research; leader creates the branch. | +| WI-1 | Pin and runtime check | `gpt-6.1-sol` | — | Judgement on evidence with no automated gate; the operator picks the pin from its report. | +| WI-1c | Interface spec | `claude-opus-5.5` | — | Advisor gate: interfaces across modules. | +| WI-0b | Record confirmed scope | `gpt-6-luna` | — | Transcribes G1. | +| WI-2a | Neutral types | `gpt-6-luna` | — | Copies the approved spec into one file. | +| WI-4a | Remove SlickGrid, add RDG | `mai-code-2` | `gpt-6.1-terra` | Mechanical but wide; build and L1 inspection verify it. | +| WI-3a | Scenario runner: keys and focus | `mai-code-2` | `gpt-6.1-terra` | Self-contained test infrastructure with its own unit tests. | +| WI-2b | Host shaping and identity | `gpt-6.1-sol` | — | Data identity: a mistake here deletes the wrong document. | +| WI-4b | Grid theme | `mai-code-2` | `gpt-6.1-terra` | One SCSS file mapping tokens; visual, its claimed strength. | +| WI-3b | Collection View fixtures and scenarios | `mai-code-2` | `gpt-6.1-terra` | Data fixtures from a list of cases. | +| WI-3c | `TDD:` contract checks | `gpt-6.1-sol` | — | Every later item is judged by these; they must state outcomes and ARIA semantics correctly. | +| WI-9a | Tree keyboard spike | `gpt-6.1-sol` | — | Highest technical risk; result decides E1. | +| WI-5 | Table core | `mai-code-2` | `gpt-6.1-sol` | UI wiring, fully checked by the WI-3c contracts (A5). | +| WI-6 | Typed value cell | `mai-code-2` | `gpt-6.1-terra` | One component with clear inputs and outputs. | +| WI-7 | Selection and document actions | `gpt-6.1-sol` | — | Data-loss risk; stale responses; advisor review mandatory. | +| WI-8 | Step in and out | `mai-code-2` | `gpt-6.1-sol` | Existing flow re-keyed by field; the key was chosen at G1. Builds on WI-7's state shape. | +| WI-9 | Accessible document tree | `gpt-6.1-sol` | — | `treegrid` semantics and focus management; `hydrafusion-max` only via E1. | +| WI-10 | Automated sweep | `mai-code-2` + `mai-code-2-flash` | `gpt-6.1-sol` | `mai-code-2` fills check gaps; flash runs the suites. | +| WI-11 | Clean-up and documentation | `gpt-6-luna` | — | Docs. | +| WI-12 | AI pre-review | `gpt-6-astra`, then `claude-opus-5.5` | — | Stage 1 and the validation gate from different vendors (CONTRIBUTING §6.1). | + +`gpt-6-luna` stays on docs and transcription. `mai-code-2-flash` claims Luna's level at lower cost, +but those items are cheap already and have no automated gate to catch a weaker draft. + +## Interfaces (starting point for WI-1c) + +Today's shapes carry three hazards that the migration must remove, all visible in +`src/utils/slickgrid/mongo/toSlickGridTable.ts`: + +- Row IDs are `${index}/${timestamp}`, so they change on every fetch and say nothing about the + document. +- The document identity is a field in the row (`'x-objectid'`) and collides with a user field of + that name; `_id` is skipped when falsy (`if (doc._id)`), so a document with `_id: 0` cannot be + edited or deleted. +- Step-in and selection use row and cell **indexes** (`handleStepIn(row, cell)`, + `selectedDocumentIndexes`). + +WI-1c turns this sketch into exact types. It is a proposal, not a decision: + +```typescript +// src/utils/documentGrid/types.ts (folder name settled in WI-1c) + +/** One displayed value; `type` keeps today's BSON type keys. */ +export interface GridCellValue { + readonly display: string; + readonly type: string; +} + +/** A document's root identity. Present only when the root `_id` can be serialised canonically. */ +export interface DocumentIdentity { + /** Canonical EJSON of the root `_id` (relaxed: false); used for queries and as the row key. */ + readonly key: string; + readonly display: string; +} + +export interface TableColumn { + /** Field name at the current level; the root `_id` column uses a reserved key that no field can have. */ + readonly key: string; + readonly label: string; + readonly isRootId: boolean; +} + +export interface TableRow { + /** Stable across fetches: `identity.key` when present, otherwise a page-position key. */ + readonly rowKey: string; + /** Undefined: browsable, never a View/Edit/Delete target (K2). */ + readonly identity?: DocumentIdentity; + /** Missing key means a missing field (K6), never `null`. */ + readonly cells: Readonly>; +} + +export interface TablePage { + readonly path: readonly string[]; + readonly columns: readonly TableColumn[]; + readonly rows: readonly TableRow[]; +} + +export interface TreeNode { + /** Stable: document key plus field path. */ + readonly key: string; + readonly parentKey: string | null; + readonly depth: number; + readonly field: string; + readonly value: GridCellValue; + /** False for arrays over the expansion limit (M4). */ + readonly expandable: boolean; +} +``` + +Webview contracts WI-1c also fixes: `onStepIn(rowKey, columnKey)`; selection held as row keys in +`CollectionViewContext.dataSelection` (replacing `selectedDocumentIndexes`), with the identities +taken from the rows, not recomputed from positions; the cell component's props +(`value: GridCellValue | undefined`, `isRootId`). The tRPC procedures keep their names; only their +output types change, so no telemetry or command contract moves. + +## Work item detail + +Every prompt also carries the `lead` skill's fixed block and file lists. "Owns" lists files the +item may change; "Not" lists files it must leave alone. The leader re-derives owned files with +`git grep` before each prompt, as the skill requires; these lists are the starting point. + +### Step 0 + +**WI-0a: draft decisions and create the branch** · `gpt-6-luna` + +- Leader creates `feature/rdg-migration` from `main` (local only; pushing is E5). +- Owns: `docs/ai-and-plans/features/data-grid/decisions.md` (new) with entries 0001 (RDG, exact + beta pin, tree built by us, reversal triggers), 0002 (way of working: feature branch, no + coexistence, automation first, native menus), 0003 placeholder for the confirmed scope. Status + "Proposed". +- Acceptance: each entry cites the research files it rests on; no rationale the operator did not + state. + +**WI-1: pin and runtime check** · `gpt-6.1-sol` · scratch worktree, nothing committed but the report + +- Compare beta.64 and beta.61 from the approved registry: does either use + `Map.prototype.getOrInsertComputed` or CSS `light-dark()`, and does the Chromium in the Electron of + VS Code `^1.109.0` (from `package.json` `engines`) support them; CSS file emission in a Vite + library build; CSP needs (inline styles). +- Smoke: a throwaway route rendering RDG with 500 rows in `npm run watch:views`; record console and + CSP errors. +- Output: a "Pin report" section appended to this document: a table per version, with evidence + links, and a recommendation. +- Checks: `mai-code-2-flash` runs the dev server and Playwright. + +**WI-1c: interface spec** · advisor `claude-opus-5.5`, read-only + +- Input: the [interfaces sketch](#interfaces-starting-point-for-wi-1c), `toSlickGridTable.ts`, + `toSlickGridTree.ts`, `ClusterSession.ts`, `collectionViewContext.ts`, `CollectionView.tsx` + (`handleStepInRequest`, delete flow around lines 480–520), parity §2. +- Output: exact types, the reserved root `_id` column key, the row key fallback, which file each + type lives in, and the list of consumers. Recorded in this document under WI-1c. Passing A1 means + ≥ 80 % confidence. + +**WI-0b: record the confirmed scope** · `gpt-6-luna` · after G1 + +- Owns: `decisions.md` entry 0003 (the confirmed M/K/D list, the gestures, the pin, the CI choice), + and status of 0001–0002 set to "Accepted". + +### Step 1 + +**WI-2a: neutral types** · `gpt-6-luna` + +- Owns: the new types file from WI-1c only. +- Acceptance: compiles; no consumer changes. +- Check: `npx tsc --noEmit -p .` + +**WI-4a: remove SlickGrid, add React Data Grid** · `mai-code-2` (fallback `gpt-6.1-terra`) + +- Owns: `package.json`, `package-lock.json` (exact pin, approved registry), `vite.config.views.mjs` + (`slickgrid` group → `react-data-grid` lazy chunk; `optimizeDeps`), `src/webviews/slickgrid.scss` + (delete), `collectionView.scss` (its SlickGrid imports), `DataViewPanelTable.tsx` and + `DataViewPanelTree.tsx` (replace with placeholders that keep today's props), + `dataViewPanelTable.scss`, `hooks/useHideScrollbarsDuringResize.ts` (delete if unused), + `QueryEditor.tsx` (its SlickGrid reference only), `tsconfig.json` (`allowSyntheticDefaultImports`, + only if nothing else needs it), `build/verification/inspect.cjs`, `inspect.test.cjs`, + `prove-inspection.cjs`, `build/verification/browser/fixtures.ts` (SlickGrid assertions only), + `NOTICE.html` (dependency notice). +- Not: `src/utils/slickgrid/**`, `src/documentdb/ClusterSession.ts` (WI-2b). +- Acceptance: build green; L1 inspection green; the RDG chunk is lazy, like SlickGrid's was. +- Checks (stated explicitly, so they override Case 1): `npm run build`, the L1 inspection, and + `npx vitest run build/verification/inspect.test.cjs`. + +**WI-3a: scenario runner, keys and focus** · `mai-code-2` (fallback `gpt-6.1-terra`) + +- Owns: `build/verification/browser/scenarios.ts` (step and assertion type unions only), + `scenario-runtime.ts`, `scenario-playwright.ts`, `scenario-runtime.test.ts`, the `run-all` helper + source, `build/verification/README.md` (L2-dev vocabulary paragraph). +- Adds: steps `press` (key or chord on the focused element), `dblclick` (role and name), `focus` + (role and name); assertion `focused` (the active element matches role and name, or a selector). +- Acceptance: unit tests for each new step and assertion; existing scenarios unchanged. +- Check: `npx vitest run --config build/verification/browser/vitest.config.ts build/verification/browser/scenario-runtime.test.ts build/verification/browser/scenarios.test.ts` + +**WI-2b: host shaping and identity** · `gpt-6.1-sol` · after WI-4a and WI-2a + +- Owns: `src/utils/slickgrid/**` moved to the WI-1c folder (with tests), `src/webviews/utils/slickgrid/typeToDisplayString.ts` + moved likewise, `src/documentdb/ClusterSession.ts`, `collectionViewRouter.ts` (output types), + `CollectionView.tsx` (data plumbing, `handleStepInRequest`, delete flow selection filter), + `collectionViewContext.ts` (selection by key), the WI-4a placeholders' props, + `build/verification/browser/fixtures.ts` (the `CellValue` import only). +- Not: `packages/documentdb-js-schema-analyzer/**` (BSON formatting stays there). +- Acceptance: identity rules from WI-1c; falsy and composite `_id` cases; heterogeneous columns; + missing versus `null`; step-in by field key. +- Tests: update and extend the moved shaping tests. +- Check: `npx vitest run src/utils/` and `npx tsc --noEmit -p .` +- Advisor: logic review before commit (persisted-data and cross-module impact). + +**WI-4b: grid theme** · `mai-code-2` (fallback `gpt-6.1-terra`) + +- Owns: a new `src/webviews/documentdb/collectionView/components/resultsTab/dataGridTheme.scss` + mapping `--rdg-*` variables to VS Code tokens for light, dark and high contrast, including focus + and selection (K10, D4, D10). +- Not: the grid components (WI-5 imports the file). +- Check: `npm run build`. Visual check happens in WI-5's scenarios and at G2. + +**WI-3b: Collection View fixtures and scenarios** · `mai-code-2` (fallback `gpt-6.1-terra`) · after WI-2b, WI-3a, WI-4a + +- Owns: a new `build/verification/browser/collectionViewFixtures.ts`, the `collectionView` entry in + `scenarios.ts`, the `collectionView` fixture in `fixtures.ts`. +- Scenarios: `mixed-types`, `missing-vs-null`, `heterogeneous`, `deep-nesting`, `arrays` + (0/10/11 elements), `page-500`, `html-values`, `empty`, `no-id` (a row without a trustworthy + `_id`), `first-load`. Each in three themes (automatic). +- Acceptance: routes load; `data-ready` succeeds against the placeholders. + +**WI-3c: `TDD:` contract checks** · `gpt-6.1-sol` · after WI-3b + +- Owns: assertions and steps on the WI-3b scenarios, and `scenarios.test.ts` cases; CI workflow + only if G1 chose CI (E5 then covers the push). +- One check per confirmed **M** and **K** row, written as a user outcome through roles and ARIA + (`grid`, `treegrid`, `row`, `gridcell`, `aria-selected`, `aria-expanded`, `aria-level`), never + RDG class names. Suite names start with `TDD:` so later items cannot weaken them (E3). +- Include the partner regressions from iteration 1 (one selected row treated as none; stale results + acting on another collection) and the WI-7 edge cases (no-`_id` row is never a target; a late + delete acknowledgement does not touch a newer selection). +- Acceptance: A3. + +**WI-9a: tree keyboard spike** · `gpt-6.1-sol` · scratch worktree, throwaway + +- Build the smallest treegrid on RDG at the pinned version over `TreeNode[]`: flattened visible rows, + expansion state, `aria-level`, `aria-expanded`, Right/Left expand and collapse, Left on a child + moves to its parent. +- Output: A4 evidence (Playwright run in the dev server) and a short note of the RDG APIs used. The + code is not committed; WI-9 may reuse it. + +### Step 2 + +Each item ends at its automated gate. The leader runs `npm run build` and the browser suite +through `mai-code-2-flash` after each pair of items, not after every commit. + +**WI-5: table core** · `mai-code-2` (fallback `gpt-6.1-sol`) + +- Owns: `DataViewPanelTable.tsx`, `dataViewPanelTable.scss`, `LoadingAnimationTable.tsx` if needed. +- Scope rows M3, M6, K3, K4, K9, K11; D1–D3, D5–D6. Plain text cells until WI-6 lands. +- Acceptance: A5. + +**WI-6: typed value cell** · `mai-code-2` (fallback `gpt-6.1-terra`) + +- Owns: a new `TypedValueCell.tsx` with a jsdom test. Last step, after WI-5 commits: wire it into + `DataViewPanelTable.tsx` (one-line change, declared in the prompt). +- Scope rows K5–K8; D8. Text only, never HTML (K8). +- Acceptance: A5. + +**WI-7: selection and document actions** · `gpt-6.1-sol` · after WI-5 + +- Owns: `DataViewPanelTable.tsx` (selection), `CollectionView.tsx` (delete flow and its + acknowledgement), `collectionViewContext.ts`, `ToolbarDocumentManipulation.tsx` if its enabled + logic moves. +- Scope rows K1–K2; D9. Gestures as released at G1. +- Acceptance: A6, including the advisor's logic review (lifecycle and data-loss risk). + +**WI-8: step in and out** · `mai-code-2` (fallback `gpt-6.1-sol`) · after WI-7 + +- Owns: `DataViewPanelTable.tsx` (double-click and key), `CollectionView.tsx` + (`handleStepInRequest`), `ToolbarTableNavigation.tsx`. +- Scope rows M1–M2, M7. Telemetry kept. +- Acceptance: A7. + +**WI-9: accessible document tree** · `gpt-6.1-sol` · after WI-6 and A4; beside WI-7/WI-8 + +- Owns: `DataViewPanelTree.tsx`, a new tree hook file and its tests. It must not touch + `CollectionView.tsx`; if it needs to, it stops and asks. +- Scope rows M4–M5; D7. +- Acceptance: A8, including the advisor's logic review. Two failures of A8: E1. + +### Step 3 + +Leader runs A9 through `mai-code-2-flash`, then raises **G2**. After release: WI-G2-n items, each +with a model chosen by the same rules; then the draft PR push if authorised. + +### Step 4 + +**WI-10: automated sweep** · `mai-code-2` (fallback `gpt-6.1-sol`), runs by `mai-code-2-flash` + +- Every confirmed **M** and **K** row in three themes; keyboard-only journeys for table and tree; + emulated forced colours; narrow width and zoom; no console errors or CSP violations; L1 and L3. +- Output: a "Sweep report" section in this document, verified and not verified, for G3. + +**WI-11: clean-up and documentation** · `gpt-6-luna` + +- Owns: this feature's `README.md` and a new `design.md`; the SlickGrid notes in + `docs/ai-and-plans/features/e2e-testing/strategy.md`, `build/vite/README.md`, + `build/verification/README.md`, `.github/skills/react-webview-architecture/**`; release notes + (through the `writing-release-notes` skill). +- Not: `CHANGELOG.md` history and older release notes. + +**WI-12: AI pre-review** · `gpt-6-astra`, then `claude-opus-5.5` in a fresh context + +- CONTRIBUTING §6.1 stages 1–4 into `iterations/03-rdg-migration-review.md`. Stage 1 by + `gpt-6-astra`; Copilot reviewer comments merged from the draft PR; validation and independent + sweep by `claude-opus-5.5`, which must not reuse its advisor context. +- Then **G3a**. + +## Open decisions + +_At G1:_ the scope rows; the pin; on-demand or CI checks; the provisional gestures and step-in +key; C1–C8. The model table is already set by the operator (`mai-code-2` for standard coding, +`mai-code-2-flash` for checks). Step 0 has no `mai-code-2` coding item, so G1 only shows how +`mai-code-2-flash` handled WI-1's checks. + +_At G2:_ the gestures (confirm); the look; the draft PR push; whether `mai-code-2` keeps its +items in Step 4, based on its Step 1 and 2 results and the fallbacks recorded so far. + +_At G3a:_ each review finding. + +## Evaluation: `/lead` or Copilot Fusion + +### What Fusion is + +Copilot Fusion is not a single model. It is a router and orchestrator that, **for each prompt**, +picks one or more models and combines their output +([About Copilot Fusion](https://docs.github.com/copilot/concepts/models/copilot-fusion)). It +uses three patterns: + +- **Single:** one model answers. +- **Cascade:** a cheaper model drafts, a judge checks it, and the prompt escalates to a stronger + model only if the draft fails. +- **Critique:** one model drafts, several models critique it in parallel, and the draft is revised. + +The effort level sets how much of this it does: Standard usually uses one model, High is for +substantial, well-scoped tasks, Max for the deepest reasoning. It is billed per model used, at +each model's normal rate. It has no context window of its own: a prompt is limited by the smallest +window among the models it uses. It shows only the final answer. In this host it is likely the +`hydrafusion` and `hydrafusion-max` model IDs (our assumption, not documented). + +### How it compares + +Fusion and `/lead` work at different levels. Fusion decides **how to answer one prompt**. `/lead` +decides **how to run a plan**: which item comes next, who writes it, who checks it, when to stop +for the operator, what gets committed. Fusion does not replace that; in this plan, it would either +be the leader's session model or a coding model for one item. + +| Criterion | `/lead` | Fusion as the session model (high/max) | +| ------------------------------------------ | ---------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------- | +| Gates and always-ask rules | Built in: prominent gate messages, park-and-continue, never infers approval | Must be restated in the prompt and kept up over a long run | +| One commit per item, done notes | Built in, recorded in this document | Possible, but by instruction only | +| File ownership and parallel lanes | Built in; the lanes above map directly onto its rules | Sequential in practice, or ad hoc subagents without ownership rules | +| Independent review | Advisor from another vendor reviews WI-2b, WI-7, WI-9 logic, with a fixed role and a recorded verdict | Critique gives several models per prompt, but internally: we see neither the critiques nor which models ran | +| Model choice | Fixed per item by the operator (this plan); measured afterwards per model and role | Chosen per prompt by Fusion; cannot be pinned per item, so the `mai-code-2` comparison cannot be made | +| Context over about 20 items and 4 gates | Leader keeps a small context; state lives in this document; a fresh session per step is supported | One growing context full of Playwright and build output, capped by the smallest model Fusion picks; compaction risk | +| Cost visibility | Per-model, per-role AIU from `agent-stats.mjs`; the last measured run (4 items) cost 1157 AIU, 86 % in subagents | Not measured here; High and Max may run several models on every prompt, including builds and docs | +| Quality on the two hard items (WI-7, WI-9) | Sol with Opus review; one advisor-guided retry, then E1 | Likely its strongest case: Critique and Max are built for single hard problems | +| Cheap models for mechanical work | Yes: Luna for docs, `mai-code-2` for standard coding, `mai-code-2-flash` for checks (operator override) | Only if Fusion chooses them; Cascade may, but we cannot require it | + +Fusion and `/lead` also overlap: `/lead` already has tiers (cheap models for simple work) and an +advisor (a second model that judges). Running Fusion as the leader would add a second layer of +routing on top of the skill's own, on every leader turn, mostly for coordination work that does not +need it. + +### Recommendation + +**Run it with `/lead`**, `gpt-6.1-sol` as leader and `claude-opus-5.5` as advisor, with the +operator's model table above. Use Fusion where a single hard prompt is the problem: + +1. **E1 escalation:** if WI-9 or WI-7 fails its gate twice, the operator names `hydrafusion-max` as + the coding model for that item. The skill requires this to be the operator's call. +2. **Optional second opinion at G1:** run `hydrafusion-max` read-only on the WI-1c interface spec + if the advisor's confidence is below 90 %. A Critique-style review of one spec is what it is for. +3. **Debugging a gate that fails for an unclear reason,** in a separate session the operator starts, + with the failure output pasted in. +4. **Not as leader,** and not as a coding model for routine items: it would hide which model wrote + each item and break the `mai-code-2` measurement. + +### `/lead` prompt + +One session per step, so each starts with a small context. Step 0: + +```text +/lead advisor: claude-opus-5.5 docs/ai-and-plans/features/data-grid/iterations/02-rdg-execution-plan.md + +Run Step 0 only (WI-0a, WI-1, WI-1c, then A1) and stop at G1. Do not start WI-0b before I release G1. + +Models are operator-named and binding. Use the "Per-item model assignment" table in the plan as +written: it overrides the skill's tiers. Do not ask the advisor for model recommendations and do +not change an item's model. Consult the advisor only for the technical gates and reviews the plan +names (WI-1c, A1, the logic reviews), not for model choice. +- Standard coding: mai-code-2. If a mai-code-2 item fails its acceptance and one corrective turn + does not fix it, rerun it on the item's named fallback and record the substitution in its done + note. A call that fails before doing any work is retried once on the same model. +- Checks, builds, Vitest, browser scenarios, L2-dev run-all, packaging and exploration: + mai-code-2-flash. If it cannot drive Playwright or misreports a result, use gpt-6.1-terra. +- Never use hydrafusion, hydrafusion-max or gpt-6.2-sol unless I name them (E1 only). +- Reasoning effort: host default. + +Gates: raise G1 with the plan's gate message. Silence is not approval; only "G1 released" releases +it. Automated gates are yours to release, with evidence in the done note. Escalations E1-E5 come to +me. + +One commit per item, done notes inline in the plan. Do not push. At the end, report usage per model +and role. +``` + +Later sessions keep everything after the first paragraph and replace it with: + +- **Step 1:** "G1 is released (see the G1 record in the plan). Run WI-0b, then Step 1, and stop at + A3/A4 with the WI-9a spike result." +- **Steps 2 and 3:** "Run Step 2, then A9, and stop at G2." +- **Step 4:** "G2 is released. Run the WI-G2 items, then Step 4 (WI-10, WI-11, WI-12), and stop at + G3a." + +# Outcome + +Not started. Record progress inline against each work item as it lands. From 501541739d7dfc193095e8baafe3a399ba871d12 Mon Sep 17 00:00:00 2001 From: Tomasz Naumowicz Date: Thu, 26 Nov 2026 17:58:41 +0100 Subject: [PATCH 007/148] docs: draft grid migration decisions (WI-0a) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .../features/data-grid/decisions.md | 99 +++++++++++++++++++ 1 file changed, 99 insertions(+) create mode 100644 docs/ai-and-plans/features/data-grid/decisions.md diff --git a/docs/ai-and-plans/features/data-grid/decisions.md b/docs/ai-and-plans/features/data-grid/decisions.md new file mode 100644 index 000000000..d08191d75 --- /dev/null +++ b/docs/ai-and-plans/features/data-grid/decisions.md @@ -0,0 +1,99 @@ +--- +feature: data-grid +kind: decisions +status: active +created: 2026-11-26 +--- + +# Data grid decisions + +These are **proposals for G1, not accepted decisions**. No product or code changes are authorized +before G1 is released. The exact pin, confirmed scope, Playwright CI choice, gestures and step-in key +remain unresolved for the operator. + +| # | Decision | Status | Changed from the proposal? | Date | PR | +| ---- | ----------------------------------------------------- | -------- | -------------------------- | ---------- | --- | +| 0001 | React Data Grid, beta candidate and document tree | Proposed | Pending G1 | 2026-11-26 | — | +| 0002 | Migration workflow and menus | Proposed | Pending G1 | 2026-11-26 | — | +| 0003 | Confirmed migration scope | Proposed | Intentionally unspecified | 2026-11-26 | — | + +## 0001 - React Data Grid, beta candidate and document tree + +**Status:** Proposed · **Date:** 2026-11-26 + +### Question + +Which grid foundation and tree implementation should the migration use? + +### Decision + +Propose replacing SlickGrid with upstream React Data Grid, without a fork. Evaluate beta.64 as the +primary exact-pin candidate and beta.61 as the alternative; WI-1's published-package and runtime +checks and the operator's G1 decision must settle the exact pin. Neither version is approved or +declared runtime-compatible here. + +Propose building the arbitrary-depth document tree in the application rather than treating RDG's +`TreeDataGrid` as a drop-in. Keep a grid-neutral boundary so another grid remains an option. + +Reopen the grid choice if SlickGrid's row selection and tree pass a future screen-reader check, if +RDG stalls or its API changes make exact pinning unworkable, or if the RDG tree or selection cannot +meet the accessibility gate after the planned retry. + +### Evidence + +- [Grid scorecard: priorities and conclusion](./grid-scorecard.md#our-priorities), + [scorecard conclusion](./grid-scorecard.md#conclusion), and + [sensitivity](./grid-scorecard.md#sensitivity). +- [RDG version recommendation and runtime caveats](./react-data-grid-capabilities.md#1-version-matters-more-than-the-beta-label-alone), + [arbitrary document tree limitations](./react-data-grid-capabilities.md#3-available-library-features-that-are-not-cheap-database-features). +- [Tree parity contract](./migration-parity.md#3-tree-view-is-a-separate-release-gate). +- [Iteration 1 guiding rules](./iterations/01-rdg-migration-plan.md#guiding-rules) and + [reversal trigger](./iterations/01-rdg-migration-plan.md#cross-cutting). +- [Iteration 2 G1](./iterations/02-rdg-execution-plan.md#g1-scope-pin-interfaces-gestures-operator-decision-gate) + and [tree/selection escalation](./iterations/02-rdg-execution-plan.md#escalations). + +## 0002 - Migration workflow and menus + +**Status:** Proposed · **Date:** 2026-11-26 + +### Question + +How should the migration be organized, verified and integrate any grid menus? + +### Decision + +Propose one feature branch, with no SlickGrid/RDG coexistence; automation-first verification; and +native VS Code context menus for any grid menu that is later needed. Such menus use the +`webview/context` contribution, `data-vscode-context` on the target and host-executed commands, not +Fluent UI or grid-owned menus. The migration plan says it adds no menus; this rule applies if a menu +is introduced later. The leader creates the local branch in Step 0; implementation waits for G1. + +### Evidence + +- [Iteration 1 work organization](./iterations/01-rdg-migration-plan.md#how-the-work-is-organised) + sets out the feature branch, no coexistence, automation-first verification and native-menu + approach. +- [Iteration 2 WI-0a](./iterations/02-rdg-execution-plan.md#step-0) assigns drafting decisions to + this entry and branch creation to the leader. + +## 0003 - Confirmed migration scope + +**Status:** Proposed · **Date:** 2026-11-26 + +### Question + +Which proposed migration scope rows are confirmed? + +### Decision + +Placeholder only. At G1, the operator reviews each M, K and D row in the iteration 1 scope tables +and decides whether to keep it, move it to “RDG default” or drop it. Record the resulting scope here +after G1; this entry does not preselect any row. + +### Evidence + +- [Iteration 1 proposed scope and operator scope check](./iterations/01-rdg-migration-plan.md#scope-what-the-migration-replicates). +- [Iteration 2 G1 decisions](./iterations/02-rdg-execution-plan.md#g1-scope-pin-interfaces-gestures-operator-decision-gate) + and [WI-0a](./iterations/02-rdg-execution-plan.md#step-0). +- [No-loss contract](./migration-parity.md), which inventories current behavior but does not itself + determine the migration scope. From 32544b5a4b40f6bee18e11e252d25a15f86b09d8 Mon Sep 17 00:00:00 2001 From: Tomasz Naumowicz Date: Thu, 26 Nov 2026 17:58:48 +0100 Subject: [PATCH 008/148] docs: record WI-0a completion Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .../data-grid/iterations/02-rdg-execution-plan.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/docs/ai-and-plans/features/data-grid/iterations/02-rdg-execution-plan.md b/docs/ai-and-plans/features/data-grid/iterations/02-rdg-execution-plan.md index f2f405c46..3863862f4 100644 --- a/docs/ai-and-plans/features/data-grid/iterations/02-rdg-execution-plan.md +++ b/docs/ai-and-plans/features/data-grid/iterations/02-rdg-execution-plan.md @@ -343,6 +343,14 @@ item may change; "Not" lists files it must leave alone. The leader re-derives ow - Acceptance: each entry cites the research files it rests on; no rationale the operator did not state. +> **Done (2026-11-26), commit `50154173`:** `gpt-6-luna` drafted Proposed entries 0001–0003 +> with research links and no pin or scope approval. The operator authorized drafting only; +> the leader confirmed (100%) that the entries leave the G1 choices open and created local +> `feature/rdg-migration` at `main` (`8f81840d`). Step 0 records stay on the planning branch +> `dev/tnaum/table-redesign`, where their source research and plan are tracked. No tests added +> (documentation only); staged whitespace check passed. Coding usage: 1.5 AIU, 8 requests, +> 59s summed model time (host log). + **WI-1: pin and runtime check** · `gpt-6.1-sol` · scratch worktree, nothing committed but the report - Compare beta.64 and beta.61 from the approved registry: does either use From 373373a02ea9dffff1123458b1e9d02f2522bcb0 Mon Sep 17 00:00:00 2001 From: Tomasz Naumowicz Date: Thu, 26 Nov 2026 18:10:08 +0100 Subject: [PATCH 009/148] docs: specify neutral grid interfaces (WI-1c) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .../iterations/02-rdg-execution-plan.md | 238 ++++++++++++++++++ 1 file changed, 238 insertions(+) diff --git a/docs/ai-and-plans/features/data-grid/iterations/02-rdg-execution-plan.md b/docs/ai-and-plans/features/data-grid/iterations/02-rdg-execution-plan.md index 3863862f4..699453ebe 100644 --- a/docs/ai-and-plans/features/data-grid/iterations/02-rdg-execution-plan.md +++ b/docs/ai-and-plans/features/data-grid/iterations/02-rdg-execution-plan.md @@ -372,6 +372,244 @@ item may change; "Not" lists files it must leave alone. The leader re-derives ow type lives in, and the list of consumers. Recorded in this document under WI-1c. Passing A1 means ≥ 80 % confidence. +#### WI-1c interface spec + +**Status:** proposed by the advisor; only G1 accepts it. Pin, gestures and scope rows are separate +G1 decisions. This is the concrete proposal for the provisional sketch above. + +| File | Side | Owner | Contents | +| --- | --- | --- | --- | +| `src/utils/documentGrid/types.ts` | Shared | WI-2a | Neutral types, column keys and `getCell`; no BSON, driver or React imports. | +| `src/utils/documentGrid/documentIdentity.ts` | Host | WI-2b | ID serialization, projection trust and page row keys. | +| `src/utils/documentGrid/toTablePage.ts` | Host | WI-2b | Replaces `slickgrid/mongo/toSlickGridTable.ts`. | +| `src/utils/documentGrid/toTreeNodes.ts` | Host | WI-2b | Replaces `slickgrid/mongo/toSlickGridTree.ts`. | +| `src/utils/documentGrid/*.test.ts` | Host | WI-2b | Moved shaping tests and new `documentIdentity.test.ts`. | +| `src/webviews/utils/documentGrid/typeToDisplayString.ts` | Webview | WI-2b | Moved unchanged: `bsonStringToDisplayString(type: string): string`. | + +`GridCellValue` replaces `src/utils/slickgrid/CellValue.ts`. Webviews import only `types.ts` from +`src/utils/documentGrid/`. Payloads are plain JSON; optional fields are omitted when absent. + +```typescript +// src/utils/documentGrid/types.ts +export interface GridCellValue { + /** Formatter output; render as text, not HTML. */ + readonly display: string; + /** The existing BSONTypes key, not its display name. */ + readonly type: string; +} + +export const ROOT_ID_COLUMN_KEY = 'root:_id'; +const FIELD_COLUMN_KEY_PREFIX = 'field:'; +export type FieldColumnKey = `field:${string}`; +export type ColumnKey = typeof ROOT_ID_COLUMN_KEY | FieldColumnKey; + +export function fieldColumnKey(field: string): FieldColumnKey { + return `${FIELD_COLUMN_KEY_PREFIX}${field}`; +} + +export function fieldFromColumnKey(key: ColumnKey): string | undefined { + return key.startsWith(FIELD_COLUMN_KEY_PREFIX) ? key.slice(FIELD_COLUMN_KEY_PREFIX.length) : undefined; +} + +export interface TableColumn { + readonly key: ColumnKey; + readonly label: string; + readonly isRootId: boolean; +} + +export interface TableRow { + /** 'id:' + documentId when actionable; otherwise 'pos:' + zero-based page index. */ + readonly rowKey: string; + /** Canonical EJSON of the root _id. Absent means browsable but not actionable. */ + readonly documentId?: string; + /** Missing key means missing field. BSON null is { display: 'null', type: 'null' }. */ + readonly cells: Readonly>>; +} + +export interface TablePage { + readonly path: readonly string[]; + /** Root ID column first, then field columns at path. */ + readonly columns: readonly TableColumn[]; + /** Server order. */ + readonly rows: readonly TableRow[]; +} + +export interface TreeNode { + /** JSON.stringify([rowKey, ...segments]); segments are field strings or array index numbers. */ + readonly key: string; + readonly parentKey: string | null; + /** Document root = 0; aria-level = depth + 1. */ + readonly depth: number; + readonly field: string; + readonly value: GridCellValue; + /** True only if children exist; false for arrays over the expansion cap. */ + readonly expandable: boolean; +} + +export function getCell(row: TableRow, key: ColumnKey): GridCellValue | undefined { + return Object.prototype.hasOwnProperty.call(row.cells, key) ? row.cells[key] : undefined; +} +``` + +The prefix is injective for any raw field, including `''`, `__proto__`, `constructor`, `root:_id` +and `rdg-select-column`; it does not make a field discoverable if the SchemaStore does not emit it. + +```typescript +// documentIdentity.ts (Document is the driver document type) +export interface PageRowIdentity { + readonly rowKey: string; + readonly documentId?: string; +} +export function toDocumentId(document: Document): string | undefined; +export function isIdentityTrustedForProjection(projection: Document | undefined): boolean; +export function assignRowIdentities(documents: readonly Document[], identityTrusted: boolean): PageRowIdentity[]; + +// toTablePage.ts +export function toGridCellValue(value: unknown): GridCellValue; +export function toTablePage( + documents: readonly Document[], + path: readonly string[], + headers: readonly string[], + identityTrusted: boolean, +): TablePage; + +// toTreeNodes.ts +export function toTreeNodes(documents: readonly Document[], identityTrusted: boolean): TreeNode[]; +``` + +**Host invariants:** + +- `toDocumentId`: require an own `_id` and reject `undefined`, array, regexp, DBRef, Map and unknown + root types. In plain objects/arrays at any depth, reject own `$`-prefixed keys, `undefined` values + and invalid dates. Require successful canonical `EJSON.stringify(id, { relaxed: false })` and + exact reserialization after the existing default `EJSON.parse`. This is intentionally + conservative: identity is withheld when the current action parser cannot preserve the value. + Cover `0`, `false`, `''`, `null`, ObjectId, UUID, Long, Decimal128, Date and composite IDs in the + round-trip matrix; do not assume all numeric subtypes survive the existing parser. +- An absent/empty projection or one with no `_id`/`_id.*` field preserves identity provenance. + A simple boolean or numeric flag for `_id` is allowed, but exclusion still leaves no own ID. + An expression, string, sub-projection, dotted `_id.*` key or parse failure withholds identity. + `ClusterSession.runFindQueryWithCache` derives and stores the flag with the cached page, using + the same Loose `parseShellBSON` semantics as `ClustersClient.runFindQuery`, and clears it with + the documents. +- Only an ID occurring exactly once on the page gets `id:` plus canonical EJSON. Rows with + missing, untrusted, non-round-tripping or duplicate IDs get `pos:` plus the row index and no + `documentId`. Position keys are scoped to the page and never reused as action targets. This + does not establish uniqueness across pages or shards. +- Table cell formatting preserves BSON keys; arrays are `array[N]`. Formatter failure leaves + the cell's text blank, not the page failed; use repository-standard diagnostics without + including user values. Use SchemaStore headers, excluding `_id`, after the dedicated root + column. The root cell displays an own `_id` even when non-actionable. Walk only own object + fields; at a missing path retain the root row and ID. Nested `_id` remains hidden (O1). +- Tree shaping emits parents before children in proposed document order (O2), with today's + root-label algorithm (`null` → `null`, ObjectId → hex, missing → empty, otherwise JSON). + Roots and objects use `{...}`, arrays use `(elements: N)` and emit children only for N ≤ 10. + Array labels are `field[i]`; other values use `toGridCellValue`. Tree has no document actions. + At depth 0 the view labels the type `Document`; elsewhere it maps the BSON key to its + existing display name. + +```typescript +// ClusterSession.ts +getCurrentPageAsTable(path: string[]): TablePage; +getCurrentPageAsTree(): TreeNode[]; + +// DataViewPanelTable.tsx +interface DataViewPanelTableProps { + readonly page: TablePage | undefined; + readonly selectedRowKeys: readonly string[]; + readonly onSelectedRowKeysChange: (rowKeys: readonly string[]) => void; + readonly onStepIn: (rowKey: string, columnKey: ColumnKey) => void; +} + +// DataViewPanelTree.tsx +interface DataViewPanelTreeProps { + readonly nodes: readonly TreeNode[]; +} + +// TypedValueCell.tsx (WI-6) +interface TypedValueCellProps { + readonly value: GridCellValue | undefined; + readonly isRootId: boolean; +} + +// collectionViewContext.ts +// dataSelection: { readonly selectedRowKeys: readonly string[] } +export interface DocumentTarget { + readonly rowKey: string; + readonly documentId: string; +} +export function resolveDocumentTargets( + page: TablePage | undefined, + selectedRowKeys: readonly string[], +): DocumentTarget[] | undefined; + +// CollectionView.tsx +interface QueryResults { + tablePage?: TablePage; + treeNodes?: TreeNode[]; + jsonDocuments?: string[]; + documentCount?: number; +} +``` + +**Webview invariants:** + +- Apply a table response only for the latest request token. On successful page replacement, + clear selected row keys and disable document actions together; also clear table selection on + view switch and table unmount. `resolveDocumentTargets` fails closed if any selected key is not + actionable on the current page. Add stays available; View/Edit require one target, Delete at + least one. The proposal excludes non-actionable rows from selection (O4). +- On Delete, snapshot the requested IDs, not the positions, before the RPC. On acknowledgement, + remove current rows matching that snapshot, subtract only their keys from the current selection, + and recompute toolbar state. An intervening selection of other documents survives. +- Step-in reads the current page and path from refs; require matching paths, a current row and a + non-root column whose cell type is `object`. Decode the raw field and append that one path + segment. No `_id`, arrays, Map or DBRef. Keep the `stepIn` telemetry event, source + `step-in-button` and `depth`; both double-click and the G1 key use it. +- `value === undefined` renders the existing missing-cell treatment and tooltip. Null stays a + real typed value. + +**Consumer migration:** + +| Consumer | Change | +| --- | --- | +| `src/documentdb/ClusterSession.ts` | Replace the shaper imports and `TableDataEntry`/`TableData` exports; shape the cached page with its identity trust state. | +| `src/webviews/documentdb/collectionView/collectionViewRouter.ts` | `getCurrentPageAsTable` keeps `z.array(z.string())` input and returns `TablePage`; `getCurrentPageAsTree` keeps no input and returns `TreeNode[]`. JSON and action RPCs keep their names and inputs. | +| `CollectionView.tsx`, `collectionViewContext.ts` | Update result/context state, RPC response handling, selection, command handlers, step-in and grid props. Remove the webview's extra root header injection. | +| `DataViewPanelTable.tsx`, `DataViewPanelTree.tsx`, new `TypedValueCell.tsx` | Consume neutral props. `ToolbarDocumentManipulation.tsx` and `ToolbarTableNavigation.tsx` keep their current context interface for commands and path. | +| Document commands and data access | `viewDocumentById`, `editDocumentById`, `deleteDocumentsById`, `vscode-documentdb.command.internal.documentView.open`, `documentsViewRouter.getDocumentById`, `ClustersClient` action methods and `parseDocumentId` keep their current contracts. Any O5 change is separate. | +| `build/verification/browser/fixtures.ts` | `CollectionOutputs['getCurrentPageAsTable']` mock becomes `TablePage`; e.g. a string ID is `'"stage0-1"'`. WI-3b supplies `TreeNode[]` and relevant identity/field edge cases once scope is agreed. | +| Existing shaper tests and docs | Move table/tree tests to the new filenames; add the focused identity matrix. WI-11 updates the still-relevant architecture skill and `slickgrid-removal.md`. | + +**Differences from the sketch/current implementation:** root ID display already lives in the +root cell, so the actionable ID is `documentId?: string` rather than a second display-bearing +object. Headers currently come from SchemaStore, not a one-page union. The tree currently uses +display names as its type values. SlickGrid initializes Field-ascending sibling sorting even +though [parity R06](../migration-parity.md#3-tree-view-is-a-separate-release-gate) describes sorting +as disabled. Falsy IDs are dropped today; missing IDs can reach the action path as an empty string. +The late delete handler uses current instead of requested selection. Action identity also depends +on projection provenance, parser round trips and match semantics, not merely serialization. + +**Choices left open for G1/E5 (not approved by A1):** + +| Option | Decision | +| --- | --- | +| O1 | Keep the current hidden nested `_id` (recommended), or show it separately with a distinct label (E5). | +| O2 | Preserve current Field-ascending sibling order (leader recommendation; no unrequested visible change), or approve the spec's document-order UI explicitly. The shaper can still emit preorder in either case. | +| O3 | Confirm the proposed K2 fail-closed cases for computed, ambiguous or unsafe IDs; otherwise specify a different safe policy. | +| O4 | Confirm non-actionable rows are not selectable (proposed), or allow inspecting them by selection without enabling actions. | +| O5 | The proposal leaves cross-page duplicates unguarded. Host-side current-page validation or stronger uniqueness safeguards affect the action boundary and need E5 approval. A count observed only after deletion is not a guard. If K2 covers such collections, resolve this before implementing their document actions. | + +**A1 advisory verdict — approve (86%), `claude-opus-5.5`.** `toSlickGridTable.ts:41–69`, +`DataViewPanelTable.tsx:122` and `CollectionView.tsx:498–514,582,611` support the identity, +late-delete and step-in constraints. `ClustersClient.ts:1190–1243` uses `$in`, `findOne` and +`replaceOne` with upsert; `parseDocumentId.ts:39` uses default EJSON parsing, so a stable +presentation key alone is insufficient. The advisor identified risks in the BSON matrix, +cross-page uniqueness, SchemaStore field discovery and deep-tree payload size. The verdict +would strengthen with round-trip/payload evidence and weaken if G1 rejects the identity or +selection constraints. A1 reviews the **proposal**, not approval of O1–O5 or proof of runtime +parity. + **WI-0b: record the confirmed scope** · `gpt-6-luna` · after G1 - Owns: `decisions.md` entry 0003 (the confirmed M/K/D list, the gestures, the pin, the CI choice), From c3beb1a48ad0e6d68a81e0b083038298edf81dcd Mon Sep 17 00:00:00 2001 From: Tomasz Naumowicz Date: Thu, 26 Nov 2026 18:10:16 +0100 Subject: [PATCH 010/148] docs: record WI-1c completion Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .../features/data-grid/iterations/02-rdg-execution-plan.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/docs/ai-and-plans/features/data-grid/iterations/02-rdg-execution-plan.md b/docs/ai-and-plans/features/data-grid/iterations/02-rdg-execution-plan.md index 699453ebe..85d375394 100644 --- a/docs/ai-and-plans/features/data-grid/iterations/02-rdg-execution-plan.md +++ b/docs/ai-and-plans/features/data-grid/iterations/02-rdg-execution-plan.md @@ -610,6 +610,13 @@ would strengthen with round-trip/payload evidence and weaken if G1 rejects the i selection constraints. A1 reviews the **proposal**, not approval of O1–O5 or proof of runtime parity. +> **Done (2026-11-26), commit `373373a0`:** advised (`claude-opus-5.5`, 86%): field keys +> and row identities have separate namespaces; the host alone shapes neutral results; the +> webview resolves actions against a current page. The proposal documents why a merely +> serializable `_id` is insufficient and leaves the visible/host-boundary choices to G1/E5. +> No tests added (spec only); whitespace check passed. Advisor usage: 336.7 AIU, 52 requests, +> 10m39s summed model time (host log). + **WI-0b: record the confirmed scope** · `gpt-6-luna` · after G1 - Owns: `decisions.md` entry 0003 (the confirmed M/K/D list, the gestures, the pin, the CI choice), From 4f8ef1925180f5e0360547d0f0c333d228390ba5 Mon Sep 17 00:00:00 2001 From: Tomasz Naumowicz Date: Thu, 26 Nov 2026 18:19:39 +0100 Subject: [PATCH 011/148] docs: record grid runtime pin evidence (WI-1) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .../iterations/02-rdg-execution-plan.md | 63 +++++++++++++++++++ 1 file changed, 63 insertions(+) diff --git a/docs/ai-and-plans/features/data-grid/iterations/02-rdg-execution-plan.md b/docs/ai-and-plans/features/data-grid/iterations/02-rdg-execution-plan.md index 85d375394..d2c274701 100644 --- a/docs/ai-and-plans/features/data-grid/iterations/02-rdg-execution-plan.md +++ b/docs/ai-and-plans/features/data-grid/iterations/02-rdg-execution-plan.md @@ -363,6 +363,69 @@ item may change; "Not" lists files it must leave alone. The leader re-derives ow links, and a recommendation. - Checks: `mai-code-2-flash` runs the dev server and Playwright. +#### WI-1 pin report + +**Recommendation for G1: exact-pin `react-data-grid@7.0.0-beta.61`.** Beta.64's normal resize +setup uses a `WeakMap` upsert method unavailable at the declared VS Code engine floor. Its +newer-runtime success does not make it a compatible pin. No dependency or engine was changed +in the product. + +`npm view` and `npm pack` retrieved both exact artifacts through the configured approved proxy +(`https://packagefeedproxy.microsoft.io/npm/`), with lifecycle scripts disabled. The downloaded +hashes matched proxy metadata (SHA-1 for both, published SRI also for beta.64), and the installed +scratch JavaScript/CSS matched the unpacked artifacts byte for byte. + +| Published artifact | 7.0.0-beta.61 | 7.0.0-beta.64 | +| --- | --- | --- | +| Upstream evidence | [Release](https://github.com/Comcast/react-data-grid/releases/tag/v7.0.0-beta.61) | [Release](https://github.com/Comcast/react-data-grid/releases/tag/v7.0.0-beta.64), [sizing hook](https://github.com/Comcast/react-data-grid/blob/v7.0.0-beta.64/src/hooks/useGridDimensions.ts) | +| Executable `getOrInsertComputed` in `lib/index.js` | No `Map` or `WeakMap` call; uses a module-scoped `ResizeObserver`. | No executable `Map` call; one `WeakMap` call for grid sizing. The [grouping fix](https://github.com/Comcast/react-data-grid/pull/4227) is a different call site. | +| Published `lib/styles.css` | 12 `light-dark()` color calls; 8,813 bytes. | 13 `light-dark()` color calls; 9,900 bytes. | +| React/React DOM peer and public row key API | `^19.2`; `rowKeyGetter`. | `^19.2`; `getRowKey`. | + +**Minimum runtime.** `engines.vscode` is `^1.109.0`. The +[VS Code 1.109.0 source](https://github.com/microsoft/vscode/blob/1.109.0/.npmrc) pins +[Electron 39.3.0](https://releases.electronjs.org/release/v39.3.0) with Chromium **142.0.7444.265**. +[Chromium 145](https://developer.chrome.com/release-notes/145#upsert) first shipped the Map and +WeakMap upsert methods by default; [`light-dark()` colors](https://developer.chrome.com/blog/new-in-chrome-123#light-dark) +have been supported since Chromium 123. Transpiling syntax to ES2023 does not polyfill a missing +runtime method. The minimum VS Code installation is distinct from either of the standalone browser +probes. + +**CSS and CSP.** [The webview controller](../../../../../packages/vscode-ext-webview/src/host/WebviewController.ts) +uses a nonce in `script-src`, not in `style-src`. Its `style-src` already permits inline styles +and there is no overriding `style-src-attr`/`style-src-elem`; RDG needs no CSP relaxation. +[The views build](../../../../../vite.config.views.mjs) injects the emitted stylesheet via +[`inlineCss()`](../../../../../build/vite/inline-css.mjs), so a standalone CSS file is expected +from a Vite library build but not from the packaged-style output. Both need content checks. + +**Scratch smoke results.** Both exact aliases used React 19.2.4, Vite 8.1.6, Lightning CSS 1.33.0 +and Playwright Core 1.65.1. The scratch-only aliases initially split the dev React dependency +graph (beta.61 invalid hook call); React deduplication and pre-optimization of both aliases +eliminated the error. The smoke has no host RPC or installed VS Code webview. + +| Check | 7.0.0-beta.61 | 7.0.0-beta.64 | +| --- | --- | --- | +| Chromium 148.0.7778.96, dev and packaged-style | Rendered 500 rows. | Rendered 500 rows; one benign favicon 404 in the dev probe. | +| [Chrome for Testing](https://googlechromelabs.github.io/chrome-for-testing/) 142.0.7444.175, dev and packaged-style | Rendered a 760×400 grid, 16 virtual rows initially, reached ID 500. No page/CSP errors. | Both routes failed to mount: `resizeObservers.getOrInsertComputed is not a function`. Map and WeakMap upserts were absent; `ResizeObserver` and `light-dark()` were supported. | +| Vite library output | Standalone CSS (8,871 bytes), RDG selectors/tokens present. | Standalone CSS (9,963 bytes), RDG selectors/tokens present. | +| Packaged-style output | One injected style (8,871 bytes), no standalone CSS or CSP violation. | One injected style (9,963 bytes), no standalone CSS or CSP violation. | + +The library/packaged builds ran `npm run build:lib:64`, `build:lib:61`, `build:packaged:64` and +`build:packaged:61` in the scratch package (`--ignore-scripts` for each). Playwright drove +`npm run watch:views --ignore-scripts` and a local static server for the packaged-style pages. +In Chromium 148, both packaged grids also supported horizontal scrolling with a frozen column, +keyboard movement and resizing from 400 to 430 px. This is a runtime smoke, not the K11 +performance or accessibility acceptance check. + +**Theme caveat for WI-4b/K10.** The default packaged CSS on both versions had Lightning CSS +markers and no native `light-dark()` calls. It tracked the system preference even when the +document's `color-scheme` was explicitly set to the opposite mode. A scratch-only beta.61 A/B +using `npx vite build --config vite.config.ab61.mjs --mode packaged61` with `cssMinify: false` +retained all 12 native calls and restored correct forced colors in Chromium 142; still one +injected stylesheet and no CSP violations. This diagnostic is not a recommendation to disable +minification globally. Verify the planned VS Code token/theme mapping under packaged output; +high-contrast and the installed minimum VS Code workbench were not run. + **WI-1c: interface spec** · advisor `claude-opus-5.5`, read-only - Input: the [interfaces sketch](#interfaces-starting-point-for-wi-1c), `toSlickGridTable.ts`, From 6fbd055b3a071d9f64964dd35b6be64dfe903e7e Mon Sep 17 00:00:00 2001 From: Tomasz Naumowicz Date: Thu, 26 Nov 2026 18:19:57 +0100 Subject: [PATCH 012/148] docs: record WI-1 completion and Step 0 gates Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .../iterations/02-rdg-execution-plan.md | 30 ++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/docs/ai-and-plans/features/data-grid/iterations/02-rdg-execution-plan.md b/docs/ai-and-plans/features/data-grid/iterations/02-rdg-execution-plan.md index d2c274701..737289e1a 100644 --- a/docs/ai-and-plans/features/data-grid/iterations/02-rdg-execution-plan.md +++ b/docs/ai-and-plans/features/data-grid/iterations/02-rdg-execution-plan.md @@ -83,6 +83,16 @@ Rules that apply to every gate: - **Blocks:** all code on the feature branch. - **May continue:** nothing except answering questions about the evidence. +**G1 pending (2026-11-26).** Step 0 evidence is ready: [proposed decisions](../decisions.md), +[M/K/D scope tables](./01-rdg-migration-plan.md#scope-what-the-migration-replicates), +[pin report](#wi-1-pin-report) and [interface spec and O1–O5](#wi-1c-interface-spec). Recommended: +beta.61, on-demand Playwright checks, the scope rows as proposed, and the gestures above with +Enter for step-in. Preserve current nested `_id` and tree sibling presentation; confirm fail-closed +identity and non-actionable-row selection behavior. O5 does not authorize host changes: if K2 is +expected to cover collections without globally unique `_id` values, resolve the safe action policy +before implementing it. Release only on the operator's `G1 released` with any per-row changes. +WI-0b has not started. + ### G2: hands-on direction check (operator test gate) - **When:** A2–A8 have passed (WI-5 to WI-9 done) and the VSIX for G2 is built (A9). @@ -133,6 +143,10 @@ Rules that apply to every gate: | A10 | WI-10 | Sweep report written with "verified" and "not verified" lists; no console errors or CSP violations in any Collection View route. | | A11 | Before G3b | Full Case 2 list from `.github/copilot-instructions.md` ran and passed, each result reported separately. | +**A1 passed (2026-11-26).** Leader applied the ≥80% gate to the baseline spec at `373373a0`: +`claude-opus-5.5` approved it at 86% (see the [WI-1c verdict](#wi-1c-interface-spec)). This is a +read-only design gate, not runtime verification or release of G1. The operator choices remain open. + ### Escalations | ID | Trigger | Operator chooses | @@ -426,6 +440,15 @@ injected stylesheet and no CSP violations. This diagnostic is not a recommendati minification globally. Verify the planned VS Code token/theme mapping under packaged output; high-contrast and the installed minimum VS Code workbench were not run. +> **Done (2026-11-26), commit `4f8ef192`:** `gpt-6.1-sol` compared exact artifacts and prepared +> the isolated smoke; `mai-code-2-flash` ran the checks and fixed a scratch-only React alias +> issue on the follow-up. The leader recommends beta.61 (99% confidence): beta.64's ordinary +> sizing actually fails on Chromium 142 and beta.61 mounts in both modes. The operator still +> owns the pin. The CSS A/B confirmed a theme caveat, not a production change. No product tests +> added; scratch type check, four Vite builds, two Chromium smoke runs and the CSS A/B ran as +> described above. Investigation usage: 66.7 AIU, 16 requests, 7m08s summed model time. +> Checks usage across both turns: 3.7 AIU, 48 requests, 6m16s summed model time (host log). + **WI-1c: interface spec** · advisor `claude-opus-5.5`, read-only - Input: the [interfaces sketch](#interfaces-starting-point-for-wi-1c), `toSlickGridTable.ts`, @@ -947,4 +970,9 @@ Later sessions keep everything after the first paragraph and replace it with: # Outcome -Not started. Record progress inline against each work item as it lands. +Step 0 complete; stopped at **G1**, not released. Only documentation was committed, on +`dev/tnaum/table-redesign`. `feature/rdg-migration` remains at its local `main` base, with no +product code changes. Verified: published artifacts, scratch Chromium 142/148 behavior, Vite +CSS delivery and the packaged-theme caveat. Not verified: installed VS Code 1.109.0, a real +collection, screen readers and high-contrast. The package pin, final scope and operator-visible +behavior have not been approved. No Step 1 work has begun. From b84c74ce902e5ad9bf7b760d5f686794e0bc702b Mon Sep 17 00:00:00 2001 From: Tomasz Naumowicz Date: Thu, 26 Nov 2026 18:47:30 +0100 Subject: [PATCH 013/148] docs: record G1 feedback and built-in grid retest Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .../iterations/02-rdg-execution-plan.md | 35 +++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/docs/ai-and-plans/features/data-grid/iterations/02-rdg-execution-plan.md b/docs/ai-and-plans/features/data-grid/iterations/02-rdg-execution-plan.md index 737289e1a..f9294949f 100644 --- a/docs/ai-and-plans/features/data-grid/iterations/02-rdg-execution-plan.md +++ b/docs/ai-and-plans/features/data-grid/iterations/02-rdg-execution-plan.md @@ -93,6 +93,24 @@ expected to cover collections without globally unique `_id` values, resolve the before implementing it. Release only on the operator's `G1 released` with any per-row changes. WI-0b has not started. +**G1 operator feedback (2026-11-26; not a release).** The operator wants the gate message to +show the options and recommendations directly; the links are for evidence. Keep implementation +simple and maintainable. The exact pin remains open pending a retest in VS Code's Integrated +Browser and the operator's pin decision. + +| Choice | Operator feedback | +| --- | --- | +| Scope, execution and models | Keep the M/K/D rows and accept C1–C8 and the assigned models as written. | +| Pin | Prefers beta.64; retest both in VS Code's built-in browser before choosing. | +| Playwright checks | On demand only. | +| Gestures | Accept the proposed row gestures and Enter. Include Shift+arrows only if already in scope; it is listed for future cell-range selection (F-3), not as a row-selection gesture in this migration. Do not add it. | +| O1–O3 | Keep today's nested `_id` display and field-name tree ordering; withhold document actions for unreliable IDs. | +| O4 | Browsable rows are always selectable, even when they have no safe action target. Selection does not confer action eligibility. | +| O5 | Cross-page/shard duplicate handling is out of scope. Keep existing error handling when the database reports an error. This is not a guarantee that a duplicate ID will trigger one: `ClustersClient.deleteDocuments` uses `deleteMany` and currently checks acknowledgement, not match uniqueness. | + +The [built-in browser retest](#built-in-browser-retest) is complete. The pin and `G1 released` +are still pending; the retest does not authorize raising `engines.vscode` or adding a polyfill. + ### G2: hands-on direction check (operator test gate) - **When:** A2–A8 have passed (WI-5 to WI-9 done) and the VSIX for G2 is built (A9). @@ -440,6 +458,23 @@ injected stylesheet and no CSP violations. This diagnostic is not a recommendati minification globally. Verify the planned VS Code token/theme mapping under packaged output; high-contrast and the installed minimum VS Code workbench were not run. +##### Built-in browser retest + +On 2026-11-26, `mai-code-2-flash` drove the existing scratch routes in VS Code's Integrated +Browser as requested. Its reported runtime was **VS Code Insiders 1.149.0-insider, Electron +43.8.10, Chromium 150.0.7871.250**. Both Map and WeakMap upserts were present. The four dev and +packaged-style routes loaded, rendered a 760×400 grid (`aria-rowcount=501`, three columns and +15 initial virtual rows), and reached ID 500 on scroll. Both packaged routes had one injected +stylesheet. The beta.64 dev and beta.61 packaged reloads recorded no CSP violations. An attempted +external-browser inspection returned a missing-reference error and supplied no test evidence. + +This verifies both versions on the operator's current Insiders runtime. It does not reproduce +the earlier Chromium 142 setup, which loaded the beta.61 control but threw the missing-method +error with beta.64, nor does it test an installed VS Code 1.109.0. **Keep the beta.61 recommendation +if retaining the declared support floor.** Selecting beta.64 requires compatibility evidence at +that floor or a separately approved new floor. Retest checks used 3.0 AIU over 27 requests +(2m41s summed model time; host log). + > **Done (2026-11-26), commit `4f8ef192`:** `gpt-6.1-sol` compared exact artifacts and prepared > the isolated smoke; `mai-code-2-flash` ran the checks and fixed a scratch-only React alias > issue on the follow-up. The leader recommends beta.61 (99% confidence): beta.64's ordinary From 83afd074ca00df57e156bf10a33a68d539ddb072 Mon Sep 17 00:00:00 2001 From: Tomasz Naumowicz Date: Thu, 26 Nov 2026 18:50:08 +0100 Subject: [PATCH 014/148] docs: record beta.64 selection at G1 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .../features/data-grid/iterations/02-rdg-execution-plan.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/docs/ai-and-plans/features/data-grid/iterations/02-rdg-execution-plan.md b/docs/ai-and-plans/features/data-grid/iterations/02-rdg-execution-plan.md index f9294949f..ed0c0766c 100644 --- a/docs/ai-and-plans/features/data-grid/iterations/02-rdg-execution-plan.md +++ b/docs/ai-and-plans/features/data-grid/iterations/02-rdg-execution-plan.md @@ -101,15 +101,16 @@ Browser and the operator's pin decision. | Choice | Operator feedback | | --- | --- | | Scope, execution and models | Keep the M/K/D rows and accept C1–C8 and the assigned models as written. | -| Pin | Prefers beta.64; retest both in VS Code's built-in browser before choosing. | +| Pin | Selected `7.0.0-beta.64` after the built-in browser retest. The choice does not by itself change VS Code's minimum supported version. | | Playwright checks | On demand only. | | Gestures | Accept the proposed row gestures and Enter. Include Shift+arrows only if already in scope; it is listed for future cell-range selection (F-3), not as a row-selection gesture in this migration. Do not add it. | | O1–O3 | Keep today's nested `_id` display and field-name tree ordering; withhold document actions for unreliable IDs. | | O4 | Browsable rows are always selectable, even when they have no safe action target. Selection does not confer action eligibility. | | O5 | Cross-page/shard duplicate handling is out of scope. Keep existing error handling when the database reports an error. This is not a guarantee that a duplicate ID will trigger one: `ClustersClient.deleteDocuments` uses `deleteMany` and currently checks acknowledgement, not match uniqueness. | -The [built-in browser retest](#built-in-browser-retest) is complete. The pin and `G1 released` -are still pending; the retest does not authorize raising `engines.vscode` or adding a polyfill. +The [built-in browser retest](#built-in-browser-retest) is complete. The operator selected +beta.64 and said G1 was approved. The specified `G1 released` signal and the minimum-version +policy are still pending. No change to `engines.vscode` or compatibility shim was authorized. ### G2: hands-on direction check (operator test gate) From 32ca8c6ab1ca45ae19994659ff8cb71d7caa13bd Mon Sep 17 00:00:00 2001 From: Tomasz Naumowicz Date: Thu, 26 Nov 2026 18:50:47 +0100 Subject: [PATCH 015/148] docs: record beta.64 support floor policy Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .../features/data-grid/iterations/02-rdg-execution-plan.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/ai-and-plans/features/data-grid/iterations/02-rdg-execution-plan.md b/docs/ai-and-plans/features/data-grid/iterations/02-rdg-execution-plan.md index ed0c0766c..dac9cdd80 100644 --- a/docs/ai-and-plans/features/data-grid/iterations/02-rdg-execution-plan.md +++ b/docs/ai-and-plans/features/data-grid/iterations/02-rdg-execution-plan.md @@ -101,7 +101,7 @@ Browser and the operator's pin decision. | Choice | Operator feedback | | --- | --- | | Scope, execution and models | Keep the M/K/D rows and accept C1–C8 and the assigned models as written. | -| Pin | Selected `7.0.0-beta.64` after the built-in browser retest. The choice does not by itself change VS Code's minimum supported version. | +| Pin | Selected `7.0.0-beta.64` after the built-in browser retest. Raise the support floor to the earliest stable VS Code release verified to work with beta.64; no compatibility shim. The exact floor is not yet verified. | | Playwright checks | On demand only. | | Gestures | Accept the proposed row gestures and Enter. Include Shift+arrows only if already in scope; it is listed for future cell-range selection (F-3), not as a row-selection gesture in this migration. Do not add it. | | O1–O3 | Keep today's nested `_id` display and field-name tree ordering; withhold document actions for unreliable IDs. | @@ -109,8 +109,8 @@ Browser and the operator's pin decision. | O5 | Cross-page/shard duplicate handling is out of scope. Keep existing error handling when the database reports an error. This is not a guarantee that a duplicate ID will trigger one: `ClustersClient.deleteDocuments` uses `deleteMany` and currently checks acknowledgement, not match uniqueness. | The [built-in browser retest](#built-in-browser-retest) is complete. The operator selected -beta.64 and said G1 was approved. The specified `G1 released` signal and the minimum-version -policy are still pending. No change to `engines.vscode` or compatibility shim was authorized. +beta.64 and approved raising the minimum after verification. The release field was left blank; +the specified `G1 released` signal is still pending. No manifest change has been made. ### G2: hands-on direction check (operator test gate) From 5c9d411a9ea6aefa5651bd5222cbfb33889db4c5 Mon Sep 17 00:00:00 2001 From: Tomasz Naumowicz Date: Thu, 26 Nov 2026 18:53:46 +0100 Subject: [PATCH 016/148] docs: identify candidate VS Code minimum for beta.64 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .../iterations/02-rdg-execution-plan.md | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/docs/ai-and-plans/features/data-grid/iterations/02-rdg-execution-plan.md b/docs/ai-and-plans/features/data-grid/iterations/02-rdg-execution-plan.md index dac9cdd80..934368c4e 100644 --- a/docs/ai-and-plans/features/data-grid/iterations/02-rdg-execution-plan.md +++ b/docs/ai-and-plans/features/data-grid/iterations/02-rdg-execution-plan.md @@ -101,7 +101,7 @@ Browser and the operator's pin decision. | Choice | Operator feedback | | --- | --- | | Scope, execution and models | Keep the M/K/D rows and accept C1–C8 and the assigned models as written. | -| Pin | Selected `7.0.0-beta.64` after the built-in browser retest. Raise the support floor to the earliest stable VS Code release verified to work with beta.64; no compatibility shim. The exact floor is not yet verified. | +| Pin | Selected `7.0.0-beta.64` after the built-in browser retest. Raise the support floor to the earliest stable VS Code release verified to work with beta.64; no compatibility shim. [Candidate: VS Code 1.123.0](#candidate-minimum-for-beta64); exact workbench verification is pending. | | Playwright checks | On demand only. | | Gestures | Accept the proposed row gestures and Enter. Include Shift+arrows only if already in scope; it is listed for future cell-range selection (F-3), not as a row-selection gesture in this migration. Do not add it. | | O1–O3 | Keep today's nested `_id` display and field-name tree ordering; withhold document actions for unreliable IDs. | @@ -476,6 +476,23 @@ if retaining the declared support floor.** Selecting beta.64 requires compatibil that floor or a separately approved new floor. Retest checks used 3.0 AIU over 27 requests (2m41s summed model time; host log). +##### Candidate minimum for beta.64 + +**VS Code 1.123.0 is the earliest stable candidate, not a verified minimum.** The last patch +in the preceding release, [1.122.1](https://code.visualstudio.com/updates/v1_122), pins +[Electron 39.8.8](https://raw.githubusercontent.com/microsoft/vscode/1.122.1/.npmrc) with +[Chromium 142.0.7444.265](https://releases.electronjs.org/release/v39.8.8). The shipped +[1.123.0 commit](https://raw.githubusercontent.com/microsoft/vscode/6a44c352bd24569c417e530095901b649960f9f8/.npmrc) +pins Electron 42.3.0 with +[Chromium 148.0.7778.180](https://releases.electronjs.org/release/v42.3.0), past Chromium 145's +upsert threshold. These are shipped-release mappings, not a run of RDG in the stable workbench. + +Before changing the manifest, open both beta.64 scratch routes in **stable 1.123.0's Integrated +Browser**, not the current Insiders tab or a 1.123 patch release. Confirm the reported runtime, +`WeakMap.prototype.getOrInsertComputed`, the mounted grid and row 500 on scroll. No stable 1.123.0 +build was present in the workspace/scratch cache; no new instance was launched. The floor lookup +used `mai-code-2-flash` (1.0 AIU, 11 requests, 1m39s summed model time). + > **Done (2026-11-26), commit `4f8ef192`:** `gpt-6.1-sol` compared exact artifacts and prepared > the isolated smoke; `mai-code-2-flash` ran the checks and fixed a scratch-only React alias > issue on the follow-up. The leader recommends beta.61 (99% confidence): beta.64's ordinary From a15d509f1aa98407b5152607f59ed05ed33e19a6 Mon Sep 17 00:00:00 2001 From: Tomasz Naumowicz Date: Thu, 26 Nov 2026 19:07:38 +0100 Subject: [PATCH 017/148] docs: record accepted beta.64 support floor evidence Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .../iterations/02-rdg-execution-plan.md | 20 ++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/docs/ai-and-plans/features/data-grid/iterations/02-rdg-execution-plan.md b/docs/ai-and-plans/features/data-grid/iterations/02-rdg-execution-plan.md index 934368c4e..d8bcbda53 100644 --- a/docs/ai-and-plans/features/data-grid/iterations/02-rdg-execution-plan.md +++ b/docs/ai-and-plans/features/data-grid/iterations/02-rdg-execution-plan.md @@ -101,16 +101,16 @@ Browser and the operator's pin decision. | Choice | Operator feedback | | --- | --- | | Scope, execution and models | Keep the M/K/D rows and accept C1–C8 and the assigned models as written. | -| Pin | Selected `7.0.0-beta.64` after the built-in browser retest. Raise the support floor to the earliest stable VS Code release verified to work with beta.64; no compatibility shim. [Candidate: VS Code 1.123.0](#candidate-minimum-for-beta64); exact workbench verification is pending. | +| Pin | Selected `7.0.0-beta.64` after the built-in browser retest. Raise the support floor to **VS Code 1.123.0**, based on the [accepted release evidence](#candidate-minimum-for-beta64); no compatibility shim. | | Playwright checks | On demand only. | | Gestures | Accept the proposed row gestures and Enter. Include Shift+arrows only if already in scope; it is listed for future cell-range selection (F-3), not as a row-selection gesture in this migration. Do not add it. | | O1–O3 | Keep today's nested `_id` display and field-name tree ordering; withhold document actions for unreliable IDs. | | O4 | Browsable rows are always selectable, even when they have no safe action target. Selection does not confer action eligibility. | | O5 | Cross-page/shard duplicate handling is out of scope. Keep existing error handling when the database reports an error. This is not a guarantee that a duplicate ID will trigger one: `ClustersClient.deleteDocuments` uses `deleteMany` and currently checks acknowledgement, not match uniqueness. | -The [built-in browser retest](#built-in-browser-retest) is complete. The operator selected -beta.64 and approved raising the minimum after verification. The release field was left blank; -the specified `G1 released` signal is still pending. No manifest change has been made. +The [built-in browser retest](#built-in-browser-retest) is complete. On 2026-11-26 the operator +accepted the release evidence for 1.123.0, authorized the manifest bump, and directed the leader +to record G1 released after the bump. ### G2: hands-on direction check (operator test gate) @@ -487,11 +487,13 @@ pins Electron 42.3.0 with [Chromium 148.0.7778.180](https://releases.electronjs.org/release/v42.3.0), past Chromium 145's upsert threshold. These are shipped-release mappings, not a run of RDG in the stable workbench. -Before changing the manifest, open both beta.64 scratch routes in **stable 1.123.0's Integrated -Browser**, not the current Insiders tab or a 1.123 patch release. Confirm the reported runtime, -`WeakMap.prototype.getOrInsertComputed`, the mounted grid and row 500 on scroll. No stable 1.123.0 -build was present in the workspace/scratch cache; no new instance was launched. The floor lookup -used `mai-code-2-flash` (1.0 AIU, 11 requests, 1m39s summed model time). +**Operator decision (2026-11-26):** Accept VS Code **1.123.0** as the minimum based on the +shipped-release evidence. Electron 42.3.0 ships Chromium 148, and the +[Chromium 145 release notes](https://developer.chrome.com/release-notes/145#upsert) establish +that it includes beta.64's required `WeakMap.prototype.getOrInsertComputed` API. Beta.64 also +passed the standalone Chromium 148 smoke. The operator accepted this evidence in lieu of +running the smoke inside the exact stable 1.123.0 workbench; that workbench run was not done. +The floor lookup used `mai-code-2-flash` (1.0 AIU, 11 requests, 1m39s summed model time). > **Done (2026-11-26), commit `4f8ef192`:** `gpt-6.1-sol` compared exact artifacts and prepared > the isolated smoke; `mai-code-2-flash` ran the checks and fixed a scratch-only React alias From a81d40fcfb7b940bf639df52de2681bb4a59f415 Mon Sep 17 00:00:00 2001 From: Tomasz Naumowicz Date: Thu, 26 Nov 2026 19:10:13 +0100 Subject: [PATCH 018/148] chore: raise minimum VS Code to 1.123.0 (WI-4a-floor) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- CONTRIBUTING.md | 2 +- package-lock.json | 2 +- package.json | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index c3d3ecff4..5ce5d4098 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -283,7 +283,7 @@ Reopen your terminal after installation, then repeat the check. code --version ``` -Use a version satisfying `engines.vscode` in `package.json` (currently 1.109.0 or +Use a version satisfying `engines.vscode` in `package.json` (currently 1.123.0 or later in the 1.x line). **Install if missing:** visit [code.visualstudio.com](https://code.visualstudio.com/), or run: diff --git a/package-lock.json b/package-lock.json index c4172e174..317d54ea7 100644 --- a/package-lock.json +++ b/package-lock.json @@ -109,7 +109,7 @@ "engines": { "node": ">=22.18.0", "npm": ">=10.0.0", - "vscode": "^1.109.0" + "vscode": "^1.123.0" } }, "node_modules/@asamuzakjp/css-color": { diff --git a/package.json b/package.json index 581736fcc..0805adcfc 100644 --- a/package.json +++ b/package.json @@ -8,7 +8,7 @@ "description": "DocumentDB GUI and MongoDB GUI for Azure DocumentDB, DocumentDB and MongoDB (including Atlas): connect, query and manage your data, in the cloud or locally.", "enableMongoClusters": true, "engines": { - "vscode": "^1.109.0", + "vscode": "^1.123.0", "node": ">=22.18.0", "npm": ">=10.0.0" }, From 3f92ddc3c8cc125318270c5d2dc18d8851d269e1 Mon Sep 17 00:00:00 2001 From: Tomasz Naumowicz Date: Thu, 26 Nov 2026 19:10:33 +0100 Subject: [PATCH 019/148] docs: record G1 release and support-floor completion Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .../iterations/02-rdg-execution-plan.md | 40 ++++++++++++++----- 1 file changed, 30 insertions(+), 10 deletions(-) diff --git a/docs/ai-and-plans/features/data-grid/iterations/02-rdg-execution-plan.md b/docs/ai-and-plans/features/data-grid/iterations/02-rdg-execution-plan.md index d8bcbda53..054fd4257 100644 --- a/docs/ai-and-plans/features/data-grid/iterations/02-rdg-execution-plan.md +++ b/docs/ai-and-plans/features/data-grid/iterations/02-rdg-execution-plan.md @@ -17,7 +17,7 @@ code: # Iteration 2: execution plan for the React Data Grid migration -**Status:** proposed, awaiting the operator at **G1**. This turns the accepted +**Status:** **G1 released**; implementation can begin. This turns the accepted [iteration 1 plan](./01-rdg-migration-plan.md) into work items an agent run can execute: owned files, order, parallel lanes, interfaces, checks, gates and a model per item. It does **not** change iteration 1's scope, guiding rules or the three operator gates. Where it reorders or splits items, @@ -83,7 +83,7 @@ Rules that apply to every gate: - **Blocks:** all code on the feature branch. - **May continue:** nothing except answering questions about the evidence. -**G1 pending (2026-11-26).** Step 0 evidence is ready: [proposed decisions](../decisions.md), +**Initial G1 recommendation (2026-11-26).** Step 0 evidence: [proposed decisions](../decisions.md), [M/K/D scope tables](./01-rdg-migration-plan.md#scope-what-the-migration-replicates), [pin report](#wi-1-pin-report) and [interface spec and O1–O5](#wi-1c-interface-spec). Recommended: beta.61, on-demand Playwright checks, the scope rows as proposed, and the gestures above with @@ -112,6 +112,16 @@ The [built-in browser retest](#built-in-browser-retest) is complete. On 2026-11- accepted the release evidence for 1.123.0, authorized the manifest bump, and directed the leader to record G1 released after the bump. +**G1 released (2026-11-26), operator decision.** The [accepted runtime evidence](#candidate-minimum-for-beta64) +is recorded in `a15d509f`; the manifest bump is committed as `a81d40fc`. The choices in the table +above are binding and override the initial recommendations and the interface sketch where they +differ. In particular, O4 allows selection even without a safe action target; O5 adds no host-side +cross-page uniqueness policy. The exact stable 1.123.0 workbench smoke was not run and is not a +G1 requirement. Next: WI-0b records these decisions in `decisions.md`. + +After each work item completes, report what is complete, in progress, planned and blocked, and +identify the current and upcoming gates and what they block. + ### G2: hands-on direction check (operator test gate) - **When:** A2–A8 have passed (WI-5 to WI-9 done) and the VSIX for G2 is built (A9). @@ -515,8 +525,9 @@ The floor lookup used `mai-code-2-flash` (1.0 AIU, 11 requests, 1m39s summed mod #### WI-1c interface spec -**Status:** proposed by the advisor; only G1 accepts it. Pin, gestures and scope rows are separate -G1 decisions. This is the concrete proposal for the provisional sketch above. +**Status:** accepted at G1 subject to the [operator decisions above](#g1-scope-pin-interfaces-gestures-operator-decision-gate). +This is the advisor's concrete proposal for the provisional sketch above; the G1 decisions +override its O1–O5 defaults where they differ. | File | Side | Owner | Contents | | --- | --- | --- | --- | @@ -787,6 +798,15 @@ parity. - Checks (stated explicitly, so they override Case 1): `npm run build`, the L1 inspection, and `npx vitest run build/verification/inspect.test.cjs`. +> **WI-4a-floor done (2026-11-26), commit `a81d40fc`:** The operator accepted VS Code 1.123.0 +> on [shipped-release evidence](#candidate-minimum-for-beta64) and authorized the isolated +> manifest change before the G1 record. `mai-code-2` updated `engines.vscode` to `^1.123.0`, +> its lockfile mirror and the contributor guide. Leader review confirmed (100%) those were the +> only changes. `mai-code-2-flash`: `npm run build` and `git diff --check` passed; the activation +> check derives `1.123.0` from the manifest. No tests added; no exact stable workbench run +> claimed. Usage: coding 2.6 AIU (5 requests, 38s); checks 0.3 AIU (6 requests, 32s summed). +> WI-4a's dependency and grid changes remain planned. + **WI-3a: scenario runner, keys and focus** · `mai-code-2` (fallback `gpt-6.1-terra`) - Owns: `build/verification/browser/scenarios.ts` (step and assertion type unions only), @@ -1025,9 +1045,9 @@ Later sessions keep everything after the first paragraph and replace it with: # Outcome -Step 0 complete; stopped at **G1**, not released. Only documentation was committed, on -`dev/tnaum/table-redesign`. `feature/rdg-migration` remains at its local `main` base, with no -product code changes. Verified: published artifacts, scratch Chromium 142/148 behavior, Vite -CSS delivery and the packaged-theme caveat. Not verified: installed VS Code 1.109.0, a real -collection, screen readers and high-contrast. The package pin, final scope and operator-visible -behavior have not been approved. No Step 1 work has begun. +Step 0 evidence is complete and **G1 is released**. The feature branch carries the planning +commits and the isolated VS Code minimum change. The operator approved beta.64 and the scope +and behavior listed at G1; the RDG dependency is not yet in the product manifest. Verified: +published artifacts, scratch Chromium 142/148 and Insiders behavior, Vite CSS delivery and the +packaged-theme caveat. The operator accepted release metadata for the support floor; the exact +stable workbench smoke, a real collection, screen readers and high-contrast were not run. From 38b013b77e6d2b26d1980a4e338348f599fb99c5 Mon Sep 17 00:00:00 2001 From: Tomasz Naumowicz Date: Thu, 26 Nov 2026 19:11:58 +0100 Subject: [PATCH 020/148] docs: accept grid migration scope and decisions (WI-0b) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .../features/data-grid/decisions.md | 74 ++++++++++++------- 1 file changed, 49 insertions(+), 25 deletions(-) diff --git a/docs/ai-and-plans/features/data-grid/decisions.md b/docs/ai-and-plans/features/data-grid/decisions.md index d08191d75..9667d9966 100644 --- a/docs/ai-and-plans/features/data-grid/decisions.md +++ b/docs/ai-and-plans/features/data-grid/decisions.md @@ -7,19 +7,18 @@ created: 2026-11-26 # Data grid decisions -These are **proposals for G1, not accepted decisions**. No product or code changes are authorized -before G1 is released. The exact pin, confirmed scope, Playwright CI choice, gestures and step-in key -remain unresolved for the operator. +G1 was released by the operator on 2026-11-26. These entries record the accepted decisions; +implementation remains subject to the planned work items and later gates. -| # | Decision | Status | Changed from the proposal? | Date | PR | -| ---- | ----------------------------------------------------- | -------- | -------------------------- | ---------- | --- | -| 0001 | React Data Grid, beta candidate and document tree | Proposed | Pending G1 | 2026-11-26 | — | -| 0002 | Migration workflow and menus | Proposed | Pending G1 | 2026-11-26 | — | -| 0003 | Confirmed migration scope | Proposed | Intentionally unspecified | 2026-11-26 | — | +| # | Decision | Status | Changed from the proposal? | Date | PR | +| ---- | ----------------------------------------------------- | -------- | ---------------------------------------------------- | ---------- | --- | +| 0001 | React Data Grid, beta candidate and document tree | Accepted | Exact pin and VS Code support floor finalized | 2026-11-26 | — | +| 0002 | Migration workflow and menus | Accepted | Playwright checks are on demand, not in CI | 2026-11-26 | — | +| 0003 | Confirmed migration scope | Accepted | M/K retained; D rows use RDG defaults; G1 choices set | 2026-11-26 | — | ## 0001 - React Data Grid, beta candidate and document tree -**Status:** Proposed · **Date:** 2026-11-26 +**Status:** Accepted · **Date:** 2026-11-26 ### Question @@ -27,13 +26,14 @@ Which grid foundation and tree implementation should the migration use? ### Decision -Propose replacing SlickGrid with upstream React Data Grid, without a fork. Evaluate beta.64 as the -primary exact-pin candidate and beta.61 as the alternative; WI-1's published-package and runtime -checks and the operator's G1 decision must settle the exact pin. Neither version is approved or -declared runtime-compatible here. +Replace SlickGrid with upstream React Data Grid, without a fork, exact-pinned to +`react-data-grid@7.0.0-beta.64`. WI-4a installs the dependency; the pin is not yet installed. +Set the VS Code support floor to `^1.123.0`, committed in `a81d40fc`. The operator accepted the +shipped-release evidence and beta.64 standalone Chromium 148 smoke in lieu of an exact stable +1.123.0 workbench smoke; that workbench run was not done. No compatibility shim is required. -Propose building the arbitrary-depth document tree in the application rather than treating RDG's -`TreeDataGrid` as a drop-in. Keep a grid-neutral boundary so another grid remains an option. +Build the arbitrary-depth document tree in the application rather than treating RDG's `TreeDataGrid` +as a drop-in. Keep a grid-neutral boundary. Reopen the grid choice if SlickGrid's row selection and tree pass a future screen-reader check, if RDG stalls or its API changes make exact pinning unworkable, or if the RDG tree or selection cannot @@ -51,10 +51,12 @@ meet the accessibility gate after the planned retry. [reversal trigger](./iterations/01-rdg-migration-plan.md#cross-cutting). - [Iteration 2 G1](./iterations/02-rdg-execution-plan.md#g1-scope-pin-interfaces-gestures-operator-decision-gate) and [tree/selection escalation](./iterations/02-rdg-execution-plan.md#escalations). +- [Accepted VS Code 1.123.0 release evidence](./iterations/02-rdg-execution-plan.md#candidate-minimum-for-beta64) + and [WI-4a support-floor change](./iterations/02-rdg-execution-plan.md#work-item-detail). ## 0002 - Migration workflow and menus -**Status:** Proposed · **Date:** 2026-11-26 +**Status:** Accepted · **Date:** 2026-11-26 ### Question @@ -62,11 +64,12 @@ How should the migration be organized, verified and integrate any grid menus? ### Decision -Propose one feature branch, with no SlickGrid/RDG coexistence; automation-first verification; and -native VS Code context menus for any grid menu that is later needed. Such menus use the +Use one feature branch, with no SlickGrid/RDG coexistence and automation-first verification. +Playwright contract checks run on demand only, not in CI. If a grid menu is later needed, use native +VS Code context menus with the `webview/context` contribution, `data-vscode-context` on the target and host-executed commands, not -Fluent UI or grid-owned menus. The migration plan says it adds no menus; this rule applies if a menu -is introduced later. The leader creates the local branch in Step 0; implementation waits for G1. +Fluent UI or grid-owned menus. The migration plan adds no menus; this rule applies if a menu is +introduced later. ### Evidence @@ -75,10 +78,12 @@ is introduced later. The leader creates the local branch in Step 0; implementati approach. - [Iteration 2 WI-0a](./iterations/02-rdg-execution-plan.md#step-0) assigns drafting decisions to this entry and branch creation to the leader. +- [G1 decision](./iterations/02-rdg-execution-plan.md#g1-scope-pin-interfaces-gestures-operator-decision-gate) + confirms on-demand Playwright checks. ## 0003 - Confirmed migration scope -**Status:** Proposed · **Date:** 2026-11-26 +**Status:** Accepted · **Date:** 2026-11-26 ### Question @@ -86,14 +91,33 @@ Which proposed migration scope rows are confirmed? ### Decision -Placeholder only. At G1, the operator reviews each M, K and D row in the iteration 1 scope tables -and decides whether to keep it, move it to “RDG default” or drop it. Record the resulting scope here -after G1; this entry does not preselect any row. +Retain all M1–M7 and K1–K11 rows in the iteration 1 scope tables as requirements. Treat D1–D10 as +RDG defaults. The linked tables remain the definitions of those rows; this entry records their +accepted status. + +Accept C1–C8 and the assigned per-item models as written in the G1 plan. + +The exact pin is `react-data-grid@7.0.0-beta.64`, with VS Code minimum `^1.123.0`; Playwright +contract checks are on demand only, not in CI. The row gestures are provisional until G2: click +selects one row; Ctrl/Cmd+click or Space toggles; Shift+click or Shift+Space extends; Enter on an +object cell steps in. Shift+Arrow is future cell-range work (F-3), not part of this migration. + +For O1–O5: + +- **O1:** Keep the current nested root-`_id` presentation. +- **O2:** Keep tree siblings in Field-ascending order. +- **O3:** Withhold document actions when identity is not reliable. +- **O4:** All browsable rows remain selectable, even without a safe action target; selection does + not imply action eligibility. +- **O5:** Cross-page/shard uniqueness mitigation is out of scope. Continue surfacing existing + server errors, but do not promise duplicate documents will cause an error. ### Evidence - [Iteration 1 proposed scope and operator scope check](./iterations/01-rdg-migration-plan.md#scope-what-the-migration-replicates). - [Iteration 2 G1 decisions](./iterations/02-rdg-execution-plan.md#g1-scope-pin-interfaces-gestures-operator-decision-gate) - and [WI-0a](./iterations/02-rdg-execution-plan.md#step-0). + and [WI-0b](./iterations/02-rdg-execution-plan.md#work-item-detail). +- [Accepted runtime and support-floor evidence](./iterations/02-rdg-execution-plan.md#candidate-minimum-for-beta64). +- [Accepted interface spec and O1–O5](./iterations/02-rdg-execution-plan.md#wi-1c-interface-spec). - [No-loss contract](./migration-parity.md), which inventories current behavior but does not itself determine the migration scope. From f669a3a70af4108b53d616c382166860d81d4563 Mon Sep 17 00:00:00 2001 From: Tomasz Naumowicz Date: Thu, 26 Nov 2026 19:12:12 +0100 Subject: [PATCH 021/148] docs: record WI-0b completion and current grid decision Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .../ai-and-plans/features/data-grid/README.md | 22 ++++++++----------- .../iterations/02-rdg-execution-plan.md | 8 ++++++- 2 files changed, 16 insertions(+), 14 deletions(-) diff --git a/docs/ai-and-plans/features/data-grid/README.md b/docs/ai-and-plans/features/data-grid/README.md index e54c44cce..4fcd899f2 100644 --- a/docs/ai-and-plans/features/data-grid/README.md +++ b/docs/ai-and-plans/features/data-grid/README.md @@ -36,13 +36,11 @@ Preparation for [#1101](https://github.com/microsoft/vscode-documentdb/issues/11 - [React Data Grid capabilities](./react-data-grid-capabilities.md): current releases, cheap additions, integration costs and runtime/API caveats. -The current recommendation is to **migrate to React Data Grid, exact-pinned to a beta**, because -accessibility (keyboard navigation in particular) is a hard requirement and RDG passes that gate on -its own foundation, while SlickGrid 11 needs our additions to reach it. Range selection with Excel -copy is buildable on RDG beta.64's public APIs without a fork (about 2–3 developer-weeks). Both -projects have one dominant maintainer; RDG has been in 7.0 pre-release since 2019, so expect to -budget for API renames on upgrades. The final decision is not yet approved; record it in -`decisions.md` once taken. +The [accepted decision](./decisions.md) is to **migrate to React Data Grid, exact-pinned to +7.0.0-beta.64**, with VS Code **1.123.0** as the new minimum. Accessible keyboard navigation +remains a release requirement. Range selection with Excel copy is possible on beta.64's public +APIs, but it is outside this migration. Both projects have one dominant maintainer, and RDG has +been in 7.0 pre-release since 2019, so allow for API changes when upgrading the pin. ## Current architecture @@ -50,11 +48,9 @@ The current table and tree use SlickGrid. Modernization deliberately kept that i moving the webviews to Vite and the tests to Vitest. SlickGrid now has its own lazy JavaScript chunk, which gives the replacement iteration a size baseline without mixing two changes in Collection View. -The replacement iteration will first make host-side result shapes grid-neutral, define an internal -table and tree interface, and capture current behavior in Vitest and browser fixtures. Candidate -grids are evaluated only after those contracts exist. The final choice must preserve selection, -step-in behavior, BSON type display, tree expansion, keyboard use, virtualization, resizing, and -loading behavior. +The replacement iteration starts with grid-neutral result types, host shaping, and the contracts +for the selected grid. Those contracts cover selection, step-in behavior, BSON type display, +tree expansion, keyboard use, virtualization, resizing, and loading behavior as scoped at G1. ## Plan @@ -62,7 +58,7 @@ loading behavior. ordered work items for the React Data Grid migration (high level; detailed interfaces follow in the next iteration). -**Execution plan (proposed):** [iterations/02-rdg-execution-plan.md](./iterations/02-rdg-execution-plan.md), +**Execution plan (G1 released):** [iterations/02-rdg-execution-plan.md](./iterations/02-rdg-execution-plan.md), the same scope as work items with owned files, parallel lanes, operator and automated gates, interfaces, a model per item, and the choice between `/lead` and Copilot Fusion. diff --git a/docs/ai-and-plans/features/data-grid/iterations/02-rdg-execution-plan.md b/docs/ai-and-plans/features/data-grid/iterations/02-rdg-execution-plan.md index 054fd4257..ae63c72f7 100644 --- a/docs/ai-and-plans/features/data-grid/iterations/02-rdg-execution-plan.md +++ b/docs/ai-and-plans/features/data-grid/iterations/02-rdg-execution-plan.md @@ -117,7 +117,7 @@ is recorded in `a15d509f`; the manifest bump is committed as `a81d40fc`. The cho above are binding and override the initial recommendations and the interface sketch where they differ. In particular, O4 allows selection even without a safe action target; O5 adds no host-side cross-page uniqueness policy. The exact stable 1.123.0 workbench smoke was not run and is not a -G1 requirement. Next: WI-0b records these decisions in `decisions.md`. +G1 requirement. WI-0b recorded these decisions in [`decisions.md`](../decisions.md). After each work item completes, report what is complete, in progress, planned and blocked, and identify the current and upcoming gates and what they block. @@ -774,6 +774,12 @@ parity. - Owns: `decisions.md` entry 0003 (the confirmed M/K/D list, the gestures, the pin, the CI choice), and status of 0001–0002 set to "Accepted". +> **Done (2026-11-26), commit `38b013b7`:** `gpt-6-luna` transcribed the operator's G1 +> decisions and accepted 0001–0003. Leader review confirmed (100%) that the record matches the +> agreed scope, pin/minimum, on-demand verification, provisional gestures and O1–O5. +> No tests added (documentation only); whitespace check passed. Coding usage: 1.1 AIU, +> 6 requests, 52s summed model time. + ### Step 1 **WI-2a: neutral types** · `gpt-6-luna` From b415822bb98c19cf79cdd6e82c29a97ac5652284 Mon Sep 17 00:00:00 2001 From: Tomasz Naumowicz Date: Thu, 26 Nov 2026 19:29:21 +0100 Subject: [PATCH 022/148] feat: define neutral document grid types (WI-2a) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- src/utils/documentGrid/types.ts | 63 +++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 src/utils/documentGrid/types.ts diff --git a/src/utils/documentGrid/types.ts b/src/utils/documentGrid/types.ts new file mode 100644 index 000000000..a002f51c4 --- /dev/null +++ b/src/utils/documentGrid/types.ts @@ -0,0 +1,63 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +export interface GridCellValue { + /** Formatter output; render as text, not HTML. */ + readonly display: string; + /** The existing BSONTypes key, not its display name. */ + readonly type: string; +} + +export const ROOT_ID_COLUMN_KEY = 'root:_id'; +const FIELD_COLUMN_KEY_PREFIX = 'field:'; +export type FieldColumnKey = `field:${string}`; +export type ColumnKey = typeof ROOT_ID_COLUMN_KEY | FieldColumnKey; + +export function fieldColumnKey(field: string): FieldColumnKey { + return `${FIELD_COLUMN_KEY_PREFIX}${field}`; +} + +export function fieldFromColumnKey(key: ColumnKey): string | undefined { + return key.startsWith(FIELD_COLUMN_KEY_PREFIX) ? key.slice(FIELD_COLUMN_KEY_PREFIX.length) : undefined; +} + +export interface TableColumn { + readonly key: ColumnKey; + readonly label: string; + readonly isRootId: boolean; +} + +export interface TableRow { + /** 'id:' + documentId when actionable; otherwise 'pos:' + zero-based page index. */ + readonly rowKey: string; + /** Canonical EJSON of the root _id. Absent means browsable but not actionable. */ + readonly documentId?: string; + /** Missing key means missing field. BSON null is { display: 'null', type: 'null' }. */ + readonly cells: Readonly>>; +} + +export interface TablePage { + readonly path: readonly string[]; + /** Root ID column first, then field columns at path. */ + readonly columns: readonly TableColumn[]; + /** Server order. */ + readonly rows: readonly TableRow[]; +} + +export interface TreeNode { + /** JSON.stringify([rowKey, ...segments]); segments are field strings or array index numbers. */ + readonly key: string; + readonly parentKey: string | null; + /** Document root = 0; aria-level = depth + 1. */ + readonly depth: number; + readonly field: string; + readonly value: GridCellValue; + /** True only if children exist; false for arrays over the expansion cap. */ + readonly expandable: boolean; +} + +export function getCell(row: TableRow, key: ColumnKey): GridCellValue | undefined { + return Object.prototype.hasOwnProperty.call(row.cells, key) ? row.cells[key] : undefined; +} From c8f47b8feb5364372b1200885556b2665afa36e7 Mon Sep 17 00:00:00 2001 From: Tomasz Naumowicz Date: Thu, 26 Nov 2026 19:29:31 +0100 Subject: [PATCH 023/148] docs: record WI-2a completion Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .../features/data-grid/iterations/02-rdg-execution-plan.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/docs/ai-and-plans/features/data-grid/iterations/02-rdg-execution-plan.md b/docs/ai-and-plans/features/data-grid/iterations/02-rdg-execution-plan.md index ae63c72f7..9bec6074a 100644 --- a/docs/ai-and-plans/features/data-grid/iterations/02-rdg-execution-plan.md +++ b/docs/ai-and-plans/features/data-grid/iterations/02-rdg-execution-plan.md @@ -788,6 +788,12 @@ parity. - Acceptance: compiles; no consumer changes. - Check: `npx tsc --noEmit -p .` +> **Done (2026-11-26), commit `b415822b`:** `gpt-6-luna` copied the approved shared types +> and column-key helpers into `src/utils/documentGrid/types.ts`. Leader review confirmed +> (100%) the contract matches WI-1c, has no imports, and changes no consumers. +> `npx tsc --noEmit -p .` and whitespace checks passed; no runtime tests added. +> Coding usage: 0.8 AIU, 10 requests, 33s summed model time. + **WI-4a: remove SlickGrid, add React Data Grid** · `mai-code-2` (fallback `gpt-6.1-terra`) - Owns: `package.json`, `package-lock.json` (exact pin, approved registry), `vite.config.views.mjs` From d83782fcedfd42011485b08ac9ba1479d416630f Mon Sep 17 00:00:00 2001 From: Tomasz Naumowicz Date: Thu, 26 Nov 2026 19:35:46 +0100 Subject: [PATCH 024/148] feat: drive keyboard and focus in browser scenarios (WI-3a) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- build/verification/README.md | 5 +- build/verification/browser/playwright.test.ts | 9 +- build/verification/browser/playwright.ts | 4 +- .../browser/scenario-playwright.ts | 44 ++++++- .../browser/scenario-runtime.test.ts | 118 +++++++++++++++++- build/verification/browser/scenarios.ts | 33 ++++- 6 files changed, 197 insertions(+), 16 deletions(-) diff --git a/build/verification/README.md b/build/verification/README.md index c9bb63545..e327f9fdd 100644 --- a/build/verification/README.md +++ b/build/verification/README.md @@ -422,8 +422,9 @@ return await new AsyncFunction('page', source)(page); Use `/scenarios/run-all/localQuickStart.js` for one view, or `/scenarios/run-all/localQuickStart/dark.js` for one view/theme. Each route starts from `about:blank`. -The helper drives the scenario's typed click/fill steps, polls `data-ready` with `page.evaluate` -(not CSP-blocked `waitForFunction`), runs assertions, and returns JSON with `route`, `ready`, +The helper drives the scenario's typed click/fill/press/double-click/focus steps, polls `data-ready` +with `page.evaluate` (not CSP-blocked `waitForFunction`), runs assertions (including `focused`, +matching the active element by exact role/name or selector), and returns JSON with `route`, `ready`, `errors`, `assertions` and `calls` (`window.__harnessCalls`). A route with steps initially shows its entry state: drive `window.__scenario.data.steps` manually or use the helper to reach the named state. Readiness checks visible content/selectors and no visible progressbar except in `provisioning`. diff --git a/build/verification/browser/playwright.test.ts b/build/verification/browser/playwright.test.ts index 1e65273fe..d152fd015 100644 --- a/build/verification/browser/playwright.test.ts +++ b/build/verification/browser/playwright.test.ts @@ -10,6 +10,8 @@ import { type BrowserReport } from './runtime'; interface LocatorFixture { click(): Promise; + dblclick(): Promise; + evaluateAll(operation: (elements: Element[]) => T): Promise; fill(value: string): Promise; press(key: string): Promise; focus(): Promise; @@ -28,6 +30,8 @@ function isReadinessPredicate(operation: (...args: never[]) => unknown): boolean function fixturePage(report: BrowserReport): IntegratedPage { const locator: LocatorFixture = { click: vi.fn(async (): Promise => {}), + dblclick: vi.fn(async (): Promise => {}), + evaluateAll: async (operation: (elements: Element[]) => T): Promise => operation([]), fill: vi.fn(async (): Promise => {}), press: vi.fn(async (): Promise => {}), focus: vi.fn(async (): Promise => {}), @@ -39,7 +43,10 @@ function fixturePage(report: BrowserReport): IntegratedPage { off: vi.fn(), bringToFront: vi.fn(), goto: vi.fn(), - keyboard: { insertText: vi.fn(async (): Promise => {}) }, + keyboard: { + insertText: vi.fn(async (): Promise => {}), + press: vi.fn(async (): Promise => {}), + }, getByRole: vi.fn((): LocatorFixture => locator), locator: vi.fn((): LocatorFixture => locator), evaluate: vi.fn().mockImplementation(async (operation: () => unknown): Promise => { diff --git a/build/verification/browser/playwright.ts b/build/verification/browser/playwright.ts index 249fd5375..89c2acc7f 100644 --- a/build/verification/browser/playwright.ts +++ b/build/verification/browser/playwright.ts @@ -19,6 +19,8 @@ interface BrowserConsole { } interface BrowserLocator { click(options?: { timeout: number }): Promise; + dblclick(options?: { timeout: number }): Promise; + evaluateAll(operation: (elements: Element[]) => T): Promise; fill(value: string, options?: { timeout: number }): Promise; press(key: string, options?: { timeout: number }): Promise; focus(options?: { timeout: number }): Promise; @@ -39,7 +41,7 @@ export interface IntegratedPage { goto(url: string, options: { waitUntil: 'domcontentloaded'; timeout: number }): Promise; getByRole(role: string, options: { name: string; exact?: boolean }): BrowserLocator; locator(selector: string): BrowserLocator; - readonly keyboard: { insertText: (text: string) => Promise }; + readonly keyboard: { insertText: (text: string) => Promise; press(key: string): Promise }; evaluate(operation: () => T | Promise): Promise; evaluate(operation: (argument: A) => T | Promise, argument: A): Promise; } diff --git a/build/verification/browser/scenario-playwright.ts b/build/verification/browser/scenario-playwright.ts index 85fe07a83..523e13d9f 100644 --- a/build/verification/browser/scenario-playwright.ts +++ b/build/verification/browser/scenario-playwright.ts @@ -40,14 +40,28 @@ export async function runScenario(page: IntegratedPage, origin: string, route: S }; const steps = async (items: readonly ScenarioStep[]): Promise => { for (const step of items) { + const description = step.action === 'press' ? step.key : step.name; if (await page.evaluate((): boolean => document.documentElement.dataset.ready === 'failed')) { - throw new Error(`Page failed before step: ${step.name}`); + throw new Error(`Page failed before step: ${description}`); } - const locator = page.getByRole(step.role, { name: step.name, exact: true }); - if (step.action === 'click') { - await locator.click({ timeout: 60000 }); - } else { - await locator.fill(step.value, { timeout: 60000 }); + switch (step.action) { + case 'press': + await page.keyboard.press(step.key); + break; + case 'click': + await page.getByRole(step.role, { name: step.name, exact: true }).click({ timeout: 60000 }); + break; + case 'fill': + await page + .getByRole(step.role, { name: step.name, exact: true }) + .fill(step.value, { timeout: 60000 }); + break; + case 'dblclick': + await page.getByRole(step.role, { name: step.name, exact: true }).dblclick({ timeout: 60000 }); + break; + case 'focus': + await page.getByRole(step.role, { name: step.name, exact: true }).focus({ timeout: 60000 }); + break; } } }; @@ -285,6 +299,24 @@ export async function runScenario(page: IntegratedPage, origin: string, route: S actual, expected: assertion.expected, }); + } else if (assertion.kind === 'focused') { + await steps(assertion.steps ?? []); + const locator = + 'selector' in assertion.target + ? page.locator(assertion.target.selector) + : page.getByRole(assertion.target.role, { + name: assertion.target.name, + exact: true, + }); + const actual = await locator.evaluateAll((elements: Element[]): boolean => + elements.some((element): boolean => element === document.activeElement), + ); + assertions.push({ + name: assertion.name, + passed: actual, + actual, + expected: true, + }); } else if (assertion.kind === 'stableText') { const read = (): Promise => page.evaluate((selector: string): string | null => { diff --git a/build/verification/browser/scenario-runtime.test.ts b/build/verification/browser/scenario-runtime.test.ts index f776e4cd5..3294a1371 100644 --- a/build/verification/browser/scenario-runtime.test.ts +++ b/build/verification/browser/scenario-runtime.test.ts @@ -9,7 +9,7 @@ import { afterEach, describe, expect, it, vi } from 'vitest'; import { type IntegratedPage } from './playwright'; import { runScenario } from './scenario-playwright'; import { installScenario, readinessHolds } from './scenario-runtime'; -import { parseScenarioRoute } from './scenario-server'; +import { parseScenarioRoute, scenarioRunner } from './scenario-server'; import { scenarios, type Scenario, type ScenarioAssertion } from './scenarios'; describe('L2-dev readiness', (): void => { @@ -162,6 +162,8 @@ describe('L2-dev layout assertions', (): void => { document.documentElement.dataset.ready = 'true'; interface Locator { click(): Promise; + dblclick(): Promise; + evaluateAll(operation: (elements: Element[]) => T): Promise; fill(value: string): Promise; press(key: string): Promise; focus(): Promise; @@ -170,6 +172,8 @@ describe('L2-dev layout assertions', (): void => { } const locator: Locator = { click: vi.fn(async (): Promise => {}), + dblclick: vi.fn(async (): Promise => {}), + evaluateAll: async (operation: (elements: Element[]) => T): Promise => operation([]), fill: vi.fn(async (): Promise => {}), press: vi.fn(async (): Promise => {}), focus: vi.fn(async (): Promise => {}), @@ -181,7 +185,10 @@ describe('L2-dev layout assertions', (): void => { off: vi.fn(), bringToFront: vi.fn(async (): Promise => {}), goto: vi.fn(async (): Promise => {}), - keyboard: { insertText: vi.fn(async (): Promise => {}) }, + keyboard: { + insertText: vi.fn(async (): Promise => {}), + press: vi.fn(async (): Promise => {}), + }, getByRole: vi.fn((): Locator => locator), locator: vi.fn((): Locator => locator), // jsdom is the page: run each serialized operation in place. @@ -321,4 +328,111 @@ describe('L2-dev layout assertions', (): void => { actual: null, }); }); + + it('drives keyboard, double-click and focus steps and checks exact focus targets', async (): Promise => { + document.body.innerHTML = + '' + + '
' + + ''; + const already = document.getElementById('already'); + const filter = document.getElementById('filter'); + already?.focus(); + const route = parseScenarioRoute('/connectionDiagnostics/default/dark'); + if (!route) throw new Error('Missing test route'); + window.__harnessErrors = []; + window.__harnessCalls = []; + window.__scenario = { + route, + data: { + ...scenarios.connectionDiagnostics.default, + steps: [ + { action: 'press', key: 'Control+Enter' }, + { action: 'dblclick', role: 'gridcell', name: 'Open record' }, + ], + assertions: [ + { + kind: 'focused', + name: 'role target', + target: { role: 'textbox', name: 'Filter' }, + steps: [{ action: 'focus', role: 'textbox', name: 'Filter' }], + }, + { kind: 'focused', name: 'missing role target', target: { role: 'row', name: 'Missing' } }, + { kind: 'focused', name: 'selector target', target: { selector: '#filter' } }, + { kind: 'focused', name: 'missing selector target', target: { selector: '#missing' } }, + ], + }, + check: (): void => {}, + }; + document.documentElement.dataset.ready = 'true'; + + interface Locator { + click(): Promise; + dblclick(): Promise; + evaluateAll(operation: (elements: Element[]) => T): Promise; + fill(value: string): Promise; + press(key: string): Promise; + focus(): Promise; + first(): Locator; + last(): Locator; + } + const dblclick = vi.fn(async (): Promise => {}); + const focus = vi.fn(async (onFocus?: () => void): Promise => onFocus?.()); + const makeLocator = (elements: Element[], onFocus?: () => void): Locator => ({ + click: vi.fn(async (): Promise => {}), + dblclick, + evaluateAll: async (operation: (matched: Element[]) => T): Promise => operation(elements), + fill: vi.fn(async (): Promise => {}), + press: vi.fn(async (): Promise => {}), + focus: async (): Promise => focus(onFocus), + first: (): Locator => locatorFor(elements), + last: (): Locator => locatorFor(elements), + }); + const locatorFor = (elements: Element[]): Locator => makeLocator(elements); + const getByRole = vi.fn((role: string, options: { name: string; exact?: boolean }): Locator => { + const elements = [...document.querySelectorAll(`[role="${role}"][data-name="${options.name}"]`)]; + return makeLocator(elements, (): void => { + if (elements[0] instanceof HTMLElement) elements[0].focus(); + }); + }); + const press = vi.fn(async (): Promise => { + expect(document.activeElement).toBe(already); + }); + const page: IntegratedPage = { + on: vi.fn(), + off: vi.fn(), + bringToFront: vi.fn(async (): Promise => {}), + goto: vi.fn(async (): Promise => {}), + keyboard: { + insertText: vi.fn(async (): Promise => {}), + press, + }, + getByRole, + locator: vi.fn((selector: string): Locator => locatorFor([...document.querySelectorAll(selector)])), + evaluate: vi + .fn() + .mockImplementation( + async (operation: (argument: unknown) => unknown, argument?: unknown): Promise => + operation(argument), + ), + }; + + const report = await runScenario(page, 'http://localhost:18080', route); + + expect(report.errors).toEqual([]); + expect(report.ready).toBe(true); + expect(report.assertions.map((result): boolean => result.passed)).toEqual([true, false, true, false]); + expect(press).toHaveBeenCalledWith('Control+Enter'); + expect(dblclick).toHaveBeenCalledTimes(1); + expect(focus).toHaveBeenCalledTimes(1); + expect(getByRole).toHaveBeenCalledWith('gridcell', { name: 'Open record', exact: true }); + expect(getByRole).toHaveBeenCalledWith('textbox', { name: 'Filter', exact: true }); + expect(document.activeElement).toBe(filter); + + const snippet = scenarioRunner([route]); + const AsyncFunction = Object.getPrototypeOf(async function () {}).constructor; + expect((): void => { + new AsyncFunction('page', snippet); + }).not.toThrow(); + expect(snippet).toContain('page.keyboard.press'); + }); }); diff --git a/build/verification/browser/scenarios.ts b/build/verification/browser/scenarios.ts index 8e92ac995..a98d8111f 100644 --- a/build/verification/browser/scenarios.ts +++ b/build/verification/browser/scenarios.ts @@ -44,13 +44,28 @@ export interface ScenarioReadiness { readonly noProgressbar: boolean; } +export type ScenarioTargetRole = + | 'button' + | 'link' + | 'switch' + | 'menuitem' + | 'radio' + | 'textbox' + | 'row' + | 'gridcell' + | 'columnheader' + | 'grid' + | 'treegrid'; + export type ScenarioStep = + | { readonly action: 'click'; readonly role: ScenarioTargetRole; readonly name: string } + | { readonly action: 'fill'; readonly role: 'textbox'; readonly name: string; readonly value: string } + | { readonly action: 'press'; readonly key: string } | { - readonly action: 'click'; - readonly role: 'button' | 'link' | 'switch' | 'menuitem' | 'radio'; + readonly action: 'dblclick' | 'focus'; + readonly role: ScenarioTargetRole; readonly name: string; - } - | { readonly action: 'fill'; readonly role: 'textbox'; readonly name: string; readonly value: string }; + }; type CallAssertion = { [P in FixturePaths]: { @@ -165,6 +180,15 @@ interface SequenceAssertion { readonly minimumSpanMs: number; } +interface FocusedAssertion { + readonly kind: 'focused'; + readonly name: string; + readonly target: + | { readonly role: ScenarioTargetRole; readonly name: string } + | { readonly selector: string }; + readonly steps?: readonly ScenarioStep[]; +} + export type ScenarioAssertion = | CallAssertion | SequenceAssertion @@ -175,6 +199,7 @@ export type ScenarioAssertion = | RowHeightsAssertion | TopAssertion | AttributeAssertion + | FocusedAssertion | InsideAssertion | StableTextAssertion; From 6f2c5ee6aaa1d687da9454d669543acc3bb452b4 Mon Sep 17 00:00:00 2001 From: Tomasz Naumowicz Date: Thu, 26 Nov 2026 19:36:08 +0100 Subject: [PATCH 025/148] docs: record WI-3a completion Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .../data-grid/iterations/02-rdg-execution-plan.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/docs/ai-and-plans/features/data-grid/iterations/02-rdg-execution-plan.md b/docs/ai-and-plans/features/data-grid/iterations/02-rdg-execution-plan.md index 9bec6074a..22d82d273 100644 --- a/docs/ai-and-plans/features/data-grid/iterations/02-rdg-execution-plan.md +++ b/docs/ai-and-plans/features/data-grid/iterations/02-rdg-execution-plan.md @@ -829,6 +829,15 @@ parity. - Acceptance: unit tests for each new step and assertion; existing scenarios unchanged. - Check: `npx vitest run --config build/verification/browser/vitest.config.ts build/verification/browser/scenario-runtime.test.ts build/verification/browser/scenarios.test.ts` +> **Done (2026-11-26), commit `d83782fc`:** `mai-code-2` added `press`, `dblclick`, `focus` +> and `focused`, with no existing scenario changes. Leader review (98%) kept role/name +> targeting exact and the run-all helper self-contained. One focused runner test covers the +> new operations and missing focus targets. After a type-only mock correction, `mai-code-2-flash` +> confirmed 73 tests passed across the runtime, scenario and Playwright adapter suites; +> `npx tsc -p build/verification/browser/tsconfig.json --noEmit` and whitespace checks passed. +> Usage: coding 12.4 AIU (14 requests, 3m19s summed, one corrective turn); checks 0.2 AIU +> (6 requests, 38s summed). + **WI-2b: host shaping and identity** · `gpt-6.1-sol` · after WI-4a and WI-2a - Owns: `src/utils/slickgrid/**` moved to the WI-1c folder (with tests), `src/webviews/utils/slickgrid/typeToDisplayString.ts` From 409eceeff569aef70ffa90fb16f37d36f5b3e1f6 Mon Sep 17 00:00:00 2001 From: Tomasz Naumowicz Date: Thu, 26 Nov 2026 19:41:55 +0100 Subject: [PATCH 026/148] feat: replace SlickGrid with the React Data Grid foundation (WI-4a) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- NOTICE.html | 365 ++---------------- build/verification/browser/fixtures.ts | 6 +- build/verification/inspect.cjs | 14 +- build/verification/inspect.test.cjs | 49 ++- build/verification/prove-inspection.cjs | 27 +- build/vite/README.md | 10 +- package-lock.json | 199 +--------- package.json | 2 +- .../collectionView/collectionView.scss | 18 - .../components/queryEditor/QueryEditor.tsx | 10 - .../resultsTab/DataViewPanelTable.tsx | 216 +---------- .../resultsTab/DataViewPanelTree.tsx | 102 +---- .../resultsTab/dataViewPanelTable.scss | 126 ------ .../toolbar/CollectionQueryActionBar.tsx | 6 - .../hooks/useHideScrollbarsDuringResize.ts | 51 --- src/webviews/slickgrid.scss | 109 ------ src/webviews/typings.d.ts | 1 + tsconfig.json | 2 +- vite.config.views.mjs | 14 +- 19 files changed, 154 insertions(+), 1173 deletions(-) delete mode 100644 src/webviews/documentdb/collectionView/components/resultsTab/dataViewPanelTable.scss delete mode 100644 src/webviews/documentdb/collectionView/hooks/useHideScrollbarsDuringResize.ts delete mode 100644 src/webviews/slickgrid.scss diff --git a/NOTICE.html b/NOTICE.html index 958b03327..da7ccead0 100644 --- a/NOTICE.html +++ b/NOTICE.html @@ -6483,303 +6483,6 @@

NOTICES AND INFORMATION

-
  • -
    - - @slickgrid-universal/binding 5.12.2 - MIT - -

    https://github.com/ghiscoding/slickgrid-universal

    -
    • Copyright (c) 2020-present, Ghislain B. https://github.com/ghiscoding/slickgrid-universal
    -
    -        Copyright (c) 2020-present, Ghislain B. 
    -https://github.com/ghiscoding/slickgrid-universal
    -
    -and the original author of SlickGrid 
    -Michael Leibman, michael{dot}leibman{at}gmail{dot}com
    -http://github.com/mleibman/slickgrid
    -
    -Permission is hereby granted, free of charge, to any person obtaining
    -a copy of this software and associated documentation files (the
    -"Software"), to deal in the Software without restriction, including
    -without limitation the rights to use, copy, modify, merge, publish,
    -distribute, sublicense, and/or sell copies of the Software, and to
    -permit persons to whom the Software is furnished to do so, subject to
    -the following conditions:
    -
    -The above copyright notice and this permission notice shall be
    -included in all copies or substantial portions of the Software.
    -
    -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
    -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
    -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
    -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
    -LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
    -OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
    -WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
    -
    -        
    -
    -
  • -
  • -
    - - @slickgrid-universal/common 5.14.0 - MIT - -

    https://github.com/ghiscoding/slickgrid-universal

    -
    • (c) 2009-present Michael Leibman
    • -
    • Copyright (c) 2020-present, Ghislain B. https://github.com/ghiscoding/slickgrid-universal
    -
    -        Copyright (c) 2020-present, Ghislain B. 
    -https://github.com/ghiscoding/slickgrid-universal
    -
    -and the original author of SlickGrid 
    -Michael Leibman, michael{dot}leibman{at}gmail{dot}com
    -http://github.com/mleibman/slickgrid
    -
    -Permission is hereby granted, free of charge, to any person obtaining
    -a copy of this software and associated documentation files (the
    -"Software"), to deal in the Software without restriction, including
    -without limitation the rights to use, copy, modify, merge, publish,
    -distribute, sublicense, and/or sell copies of the Software, and to
    -permit persons to whom the Software is furnished to do so, subject to
    -the following conditions:
    -
    -The above copyright notice and this permission notice shall be
    -included in all copies or substantial portions of the Software.
    -
    -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
    -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
    -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
    -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
    -LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
    -OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
    -WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
    -
    -        
    -
    -
  • -
  • -
    - - @slickgrid-universal/custom-footer-component 5.14.0 - MIT - -

    https://github.com/ghiscoding/slickgrid-universal

    -
    • Copyright (c) 2020-present, Ghislain B. https://github.com/ghiscoding/slickgrid-universal
    -
    -        Copyright (c) 2020-present, Ghislain B. 
    -https://github.com/ghiscoding/slickgrid-universal
    -
    -and the original author of SlickGrid 
    -Michael Leibman, michael{dot}leibman{at}gmail{dot}com
    -http://github.com/mleibman/slickgrid
    -
    -Permission is hereby granted, free of charge, to any person obtaining
    -a copy of this software and associated documentation files (the
    -"Software"), to deal in the Software without restriction, including
    -without limitation the rights to use, copy, modify, merge, publish,
    -distribute, sublicense, and/or sell copies of the Software, and to
    -permit persons to whom the Software is furnished to do so, subject to
    -the following conditions:
    -
    -The above copyright notice and this permission notice shall be
    -included in all copies or substantial portions of the Software.
    -
    -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
    -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
    -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
    -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
    -LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
    -OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
    -WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
    -
    -        
    -
    -
  • -
  • -
    - - @slickgrid-universal/empty-warning-component 5.14.0 - MIT - -

    https://github.com/ghiscoding/slickgrid-universal

    -
    • Copyright (c) 2020-present, Ghislain B. https://github.com/ghiscoding/slickgrid-universal
    -
    -        Copyright (c) 2020-present, Ghislain B. 
    -https://github.com/ghiscoding/slickgrid-universal
    -
    -and the original author of SlickGrid 
    -Michael Leibman, michael{dot}leibman{at}gmail{dot}com
    -http://github.com/mleibman/slickgrid
    -
    -Permission is hereby granted, free of charge, to any person obtaining
    -a copy of this software and associated documentation files (the
    -"Software"), to deal in the Software without restriction, including
    -without limitation the rights to use, copy, modify, merge, publish,
    -distribute, sublicense, and/or sell copies of the Software, and to
    -permit persons to whom the Software is furnished to do so, subject to
    -the following conditions:
    -
    -The above copyright notice and this permission notice shall be
    -included in all copies or substantial portions of the Software.
    -
    -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
    -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
    -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
    -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
    -LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
    -OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
    -WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
    -
    -        
    -
    -
  • -
  • -
    - - @slickgrid-universal/event-pub-sub 5.13.0 - MIT - -

    https://github.com/ghiscoding/slickgrid-universal

    -
    • Copyright (c) 2020-present, Ghislain B. https://github.com/ghiscoding/slickgrid-universal
    -
    -        Copyright (c) 2020-present, Ghislain B. 
    -https://github.com/ghiscoding/slickgrid-universal
    -
    -and the original author of SlickGrid 
    -Michael Leibman, michael{dot}leibman{at}gmail{dot}com
    -http://github.com/mleibman/slickgrid
    -
    -Permission is hereby granted, free of charge, to any person obtaining
    -a copy of this software and associated documentation files (the
    -"Software"), to deal in the Software without restriction, including
    -without limitation the rights to use, copy, modify, merge, publish,
    -distribute, sublicense, and/or sell copies of the Software, and to
    -permit persons to whom the Software is furnished to do so, subject to
    -the following conditions:
    -
    -The above copyright notice and this permission notice shall be
    -included in all copies or substantial portions of the Software.
    -
    -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
    -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
    -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
    -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
    -LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
    -OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
    -WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
    -
    -        
    -
    -
  • -
  • -
    - - @slickgrid-universal/pagination-component 5.14.0 - MIT - -

    https://github.com/ghiscoding/slickgrid-universal

    -
    • Copyright (c) 2020-present, Ghislain B. https://github.com/ghiscoding/slickgrid-universal
    -
    -        Copyright (c) 2020-present, Ghislain B. 
    -https://github.com/ghiscoding/slickgrid-universal
    -
    -and the original author of SlickGrid 
    -Michael Leibman, michael{dot}leibman{at}gmail{dot}com
    -http://github.com/mleibman/slickgrid
    -
    -Permission is hereby granted, free of charge, to any person obtaining
    -a copy of this software and associated documentation files (the
    -"Software"), to deal in the Software without restriction, including
    -without limitation the rights to use, copy, modify, merge, publish,
    -distribute, sublicense, and/or sell copies of the Software, and to
    -permit persons to whom the Software is furnished to do so, subject to
    -the following conditions:
    -
    -The above copyright notice and this permission notice shall be
    -included in all copies or substantial portions of the Software.
    -
    -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
    -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
    -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
    -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
    -LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
    -OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
    -WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
    -
    -        
    -
    -
  • -
  • -
    - - @slickgrid-universal/row-detail-view-plugin 5.14.0 - MIT - -

    https://github.com/ghiscoding/slickgrid-universal

    -
    • Copyright (c) 2020-present, Ghislain B. https://github.com/ghiscoding/slickgrid-universal
    -
    -        Copyright (c) 2020-present, Ghislain B. 
    -https://github.com/ghiscoding/slickgrid-universal
    -
    -and the original author of SlickGrid 
    -Michael Leibman, michael{dot}leibman{at}gmail{dot}com
    -http://github.com/mleibman/slickgrid
    -
    -Permission is hereby granted, free of charge, to any person obtaining
    -a copy of this software and associated documentation files (the
    -"Software"), to deal in the Software without restriction, including
    -without limitation the rights to use, copy, modify, merge, publish,
    -distribute, sublicense, and/or sell copies of the Software, and to
    -permit persons to whom the Software is furnished to do so, subject to
    -the following conditions:
    -
    -The above copyright notice and this permission notice shall be
    -included in all copies or substantial portions of the Software.
    -
    -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
    -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
    -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
    -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
    -LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
    -OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
    -WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
    -
    -        
    -
    -
  • -
  • -
    - - @slickgrid-universal/utils 5.12.0 - MIT - -

    https://github.com/ghiscoding/slickgrid-universal

    -
    • Copyright (c) 2020-present, Ghislain B. https://github.com/ghiscoding/slickgrid-universal
    -
    -        Copyright (c) 2020-present, Ghislain B. 
    -https://github.com/ghiscoding/slickgrid-universal
    -
    -and the original author of SlickGrid 
    -Michael Leibman, michael{dot}leibman{at}gmail{dot}com
    -http://github.com/mleibman/slickgrid
    -
    -Permission is hereby granted, free of charge, to any person obtaining
    -a copy of this software and associated documentation files (the
    -"Software"), to deal in the Software without restriction, including
    -without limitation the rights to use, copy, modify, merge, publish,
    -distribute, sublicense, and/or sell copies of the Software, and to
    -permit persons to whom the Software is furnished to do so, subject to
    -the following conditions:
    -
    -The above copyright notice and this permission notice shall be
    -included in all copies or substantial portions of the Software.
    -
    -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
    -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
    -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
    -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
    -LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
    -OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
    -WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
    -
    -        
    -
    -
  • @@ -9045,6 +8748,41 @@

    NOTICES AND INFORMATION

  • +
  • +
    + + react-data-grid 7.0.0-beta.64 - MIT + +

    https://github.com/Comcast/react-data-grid

    +
    +        The MIT License (MIT)
    +
    +Original work Copyright (c) 2014 Prometheus Research
    +Modified work Copyright 2015 Comcast
    +
    +For the original source code please see https://github.com/prometheusresearch-archive/react-grid
    +
    +Permission is hereby granted, free of charge, to any person obtaining a copy
    +of this software and associated documentation files (the "Software"), to deal
    +in the Software without restriction, including without limitation the rights
    +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
    +copies of the Software, and to permit persons to whom the Software is
    +furnished to do so, subject to the following conditions:
    +
    +The above copyright notice and this permission notice shall be included in
    +all copies or substantial portions of the Software.
    +
    +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
    +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
    +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
    +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
    +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
    +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
    +THE SOFTWARE.
    +
    +        
    +
    +
  • @@ -9381,39 +9119,6 @@

    NOTICES AND INFORMATION

  • -
  • -
    - - slickgrid-react 5.14.1 - MIT - -

    https://github.com/ghiscoding/slickgrid-react

    -
    • Copyright (c) 2022-present, Michael Leibman and Ghislain B. https://github.com/ghiscoding/slickgrid-react
    -
    -        Copyright (c) 2022-present, Michael Leibman and Ghislain B.
    -https://github.com/ghiscoding/slickgrid-react
    -
    -Permission is hereby granted, free of charge, to any person obtaining
    -a copy of this software and associated documentation files (the
    -"Software"), to deal in the Software without restriction, including
    -without limitation the rights to use, copy, modify, merge, publish,
    -distribute, sublicense, and/or sell copies of the Software, and to
    -permit persons to whom the Software is furnished to do so, subject to
    -the following conditions:
    -
    -The above copyright notice and this permission notice shall be
    -included in all copies or substantial portions of the Software.
    -
    -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
    -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
    -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
    -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
    -LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
    -OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
    -WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
    -
    -        
    -
    -
  • diff --git a/build/verification/browser/fixtures.ts b/build/verification/browser/fixtures.ts index 096ff6636..a853769bd 100644 --- a/build/verification/browser/fixtures.ts +++ b/build/verification/browser/fixtures.ts @@ -506,13 +506,9 @@ export const fixtures = { collectionView: { config: collectionConfig, monaco: true, - content: ['Stage 0 fixture row Alpha', 'Stage 0 fixture row Beta'], + content: ['Documents'], styles: [ { selector: '.collectionView', property: 'display', expected: 'flex' }, - { selector: '.slick-cell', property: 'position', expected: 'absolute' }, - { selector: '.slick-header-column', property: 'box-sizing', expected: 'content-box' }, - { selector: '.slick-resizable-handle', property: 'cursor', expected: 'col-resize' }, - { selector: '.slick-resizable-handle', property: 'width', expected: '7px' }, { selector: '.monaco-editor', property: 'position', expected: 'relative' }, { selector: '.monaco-editor .overflow-guard', property: 'overflow', expected: 'hidden' }, { selector: '.monaco-editor .view-lines', property: 'position', expected: 'absolute' }, diff --git a/build/verification/inspect.cjs b/build/verification/inspect.cjs index 8c5f806d4..e1d4d1dc7 100644 --- a/build/verification/inspect.cjs +++ b/build/verification/inspect.cjs @@ -385,7 +385,7 @@ function summarizeGraph(entryName, assets, modules, allowAbsentBson) { assets: [...assets].sort(), bsonModules: bsonModules.map((identifier) => identifier.slice(identifier.indexOf('/node_modules/') + 1)), monaco: [...modules].some((identifier) => identifier.includes('/monaco-editor/')), - slickgrid: [...modules].some((identifier) => /\/(?:slickgrid|@slickgrid-universal)\//.test(identifier)), + reactDataGrid: [...modules].some((identifier) => identifier.includes('/react-data-grid/')), }; } @@ -437,6 +437,7 @@ function hostGraphs(report, files) { const roots = [entry.fileName]; const { assets, modules } = viteChunkClosure(report, name, roots, files, { dynamic: true, host: true }); graphs[name] = summarizeGraph(name, assets, modules, name === 'playgroundTsPlugin'); + assert.ok(!graphs[name].reactDataGrid, `${name} must exclude React Data Grid`); if (name === 'main') { const staticGraph = mainStartupClosure(report, entry, files); assert.ok( @@ -472,7 +473,16 @@ function viewGraphs(report, files) { graphs[name] = viteViewGraph(report, name, files); } for (const name of ['localQuickStart', 'atlasCredentials']) { - assert.ok(!graphs[name].monaco && !graphs[name].slickgrid, `${name} must exclude Monaco and SlickGrid`); + assert.ok( + !graphs[name].monaco && !graphs[name].reactDataGrid, + `${name} must exclude Monaco and React Data Grid`, + ); + } + assert.ok(graphs.collectionView.reactDataGrid, 'collectionView must include React Data Grid'); + for (const [name, graph] of Object.entries(graphs)) { + if (name !== 'collectionView') { + assert.ok(!graph.reactDataGrid, `${name} must exclude React Data Grid`); + } } return graphs; } diff --git a/build/verification/inspect.test.cjs b/build/verification/inspect.test.cjs index a75451293..2a9b13c77 100644 --- a/build/verification/inspect.test.cjs +++ b/build/verification/inspect.test.cjs @@ -199,6 +199,16 @@ test('host BSON invariant requires one per host/worker and permits zero or one, assert.throws(() => hostGraphs(report, bundled), /playgroundWorker: expected exactly one BSON module, got 0/); }); +test('host graphs exclude React Data Grid', () => { + for (const name of ['main', 'playgroundWorker', 'playgroundTsPlugin']) { + const { report, bundled } = hostFixture(); + report.chunks.find((chunk) => chunk.name === name).moduleIds.push( + './node_modules/react-data-grid/lib/index.js', + ); + assert.throws(() => hostGraphs(report, bundled), new RegExp(`${name} must exclude React Data Grid`)); + } +}); + test('host graph edges require report chunks and packaged chunks, and obsolete reports require regeneration', () => { const { report, bundled } = hostFixture(); assert.throws(() => hostGraphs({ bundler: 'webpack' }, bundled), /non-Vite host bundle report; regenerate/); @@ -672,13 +682,17 @@ function viteFixture() { imports: [], moduleIds: ['./node_modules/monaco-editor/esm/vs/editor/editor.api.js'], }, - { fileName: 'slickgrid.js', imports: [], moduleIds: ['./node_modules/@slickgrid-universal/common/index.js'] }, + { + fileName: 'react-data-grid.js', + imports: [], + moduleIds: ['./node_modules/react-data-grid/lib/index.js'], + }, ...Object.entries(viewModules).map(([name, facadeModuleId]) => ({ fileName: `${name}.js`, facadeModuleId, imports: name === 'collectionView' - ? ['monaco-AbC12345.js', 'slickgrid.js'] + ? ['monaco-AbC12345.js', 'react-data-grid.js'] : name === 'documentView' ? ['monaco-AbC12345.js'] : [], @@ -704,20 +718,20 @@ test('Vite view graphs include only entry and view static closures, including cy assets: ['localQuickStart.js', 'runtime.js', 'shared.js', 'views.js'], bsonModules: [], monaco: false, - slickgrid: false, + reactDataGrid: false, }); assert.deepEqual(graphs.collectionView.assets, [ 'collectionView.js', 'monaco-AbC12345.js', + 'react-data-grid.js', 'runtime.js', 'shared.js', - 'slickgrid.js', 'views.js', ]); assert.equal(graphs.collectionView.monaco, true); - assert.equal(graphs.collectionView.slickgrid, true); + assert.equal(graphs.collectionView.reactDataGrid, true); assert.equal(graphs.documentView.monaco, true); - assert.equal(graphs.documentView.slickgrid, false); + assert.equal(graphs.documentView.reactDataGrid, false); }); test('Vite requires the mapped lazy chunk to be a direct dynamic import of views.js', () => { @@ -743,17 +757,34 @@ test('every Vite graph chunk must exist in both the report and the VSIX', () => ); }); -test('Vite always enforces lightweight views', () => { +test('Vite always enforces lazy React Data Grid loading and lightweight views', () => { + const missing = viteFixture(); + missing.report.chunks.find((chunk) => chunk.fileName === 'collectionView.js').imports.pop(); + assert.throws(() => viewGraphs(missing.report, missing.bundled), /collectionView must include React Data Grid/); + for (const name of ['localQuickStart', 'atlasCredentials']) { - for (const asset of ['monaco-AbC12345.js', 'slickgrid.js']) { + for (const asset of ['monaco-AbC12345.js', 'react-data-grid.js']) { const { report, bundled } = viteFixture(); report.chunks.find((chunk) => chunk.fileName === `${name}.js`).imports.push(asset); assert.throws( () => viewGraphs(report, bundled), - (error) => error.message === `${name} must exclude Monaco and SlickGrid`, + (error) => error.message === `${name} must exclude Monaco and React Data Grid`, ); } } + + for (const name of Object.keys(viewModules).filter((candidate) => candidate !== 'collectionView')) { + const { report, bundled } = viteFixture(); + report.chunks.find((chunk) => chunk.fileName === `${name}.js`).imports.push('react-data-grid.js'); + assert.throws( + () => viewGraphs(report, bundled), + (error) => + error.message === + (['localQuickStart', 'atlasCredentials'].includes(name) + ? `${name} must exclude Monaco and React Data Grid` + : `${name} must exclude React Data Grid`), + ); + } }); test('views reject webpack-format and unidentified reports instead of using the shared entry fallback', () => { diff --git a/build/verification/prove-inspection.cjs b/build/verification/prove-inspection.cjs index 493ebe667..fa9043308 100644 --- a/build/verification/prove-inspection.cjs +++ b/build/verification/prove-inspection.cjs @@ -261,8 +261,14 @@ try { const { viewModules } = require('./inspect.cjs'); const lazy = views.chunks.find((chunk) => chunk.facadeModuleId === viewModules.localQuickStart); const monaco = views.chunks.find((chunk) => /^monaco-[A-Za-z0-9_-]+\.js$/.test(chunk.fileName)); + const reactDataGrid = views.chunks.find((chunk) => + chunk.moduleIds.some((moduleId) => moduleId.replaceAll('\\', '/').includes('/node_modules/react-data-grid/')), + ); + const collectionView = views.chunks.find((chunk) => chunk.facadeModuleId === viewModules.collectionView); assert.ok(lazy, 'Proof requires Local Quick Start lazy chunk'); assert.ok(monaco, 'Proof requires Monaco chunk'); + assert.ok(reactDataGrid, 'Proof requires React Data Grid chunk'); + assert.ok(collectionView, 'Proof requires Collection View lazy chunk'); const monacoLoader = budgetEntry('/monaco-editor/'); const loaderChunk = views.chunks.find((chunk) => chunk.moduleIds.includes(monacoLoader.moduleId)); assert.ok(loaderChunk, `Proof requires the chunk containing ${monacoLoader.moduleId}`); @@ -283,11 +289,30 @@ try { [ 'monaco-in-local-quick-start', undefined, - /localQuickStart must exclude Monaco and SlickGrid/, + /localQuickStart must exclude Monaco and React Data Grid/, (report) => { report.chunks.find((chunk) => chunk.fileName === lazy.fileName).imports.push(monaco.fileName); }, ], + [ + 'react-data-grid-in-local-quick-start', + undefined, + /localQuickStart must exclude Monaco and React Data Grid/, + (report) => { + report.chunks.find((chunk) => chunk.fileName === lazy.fileName).imports.push(reactDataGrid.fileName); + }, + ], + [ + 'missing-react-data-grid', + undefined, + /collectionView must include React Data Grid/, + (report) => { + const chunk = report.chunks.find((candidate) => candidate.fileName === reactDataGrid.fileName); + chunk.moduleIds = chunk.moduleIds.filter( + (moduleId) => !moduleId.replaceAll('\\', '/').includes('/node_modules/react-data-grid/'), + ); + }, + ], [ 'duplicate-bson', undefined, diff --git a/build/vite/README.md b/build/vite/README.md index bfa00393b..b73ff1640 100644 --- a/build/vite/README.md +++ b/build/vite/README.md @@ -73,7 +73,7 @@ The groups capture modules in this priority order: | `preload-helper` | `50` | Vite's virtual preload helper. | | `react` | `40` | `react`, `react-dom`, `scheduler`. | | `fluentui` | `30` | `@fluentui`, `@griffel`. | -| `slickgrid` | `20` | `slickgrid-react`, `@slickgrid-universal`. | +| `react-data-grid`| `20` | `react-data-grid`. | | `monaco` | `10` | `monaco-editor`, `@monaco-editor`, and the plugin's `monacoVirtualModulePrefix` modules. | Order matters because `includeDependenciesRecursively` remains at its default, enabled: @@ -84,10 +84,10 @@ without introducing circular chunks. There is deliberately no catch-all vendor group. A group shared by the entry and a lazy view would hoist the view's dependencies into the entry's static graph. React and Fluent UI are -needed by the entry; Monaco remains behind editor views, and SlickGrid behind Collection View. +needed by the entry; Monaco remains behind editor views, and React Data Grid behind Collection View. Other modules are split automatically. L1 requires each registry-backed lazy chunk and excludes -Monaco/SlickGrid from Local Quick Start and Atlas Credentials. L2 checks actual fetched chunks -and SlickGrid's rendered rows/styles, not just an apparent drop in `views.js` size. +Monaco/React Data Grid from Local Quick Start and Atlas Credentials. L2 checks actual fetched chunks +and Collection View's rendered application and Monaco, not just an apparent drop in `views.js` size. ### Monaco features and workers @@ -134,7 +134,7 @@ worker check. | `server.host: '127.0.0.1'`, `server.port: 18080`, `server.strictPort: true` | `npm run watch:views` binds locally at the fixed port expected by the host. A busy port must fail, not silently move to a URL outside the development CSP. | | `server.origin: 'http://localhost:18080'` | Match `WebviewController`'s `DEFAULT_DEV_SERVER_HOST` exactly for absolute asset and worker URLs, even though the listener binds to `127.0.0.1`. | | `server.cors: { origin: allowedDevOrigins }` | Allow module fetches from `vscode-webview://` pages and Vite's local-machine origins, including Blob-worker fetches, without accepting arbitrary origins. | -| `optimizeDeps.include` | Pre-bundle Fluent UI/Griffel, React (including JSX runtimes), SlickGrid, the Monaco React wrapper, and `monaco.optimizeDepsInclude` (all feature/API/language imports plus the JavaScript tokenizer) together. Avoid first-editor re-optimization, page reloads and split Monaco identities. | +| `optimizeDeps.include` | Pre-bundle Fluent UI/Griffel, React (including JSX runtimes), React Data Grid, the Monaco React wrapper, and `monaco.optimizeDepsInclude` (all feature/API/language imports plus the JavaScript tokenizer) together. Avoid first-editor re-optimization, page reloads and split Monaco identities. | | `server.warmup.clientFiles` | Transform the entry and `./src/webviews/**/*.tsx` early to reduce first-panel latency; this is not a production eager-import boundary. | | [webview-dev-entry.mjs](./webview-dev-entry.mjs) | Serve `/views.js` without a prebuilt disk entry. Its first import is a separate React Refresh preamble module, then it re-exports the source entry's `render`. plugin-react normally injects the preamble into `index.html`, which this host does not use; a separate allowed-origin module avoids adding an inline script/nonce to the template. The middleware supplies CORS itself because it runs before Vite's CORS middleware. | | [webview-scenarios.mjs](./webview-scenarios.mjs) | Serve-only L2-dev index, typed scenario pages and runner endpoints via `ssrLoadModule`. Unknown routes return 404; source/HMR/asset requests pass to Vite. Nothing is added to production bundles. | diff --git a/package-lock.json b/package-lock.json index 317d54ea7..8e82121a6 100644 --- a/package-lock.json +++ b/package-lock.json @@ -54,11 +54,11 @@ "monaco-editor": "~0.52.2", "mongodb": "^7.1.0", "mongodb-connection-string-url": "~3.0.2", + "react-data-grid": "7.0.0-beta.64", "react-hotkeys-hook": "~5.2.1", "react-markdown": "^10.1.0", "regenerator-runtime": "^0.14.1", "semver": "~7.7.4", - "slickgrid-react": "~9.13.0", "vscode-json-languageservice": "~5.6.2", "vscode-languageclient": "~9.0.1", "vscode-languageserver": "~9.0.1", @@ -2636,19 +2636,6 @@ "node": "^18.18.0 || ^20.9.0 || >=21.1.0" } }, - "node_modules/@excel-builder-vanilla/types": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/@excel-builder-vanilla/types/-/types-4.2.1.tgz", - "integrity": "sha512-AtVzHKfH7TtRTH7Yczwu6SMXYhmvO+W6H2L4ktg7JesK4cHSS7FinzFk+zkPWs2ROZEXYHLZxJTGY7OrhiOTjw==", - "license": "MIT", - "dependencies": { - "fflate": "^0.8.2" - }, - "funding": { - "type": "ko_fi", - "url": "https://ko-fi.com/ghiscoding" - } - }, "node_modules/@floating-ui/core": { "version": "1.8.0", "resolved": "https://registry.npmjs.org/@floating-ui/core/-/core-1.8.0.tgz", @@ -4566,12 +4553,6 @@ "@swc/helpers": "^0.5.1" } }, - "node_modules/@formkit/tempo": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/@formkit/tempo/-/tempo-1.0.0.tgz", - "integrity": "sha512-2jhR8jnWFt4ajtbpHL2ZvJJ+ofj/XpAumb1OLmsY7U5iwCjGKuk0wqLR7dGsZfyvJeivfWLD9vzj9cdkUUWzyg==", - "license": "MIT" - }, "node_modules/@griffel/core": { "version": "1.20.1", "resolved": "https://registry.npmjs.org/@griffel/core/-/core-1.20.1.tgz", @@ -6468,95 +6449,6 @@ "url": "https://ko-fi.com/killymxi" } }, - "node_modules/@slickgrid-universal/binding": { - "version": "9.13.0", - "resolved": "https://registry.npmjs.org/@slickgrid-universal/binding/-/binding-9.13.0.tgz", - "integrity": "sha512-/3mWCmmekDsW8dXhcaodCgmasD9WMeWNtcD/NKWCYmYERx52EDUOVNxWf8tcpCFlN+eV8smAnTxWGPFZG7Oxaw==", - "license": "MIT" - }, - "node_modules/@slickgrid-universal/common": { - "version": "9.13.0", - "resolved": "https://registry.npmjs.org/@slickgrid-universal/common/-/common-9.13.0.tgz", - "integrity": "sha512-azi6T/xQXFvzehMP3My33jlY2OgjPXf0qjDzqToe/90ijI/JKZQV99o7LUjHpqQAKpPGHpukiPZTV5az3gzvNA==", - "license": "MIT", - "dependencies": { - "@excel-builder-vanilla/types": "^4.2.1", - "@formkit/tempo": "^1.0.0", - "@slickgrid-universal/binding": "9.13.0", - "@slickgrid-universal/event-pub-sub": "9.13.0", - "@slickgrid-universal/utils": "9.13.0", - "@types/sortablejs": "^1.15.9", - "@types/trusted-types": "^2.0.7", - "autocompleter": "^9.3.2", - "dequal": "^2.0.3", - "multiple-select-vanilla": "^4.4.1", - "sortablejs": "^1.15.6", - "un-flatten-tree": "^2.0.12", - "vanilla-calendar-pro": "^3.1.0" - }, - "engines": { - "node": "^20.0.0 || >=22.0.0" - }, - "funding": { - "type": "ko_fi", - "url": "https://ko-fi.com/ghiscoding" - } - }, - "node_modules/@slickgrid-universal/custom-footer-component": { - "version": "9.13.0", - "resolved": "https://registry.npmjs.org/@slickgrid-universal/custom-footer-component/-/custom-footer-component-9.13.0.tgz", - "integrity": "sha512-8rmWNMNZ+tdyCw8AjgsWwyLZQYjAe22guwWW4F/rzOPHRZdCiUX9b1CeHzPDTZWGS/DSULQuVsxbWME4JDwrrQ==", - "license": "MIT", - "dependencies": { - "@formkit/tempo": "^1.0.0", - "@slickgrid-universal/binding": "9.13.0", - "@slickgrid-universal/common": "9.13.0" - } - }, - "node_modules/@slickgrid-universal/empty-warning-component": { - "version": "9.13.0", - "resolved": "https://registry.npmjs.org/@slickgrid-universal/empty-warning-component/-/empty-warning-component-9.13.0.tgz", - "integrity": "sha512-11OQYqAFIQ8hKbj4i6Rh1WC9vFjaQqZ75fLSAJeRB+ow7TOa/M7PWP749Jk3A+V8hKhzIF0rNGZ5BZyMJQ5cQw==", - "license": "MIT", - "dependencies": { - "@slickgrid-universal/common": "9.13.0" - } - }, - "node_modules/@slickgrid-universal/event-pub-sub": { - "version": "9.13.0", - "resolved": "https://registry.npmjs.org/@slickgrid-universal/event-pub-sub/-/event-pub-sub-9.13.0.tgz", - "integrity": "sha512-PHacS+HbROsiDid4WwA08lC6b8U+fn4NgEPRriG99DAyHTpGuJRCaZyhGkmuhSbUpcZ8IB6g0igcVWWW0c89gw==", - "license": "MIT", - "dependencies": { - "@slickgrid-universal/utils": "9.13.0" - } - }, - "node_modules/@slickgrid-universal/pagination-component": { - "version": "9.13.0", - "resolved": "https://registry.npmjs.org/@slickgrid-universal/pagination-component/-/pagination-component-9.13.0.tgz", - "integrity": "sha512-xa4HdrYll1Kd8a6BGFiHcMVnxokf5NlKf86QlxPWzSIcFLLZFCSdCSE1pO9KorPw3mi83BSTh9ykQTCP52QXzw==", - "license": "MIT", - "dependencies": { - "@slickgrid-universal/binding": "9.13.0", - "@slickgrid-universal/common": "9.13.0" - } - }, - "node_modules/@slickgrid-universal/row-detail-view-plugin": { - "version": "9.13.0", - "resolved": "https://registry.npmjs.org/@slickgrid-universal/row-detail-view-plugin/-/row-detail-view-plugin-9.13.0.tgz", - "integrity": "sha512-8DvLouWwdqFl2o/4iObUOhpCSYfPHVWbK0lLRBYD7bkQHbWNj5bvI9aQr8QY7bo5OTZcED7D8yG5fSSXKnmx/Q==", - "license": "MIT", - "dependencies": { - "@slickgrid-universal/common": "9.13.0", - "@slickgrid-universal/utils": "9.13.0" - } - }, - "node_modules/@slickgrid-universal/utils": { - "version": "9.13.0", - "resolved": "https://registry.npmjs.org/@slickgrid-universal/utils/-/utils-9.13.0.tgz", - "integrity": "sha512-0zFVPRb4o9B9BDDl2lukz3w3z1SRDAFP9IbXb30pivERBYsg/eRPlo2zTiY2YlUFExAsdlRfmofYbf/b4ytNRQ==", - "license": "MIT" - }, "node_modules/@smithy/config-resolver": { "version": "4.4.17", "resolved": "https://registry.npmjs.org/@smithy/config-resolver/-/config-resolver-4.4.17.tgz", @@ -7432,12 +7324,6 @@ "dev": true, "license": "MIT" }, - "node_modules/@types/sortablejs": { - "version": "1.15.9", - "resolved": "https://registry.npmjs.org/@types/sortablejs/-/sortablejs-1.15.9.tgz", - "integrity": "sha512-7HP+rZGE2p886PKV9c9OJzLBI6BBJu1O7lJGYnPyG3fS4/duUCcngkNCjsLwIMV+WMqANe3tt4irrXHSIe68OQ==", - "license": "MIT" - }, "node_modules/@types/stream-buffers": { "version": "3.0.8", "resolved": "https://registry.npmjs.org/@types/stream-buffers/-/stream-buffers-3.0.8.tgz", @@ -7447,12 +7333,6 @@ "@types/node": "*" } }, - "node_modules/@types/trusted-types": { - "version": "2.0.7", - "resolved": "https://registry.npmjs.org/@types/trusted-types/-/trusted-types-2.0.7.tgz", - "integrity": "sha512-ScaPdn1dQczgbl0QFTeTOmVHFULt394XJgOQNoyVhZ6r2vLnMLJfBPd53SB52T/3G36VI1/g2MZaX0cwDuXsfw==", - "license": "MIT" - }, "node_modules/@types/unist": { "version": "3.0.3", "resolved": "https://registry.npmjs.org/@types/unist/-/unist-3.0.3.tgz", @@ -8547,12 +8427,6 @@ "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==", "license": "MIT" }, - "node_modules/autocompleter": { - "version": "9.3.2", - "resolved": "https://registry.npmjs.org/autocompleter/-/autocompleter-9.3.2.tgz", - "integrity": "sha512-rLbf2TLGOD7y+gOS36ksrZdIsvoHa2KXc2A7503w+NBRPrcF73zzFeYBxEcV/iMPjaBH3jFhNIYObZ7zt1fkCQ==", - "license": "MIT" - }, "node_modules/available-typed-arrays": { "version": "1.0.7", "resolved": "https://registry.npmjs.org/available-typed-arrays/-/available-typed-arrays-1.0.7.tgz", @@ -11108,12 +10982,6 @@ "node": "^12.20 || >= 14.13" } }, - "node_modules/fflate": { - "version": "0.8.3", - "resolved": "https://registry.npmjs.org/fflate/-/fflate-0.8.3.tgz", - "integrity": "sha512-tbZNuJrLwGUp3zshBtdy4W+ORxZuIh8a5ilyIEQDC5rY1f3U20JMry0Ll3WBzU58EZKsEuJFXhb5gwv8CsPvgA==", - "license": "MIT" - }, "node_modules/file-entry-cache": { "version": "8.0.0", "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-8.0.0.tgz", @@ -14631,19 +14499,6 @@ "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", "license": "MIT" }, - "node_modules/multiple-select-vanilla": { - "version": "4.4.1", - "resolved": "https://registry.npmjs.org/multiple-select-vanilla/-/multiple-select-vanilla-4.4.1.tgz", - "integrity": "sha512-vG8Ea0ovHKrhi1FvpYlnNpDed1I6JzHyFoDtznRTH7A00y/t6MKGSKMs7cNp8mpXUnWb7WZr3/k0naFjg3qeCw==", - "license": "MIT", - "dependencies": { - "@types/trusted-types": "^2.0.7" - }, - "funding": { - "type": "ko_fi", - "url": "https://ko-fi.com/ghiscoding" - } - }, "node_modules/mute-stream": { "version": "0.0.8", "resolved": "https://registry.npmjs.org/mute-stream/-/mute-stream-0.0.8.tgz", @@ -15980,6 +15835,16 @@ "node": ">=0.10.0" } }, + "node_modules/react-data-grid": { + "version": "7.0.0-beta.64", + "resolved": "https://ms-feed-25.pkgs.visualstudio.com/1es-public/_packaging/npm-public/npm/registry/react-data-grid/-/react-data-grid-7.0.0-beta.64.tgz", + "integrity": "sha512-C6qj1Y5rIb5jY5pPffSNgkFB0A8YPUQW8pveD9J7D29y2LCXIpsAgNXPl9zHlVcXHHdXwMOXd9BBTCy6qIyMpg==", + "license": "MIT", + "peerDependencies": { + "react": "^19.2", + "react-dom": "^19.2" + } + }, "node_modules/react-dom": { "version": "19.2.5", "resolved": "https://registry.npmjs.org/react-dom/-/react-dom-19.2.5.tgz", @@ -17004,26 +16869,6 @@ "url": "https://github.com/chalk/slice-ansi?sponsor=1" } }, - "node_modules/slickgrid-react": { - "version": "9.13.0", - "resolved": "https://registry.npmjs.org/slickgrid-react/-/slickgrid-react-9.13.0.tgz", - "integrity": "sha512-nrFa8MuOyTeNSlKEA3yNcpBXHbIl0mmbTZnfFR7Kty6OPrvgUbMwxaOWR/UZ88qKbLte08McdlEifn65Z5bfVg==", - "license": "MIT", - "dependencies": { - "@slickgrid-universal/common": "9.13.0", - "@slickgrid-universal/custom-footer-component": "9.13.0", - "@slickgrid-universal/empty-warning-component": "9.13.0", - "@slickgrid-universal/event-pub-sub": "9.13.0", - "@slickgrid-universal/pagination-component": "9.13.0", - "@slickgrid-universal/row-detail-view-plugin": "9.13.0", - "@slickgrid-universal/utils": "9.13.0", - "dequal": "^2.0.3", - "sortablejs": "^1.15.6" - }, - "peerDependencies": { - "react": ">=19.0.0" - } - }, "node_modules/smart-buffer": { "version": "4.2.0", "resolved": "https://registry.npmjs.org/smart-buffer/-/smart-buffer-4.2.0.tgz", @@ -17062,12 +16907,6 @@ "node": ">= 14" } }, - "node_modules/sortablejs": { - "version": "1.15.7", - "resolved": "https://registry.npmjs.org/sortablejs/-/sortablejs-1.15.7.tgz", - "integrity": "sha512-Kk8wLQPlS+yi1ZEf48a4+fzHa4yxjC30M/Sr2AnQu+f/MPwvvX9XjZ6OWejiz8crBsLwSq8GHqaxaET7u6ux0A==", - "license": "MIT" - }, "node_modules/source-map-js": { "version": "1.2.2", "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.2.tgz", @@ -18256,12 +18095,6 @@ "dev": true, "license": "MIT" }, - "node_modules/un-flatten-tree": { - "version": "2.0.12", - "resolved": "https://registry.npmjs.org/un-flatten-tree/-/un-flatten-tree-2.0.12.tgz", - "integrity": "sha512-E7v59ADEqVQs9gTZYxoe3uGs6Jj/a3gJ7lSJaTIBTc5w0+B3PJ/kVjs/Y/A26NBWEW8WAo556PpRatH4XHZR1w==", - "license": "MIT" - }, "node_modules/unbox-primitive": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/unbox-primitive/-/unbox-primitive-1.1.0.tgz", @@ -18496,16 +18329,6 @@ "spdx-expression-parse": "^3.0.0" } }, - "node_modules/vanilla-calendar-pro": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/vanilla-calendar-pro/-/vanilla-calendar-pro-3.1.0.tgz", - "integrity": "sha512-yXDtCaedcKz6i5OOdWGwui0C8MAmjXjj7JzKZyjDlkczSRqnhI8BDGFygqT2K+qL1uY7R2fLYlTlxA6oyFs2yg==", - "license": "MIT", - "funding": { - "type": "individual", - "url": "https://buymeacoffee.com/uvarov" - } - }, "node_modules/vary": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz", diff --git a/package.json b/package.json index 0805adcfc..2263990e2 100644 --- a/package.json +++ b/package.json @@ -196,11 +196,11 @@ "monaco-editor": "~0.52.2", "mongodb": "^7.1.0", "mongodb-connection-string-url": "~3.0.2", + "react-data-grid": "7.0.0-beta.64", "react-hotkeys-hook": "~5.2.1", "react-markdown": "^10.1.0", "regenerator-runtime": "^0.14.1", "semver": "~7.7.4", - "slickgrid-react": "~9.13.0", "vscode-json-languageservice": "~5.6.2", "vscode-languageclient": "~9.0.1", "vscode-languageserver": "~9.0.1", diff --git a/src/webviews/documentdb/collectionView/collectionView.scss b/src/webviews/documentdb/collectionView/collectionView.scss index b58d4b799..9871dd4eb 100644 --- a/src/webviews/documentdb/collectionView/collectionView.scss +++ b/src/webviews/documentdb/collectionView/collectionView.scss @@ -3,8 +3,6 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -@use '../../slickgrid.scss'; - @use '../../index'; //@import '@fluentui/react/dist/sass/_References'; @@ -221,22 +219,6 @@ $tab-focus-inset: calc(2 * var(--strokeWidthThick)); //background-color: aqua; // used to investigate layout issues - // Temporarily hide overflow during QueryEditor transitions to improve UX responsiveness. - // This class is applied when the enhanced query mode is toggled. While the window-level - // scrollbar flickering is now fixed by the media query on .collectionView, this logic - // remains useful for speeding up scrollbar re-rendering in SlickGrid (Table/Tree views). - // The !important is needed because child components (Monaco editor, SlickGrid) may have - // inline styles that would override this. Hiding overflow for 500ms makes the transition - // feel snappier by preventing intermediate scrollbar states during the ~100ms debounce - // period before resize handlers complete. - &.resizing { - overflow: hidden !important; - - * { - overflow: hidden !important; - } - } - .loadingAnimationTable { .headerRow { align-items: center; diff --git a/src/webviews/documentdb/collectionView/components/queryEditor/QueryEditor.tsx b/src/webviews/documentdb/collectionView/components/queryEditor/QueryEditor.tsx index 236e17a43..1584b565e 100644 --- a/src/webviews/documentdb/collectionView/components/queryEditor/QueryEditor.tsx +++ b/src/webviews/documentdb/collectionView/components/queryEditor/QueryEditor.tsx @@ -28,7 +28,6 @@ import { normalizeCompletionCategory } from '../../../../../telemetry/completion import { useTrpcClient } from '../../../../_integration/useTrpcClient'; import { MonacoAutoHeight } from '../../../../components/MonacoAutoHeight'; import { CollectionViewContext } from '../../collectionViewContext'; -import { useHideScrollbarsDuringResize } from '../../hooks/useHideScrollbarsDuringResize'; import './queryEditor.scss'; /** @@ -86,8 +85,6 @@ export const QueryEditor = ({ onExecuteRequest }: QueryEditorProps): JSX.Element const projectEditorRef = useRef(null); const sortEditorRef = useRef(null); - const hideScrollbarsTemporarily = useHideScrollbarsDuringResize(); - /** * Creates a Monaco model with a URI scheme for the given editor type. * This enables the completion provider to identify which editor the request is for. @@ -653,13 +650,6 @@ export const QueryEditor = ({ onExecuteRequest }: QueryEditorProps): JSX.Element // Toggle enhanced mode setIsEnhancedQueryMode(enhancedModeEnabled); - // Temporarily hide scrollbars during the transition to improve UX responsiveness. - // Note: The window-level scrollbar flickering (caused by cumulative fractional - // pixel rounding) is now fixed by a media query on .collectionView. However, - // this logic remains useful for making the transition feel snappier by hiding - // intermediate scrollbar states in SlickGrid (Table/Tree views) during the - // ~100ms debounce period before resize handlers complete and grids re-render. - hideScrollbarsTemporarily(); }} icon={isEnhancedQueryMode ? : } > diff --git a/src/webviews/documentdb/collectionView/components/resultsTab/DataViewPanelTable.tsx b/src/webviews/documentdb/collectionView/components/resultsTab/DataViewPanelTable.tsx index 4abb0becc..ead594afe 100644 --- a/src/webviews/documentdb/collectionView/components/resultsTab/DataViewPanelTable.tsx +++ b/src/webviews/documentdb/collectionView/components/resultsTab/DataViewPanelTable.tsx @@ -3,24 +3,11 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -/* eslint-disable react-hooks/refs -- SlickgridReact requires ref for imperative grid API access */ - -import * as l10n from '@vscode/l10n'; -import { debounce } from 'es-toolkit'; import * as React from 'react'; -import { useContext, useRef } from 'react'; -import { - SlickgridReact, - type Formatter, - type GridOption, - type OnDblClickEventArgs, - type OnSelectedRowsChangedEventArgs, -} from 'slickgrid-react'; +import { DataGrid } from 'react-data-grid'; +import 'react-data-grid/lib/styles.css'; import { type TableDataEntry } from '../../../../../documentdb/ClusterSession'; -import { type CellValue } from '../../../../../utils/slickgrid/CellValue'; -import { bsonStringToDisplayString } from '../../../../utils/slickgrid/typeToDisplayString'; import { CollectionViewContext } from '../../collectionViewContext'; -import './dataViewPanelTable.scss'; import { LoadingAnimationTable } from './LoadingAnimationTable'; interface Props { @@ -29,198 +16,19 @@ interface Props { handleStepIn: (row: number, cell: number) => void; } -const cellFormatter: Formatter = (_row: number, _cell: number, value: CellValue) => { - if (value === undefined || value === null) { - return { - text: '', - toolTip: l10n.t('This field is not set'), - }; - } - return { - text: value.value, - addClasses: `typedTableCell type-${value.type}`, - toolTip: bsonStringToDisplayString(value.type), - }; -}; - export function DataViewPanelTable({ liveHeaders, liveData, handleStepIn }: Props): React.JSX.Element { - const [currentContext, setCurrentContext] = useContext(CollectionViewContext); - const gridRef = useRef(null); - - // IMPORTANT: Store latest data in refs to solve React closure issues with third-party components. - // React closure issues occur when event handlers or callbacks capture outdated state or props - // from the render in which they were defined. This is known as "stale state capturing." - // SlickGrid binds event handlers during initialization and doesn't automatically update them on re-renders, - // leading to potential bugs if the state changes after the handlers are initialized. - const liveDataRef = useRef(liveData); - - // Also keep a ref for grid columns to solve the same issue - const gridColumnsRef = useRef>([]); - - // Update data ref whenever liveData changes - React.useEffect(() => { - liveDataRef.current = liveData; - }, [liveData]); - - // Create grid columns - type GridColumn = { id: string; name: string; field: string; minWidth: number }; - - const gridColumns: GridColumn[] = liveHeaders.map((header) => { - return { - id: header + '_id', - name: header, - field: header, - minWidth: 100, - formatter: cellFormatter, - }; - }); - - // Update grid columns ref whenever they change - React.useEffect(() => { - gridColumnsRef.current = gridColumns; - }, [gridColumns]); - - // Using useCallback for reference stability, but the critical solution is the ref pattern - const onCellDblClick = React.useCallback( - (event: CustomEvent<{ eventData: unknown; args: OnDblClickEventArgs }>): void => { - // Use ref to always get latest data and columns - const activeDocument = liveDataRef.current[event.detail.args.row]; - - // Access columns from the ref instead of the closure-captured variable - const columnsData = gridColumnsRef.current; - if (!activeDocument || event.detail.args.cell >= columnsData.length) { - return; // Guard against invalid indexes - } - - const activeColumn = columnsData[event.detail.args.cell].field; - const activeCell = activeDocument[activeColumn] as { type?: string }; - - if (activeCell && activeCell.type === 'object') { - handleStepIn(event.detail.args.row, event.detail.args.cell); - } - }, - [handleStepIn], - ); - - // Add this handler definition after onCellDblClick but before gridOptions - const onSelectedRowsChanged = React.useCallback( - (_eventData: unknown, _args: OnSelectedRowsChangedEventArgs): void => { - // Use the ref pattern to access latest data - setCurrentContext((prev) => ({ - ...prev, - commands: { - // Use prev instead of currentContext to avoid stale state references - ...prev.commands, - disableAddDocument: false, - disableDeleteDocument: _args.rows.length === 0, - disableEditDocument: _args.rows.length !== 1, - disableViewDocument: _args.rows.length !== 1, - }, - dataSelection: { - selectedDocumentIndexes: _args.rows, - // Always use the ref to get the latest data, not the prop value captured in closure - selectedDocumentObjectIds: _args.rows.map((row) => liveDataRef.current[row]?.['x-objectid'] ?? ''), - }, - })); - }, - [setCurrentContext], // Only depends on setCurrentContext, not liveData since we use the ref - ); - - const gridOptions: GridOption = { - // keep this so that slickgrid uses the container when we resize it manually - autoResize: { - calculateAvailableSizeBy: 'container', - container: '#resultsDisplayAreaId', // this is a selector of the parent container, in this case it's the collectionView.tsx and the class is "resultsDisplayArea" - bottomPadding: 2, - }, - enableAutoResize: false, // Disable SlickGrid's automatic resize, we'll handle it manually with ResizeObserver - enableAutoSizeColumns: true, // true by default, we disabled it under the assumption that there are a lot of columns in users' data in general - - enableCellNavigation: true, - enableTextSelectionOnCells: true, - - enableCheckboxSelector: false, // todo: [post MVP] this is failing, it looks like it happens when we're defining columns after the grid has been created.. we're deleting the 'checkbox' column. we can work around it, but it needs a bit more attention to get it done right. - enableRowSelection: true, - multiSelect: true, - // checkboxSelector: { - // // optionally change the column index position of the icon (defaults to 0) - // // columnIndexPosition: 1, - - // // you can toggle these 2 properties to show the "select all" checkbox in different location - // hideInFilterHeaderRow: false, - // hideInColumnTitleRow: true, - // applySelectOnAllPages: true, // when clicking "Select All", should we apply it to all pages (defaults to true) - // }, - // rowSelectionOptions: { - // // todo: [post MVP] connected to the issue above. - // // True (Single Selection), False (Multiple Selections) - // selectActiveRow: false, - // }, - - // disalbing features that would require more polishing to make them production-ready - enableColumnPicker: false, - enableColumnReorder: false, - enableContextMenu: false, - enableGridMenu: false, - enableHeaderButton: false, - enableHeaderMenu: false, - footerRowHeight: 1, - }; - - React.useEffect(() => { - return () => { - gridRef.current?.gridService.setSelectedRows([]); - }; - }, []); - - /* - * Effect to manually trigger grid update on liveHeaders or liveData change. - * This is necessary because SlickGrid does not consistently re-render when data changes. - * This could be an implementation issue/details of the SlickGrid React wrapper - * or a mistake in the way we're using the grid. - */ - React.useEffect(() => { - gridRef.current?.gridService.renderGrid(); - }, [liveData, gridColumns]); // Re-run when headers or data change - - // Setup ResizeObserver to watch the results container and manually trigger grid resize - React.useEffect(() => { - const container = document.querySelector('.resultsDisplayArea'); - let resizeObserver: ResizeObserver | null = null; - - if (container) { - const debouncedResizeHandler = debounce(() => { - void gridRef.current?.resizerService?.resizeGrid(10); - }, 200); - - resizeObserver = new ResizeObserver(debouncedResizeHandler); - resizeObserver.observe(container); - } - - return () => { - if (resizeObserver) { - resizeObserver.disconnect(); - } - }; - }, []); + const [currentContext] = React.useContext(CollectionViewContext); + void liveHeaders; + void liveData; + void handleStepIn; if (currentContext.isFirstTimeLoad) { return ; - } else { - return ( - onCellDblClick(event)} - onSelectedRowsChanged={debounce( - (event: { detail: { eventData: unknown; args: OnSelectedRowsChangedEventArgs } }) => - onSelectedRowsChanged(event.detail.eventData, event.detail.args), - 100, - )} - /> - ); } + + return ( + + ); } diff --git a/src/webviews/documentdb/collectionView/components/resultsTab/DataViewPanelTree.tsx b/src/webviews/documentdb/collectionView/components/resultsTab/DataViewPanelTree.tsx index c5eebf7e6..4da71f9c5 100644 --- a/src/webviews/documentdb/collectionView/components/resultsTab/DataViewPanelTree.tsx +++ b/src/webviews/documentdb/collectionView/components/resultsTab/DataViewPanelTree.tsx @@ -3,111 +3,13 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { debounce } from 'es-toolkit'; import * as React from 'react'; -import { Formatters, SlickgridReact, type GridOption } from 'slickgrid-react'; interface Props { liveData: { [key: string]: unknown }[]; } export const DataViewPanelTree = ({ liveData }: Props): React.JSX.Element => { - const gridRef = React.useRef(null); - - const columnsDef = [ - { - id: 'id_field', - name: 'Field', - field: 'field', - minWidth: 100, - type: 'string' as const, - formatter: Formatters.tree, - cssClass: 'cell-title', - filterable: true, - sortable: true, - }, - { id: 'id_value', name: 'Value', field: 'value', minWidth: 100, filterable: true }, - { id: 'id_type', name: 'Type', field: 'type', minWidth: 100, filterable: true }, - ]; - - const gridOptions: GridOption = { - // keep this so that slickgrid uses the container when we resize it manually - autoResize: { - calculateAvailableSizeBy: 'container', - container: '.resultsDisplayArea', // this is a selector of the parent container, in this case it's the collectionView.tsx and the class is "resultsDisplayArea" - bottomPadding: 0, - }, - enableAutoResize: false, // Disable SlickGrid's automatic resize, we'll handle it manually with ResizeObserver - enableAutoSizeColumns: true, // true as when using a tree, there are only 3 columns to work with - - showHeaderRow: false, // this actually hides the filter-view, not the header: https://ghiscoding.gitbook.io/slickgrid-universal/grid-functionalities/tree-data-grid#parentchild-relation-dataset:~:text=If%20you%20don%27t,showHeaderRow%3A%20false - - enableFiltering: true, // required by slickgrid to render Tree Data - enableSorting: false, - - enableTreeData: true, - - treeDataOptions: { - columnId: 'id_field', - parentPropName: 'parentId', - // this is optional, you can define the tree level property name that will be used for the sorting/indentation, internally it will use "__treeLevel" - levelPropName: 'treeLevel', - indentMarginLeft: 15, - initiallyCollapsed: true, - - // initialSort: { - // // tn: incredible! this is actually needed if you want to shown chevrons to expand/collapse the tree (!??? 2h+ to find this by trial&error) - // // https://github.com/ghiscoding/slickgrid-react/discussions/393 - // // with the 5.5.1 release of slickgrid-react, this is no longer needed - // columnId: 'id_field', - // direction: 'ASC', - // }, - - // we can also add a custom Formatter just for the title text portion - titleFormatter: (_row, _cell, value, _def, _dataContext) => { - //return `${value} (id: ${dataContext.id} | ${dataContext.parentId ? `parentId: ` + dataContext.parentId : `root`})`; - return `${value}`; - }, - }, - multiColumnSort: false, // multi-column sorting is not supported with Tree Data, so you need to disable it - // disalbing features that would require more polishing to make them production-ready - enableColumnPicker: false, - enableColumnReorder: false, - enableContextMenu: false, - enableGridMenu: false, - enableHeaderButton: false, - enableHeaderMenu: false, - }; - - // Setup ResizeObserver to watch the results container and manually trigger grid resize - React.useEffect(() => { - const container = document.querySelector('.resultsDisplayArea'); - let resizeObserver: ResizeObserver | null = null; - - if (container) { - const debouncedResizeHandler = debounce(() => { - void gridRef.current?.resizerService?.resizeGrid(10); - }, 200); - - resizeObserver = new ResizeObserver(debouncedResizeHandler); - resizeObserver.observe(container); - } - - return () => { - if (resizeObserver) { - resizeObserver.disconnect(); - } - }; - }, []); - - return ( - console.log('Tree View created')} - /> - ); + void liveData; + return <>; }; diff --git a/src/webviews/documentdb/collectionView/components/resultsTab/dataViewPanelTable.scss b/src/webviews/documentdb/collectionView/components/resultsTab/dataViewPanelTable.scss deleted file mode 100644 index 792503e15..000000000 --- a/src/webviews/documentdb/collectionView/components/resultsTab/dataViewPanelTable.scss +++ /dev/null @@ -1,126 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -.typeIcon { - opacity: 0.4; - font-size: 80%; - display: inline-block; - width: 14pt; -} - -.typedTableCell { - position: relative; - - &:before { - float: right; - right: 3px; - font-size: smaller; - opacity: 0.4; - } - - &.type-string:before { - content: 'Ab'; // For 'String', as in alphabetical letters - } - - &.type-number:before { - content: '12'; // For 'Number', representing digits - } - - &.type-int32:before { - content: 'i32'; // For 'Int32', using 32 as a shorthand - } - - &.type-double:before { - content: '.12'; // For 'Double', "Db" for abbreviation - } - - &.type-decimal128:before { - content: 'd128'; // For 'Decimal128', shorthand for large decimals - } - - &.type-long:before { - content: 'L'; // For 'Long', "L" for Long - } - - &.type-boolean:before { - content: 'tf'; // For 'Boolean', representing True/False - } - - &.type-object:before { - content: '{ }'; // For 'Object', brackets representing an object - } - - &.type-array:before { - content: '[ ]'; // For 'Array', brackets representing an array - } - - &.type-null:before { - content: 'Ø'; // For 'Null', empty set symbol for null - } - - &.type-undefined:before { - content: '?'; // For 'Undefined', question marks indicating unknown - } - - &.type-date:before { - content: 'DT'; // For 'Date', shorthand for date - } - - &.type-regexp:before { - content: '/./'; // For 'RegExp', regex pattern - } - - &.type-binary:before { - content: '01'; // For 'Binary', representing binary digits - } - - &.type-objectid:before { - content: 'ID'; // For 'ObjectId', shorthand for ID - } - - &.type-symbol:before { - content: 'Σ'; // For 'Symbol', using Greek letter Sigma - } - - &.type-timestamp:before { - content: 'TS'; // For 'Timestamp', using "TS" shorthand - } - - &.type-minkey:before { - content: 'Min'; // For 'MinKey', "Min" for minimum - } - - &.type-maxkey:before { - content: 'Max'; // For 'MaxKey', "Max" for maximum - } - - &.type-dbref:before { - content: 'DB'; // For 'DBRef', shorthand for database reference - } - - &.type-uuid:before { - content: 'U'; // For 'UUID' - } - - &.type-uuid-legacy:before { - content: 'U~'; // For 'UUID (Legacy)' - } - - &.type-code:before { - content: ''; // For 'Code', using code brackets as shorthand - } - - &.type-codewithscope:before { - content: ''; // For 'CodeWithScope', "C" within braces to indicate scope - } - - &.type-map:before { - content: 'map'; // For 'Map', short for map - } - - &.type-_unknown_:before { - content: '??'; // For '_UNKNOWN_', indicating an unknown value - } -} diff --git a/src/webviews/documentdb/collectionView/components/toolbar/CollectionQueryActionBar.tsx b/src/webviews/documentdb/collectionView/components/toolbar/CollectionQueryActionBar.tsx index 946646f02..301f50d27 100644 --- a/src/webviews/documentdb/collectionView/components/toolbar/CollectionQueryActionBar.tsx +++ b/src/webviews/documentdb/collectionView/components/toolbar/CollectionQueryActionBar.tsx @@ -40,7 +40,6 @@ import { useContext, type JSX } from 'react'; import { useTrpcClient } from '../../../../_integration/useTrpcClient'; import { CollectionViewContext } from '../../collectionViewContext'; import { type CollectionViewWebviewConfigurationType } from '../../collectionViewController'; -import { useHideScrollbarsDuringResize } from '../../hooks/useHideScrollbarsDuringResize'; export interface CollectionQueryActionBarProps { variant: 'documents' | 'queryInsights'; @@ -63,8 +62,6 @@ const QueryExecutionToolbar = ({ variant }: CollectionQueryActionBarProps): JSX. const configuration = useConfiguration(); const [currentContext, setCurrentContext] = useContext(CollectionViewContext); - const hideScrollbarsTemporarily = useHideScrollbarsDuringResize(); - const handleExecuteQuery = () => { // return to the root level setCurrentContext((prev) => ({ @@ -155,9 +152,6 @@ const QueryExecutionToolbar = ({ variant }: CollectionQueryActionBarProps): JSX. ...prev, isAiRowVisible: checkedItems.includes('copilot'), })); - - // Temporarily hide scrollbars during the transition to improve UX responsiveness - hideScrollbarsTemporarily(); } }; diff --git a/src/webviews/documentdb/collectionView/hooks/useHideScrollbarsDuringResize.ts b/src/webviews/documentdb/collectionView/hooks/useHideScrollbarsDuringResize.ts deleted file mode 100644 index e2f98e637..000000000 --- a/src/webviews/documentdb/collectionView/hooks/useHideScrollbarsDuringResize.ts +++ /dev/null @@ -1,51 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -import { useEffect, useRef } from 'react'; - -/** - * Custom hook to temporarily hide scrollbars during layout transitions. - * - * This hook provides a function that hides scrollbars on .resultsDisplayArea for 500ms - * to improve UX during QueryEditor transitions (Collapse animations). While the window-level - * scrollbar flickering is fixed by a media query on .collectionView, this logic remains - * useful for speeding up scrollbar re-rendering in SlickGrid (Table/Tree views) during - * the ~100ms debounce period before resize handlers complete. - * - * @returns A function that temporarily hides scrollbars for 500ms - */ -export const useHideScrollbarsDuringResize = (): (() => void) => { - const timeoutRef = useRef(null); - - const hideScrollbarsTemporarily = () => { - const resultsArea = document.querySelector('.resultsDisplayArea'); - if (resultsArea) { - resultsArea.classList.add('resizing'); - - // Clear any existing timeout - if (timeoutRef.current) { - clearTimeout(timeoutRef.current); - } - - // Show scrollbars after 500ms - timeoutRef.current = setTimeout(() => { - resultsArea.classList.remove('resizing'); - timeoutRef.current = null; - }, 500); - } - }; - - // Cleanup timeout on unmount - useEffect(() => { - return () => { - if (timeoutRef.current) { - clearTimeout(timeoutRef.current); - timeoutRef.current = null; - } - }; - }, []); - - return hideScrollbarsTemporarily; -}; diff --git a/src/webviews/slickgrid.scss b/src/webviews/slickgrid.scss deleted file mode 100644 index 9d2d6f86c..000000000 --- a/src/webviews/slickgrid.scss +++ /dev/null @@ -1,109 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -$base-background-color: var(--vscode-editor-background); -$base-text-color: var(--vscode-editor-foreground); -$primary-color: #006dcc; // Can't replace here since the adjust function fails on variables -$slick-icon-color: inherit; // var(--vscode-icon-foreground); -$slick-header-resizable-hover: 1px solid var(--vscode-editor-selectionBackground); - -@use '@slickgrid-universal/common/dist/styles/sass/slickgrid-theme-default.scss' with ( - $slick-highlight-color: $base-text-color, - $slick-primary-color: $primary-color, - - $slick-border-color: $base-text-color, - $slick-font-color: $base-text-color, - - /* Slickgrid container, including headers but excluding pagination */ $slick-container-border-top: 0 none, - $slick-container-border-right: 0 none, - $slick-container-border-bottom: 0 none, - $slick-container-border-left: 0 none, - $slick-canvas-bg-color: $base-background-color, - - /* grid */ $slick-grid-border-color: none, - $slick-grid-header-background: $base-background-color, - $slick-grid-header-unorderable-bg-color: $base-background-color, - $slick-grid-cell-color: $base-text-color, - $slick-gray-dark: $base-text-color, - $slick-link-color: var(--vscode-textLink-foreground), - $slick-link-color-hover: var(--vscode-textLink-activeForeground), - $slick-navbar-default-link-hover-color: $base-text-color, - $slick-text-color: $base-text-color, - $slick-table-background: transparent, - $slick-scrollbar-color: var(--vscode-scrollbarSlider-activeBackground) var(--vscode-scrollbarSlider-background), - $slick-hover-header-color: var(--vscode-editor-placeholder-foreground), - $slick-sorting-header-color: $base-text-color, - $slick-placeholder-color: var(--vscode-editor-placeholder-foreground), - /* cell */ $slick-cell-active-border: none, - $slick-cell-active-box-shadow: inset 0 0 0 1px #aaaaaa, - $slick-cell-box-shadow: none, - $slick-cell-display: block, - $slick-cell-text-color: $base-text-color, - $slick-cell-border-top: 1px transparent, - $slick-cell-border-right: 1px transparent, - $slick-cell-border-bottom: 1px transparent, - $slick-cell-border-left: 1px transparent, - $slick-cell-even-background-color: var(--vscode-diffEditor-unchangedCodeBackground), - $slick-cell-odd-background-color: var(--vscode-diffEditor-unchangedCodeBackground), - // for striping every second row - $slick-cell-odd-active-background-color: var(--vscode-diffEditor-unchangedCodeBackground), - // var(--vscode-diffEditor-removedLineBackground), - /* row */ $slick-row-mouse-hover-color: var(--vscode-diffEditor-insertedLineBackground), - $slick-row-mouse-hover-box-shadow: none, - $slick-row-selected-color: var(--vscode-editor-findMatchBackground), - $slick-row-highlight-background-color: var(--vscode-editor-selectionHighlightBackground), - $slick-row-checkbox-selector-background: inherit, - $slick-row-checkbox-selector-border: none, - - // These rules were override because the color.adjust doesn't work with variables - $slick-autocomplete-hover-bg-color: var(--vscode-diffEditor-insertedLineBackground), - $slick-detail-view-icon-color-hover: $primary-color, - $slick-row-based-edit-editmode-active-bgcolor: $base-text-color, - $slick-row-based-edit-editmode-active-hover-bgcolor: $base-text-color, - $slick-row-based-edit-editmode-bgcolor: $base-text-color, - $slick-row-based-edit-editmode-hover-bgcolor: $base-text-color, - - /* header */ $slick-header-row-count: 1, - $slick-header-background-color: $base-background-color, - $slick-header-border-top: 0 none, - // header, column titles, that is without the Filters - $slick-header-border-right: 0 none, - $slick-header-border-bottom: 0 none, - $slick-header-border-left: 0 none, - $slick-header-column-background-active: $base-background-color, - //--- - $slick-header-column-background-hover: $base-background-color, - //--- - $slick-header-column-sortable-background-hover: $base-background-color, - $slick-header-column-border-top: 0 none, - // header, column titles, that is without the Filters - $slick-header-column-border-right: 0 none, - $slick-header-column-border-bottom: 0 none, - $slick-header-column-border-left: 0 none, - $slick-header-filter-row-border-top: 0 none, - // header row is where the Filters are showing - $slick-header-filter-row-border-right: 0 none, - $slick-header-filter-row-border-bottom: 0 none, - $slick-header-filter-row-border-left: 0 none, - $slick-header-row-background-color: $base-background-color, - $slick-header-text-color: $base-text-color, - $slick-header-resizable-hover: $slick-header-resizable-hover, - $slick-header-resizable-hover-border-bottom: 0 none, - $slick-header-resizable-hover-border-left: 0 none, - $slick-header-resizable-hover-border-right: $slick-header-resizable-hover, - $slick-header-resizable-hover-border-top: 0 none, - - /* Empty Data Warning element */ $slick-empty-data-warning-color: $base-text-color, - - /* icons */ $slick-icon-color: $slick-icon-color, - $slick-icon-group-color: $slick-icon-color, - $slick-icon-sort-color: $slick-icon-color, - $slick-detail-view-icon-color: $slick-icon-color, - $slick-column-picker-icon-color: $slick-icon-color, - $slick-checkbox-icon-color: $slick-icon-color, - $slick-multiselect-icon-color: $slick-icon-color, - $slick-multiselect-icon-checked-color: $slick-icon-color, - $slick-pagination-icon-color: $slick-icon-color -); diff --git a/src/webviews/typings.d.ts b/src/webviews/typings.d.ts index ecdf4ebc3..0bc896e4b 100644 --- a/src/webviews/typings.d.ts +++ b/src/webviews/typings.d.ts @@ -13,3 +13,4 @@ declare global { // Stylesheets are side-effect imports that Vite compiles. TypeScript 6 checks that side-effect imports // resolve (`noUncheckedSideEffectImports`), so declare them as modules without exports. declare module '*.scss' {} +declare module 'react-data-grid/lib/styles.css' {} diff --git a/tsconfig.json b/tsconfig.json index a22df8c3d..c5c43336b 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -12,7 +12,7 @@ // which must not depend on a dependency's `/// ` to be in scope. "types": ["node"], "esModuleInterop": true, // added by tnaum to help with Denque integration, happy to discuss other approaches - "allowSyntheticDefaultImports": true, // added by tnaum to fix SlickGrid integration, eager to discuss other approaches + "allowSyntheticDefaultImports": true, "noImplicitThis": true, "noImplicitReturns": true, "noUnusedLocals": true, diff --git a/vite.config.views.mjs b/vite.config.views.mjs index 1bf9a8359..ee691f366 100644 --- a/vite.config.views.mjs +++ b/vite.config.views.mjs @@ -122,10 +122,10 @@ export default defineConfig(async ({ command, mode }) => { keepNames: false, // Named vendor chunks (`codeSplitting.groups`, which replaces the deprecated // `manualChunks`/`advancedChunks` in Rolldown 1.0). The entry statically loads - // React and Fluent UI; Monaco and SlickGrid stay behind the lazy view chunks that - // import them. A catch-all vendor group is deliberately absent: a group shared by - // the entry and a lazy view would hoist the view's dependencies into the entry's - // static graph. Everything else is chunked automatically per view. + // React and Fluent UI; Monaco and React Data Grid stay behind the lazy view + // chunks that import them. A catch-all vendor group is deliberately absent: a + // group shared by the entry and a lazy view would hoist the view's dependencies + // into the entry's static graph. Everything else is chunked automatically per view. codeSplitting: { // Rolldown also moves every not-yet-captured dependency of a group's modules // into that group (`includeDependenciesRecursively`, kept on to avoid circular @@ -137,8 +137,8 @@ export default defineConfig(async ({ command, mode }) => { { name: 'react', test: inPackages('react', 'react-dom', 'scheduler'), priority: 40 }, { name: 'fluentui', test: inPackages('@fluentui', '@griffel'), priority: 30 }, { - name: 'slickgrid', - test: inPackages('slickgrid-react', '@slickgrid-universal'), + name: 'react-data-grid', + test: inPackages('react-data-grid'), priority: 20, }, { @@ -167,7 +167,7 @@ export default defineConfig(async ({ command, mode }) => { 'react/jsx-runtime', 'react/jsx-dev-runtime', '@monaco-editor/react', - 'slickgrid-react', + 'react-data-grid', ...monaco.optimizeDepsInclude, ], }, From f36da780372ace367e2428a623c6c80adef4740e Mon Sep 17 00:00:00 2001 From: Tomasz Naumowicz Date: Thu, 26 Nov 2026 19:42:11 +0100 Subject: [PATCH 027/148] docs: record WI-4a completion and bundle contract Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- build/verification/README.md | 3 ++- .../data-grid/iterations/02-rdg-execution-plan.md | 11 +++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/build/verification/README.md b/build/verification/README.md index e327f9fdd..0ced7221a 100644 --- a/build/verification/README.md +++ b/build/verification/README.md @@ -101,7 +101,8 @@ that view's lazy chunk and its static import closure, never every dynamic child. `facadeModuleId` must match the registry-backed map and appear in the entry's `dynamicImports`. When adding a webview, register its facade in `viewModules` in [`inspect.cjs`](./inspect.cjs) and its page label in [`build-size-report.cjs`](./build-size-report.cjs). -Local Quick Start and Atlas Credentials must always exclude Monaco and SlickGrid. +Local Quick Start and Atlas Credentials must always exclude Monaco. In the JavaScript bundle +graph, React Data Grid is reachable only through Collection View. The packaged manifest's top-level icon and local file paths under `contributes` are required, with missing paths reported alongside their JSON pointers; URLs, substitutions and codicons are excluded. diff --git a/docs/ai-and-plans/features/data-grid/iterations/02-rdg-execution-plan.md b/docs/ai-and-plans/features/data-grid/iterations/02-rdg-execution-plan.md index 22d82d273..d9ed4a637 100644 --- a/docs/ai-and-plans/features/data-grid/iterations/02-rdg-execution-plan.md +++ b/docs/ai-and-plans/features/data-grid/iterations/02-rdg-execution-plan.md @@ -819,6 +819,17 @@ parity. > claimed. Usage: coding 2.6 AIU (5 requests, 38s); checks 0.3 AIU (6 requests, 32s summed). > WI-4a's dependency and grid changes remain planned. +> **Done (2026-11-26), commit `409eceef`:** `mai-code-2` installed the approved exact beta.64 +> pin, removed the SlickGrid runtime, and left the approved Table/Tree placeholders. Leader +> review (98%) retained the existing props/readiness and used an inert, hidden-from-AT empty +> RDG instance to verify the real lazy dependency without exposing functional grid behavior. +> `mai-code-2-flash`: `npm run build`, `npm run package`, L1 inspection and 26 negative controls +> passed. The packaged JS chunk was reachable only through Collection View. Inspector +> `node --test` (this is a `node:test` suite, not a root Vitest match) passed 45 tests; focused +> browser Vitest passed 47. SlickGrid-named BSON shapers and their fixture import remain for +> WI-2b. The existing missing-field l10n call is temporarily removed pending WI-6; no localization +> generation ran. Usage: coding 27.7 AIU (44 requests, 6m48s); checks 0.7 AIU (16 requests, 1m19s). + **WI-3a: scenario runner, keys and focus** · `mai-code-2` (fallback `gpt-6.1-terra`) - Owns: `build/verification/browser/scenarios.ts` (step and assertion type unions only), From 80200fc6b22c52f5e5f40697ca88f1dbde578cb9 Mon Sep 17 00:00:00 2001 From: Tomasz Naumowicz Date: Thu, 26 Nov 2026 19:54:34 +0100 Subject: [PATCH 028/148] feat: shape collection results with stable document identities (WI-2b) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- build/verification/browser/fixtures.ts | 44 +-- src/documentdb/ClusterSession.ts | 68 ++-- .../documentGrid/documentIdentity.test.ts | 122 +++++++ src/utils/documentGrid/documentIdentity.ts | 88 +++++ src/utils/documentGrid/toTablePage.test.ts | 188 ++++++++++ src/utils/documentGrid/toTablePage.ts | 74 ++++ src/utils/documentGrid/toTreeNodes.test.ts | 141 ++++++++ src/utils/documentGrid/toTreeNodes.ts | 94 +++++ src/utils/slickgrid/CellValue.ts | 9 - .../slickgrid/mongo/toSlickGridTable.test.ts | 95 ----- src/utils/slickgrid/mongo/toSlickGridTable.ts | 93 ----- .../slickgrid/mongo/toSlickGridTree.test.ts | 73 ---- src/utils/slickgrid/mongo/toSlickGridTree.ts | 168 --------- .../collectionView/CollectionView.tsx | 341 ++++++++++++------ .../collectionView/collectionViewContext.ts | 33 +- .../collectionView/collectionViewRouter.ts | 8 +- .../resultsTab/DataViewPanelTable.tsx | 25 +- .../resultsTab/DataViewPanelTree.tsx | 9 +- .../typeToDisplayString.ts | 0 19 files changed, 1043 insertions(+), 630 deletions(-) create mode 100644 src/utils/documentGrid/documentIdentity.test.ts create mode 100644 src/utils/documentGrid/documentIdentity.ts create mode 100644 src/utils/documentGrid/toTablePage.test.ts create mode 100644 src/utils/documentGrid/toTablePage.ts create mode 100644 src/utils/documentGrid/toTreeNodes.test.ts create mode 100644 src/utils/documentGrid/toTreeNodes.ts delete mode 100644 src/utils/slickgrid/CellValue.ts delete mode 100644 src/utils/slickgrid/mongo/toSlickGridTable.test.ts delete mode 100644 src/utils/slickgrid/mongo/toSlickGridTable.ts delete mode 100644 src/utils/slickgrid/mongo/toSlickGridTree.test.ts delete mode 100644 src/utils/slickgrid/mongo/toSlickGridTree.ts rename src/webviews/utils/{slickgrid => documentGrid}/typeToDisplayString.ts (100%) diff --git a/build/verification/browser/fixtures.ts b/build/verification/browser/fixtures.ts index a853769bd..1b55b0076 100644 --- a/build/verification/browser/fixtures.ts +++ b/build/verification/browser/fixtures.ts @@ -9,7 +9,7 @@ import { type DockerStatusResult, type InstanceStatusUpdate, } from '../../../src/services/localQuickStart/quickStartTypes'; -import { type CellValue } from '../../../src/utils/slickgrid/CellValue'; +import { type TableRow } from '../../../src/utils/documentGrid/types'; import { type WebviewName } from '../../../src/webviews/_integration/WebviewRegistry'; import { type AtlasCredentialsWebviewConfig } from '../../../src/webviews/documentdb/atlasCredentials/atlasCredentialsController'; import { type ClusterDashboardWebviewConfigurationType } from '../../../src/webviews/documentdb/clusterDashboard/clusterDashboardController'; @@ -435,34 +435,34 @@ export const diagnosticsRowLabels = [ 'Authentication', 'Database access', ] as const; -interface FixtureTableRow { - readonly id: string; - readonly 'x-objectid': string; - readonly _id: CellValue; - readonly name: CellValue; - readonly quantity: CellValue; - readonly [key: string]: unknown; -} -const rows: FixtureTableRow[] = [ +const rows: TableRow[] = [ { - id: 'stage0-row-1', - 'x-objectid': '"stage0-1"', - _id: { value: 'stage0-1', type: 'string' }, - name: { value: 'Stage 0 fixture row Alpha', type: 'string' }, - quantity: { value: '7', type: 'number' }, + rowKey: 'id:"stage0-1"', + documentId: '"stage0-1"', + cells: { + 'root:_id': { display: 'stage0-1', type: 'string' }, + 'field:name': { display: 'Stage 0 fixture row Alpha', type: 'string' }, + 'field:quantity': { display: '7', type: 'number' }, + }, }, { - id: 'stage0-row-2', - 'x-objectid': '"stage0-2"', - _id: { value: 'stage0-2', type: 'string' }, - name: { value: 'Stage 0 fixture row Beta', type: 'string' }, - quantity: { value: '11', type: 'number' }, + rowKey: 'id:"stage0-2"', + documentId: '"stage0-2"', + cells: { + 'root:_id': { display: 'stage0-2', type: 'string' }, + 'field:name': { display: 'Stage 0 fixture row Beta', type: 'string' }, + 'field:quantity': { display: '11', type: 'number' }, + }, }, ]; const table: CollectionOutputs['getCurrentPageAsTable'] = { path: [], - headers: ['_id', 'name', 'quantity'], - data: rows, + columns: [ + { key: 'root:_id', label: '_id', isRootId: true }, + { key: 'field:name', label: 'name', isRootId: false }, + { key: 'field:quantity', label: 'quantity', isRootId: false }, + ], + rows, }; const stage1: CollectionOutputs['queryInsights']['getQueryInsightsStage1'] = { executionTime: 2, diff --git a/src/documentdb/ClusterSession.ts b/src/documentdb/ClusterSession.ts index 2a7ed1ed9..32af25b92 100644 --- a/src/documentdb/ClusterSession.ts +++ b/src/documentdb/ClusterSession.ts @@ -9,8 +9,10 @@ import * as l10n from '@vscode/l10n'; import { EJSON } from 'bson'; import { type Document, type Filter, type WithId } from 'mongodb'; import { ext } from '../extensionVariables'; -import { getDataAtPath } from '../utils/slickgrid/mongo/toSlickGridTable'; -import { toSlickGridTree, type TreeData } from '../utils/slickgrid/mongo/toSlickGridTree'; +import { isIdentityTrustedForProjection } from '../utils/documentGrid/documentIdentity'; +import { toTablePage } from '../utils/documentGrid/toTablePage'; +import { toTreeNodes } from '../utils/documentGrid/toTreeNodes'; +import { type TablePage, type TreeNode } from '../utils/documentGrid/types'; import { type QueryInsightsStage2Response } from '../webviews/documentdb/collectionView/types/queryInsights'; import { ClustersClient, type FindQueryParams } from './ClustersClient'; import { SchemaStore } from './SchemaStore'; @@ -18,28 +20,6 @@ import { fixupDocumentDbExplain } from './utils/fixupDocumentDbExplain'; import { parseDocumentId } from './utils/parseDocumentId'; import { toFilterQueryObj } from './utils/toFilterQuery'; -export type TableDataEntry = { - /** - * The unique identifier for the entry. It is used to identify the document in the table. - * - * @remarks - * The format of this identifier is a copy of the original '_id' value that is converted to EJSON and then stringified. - * This conversion is necessary to facilitate the movement of data between the extension and the webview, - * as webviews do not have access to the BSON library and require the identifier to be in string format. - * - * @type {string} - * @optional - */ - 'x-objectid'?: string; - [key: string]: unknown; -}; - -export interface TableData { - path: string[]; - headers: string[]; - data: TableDataEntry[]; -} - /** * Parsed query parameters with BSON objects * This extends FindQueryParams by providing parsed Document objects @@ -111,6 +91,7 @@ export class ClusterSession { * This is NOT accumulated - it only contains the current page's data. */ private _currentRawDocuments: WithId[] = []; + private _currentPageIdentityTrusted = false; /** * Query Insights caching @@ -177,6 +158,7 @@ export class ClusterSession { // approximate/relative (e.g., "mostly String"). this._currentPageSize = null; this._currentRawDocuments = []; + this._currentPageIdentityTrusted = false; this._lastExecutionTimeMs = undefined; // Clear query insights caches @@ -263,6 +245,7 @@ export class ClusterSession { if (queryLimit > 0 && pageOffset >= queryLimit) { // We're trying to page beyond the query's limit - return empty results this._currentRawDocuments = []; + this._currentPageIdentityTrusted = false; return 0; } @@ -294,6 +277,21 @@ export class ClusterSession { limit: dbLimit, }; + let identityTrusted = true; + if (paginatedQueryParams.project && paginatedQueryParams.project.trim() !== '{}') { + try { + const projection: unknown = parseShellBSON(paginatedQueryParams.project, { mode: ParseMode.Loose }); + identityTrusted = + projection !== null && + typeof projection === 'object' && + !Array.isArray(projection) && + isIdentityTrustedForProjection(projection as Document); + } catch { + // The query execution retains its existing projection-error reporting. + identityTrusted = false; + } + } + // Track execution time for query insights const startTime = performance.now(); const documents: WithId[] = await this._client.runFindQuery( @@ -305,6 +303,7 @@ export class ClusterSession { // Update current page documents (always replace, not accumulate) this._currentRawDocuments = documents; + this._currentPageIdentityTrusted = identityTrusted; // Store database/collection context for schema operations this._databaseName = databaseName; @@ -327,8 +326,8 @@ export class ClusterSession { return this._currentRawDocuments.map((doc) => JSON.stringify(doc, null, 4)); } - public getCurrentPageAsTree(): TreeData[] { - return toSlickGridTree(this._currentRawDocuments); + public getCurrentPageAsTree(): TreeNode[] { + return toTreeNodes(this._currentRawDocuments, this._currentPageIdentityTrusted); } async deleteDocuments(databaseName: string, collectionName: string, documentIds: string[]): Promise { @@ -350,18 +349,13 @@ export class ClusterSession { return acknowledged; } - public getCurrentPageAsTable(path: string[]): TableData { + public getCurrentPageAsTable(path: string[]): TablePage { const store = SchemaStore.getInstance(); - const responsePack: TableData = { - path: path, - headers: - this._databaseName && this._collectionName - ? store.getPropertyNamesAtLevel(this._clusterId, this._databaseName, this._collectionName, path) - : [], - data: getDataAtPath(this._currentRawDocuments, path), - }; - - return responsePack; + const headers = + this._databaseName && this._collectionName + ? store.getPropertyNamesAtLevel(this._clusterId, this._databaseName, this._collectionName, path) + : []; + return toTablePage(this._currentRawDocuments, path, headers, this._currentPageIdentityTrusted); } /** diff --git a/src/utils/documentGrid/documentIdentity.test.ts b/src/utils/documentGrid/documentIdentity.test.ts new file mode 100644 index 000000000..e77aecd29 --- /dev/null +++ b/src/utils/documentGrid/documentIdentity.test.ts @@ -0,0 +1,122 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +import { EJSON, UUID } from 'bson'; +import { BSONRegExp, DBRef, Decimal128, Double, Int32, Long, ObjectId, type Document } from 'mongodb'; +import { describe, expect, it } from 'vitest'; +import { assignRowIdentities, isIdentityTrustedForProjection, toDocumentId } from './documentIdentity'; + +describe('documentIdentity', () => { + it('round-trips falsy, BSON and composite IDs through the existing default action parser', () => { + const ids: unknown[] = [ + 0, + false, + '', + null, + 'plain', + new ObjectId('000000000000000000000001'), + new UUID('00112233-4455-6677-8899-aabbccddeeff'), + new Int32(7), + new Double(1.5), + Decimal128.fromString('1.25'), + new Date('2026-11-26T00:00:00Z'), + { author: 'John', userId: 0, nested: { value: null }, items: [false, ''] }, + ]; + for (const id of ids) { + const canonical = EJSON.stringify(id, { relaxed: false }); + expect(toDocumentId({ _id: id })).toBe(canonical); + expect(EJSON.stringify(EJSON.parse(canonical), { relaxed: false })).toBe(canonical); + } + }); + + it('withholds numeric subtype IDs that the default parser changes', () => { + for (const id of [ + new Double(7), + Long.fromNumber(7), + Long.fromString('9007199254740993'), + { n: Long.fromNumber(7) }, + ]) { + expect(toDocumentId({ _id: id })).toBeUndefined(); + } + }); + + it('requires an own ID and rejects undefined and unsupported root types', () => { + const inherited = Object.create({ _id: 'inherited' }) as Document; + expect(toDocumentId(inherited)).toBeUndefined(); + expect(toDocumentId({})).toBeUndefined(); + for (const id of [ + undefined, + [], + /pattern/, + new BSONRegExp('pattern'), + new Map([['key', 'value']]), + new DBRef('refs', new ObjectId()), + Symbol('id'), + (): void => {}, + new (class UnknownId { + value = 1; + })(), + ]) { + expect(toDocumentId({ _id: id })).toBeUndefined(); + } + }); + + it('rejects operator-like keys, undefined and invalid dates inside composite IDs', () => { + for (const id of [ + { $eq: 'wrong' }, + { nested: { $gt: 0 } }, + { nested: [{ $in: [] }] }, + { nested: undefined }, + { nested: [undefined] }, + { nested: new Date(NaN) }, + new Date(NaN), + ]) { + expect(toDocumentId({ _id: id })).toBeUndefined(); + } + const circular: Document = {}; + circular.self = circular; + expect(toDocumentId({ _id: circular })).toBeUndefined(); + }); + + it('allows prototype-like literal ID fields without treating them as metadata', () => { + const id: unknown = JSON.parse('{"__proto__":"value","constructor":0,"id":false}'); + expect(toDocumentId({ _id: id })).toBe(EJSON.stringify(id, { relaxed: false })); + expect(toDocumentId({ _id: { a: 1, b: 2 } })).not.toBe(toDocumentId({ _id: { b: 2, a: 1 } })); + }); + + it('trusts only unchanged projection provenance and simple root flags', () => { + for (const projection of [undefined, {}, { name: 1 }, { _id: 0 }, { _id: 1 }, { _id: false }, { _id: true }]) { + expect(isIdentityTrustedForProjection(projection)).toBe(true); + } + for (const projection of [ + { _id: '$name' }, + { _id: { $literal: 1 } }, + { _id: { x: 1 } }, + { '_id.x': 1 }, + { _id: undefined }, + ]) { + expect(isIdentityTrustedForProjection(projection)).toBe(false); + } + }); + + it('gives only unique trusted IDs stable keys, leaving every other row positional', () => { + const documents: Document[] = [{ _id: 'unique' }, { _id: 'duplicate' }, {}, { _id: 'duplicate' }, { _id: 0 }]; + const identities = assignRowIdentities(documents, true); + expect(identities).toEqual([ + { rowKey: 'id:"unique"', documentId: '"unique"' }, + { rowKey: 'pos:1' }, + { rowKey: 'pos:2' }, + { rowKey: 'pos:3' }, + { rowKey: 'id:{"$numberInt":"0"}', documentId: '{"$numberInt":"0"}' }, + ]); + expect(assignRowIdentities([...documents].reverse(), true).at(-1)).toEqual(identities[0]); + expect(assignRowIdentities(documents, false)).toEqual(documents.map((_, index) => ({ rowKey: `pos:${index}` }))); + expect(new Set(identities.map((identity) => identity.rowKey)).size).toBe(documents.length); + expect(assignRowIdentities([{ _id: { a: 0 } }, { _id: { a: 0 } }], true)).toEqual([ + { rowKey: 'pos:0' }, + { rowKey: 'pos:1' }, + ]); + }); +}); diff --git a/src/utils/documentGrid/documentIdentity.ts b/src/utils/documentGrid/documentIdentity.ts new file mode 100644 index 000000000..0cb6754b5 --- /dev/null +++ b/src/utils/documentGrid/documentIdentity.ts @@ -0,0 +1,88 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +import { BSONTypes } from '@documentdb-js/schema-analyzer'; +import { EJSON } from 'bson'; +import { type Document } from 'mongodb'; + +export interface PageRowIdentity { + readonly rowKey: string; + readonly documentId?: string; +} + +function isSafeIdentityValue(value: unknown): boolean { + const type = BSONTypes.inferType(value); + if (type === BSONTypes.Undefined || type === BSONTypes._UNKNOWN_) { + return false; + } + if (type === BSONTypes.Date) { + return Number.isFinite((value as Date).getTime()); + } + if (type === BSONTypes.Object || type === BSONTypes.Array) { + if (type === BSONTypes.Object) { + const prototype: unknown = Object.getPrototypeOf(value); + if (prototype !== null && prototype !== Object.prototype) { + return false; + } + } + return Object.entries(value as object).every( + ([key, child]) => !key.startsWith('$') && isSafeIdentityValue(child), + ); + } + return true; +} + +export function toDocumentId(document: Document): string | undefined { + if (!Object.prototype.hasOwnProperty.call(document, '_id')) { + return undefined; + } + + const id: unknown = document._id; + const type = BSONTypes.inferType(id); + if (type === BSONTypes.Array || type === BSONTypes.RegExp || type === BSONTypes.DBRef || type === BSONTypes.Map) { + return undefined; + } + + try { + const canonical = EJSON.stringify(id, { relaxed: false }); + if (typeof canonical !== 'string' || !isSafeIdentityValue(id)) { + return undefined; + } + return EJSON.stringify(EJSON.parse(canonical), { relaxed: false }) === canonical ? canonical : undefined; + } catch { + // Serialization and the existing action parser must both preserve the ID exactly. + return undefined; + } +} + +export function isIdentityTrustedForProjection(projection: Document | undefined): boolean { + if (projection === undefined) { + return true; + } + for (const key of Object.keys(projection)) { + if (key.startsWith('_id.')) { + return false; + } + if (key === '_id' && typeof projection[key] !== 'boolean' && typeof projection[key] !== 'number') { + return false; + } + } + return true; +} + +export function assignRowIdentities(documents: readonly Document[], identityTrusted: boolean): PageRowIdentity[] { + const ids = documents.map((document) => (identityTrusted ? toDocumentId(document) : undefined)); + const counts = new Map(); + for (const id of ids) { + if (id !== undefined) { + counts.set(id, (counts.get(id) ?? 0) + 1); + } + } + return ids.map((documentId, index) => + documentId !== undefined && counts.get(documentId) === 1 + ? { rowKey: `id:${documentId}`, documentId } + : { rowKey: `pos:${index}` }, + ); +} diff --git a/src/utils/documentGrid/toTablePage.test.ts b/src/utils/documentGrid/toTablePage.test.ts new file mode 100644 index 000000000..872407717 --- /dev/null +++ b/src/utils/documentGrid/toTablePage.test.ts @@ -0,0 +1,188 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +import { describe, expect, it, vi } from 'vitest'; + +import { ObjectId, type Document, type WithId } from 'mongodb'; +import { ext } from '../../extensionVariables'; +import { resolveDocumentTargets } from '../../webviews/documentdb/collectionView/collectionViewContext'; +import { toGridCellValue, toTablePage } from './toTablePage'; +import { fieldColumnKey, getCell, ROOT_ID_COLUMN_KEY } from './types'; + +vi.mock('../../extensionVariables', () => ({ ext: { outputChannel: { warn: vi.fn() } } })); + +const jsonDocuments = [ + { + name: 'Document 1', + nestedDocument: { + key: 'value', + anotherKey: 'anotherValue', + }, + array: [ + 'value1', + 'value2', + { + key: 'value', + }, + ], + }, + { + name: 'Document 1', + nestedDocument: { + key: 'value', + subNestedDocument: { + a_key: false, + }, + }, + array: [ + 'value1', + 'value2', + { + key: 'value', + }, + ], + }, + { + title: 'The Favourite', + genres: ['Drama', 'History'], + runtime: 121, + rated: 'R', + year: 2018, + directors: ['Yorgos Lanthimos'], + cast: ['Olivia Colman', 'Emma Stone', 'Rachel Weisz'], + type: 'movie', + }, + { + songName: 'There goes my baby', + firstName: 'Murray', + genre: 'Hip Hop', + recent: '2024-08-20T21:29:34.957Z', + }, + { + songName: 'With Or Without You', + firstName: 'Anastacio', + genre: 'Non Music', + recent: '2024-08-21T02:49:29.160Z', + }, +]; + +const documents: WithId[] = jsonDocuments.map((doc) => { + return { + _id: new ObjectId(), + ...doc, + }; +}); + +describe('toTablePage', () => { + it('at the root', () => { + const page = toTablePage(documents, [], ['name', 'nestedDocument', 'array'], true); + expect(page.rows).toHaveLength(5); + }); + + it('at a nested level', () => { + const page = toTablePage(documents, ['nestedDocument'], ['key', 'anotherKey', 'subNestedDocument'], true); + + expect(page.rows).toHaveLength(5); + expect(getCell(page.rows[0], fieldColumnKey('key'))).toBeDefined(); + expect(getCell(page.rows[1], fieldColumnKey('key'))).toEqual({ display: 'value', type: 'string' }); + expect(getCell(page.rows[0], fieldColumnKey('anotherKey'))).toBeDefined(); + expect(getCell(page.rows[1], fieldColumnKey('subNestedDocument'))).toBeDefined(); + }); + + it('at a 2nd nested level', () => { + const page = toTablePage(documents, ['nestedDocument', 'subNestedDocument'], ['a_key'], true); + expect(page.rows).toHaveLength(5); + expect(getCell(page.rows[1], fieldColumnKey('a_key'))).toEqual({ display: 'false', type: 'boolean' }); + }); + + it('preserves heterogeneous fields, falsy values, arrays and missing versus null', () => { + const page = toTablePage( + [{ _id: 0, value: null, array: [false, null], empty: '' }, { _id: false, value: 0 }, { _id: '' }], + [], + ['_id', 'value', 'array', 'empty', 'knownElsewhere'], + true, + ); + expect(page.columns.map((column) => column.key)).toEqual([ + ROOT_ID_COLUMN_KEY, + 'field:value', + 'field:array', + 'field:empty', + 'field:knownElsewhere', + ]); + expect(getCell(page.rows[0], fieldColumnKey('value'))).toEqual({ display: 'null', type: 'null' }); + expect(getCell(page.rows[1], fieldColumnKey('value'))).toEqual({ display: '0', type: 'double' }); + expect(getCell(page.rows[2], fieldColumnKey('value'))).toBeUndefined(); + expect(getCell(page.rows[0], fieldColumnKey('empty'))).toEqual({ display: '', type: 'string' }); + expect(getCell(page.rows[0], fieldColumnKey('array'))).toEqual({ display: 'array[2]', type: 'array' }); + expect(page.rows.every((row) => row.documentId !== undefined)).toBe(true); + }); + + it('retains root IDs at nested and missing paths while hiding nested _id and inherited fields', () => { + const nested: Document = Object.create({ inherited: 'hidden' }) as Document; + nested._id = 'nested'; + nested.value = null; + const page = toTablePage( + [{ _id: 'root', nested }, { _id: null, nested: null }, { _id: false }], + ['nested'], + ['_id', 'value', 'inherited'], + true, + ); + expect(getCell(page.rows[0], ROOT_ID_COLUMN_KEY)).toEqual({ display: 'root', type: 'string' }); + expect(getCell(page.rows[0], fieldColumnKey('_id'))).toBeUndefined(); + expect(getCell(page.rows[0], fieldColumnKey('inherited'))).toBeUndefined(); + expect(getCell(page.rows[0], fieldColumnKey('value'))).toEqual({ display: 'null', type: 'null' }); + expect(page.rows[1].cells).toEqual({ [ROOT_ID_COLUMN_KEY]: { display: 'null', type: 'null' } }); + expect(page.rows[2].cells).toEqual({ [ROOT_ID_COLUMN_KEY]: { display: 'false', type: 'boolean' } }); + const inheritedPath = toTablePage([{ _id: 'root', nested }], ['nested', 'inherited'], ['value'], true); + expect(Object.keys(inheritedPath.rows[0].cells)).toEqual([ROOT_ID_COLUMN_KEY]); + }); + + it('isolates document metadata from reserved and prototype-like field names', () => { + const document: Document = JSON.parse( + '{"_id":"root","id":"user","x-objectid":"user","__proto__":null,"constructor":false,"root:_id":0,"":""}', + ) as Document; + const page = toTablePage([document], [], Object.keys(document), true); + expect(page.rows[0].documentId).toBe('"root"'); + expect(getCell(page.rows[0], fieldColumnKey('x-objectid'))?.display).toBe('user'); + expect(getCell(page.rows[0], fieldColumnKey('__proto__'))).toEqual({ display: 'null', type: 'null' }); + expect(getCell(page.rows[0], fieldColumnKey('constructor'))?.type).toBe('boolean'); + expect(getCell(page.rows[0], fieldColumnKey('root:_id'))?.type).toBe('double'); + expect(getCell(page.rows[0], fieldColumnKey(''))?.display).toBe(''); + expect(JSON.parse(JSON.stringify(page))).toEqual(page); + }); + + it('keeps cells visible when projection or duplicate IDs withhold actions', () => { + const projected = toTablePage([{ _id: 'computed', value: 1 }], [], ['value'], false); + expect(projected.rows[0]).toMatchObject({ rowKey: 'pos:0' }); + expect(projected.rows[0]).not.toHaveProperty('documentId'); + expect(getCell(projected.rows[0], ROOT_ID_COLUMN_KEY)?.display).toBe('computed'); + const duplicate = toTablePage([{ _id: 'same' }, { _id: 'same' }], [], [], true); + expect(duplicate.rows.map((row) => row.rowKey)).toEqual(['pos:0', 'pos:1']); + expect(duplicate.rows.every((row) => !Object.hasOwn(row, 'documentId'))).toBe(true); + }); + + it('leaves formatter failures blank without failing the page or logging the user value', () => { + const page = toTablePage( + [{ _id: 'root', invalidDate: new Date(NaN), explicitUndefined: undefined }], + [], + [], + true, + ); + expect(getCell(page.rows[0], fieldColumnKey('invalidDate'))).toEqual({ display: '', type: 'date' }); + expect(getCell(page.rows[0], fieldColumnKey('explicitUndefined'))).toEqual({ display: '', type: 'undefined' }); + expect(ext.outputChannel.warn).toHaveBeenCalledWith('[DocumentGrid] Failed to format a cell value'); + expect(toGridCellValue(null)).toEqual({ display: 'null', type: 'null' }); + }); + + it('resolves the whole selection or fails closed for stale or non-actionable keys', () => { + const page = toTablePage([{ _id: 'safe' }, {}], [], [], true); + const safeKey = page.rows[0].rowKey; + expect(resolveDocumentTargets(page, [safeKey])).toEqual([{ rowKey: safeKey, documentId: '"safe"' }]); + expect(resolveDocumentTargets(page, [safeKey, 'pos:1'])).toBeUndefined(); + expect(resolveDocumentTargets(page, [safeKey, 'stale'])).toBeUndefined(); + expect(resolveDocumentTargets(undefined, [safeKey])).toBeUndefined(); + expect(resolveDocumentTargets(page, [])).toEqual([]); + }); +}); diff --git a/src/utils/documentGrid/toTablePage.ts b/src/utils/documentGrid/toTablePage.ts new file mode 100644 index 000000000..71445aa72 --- /dev/null +++ b/src/utils/documentGrid/toTablePage.ts @@ -0,0 +1,74 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +import { BSONTypes, valueToDisplayString } from '@documentdb-js/schema-analyzer'; +import { type Document } from 'mongodb'; +import { ext } from '../../extensionVariables'; +import { assignRowIdentities } from './documentIdentity'; +import { fieldColumnKey, ROOT_ID_COLUMN_KEY, type ColumnKey, type GridCellValue, type TablePage } from './types'; + +export function toGridCellValue(value: unknown): GridCellValue { + const type = BSONTypes.inferType(value); + try { + return { + display: Array.isArray(value) ? `array[${value.length}]` : (valueToDisplayString(value, type) ?? ''), + type, + }; + } catch { + ext.outputChannel.warn('[DocumentGrid] Failed to format a cell value'); + return { display: '', type }; + } +} + +export function toTablePage( + documents: readonly Document[], + path: readonly string[], + headers: readonly string[], + identityTrusted: boolean, +): TablePage { + const identities = assignRowIdentities(documents, identityTrusted); + return { + path: [...path], + columns: [ + { key: ROOT_ID_COLUMN_KEY, label: '_id', isRootId: true }, + ...headers + .filter((field) => field !== '_id') + .map((field) => ({ key: fieldColumnKey(field), label: field, isRootId: false })), + ], + rows: documents.map((document, index) => { + const cells: Partial> = {}; + if (Object.prototype.hasOwnProperty.call(document, '_id')) { + cells[ROOT_ID_COLUMN_KEY] = toGridCellValue(document._id); + } + + let subdocument: unknown = document; + for (const field of path) { + if ( + subdocument !== null && + typeof subdocument === 'object' && + Object.prototype.hasOwnProperty.call(subdocument, field) + ) { + subdocument = (subdocument as Document)[field] as unknown; + } else { + subdocument = undefined; + break; + } + } + + if ( + subdocument !== null && + typeof subdocument === 'object' && + (BSONTypes.inferType(subdocument) === BSONTypes.Object || Array.isArray(subdocument)) + ) { + for (const [field, value] of Object.entries(subdocument)) { + if (field !== '_id') { + cells[fieldColumnKey(field)] = toGridCellValue(value); + } + } + } + return { ...identities[index], cells }; + }), + }; +} diff --git a/src/utils/documentGrid/toTreeNodes.test.ts b/src/utils/documentGrid/toTreeNodes.test.ts new file mode 100644 index 000000000..e5341f1c3 --- /dev/null +++ b/src/utils/documentGrid/toTreeNodes.test.ts @@ -0,0 +1,141 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +import { describe, expect, it } from 'vitest'; + +import { ObjectId, type Document, type WithId } from 'mongodb'; +import { toTreeNodes } from './toTreeNodes'; + +const jsonDocuments = [ + { + name: 'Document 1', + nestedDocument: { + key: 'value', + anotherKey: 'anotherValue', + }, + array: [ + 'value1', + 'value2', + { + key: 'value', + }, + ], + }, + { + title: 'The Favourite', + genres: ['Drama', 'History'], + runtime: 121, + rated: 'R', + year: 2018, + directors: ['Yorgos Lanthimos'], + cast: ['Olivia Colman', 'Emma Stone', 'Rachel Weisz'], + type: 'movie', + }, + { + songName: 'There goes my baby', + firstName: 'Murray', + genre: 'Hip Hop', + recent: '2024-08-20T21:29:34.957Z', + }, + { + songName: 'With Or Without You', + firstName: 'Anastacio', + genre: 'Non Music', + recent: '2024-08-21T02:49:29.160Z', + }, +]; + +const documents: WithId[] = jsonDocuments.map((doc) => { + return { + _id: new ObjectId(), + ...doc, + }; +}); + +describe('toTreeNodes', () => { + it('1 doc -> tree data', () => { + const tree = toTreeNodes([documents[0]], true); + + // 1 root node for 1 document + expect(tree.filter((node) => node.parentKey === null)).toHaveLength(1); + expect(tree).toHaveLength(11); + }); + + it('n docs -> tree data', () => { + const tree = toTreeNodes(documents, true); + + // 4 root nodes for 4 documents + expect(tree.filter((node) => node.parentKey === null)).toHaveLength(4); + expect(tree).toHaveLength(39); + }); + + it('preserves root labels and retains _id fields in the tree', () => { + const objectId = new ObjectId('000000000000000000000001'); + const tree = toTreeNodes([{ _id: null }, {}, { _id: objectId }, { _id: false, nested: { _id: 'child' } }], true); + expect(tree.filter((node) => node.parentKey === null).map((node) => node.field)).toEqual([ + 'null', + '', + objectId.toHexString(), + 'false', + ]); + expect(tree.filter((node) => node.field === '_id')).toHaveLength(4); + expect(tree.find((node) => node.field === '_id' && node.depth === 2)?.value.display).toBe('child'); + expect(tree.find((node) => node.value.type === 'null')?.value.display).toBe('null'); + }); + + it('emits unambiguous path keys in preorder, independent of root document position', () => { + const document = { _id: 'stable', 'a.b': { '': null }, a: { b: false }, values: [{ x: 0 }] }; + const tree = toTreeNodes([document], true); + expect(new Set(tree.map((node) => node.key)).size).toBe(tree.length); + const rootKey = 'id:"stable"'; + expect(tree.find((node) => node.depth === 2 && node.field === '')?.key).toBe( + JSON.stringify([rootKey, 'a.b', '']), + ); + expect(tree.find((node) => node.field === 'x')?.key).toBe(JSON.stringify([rootKey, 'values', 0, 'x'])); + tree.forEach((node, index) => { + if (node.parentKey !== null) { + const parentIndex = tree.findIndex((parent) => parent.key === node.parentKey); + expect(parentIndex).toBeLessThan(index); + expect(tree[parentIndex].depth + 1).toBe(node.depth); + } + }); + const reordered = toTreeNodes([{ _id: 'other' }, document], true); + expect(reordered.filter((node) => (JSON.parse(node.key) as readonly unknown[])[0] === rootKey)).toEqual(tree); + expect(JSON.parse(JSON.stringify(tree))).toEqual(tree); + }); + + it('expands arrays only at the existing bound, with typed index segments and current labels', () => { + const tree = toTreeNodes( + [ + { + _id: 'root', + empty: [], + ten: Array.from({ length: 10 }, (_, i) => i), + eleven: Array(11).fill(null), + }, + ], + true, + ); + const empty = tree.find((node) => node.field === 'empty'); + const ten = tree.find((node) => node.field === 'ten'); + const eleven = tree.find((node) => node.field === 'eleven'); + expect(empty).toMatchObject({ expandable: false, value: { display: '(elements: 0)', type: 'array' } }); + expect(ten).toMatchObject({ expandable: true, value: { display: '(elements: 10)', type: 'array' } }); + expect(eleven).toMatchObject({ expandable: false, value: { display: '(elements: 11)', type: 'array' } }); + expect(tree.filter((node) => node.parentKey === ten?.key)).toHaveLength(10); + expect(tree.find((node) => node.field === 'ten[0]')?.key).toBe(JSON.stringify(['id:"root"', 'ten', 0])); + expect(tree.filter((node) => node.parentKey === eleven?.key)).toHaveLength(0); + }); + + it('keeps all roots distinct for missing, duplicate and untrusted identities', () => { + for (const trusted of [true, false]) { + const tree = toTreeNodes([{ _id: 'same' }, { _id: 'same' }, {}], trusted); + const roots = tree.filter((node) => node.parentKey === null); + expect(roots.map((node) => node.key)).toEqual(['["pos:0"]', '["pos:1"]', '["pos:2"]']); + expect(roots[2].expandable).toBe(false); + expect(new Set(tree.map((node) => node.key)).size).toBe(tree.length); + } + }); +}); diff --git a/src/utils/documentGrid/toTreeNodes.ts b/src/utils/documentGrid/toTreeNodes.ts new file mode 100644 index 000000000..9f0a7f10a --- /dev/null +++ b/src/utils/documentGrid/toTreeNodes.ts @@ -0,0 +1,94 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +import { BSONTypes } from '@documentdb-js/schema-analyzer'; +import { type Document, type ObjectId } from 'mongodb'; +import { assignRowIdentities } from './documentIdentity'; +import { toGridCellValue } from './toTablePage'; +import { type GridCellValue, type TreeNode } from './types'; + +const ARRAY_EXPANSION_LIMIT = 10; + +export function toTreeNodes(documents: readonly Document[], identityTrusted: boolean): TreeNode[] { + const nodes: TreeNode[] = []; + const identities = assignRowIdentities(documents, identityTrusted); + documents.forEach((document, index) => { + const rowKey = identities[index].rowKey; + const rootKey = JSON.stringify([rowKey]); + const id: unknown = Object.prototype.hasOwnProperty.call(document, '_id') ? document._id : undefined; + let field: string; + if (id === null) { + field = 'null'; + } else if (BSONTypes.inferType(id) === BSONTypes.ObjectId) { + field = (id as ObjectId).toHexString(); + } else { + field = JSON.stringify(id) ?? ''; + } + nodes.push({ + key: rootKey, + parentKey: null, + depth: 0, + field, + value: { display: '{...}', type: BSONTypes.Object }, + expandable: Object.keys(document).length > 0, + }); + + const stack = Object.entries(document) + .reverse() + .map(([key, value]) => ({ + segments: [key] as (string | number)[], + field: key, + value: value as unknown, + parentKey: rootKey, + })); + + while (stack.length > 0) { + const entry = stack.pop(); + if (!entry) { + continue; + } + const key = JSON.stringify([rowKey, ...entry.segments]); + const type = BSONTypes.inferType(entry.value); + const children: { segment: string | number; field: string; value: unknown }[] = []; + let value: GridCellValue; + if (type === BSONTypes.Object) { + value = { display: '{...}', type }; + for (const [field, child] of Object.entries(entry.value as object)) { + children.push({ segment: field, field, value: child }); + } + } else if (Array.isArray(entry.value)) { + value = { display: `(elements: ${entry.value.length})`, type }; + if (entry.value.length <= ARRAY_EXPANSION_LIMIT) { + entry.value.forEach((child, childIndex) => { + children.push({ + segment: childIndex, + field: `${entry.field}[${childIndex}]`, + value: child as unknown, + }); + }); + } + } else { + value = toGridCellValue(entry.value); + } + nodes.push({ + key, + parentKey: entry.parentKey, + depth: entry.segments.length, + field: entry.field, + value, + expandable: children.length > 0, + }); + for (const child of children.reverse()) { + stack.push({ + segments: [...entry.segments, child.segment], + field: child.field, + value: child.value, + parentKey: key, + }); + } + } + }); + return nodes; +} diff --git a/src/utils/slickgrid/CellValue.ts b/src/utils/slickgrid/CellValue.ts deleted file mode 100644 index 0fd29836d..000000000 --- a/src/utils/slickgrid/CellValue.ts +++ /dev/null @@ -1,9 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -export interface CellValue { - value: string; - type: string; -} diff --git a/src/utils/slickgrid/mongo/toSlickGridTable.test.ts b/src/utils/slickgrid/mongo/toSlickGridTable.test.ts deleted file mode 100644 index f5dbe10ac..000000000 --- a/src/utils/slickgrid/mongo/toSlickGridTable.test.ts +++ /dev/null @@ -1,95 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -import { describe, expect, it } from 'vitest'; - -import { ObjectId, type Document, type WithId } from 'mongodb'; -import { getDataAtPath } from './toSlickGridTable'; - -const jsonDocuments = [ - { - name: 'Document 1', - nestedDocument: { - key: 'value', - anotherKey: 'anotherValue', - }, - array: [ - 'value1', - 'value2', - { - key: 'value', - }, - ], - }, - { - name: 'Document 1', - nestedDocument: { - key: 'value', - subNestedDocument: { - a_key: false, - }, - }, - array: [ - 'value1', - 'value2', - { - key: 'value', - }, - ], - }, - { - title: 'The Favourite', - genres: ['Drama', 'History'], - runtime: 121, - rated: 'R', - year: 2018, - directors: ['Yorgos Lanthimos'], - cast: ['Olivia Colman', 'Emma Stone', 'Rachel Weisz'], - type: 'movie', - }, - { - songName: 'There goes my baby', - firstName: 'Murray', - genre: 'Hip Hop', - recent: '2024-08-20T21:29:34.957Z', - }, - { - songName: 'With Or Without You', - firstName: 'Anastacio', - genre: 'Non Music', - recent: '2024-08-21T02:49:29.160Z', - }, -]; - -const mongoDocuments: WithId[] = jsonDocuments.map((doc) => { - return { - _id: new ObjectId(), - ...doc, - }; -}); - -describe('toSlickGridTable', () => { - it('at the root', () => { - const tableData = getDataAtPath(mongoDocuments, []); - expect(tableData).toHaveLength(5); - }); - - it('at a nested level', () => { - const tableData = getDataAtPath(mongoDocuments, ['nestedDocument']); - - expect(tableData).toHaveLength(5); - expect(tableData[0]['key']).toBeDefined(); - expect(tableData[1]['key']).toEqual({ value: 'value', type: 'string' }); - expect(tableData[0]['anotherKey']).toBeDefined(); - expect(tableData[1]['subNestedDocument']).toBeDefined(); - }); - - it('at a 2nd nested level', () => { - const tableData = getDataAtPath(mongoDocuments, ['nestedDocument', 'subNestedDocument']); - expect(tableData).toHaveLength(5); - expect(tableData[1]['a_key']).toBeDefined(); - expect(tableData[1]['a_key']).toEqual({ value: 'false', type: 'boolean' }); - }); -}); diff --git a/src/utils/slickgrid/mongo/toSlickGridTable.ts b/src/utils/slickgrid/mongo/toSlickGridTable.ts deleted file mode 100644 index 4952b59e7..000000000 --- a/src/utils/slickgrid/mongo/toSlickGridTable.ts +++ /dev/null @@ -1,93 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -import { BSONTypes, valueToDisplayString } from '@documentdb-js/schema-analyzer'; -import { EJSON } from 'bson'; -import { type Document, type WithId } from 'mongodb'; -import { type TableDataEntry } from '../../../documentdb/ClusterSession'; - -/** - * Extracts data from a list of MongoDB documents at a specified path. - * - * @param documents - An array of MongoDB documents with an ID. - * @param path - An array of strings representing the path to extract data from within each document. - * @returns An array of objects representing the extracted data at the specified path. - * - * @remarks - * This function ensures that each row has a unique ID by appending a random element to the ID prefix. - * It also handles the special case of the '_id' field, ensuring it is always included in the data. - * If the path leads to an array, the function will note the number of elements in the array. - * - * @todo Address the issue where the approach solves problems with the tree view but not with the table view. - */ -export function getDataAtPath(documents: WithId[], path: string[]): TableDataEntry[] { - const result = new Array(); - - /** - * adding a random element to the idPrefix to make sure that the IDs are unique - * otherwise, while the data is being updated in the tree, the ID would be the - * same and the tree would always update - * - * todo: continue on this. surprisingly this approach solves issues with the tree view - * but not with the table view - */ - const randomId = Date.now().toString().slice(-6); - - let i = 0; - for (const doc of documents) { - i++; - const row: TableDataEntry = { id: `${i}/${randomId}` }; // inject the randomId to make sure the IDs are unique - - // at the root level, extract the objectId for further data edits - // we also make sure that the '_id' field is always included in the data! - if (doc._id) { - row['_id'] = { - value: valueToDisplayString(doc._id, BSONTypes.inferType(doc._id)), - type: BSONTypes.inferType(doc._id), - }; - // TODO: problem here -> what if the user has a field with this name... - row['x-objectid'] = EJSON.stringify(doc._id, { relaxed: false }); // this is crucial, we need to retain the _id field for future queries from the table view - } - - // traverse the path to get the level required - let subdocument: Document = doc; - for (const key of path) { - if (subdocument instanceof Object && subdocument[key]) { - subdocument = subdocument[key] as Document; - } else { - // easy, just abort here, and set the subdocument to an empty object - subdocument = {}; - break; - } - } - - if (subdocument !== undefined) { - // now, we have the subdocument, we can add all its keys to the row - for (const key of Object.keys(subdocument)) { - if (key === '_id') { - // _id has been processed already - continue; - } else { - const value: unknown = subdocument[key]; - const type: BSONTypes = BSONTypes.inferType(value); - - // eslint-disable-next-line - if (value instanceof Array) { - row[key] = { - value: `array[${value.length}]`, - type: BSONTypes.Array, - }; - } else { - row[key] = { value: valueToDisplayString(value, type), type: type }; - } - } - } - } - - result.push(row); - } - - return result; -} diff --git a/src/utils/slickgrid/mongo/toSlickGridTree.test.ts b/src/utils/slickgrid/mongo/toSlickGridTree.test.ts deleted file mode 100644 index db4a7a3e8..000000000 --- a/src/utils/slickgrid/mongo/toSlickGridTree.test.ts +++ /dev/null @@ -1,73 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -import { describe, expect, it } from 'vitest'; - -import { ObjectId, type Document, type WithId } from 'mongodb'; -import { documentToSlickGridTree, toSlickGridTree } from './toSlickGridTree'; - -const jsonDocuments = [ - { - name: 'Document 1', - nestedDocument: { - key: 'value', - anotherKey: 'anotherValue', - }, - array: [ - 'value1', - 'value2', - { - key: 'value', - }, - ], - }, - { - title: 'The Favourite', - genres: ['Drama', 'History'], - runtime: 121, - rated: 'R', - year: 2018, - directors: ['Yorgos Lanthimos'], - cast: ['Olivia Colman', 'Emma Stone', 'Rachel Weisz'], - type: 'movie', - }, - { - songName: 'There goes my baby', - firstName: 'Murray', - genre: 'Hip Hop', - recent: '2024-08-20T21:29:34.957Z', - }, - { - songName: 'With Or Without You', - firstName: 'Anastacio', - genre: 'Non Music', - recent: '2024-08-21T02:49:29.160Z', - }, -]; - -const mongoDocuments: WithId[] = jsonDocuments.map((doc) => { - return { - _id: new ObjectId(), - ...doc, - }; -}); - -describe('toSlickGridTree', () => { - it('1 doc -> tree data', () => { - const tree = documentToSlickGridTree(mongoDocuments[0]); - - // 1 root node for 1 document - expect(tree.filter((node) => node.parentId === null)).toHaveLength(1); - expect(tree).toHaveLength(11); - }); - - it('n docs -> tree data', () => { - const tree = toSlickGridTree(mongoDocuments); - - // 4 root nodes for 4 documents - expect(tree.filter((node) => node.parentId === null)).toHaveLength(4); - expect(tree).toHaveLength(39); - }); -}); diff --git a/src/utils/slickgrid/mongo/toSlickGridTree.ts b/src/utils/slickgrid/mongo/toSlickGridTree.ts deleted file mode 100644 index 11a8ccce2..000000000 --- a/src/utils/slickgrid/mongo/toSlickGridTree.ts +++ /dev/null @@ -1,168 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -import { BSONTypes, valueToDisplayString } from '@documentdb-js/schema-analyzer'; -import { type Document, type ObjectId, type WithId } from 'mongodb'; - -/** - * The data structure for a single node entry in the tree data structure for SlickGrid. - * - * @id - The unique identifier of the node, it's an internal field, has to be unique, won't be shown. - * @parentId - The unique identifier of the parent node, it's an internal field, has to be unique, won't be shown. - * - * @field - The name of the field int the MongoDB document (to be shown to the user). - * @value - The value of the field in the MongoDB document (to be shown to the user). - * @type - The detected data type of the value in the MongoDB document (to be shown to the user). - */ -export type TreeData = { id: string; parentId: string | null; field: string; value: string; type: string }; - -/** - * The data structure for a single column definition in the tree data structure for SlickGrid. - * These entries are required to keep the actual structure of the data and the columns in sync - */ -export type TreeDataColumnDefinition = { id: string; name: string; field: string; minWidth: number }; - -const ARRAY_EXPANSION_LIMIT = 10; // allow array expansion only when the number of elements is less than this limit, TODO: move this to settings later - -/** - * Handling the conversion of an array of MongoDB documents to a tree structure for SlickGrid. - * - * @param documents an array of MongoDB documents to convert to a tree structure for SlickGrid. - * @returns - */ -export function toSlickGridTree(documents: WithId[]): TreeData[] { - const tree: TreeData[] = []; - - /** - * adding a random element to the idPrefix to make sure that the IDs are unique - * otherwise, while the data is being updated in the tree, the ID would be the - * same and the tree would always update - */ - const randomId = Date.now().toString().slice(-6); - - documents.forEach((doc, index) => { - const documentTree = documentToSlickGridTree(doc, `${index}/${randomId}-`); - tree.push(...documentTree); - }); - - return tree; -} - -/** - * Handling the conversion of a single document to a tree structure for SlickGrid. - * Taking care of the nested objects and arrays. Basic preorder traversal with a stack. - * - * @param document - The MongoDB document to convert to a tree structure. - * @param idPrefix - The prefix to use for the IDs of the entries in the tree data structure. - * This is useful when converting multiple documents to tree structures. - * The internal id generated with always be a string, converted from a number - * that increments by one on each entry, but the prefix can be used to differentiate - * between different documents in case you're merging them into a single tree later on. - */ -export function documentToSlickGridTree(document: WithId, idPrefix?: string): TreeData[] { - const tree: TreeData[] = []; - - let localEntryId = 0; // starts with 0 on each document - if (idPrefix === undefined || idPrefix === null) { - idPrefix = ''; - } - - /** - * Introducing an artificail root element with the value of the '_id' field of the document. - * Next, all document fields at the top level (including the '_id' field) will be added as children of this root. - */ - - const rootId = `${idPrefix}${localEntryId}`; // localEntryId is always a 0 here - - // Handle document._id which could be null - let idFieldValue: string; - if (document._id === null) { - idFieldValue = 'null'; - } else if (document._id?._bsontype === 'ObjectId') { - idFieldValue = document._id.toString(); - } else { - idFieldValue = JSON.stringify(document._id); - } - - tree.push({ - id: rootId, - field: idFieldValue, - value: '{...}', - type: 'Document', - parentId: null, - }); - - const stack: { key: string; value: unknown; parentId: string | null }[] = Object.entries(document).map( - ([key, value]) => ({ - parentId: rootId, - key: key, - // eslint-disable-next-line -- the value can be anything here as it comes from a MongoDB document - value: value, - }), - ); - - while (stack.length > 0) { - localEntryId++; - const globalEntryId = `${idPrefix}${localEntryId}`; // combines the global prefix with the local id - - const stackEntry = stack.pop(); - if (!stackEntry) { - continue; - } - - const dataType: BSONTypes = BSONTypes.inferType(stackEntry.value); - - switch (dataType) { - case BSONTypes.Object: { - tree.push({ - id: globalEntryId, - field: `${stackEntry.key}`, - value: `{...}`, - type: 'Object', - parentId: stackEntry.parentId, - }); - - // Add the properties of the object to the stack - Object.entries(stackEntry.value as ObjectId).map(([key, value]) => { - stack.push({ key: `${key}`, value: value, parentId: globalEntryId }); - }); - break; - } - case BSONTypes.Array: { - const value = stackEntry.value as unknown[]; - - tree.push({ - id: globalEntryId, - field: `${stackEntry.key}`, - value: `(elements: ${value.length})`, - type: 'Array', - parentId: stackEntry.parentId, - }); - - if (value.length <= ARRAY_EXPANSION_LIMIT) { - // Add the elements of the array to the stack - value.forEach((element, index) => { - stack.push({ key: `${stackEntry.key}[${index}]`, value: element, parentId: globalEntryId }); - }); - } - break; - } - - default: { - // over time, this generic case should never be called once we cover all BSON types - tree.push({ - id: globalEntryId, - field: `${stackEntry.key}`, - value: valueToDisplayString(stackEntry.value, dataType), - type: BSONTypes.toDisplayString(BSONTypes.inferType(stackEntry.value)), - parentId: stackEntry.parentId, - }); - break; - } - } - } - - return tree; -} diff --git a/src/webviews/documentdb/collectionView/CollectionView.tsx b/src/webviews/documentdb/collectionView/CollectionView.tsx index b8dd7918b..bc5d6a18e 100644 --- a/src/webviews/documentdb/collectionView/CollectionView.tsx +++ b/src/webviews/documentdb/collectionView/CollectionView.tsx @@ -7,8 +7,15 @@ import { Button, ProgressBar, Tab, TabList } from '@fluentui/react-components'; import { EmojiRegular } from '@fluentui/react-icons'; import { useConfiguration } from '@microsoft/vscode-ext-webview/react'; import * as l10n from '@vscode/l10n'; -import { type JSX, useEffect, useRef, useState } from 'react'; -import { type TableDataEntry } from '../../../documentdb/ClusterSession'; +import { type JSX, useCallback, useEffect, useRef, useState } from 'react'; +import { + fieldFromColumnKey, + getCell, + ROOT_ID_COLUMN_KEY, + type ColumnKey, + type TablePage, + type TreeNode, +} from '../../../utils/documentGrid/types'; import { useTrpcClient } from '../../_integration/useTrpcClient'; import { useViewLoadTelemetry } from '../../_integration/useViewLoadTelemetry'; import { Announcer } from '../../components/accessibility'; @@ -19,6 +26,7 @@ import { CollectionViewContext, type CollectionViewContextType, DefaultCollectionViewContext, + resolveDocumentTargets, Views, } from './collectionViewContext'; import { type CollectionViewWebviewConfigurationType } from './collectionViewController'; @@ -37,12 +45,8 @@ import { QueryInsightsMain } from './queryInsightsTab/QueryInsightsTab'; import { extractErrorCode } from './utils/errorCodeExtractor'; interface QueryResults { - tableHeaders?: string[]; - tableData?: TableDataEntry[]; // 'x-objectid': string; - tableCurrentPath?: string[]; - - treeData?: { [key: string]: unknown }[]; - + tablePage?: TablePage; + treeNodes?: TreeNode[]; jsonDocuments?: string[]; /** Number of documents returned by the query (for screen reader announcements) */ @@ -69,6 +73,7 @@ export const CollectionView = (): JSX.Element => { */ const firstLoadStartedAtRef = useRef(undefined); const firstLoadClaimedRef = useRef(false); + const firstLoadDocumentCountRef = useRef(undefined); /** * Please note: using the context and states inside of closures can lead to stale data. @@ -160,11 +165,34 @@ export const CollectionView = (): JSX.Element => { // keep Refs updated with the current state const currentQueryResultsRef = useRef(currentQueryResults); const currentContextRef = useRef(currentContext); + const dataRequestRef = useRef(0); + const cachedQueryRef = useRef(undefined); + const tablePageQueryRef = useRef(undefined); + currentQueryResultsRef.current = currentQueryResults; + currentContextRef.current = currentContext; - useEffect(() => { - currentQueryResultsRef.current = currentQueryResults; - currentContextRef.current = currentContext; - }, [currentQueryResults, currentContext]); + const handleSelectedRowKeysChange = useCallback((selectedRowKeys: readonly string[]): void => { + setCurrentContext((prev) => { + const targets = + !prev.isLoading && + prev.currentView === Views.TABLE && + tablePageQueryRef.current === prev.activeQuery + ? resolveDocumentTargets(currentQueryResultsRef.current?.tablePage, selectedRowKeys) + : undefined; + const next = { + ...prev, + dataSelection: { selectedRowKeys: [...selectedRowKeys] }, + commands: { + disableAddDocument: false, + disableViewDocument: targets?.length !== 1, + disableEditDocument: targets?.length !== 1, + disableDeleteDocument: !targets?.length, + }, + }; + currentContextRef.current = next; + return next; + }); + }, []); /** * Reset query insights when query changes (not on pagination) @@ -278,36 +306,51 @@ export const CollectionView = (): JSX.Element => { * within various controls (query panel, paging, etc.). */ - function getDataForView(selectedView: Views, onSettled?: (loaded: boolean) => void): void { + function settleFirstLoad(outcome: 'dataShown' | 'empty' | 'failed'): void { + const startedAt = firstLoadStartedAtRef.current; + if (startedAt === undefined) { + return; + } + firstLoadStartedAtRef.current = undefined; + viewLoad.reportFirstData(outcome, performance.now() - startedAt); + } + + function getDataForView(selectedView: Views): void { + if (cachedQueryRef.current !== currentContextRef.current.activeQuery) { + return; + } + const request = ++dataRequestRef.current; + const query = currentContextRef.current.activeQuery; + const path = [...(currentContextRef.current.currentViewState?.currentPath ?? [])]; + const isCurrentRequest = (): boolean => + request === dataRequestRef.current && + query === currentContextRef.current.activeQuery && + selectedView === currentContextRef.current.currentView && + (selectedView !== Views.TABLE || + JSON.stringify(path) === + JSON.stringify(currentContextRef.current.currentViewState?.currentPath ?? [])); switch (selectedView) { case Views.TABLE: { - const path = currentContext.currentViewState?.currentPath ?? []; - trpcClient.mongoClusters.collectionView.getCurrentPageAsTable .query(path) .then((result) => { - let tableHeaders: string[]; - - /* - * If the _id is not in the headers, we add it as the first column. - * This is a presentation detail, not a data detail, that's why it's done - * here, in the view, not in the controller. - */ - if (result.headers.find((header) => header === '_id') === undefined) { - tableHeaders = ['_id', ...result.headers]; - } else { - tableHeaders = result.headers ?? []; + if (!isCurrentRequest() || JSON.stringify(result.path) !== JSON.stringify(path)) { + return; } - + tablePageQueryRef.current = query; + currentQueryResultsRef.current = { ...currentQueryResultsRef.current, tablePage: result }; setCurrentQueryResults((prev) => ({ ...prev, - tableHeaders: tableHeaders, - tableData: (result.data as TableDataEntry[]) ?? [], + tablePage: result, })); - onSettled?.(true); + handleSelectedRowKeysChange([]); + settleFirstLoad(firstLoadDocumentCountRef.current === 0 ? 'empty' : 'dataShown'); }) .catch((error) => { - onSettled?.(false); + if (!isCurrentRequest()) { + return; + } + settleFirstLoad('failed'); void trpcClient.common.displayErrorMessage.mutate({ message: l10n.t('Error while loading the data'), modal: false, @@ -320,14 +363,20 @@ export const CollectionView = (): JSX.Element => { trpcClient.mongoClusters.collectionView.getCurrentPageAsTree .query() .then((result) => { + if (!isCurrentRequest()) { + return; + } setCurrentQueryResults((prev) => ({ ...prev, - treeData: result, + treeNodes: result, })); - onSettled?.(true); + settleFirstLoad(firstLoadDocumentCountRef.current === 0 ? 'empty' : 'dataShown'); }) .catch((error) => { - onSettled?.(false); + if (!isCurrentRequest()) { + return; + } + settleFirstLoad('failed'); void trpcClient.common.displayErrorMessage.mutate({ message: l10n.t('Error while loading the data'), modal: false, @@ -339,14 +388,20 @@ export const CollectionView = (): JSX.Element => { trpcClient.mongoClusters.collectionView.getCurrentPageAsJson .query() .then((result) => { + if (!isCurrentRequest()) { + return; + } setCurrentQueryResults((prev) => ({ ...prev, jsonDocuments: result, })); - onSettled?.(true); + settleFirstLoad(firstLoadDocumentCountRef.current === 0 ? 'empty' : 'dataShown'); }) .catch((error) => { - onSettled?.(false); + if (!isCurrentRequest()) { + return; + } + settleFirstLoad('failed'); void trpcClient.common.displayErrorMessage.mutate({ message: l10n.t('Error while loading the data'), modal: false, @@ -355,7 +410,7 @@ export const CollectionView = (): JSX.Element => { }); break; default: - onSettled?.(true); + settleFirstLoad(firstLoadDocumentCountRef.current === 0 ? 'empty' : 'dataShown'); break; } } @@ -383,22 +438,25 @@ export const CollectionView = (): JSX.Element => { } useEffect(() => { - setCurrentContext((prev) => ({ ...prev, isLoading: true })); + let cancelled = false; + cachedQueryRef.current = undefined; + ++dataRequestRef.current; + setCurrentContext((prev) => ({ + ...prev, + isLoading: true, + commands: { + ...prev.commands, + disableViewDocument: true, + disableEditDocument: true, + disableDeleteDocument: true, + }, + })); const isFirstLoad = !firstLoadClaimedRef.current; if (isFirstLoad) { firstLoadClaimedRef.current = true; firstLoadStartedAtRef.current = performance.now(); } - const settleFirstLoad = (outcome: 'dataShown' | 'empty' | 'failed'): void => { - const startedAt = firstLoadStartedAtRef.current; - if (!isFirstLoad || startedAt === undefined) { - return; - } - firstLoadStartedAtRef.current = undefined; - viewLoad.reportFirstData(outcome, performance.now() - startedAt); - }; - // 1. Run the query, this operation only acknowledges the request. // Next we need to load the ones we need. trpcClient.mongoClusters.collectionView.runFindQuery @@ -413,6 +471,11 @@ export const CollectionView = (): JSX.Element => { executionIntent: currentContext.activeQuery.executionIntent ?? 'pagination', }) .then((response) => { + if (cancelled || currentContext.activeQuery !== currentContextRef.current.activeQuery) { + return; + } + cachedQueryRef.current = currentContext.activeQuery; + firstLoadDocumentCountRef.current = response.documentCount; // Store document count for screen reader announcements (skip pagination) if (currentContext.activeQuery.executionIntent !== 'pagination') { setCurrentQueryResults((prev) => ({ ...prev, documentCount: response.documentCount })); @@ -423,9 +486,7 @@ export const CollectionView = (): JSX.Element => { updateAutoCompletionData(); // 3. Load the data for the current view - getDataForView(currentContext.currentView, (loaded) => - settleFirstLoad(!loaded ? 'failed' : response.documentCount === 0 ? 'empty' : 'dataShown'), - ); + getDataForView(currentContextRef.current.currentView); // 4. Non-blocking Stage 1 prefetch to populate cache. Only on a // fresh query (initial/refresh): pagination keeps the same @@ -441,9 +502,15 @@ export const CollectionView = (): JSX.Element => { setCurrentContext((prev) => ({ ...prev, isLoading: false, isFirstTimeLoad: false })); }) .catch(async (error) => { + if (cancelled || currentContext.activeQuery !== currentContextRef.current.activeQuery) { + return; + } settleFirstLoad('failed'); const cause = error instanceof Error ? error.message : String(error); const explained = await trpcClient.common.explainOperationFailure.query({ message: cause }); + if (cancelled || currentContext.activeQuery !== currentContextRef.current.activeQuery) { + return; + } void trpcClient.common.displayErrorMessage.mutate({ message: explained ?? l10n.t('Error while running the query'), modal: true, @@ -451,8 +518,14 @@ export const CollectionView = (): JSX.Element => { }); }) .finally(() => { - setCurrentContext((prev) => ({ ...prev, isLoading: false, isFirstTimeLoad: false })); + if (!cancelled && currentContext.activeQuery === currentContextRef.current.activeQuery) { + setCurrentContext((prev) => ({ ...prev, isLoading: false, isFirstTimeLoad: false })); + } }); + return (): void => { + cancelled = true; + ++dataRequestRef.current; + }; }, [currentContext.activeQuery]); useEffect(() => { @@ -477,13 +550,31 @@ export const CollectionView = (): JSX.Element => { console.debug('Failed to report an event:', error); }); + handleSelectedRowKeysChange([]); + currentContextRef.current = { ...currentContextRef.current, currentView: selection }; setCurrentContext((prev) => ({ ...prev, currentView: selection })); getDataForView(selection); }; function handleDeleteDocumentRequest(): void { + const context = currentContextRef.current; + if ( + context.isLoading || + context.currentView !== Views.TABLE || + tablePageQueryRef.current !== context.activeQuery + ) { + return; + } + const targets = resolveDocumentTargets( + currentQueryResultsRef.current?.tablePage, + context.dataSelection.selectedRowKeys, + ); + if (!targets?.length) { + return; + } + const requestedIds = targets.map((target) => target.documentId); trpcClient.mongoClusters.collectionView.deleteDocumentsById - .mutate(currentContext.dataSelection.selectedDocumentObjectIds) + .mutate(requestedIds) .then((acknowledged) => { if (!acknowledged) { return; @@ -495,23 +586,39 @@ export const CollectionView = (): JSX.Element => { * the changes immediately without potential focus/table resizing issues etc. */ - setCurrentQueryResults((prev) => ({ - ...prev, - tableData: prev?.tableData?.filter( - (row) => - !currentContextRef.current.dataSelection.selectedDocumentObjectIds.includes( - row['x-objectid'] ?? '', - ), - ), - })); - - setCurrentContext((prev) => ({ - ...prev, - dataSelection: { - selectedDocumentIndexes: [], - selectedDocumentObjectIds: [], - }, - })); + const page = currentQueryResultsRef.current?.tablePage; + if (!page) { + return; + } + const removedKeys = new Set( + page.rows + .filter((row) => row.documentId !== undefined && requestedIds.includes(row.documentId)) + .map((row) => row.rowKey), + ); + const nextPage = { ...page, rows: page.rows.filter((row) => !removedKeys.has(row.rowKey)) }; + currentQueryResultsRef.current = { ...currentQueryResultsRef.current, tablePage: nextPage }; + setCurrentQueryResults((prev) => ({ ...prev, tablePage: nextPage })); + setCurrentContext((prev) => { + const selectedRowKeys = prev.dataSelection.selectedRowKeys.filter((key) => !removedKeys.has(key)); + const remainingTargets = + !prev.isLoading && + prev.currentView === Views.TABLE && + tablePageQueryRef.current === prev.activeQuery + ? resolveDocumentTargets(currentQueryResultsRef.current?.tablePage, selectedRowKeys) + : undefined; + const next = { + ...prev, + dataSelection: { selectedRowKeys }, + commands: { + disableAddDocument: false, + disableViewDocument: remainingTargets?.length !== 1, + disableEditDocument: remainingTargets?.length !== 1, + disableDeleteDocument: !remainingTargets?.length, + }, + }; + currentContextRef.current = next; + return next; + }); }) .catch((error) => { void trpcClient.common.displayErrorMessage.mutate({ @@ -523,8 +630,23 @@ export const CollectionView = (): JSX.Element => { } function handleViewDocumentRequest(): void { + const context = currentContextRef.current; + if ( + context.isLoading || + context.currentView !== Views.TABLE || + tablePageQueryRef.current !== context.activeQuery + ) { + return; + } + const targets = resolveDocumentTargets( + currentQueryResultsRef.current?.tablePage, + context.dataSelection.selectedRowKeys, + ); + if (targets?.length !== 1) { + return; + } trpcClient.mongoClusters.collectionView.viewDocumentById - .mutate(currentContext.dataSelection.selectedDocumentObjectIds[0]) + .mutate(targets[0].documentId) .catch((error) => { void trpcClient.common.displayErrorMessage.mutate({ message: l10n.t('Error opening the document view'), @@ -535,8 +657,23 @@ export const CollectionView = (): JSX.Element => { } function handleEditDocumentRequest(): void { + const context = currentContextRef.current; + if ( + context.isLoading || + context.currentView !== Views.TABLE || + tablePageQueryRef.current !== context.activeQuery + ) { + return; + } + const targets = resolveDocumentTargets( + currentQueryResultsRef.current?.tablePage, + context.dataSelection.selectedRowKeys, + ); + if (targets?.length !== 1) { + return; + } trpcClient.mongoClusters.collectionView.editDocumentById - .mutate(currentContext.dataSelection.selectedDocumentObjectIds[0]) + .mutate(targets[0].documentId) .catch((error) => { void trpcClient.common.displayErrorMessage.mutate({ message: l10n.t('Error opening the document view'), @@ -556,46 +693,29 @@ export const CollectionView = (): JSX.Element => { }); } - function handleStepInRequest(row: number, cell: number): void { - // Always use the ref to access latest data - const queryResults = currentQueryResultsRef.current; - - const activeDocument: TableDataEntry = queryResults?.tableData?.[row] ?? {}; - const activeColumn: string = queryResults?.tableHeaders?.[cell] ?? ''; - - // Add proper property existence check - if (!(activeColumn in activeDocument)) { - console.debug('Column does not exist in document:', activeColumn); - return; - } - - const activeCell = activeDocument[activeColumn]; - - // Add proper null check - if (activeCell === undefined || activeCell === null) { - console.debug('Cell value is undefined for column:', activeColumn); - return; - } - - console.debug('Step-in requested on cell', activeCell, 'in row', row, 'column', cell); - - if (activeColumn === '_id') { - console.debug('Cell is an _id, skipping step-in'); - return; - } - - // Type guard for safer property access + function handleStepInRequest(rowKey: string, columnKey: ColumnKey): void { + const page = currentQueryResultsRef.current?.tablePage; + const context = currentContextRef.current; + const path = context.currentViewState?.currentPath ?? []; + const row = page?.rows.find((candidate) => candidate.rowKey === rowKey); + const field = fieldFromColumnKey(columnKey); if ( - typeof activeCell !== 'object' || - activeCell === null || - !('type' in activeCell) || - activeCell.type !== 'object' + !page || + !row || + context.isLoading || + context.currentView !== Views.TABLE || + tablePageQueryRef.current !== context.activeQuery || + JSON.stringify(page.path) !== JSON.stringify(path) || + columnKey === ROOT_ID_COLUMN_KEY || + field === undefined || + field === '_id' || + !page.columns.some((column) => column.key === columnKey && !column.isRootId) || + getCell(row, columnKey)?.type !== 'object' ) { - console.debug('Cell is not an object, skipping step-in'); return; } - const newPath = [...(currentContextRef.current.currentViewState?.currentPath ?? []), activeColumn]; + const newPath = [...path, field]; setCurrentContext((prev) => ({ ...prev, @@ -763,13 +883,14 @@ export const CollectionView = (): JSX.Element => { { 'Table View': ( ), 'Tree View': ( - + ), 'JSON View': ( diff --git a/src/webviews/documentdb/collectionView/collectionViewContext.ts b/src/webviews/documentdb/collectionView/collectionViewContext.ts index 53649c8c3..495b6f3f3 100644 --- a/src/webviews/documentdb/collectionView/collectionViewContext.ts +++ b/src/webviews/documentdb/collectionView/collectionViewContext.ts @@ -6,6 +6,7 @@ import { createContext } from 'react'; import { DocumentViewMode as Views } from '../../../documentdb/DocumentViewMode'; import { type AIIndexRecommendation } from '../../../services/ai/types'; +import { type TablePage } from '../../../utils/documentGrid/types'; import { type QueryInsightsStage1Response, type QueryInsightsStage2Response } from './types/queryInsights'; import { type QueryInsightsStreamUsage } from './types/queryInsightsStream'; @@ -274,6 +275,30 @@ export type TableViewState = { currentPath: string[]; }; +export interface DocumentTarget { + readonly rowKey: string; + readonly documentId: string; +} + +export function resolveDocumentTargets( + page: TablePage | undefined, + selectedRowKeys: readonly string[], +): DocumentTarget[] | undefined { + if (!page) { + return undefined; + } + const rows = new Map(page.rows.map((row) => [row.rowKey, row])); + const targets: DocumentTarget[] = []; + for (const rowKey of selectedRowKeys) { + const row = rows.get(rowKey); + if (row?.documentId === undefined) { + return undefined; + } + targets.push({ rowKey, documentId: row.documentId }); + } + return targets; +} + export type CollectionViewContextType = { isLoading: boolean; // this is a concious decision to use 'isLoading' instead of tags. It's not only the data display component that is supposed to react to the lading state but also some input fields, buttons, etc. isFirstTimeLoad: boolean; // this will be set to true during the first data fetch, here we need more time and add more loading animations, but only on the first load @@ -298,10 +323,7 @@ export type CollectionViewContextType = { disableDeleteDocument: boolean; }; dataSelection: { - // real document _id values, for easier lookup - selectedDocumentObjectIds: string[]; - // actual index in the current snapshot of the data, for easier lookup - selectedDocumentIndexes: number[]; + readonly selectedRowKeys: readonly string[]; }; queryEditor?: { getCurrentQuery: () => { @@ -349,8 +371,7 @@ export const DefaultCollectionViewContext: CollectionViewContextType = { disableDeleteDocument: true, }, dataSelection: { - selectedDocumentObjectIds: [], - selectedDocumentIndexes: [], + selectedRowKeys: [], }, isAiRowVisible: false, // `idle` is the pre-first-query resting state. The prefetch in diff --git a/src/webviews/documentdb/collectionView/collectionViewRouter.ts b/src/webviews/documentdb/collectionView/collectionViewRouter.ts index 04c77c478..965b0e4dc 100644 --- a/src/webviews/documentdb/collectionView/collectionViewRouter.ts +++ b/src/webviews/documentdb/collectionView/collectionViewRouter.ts @@ -285,9 +285,9 @@ export const collectionsViewRouter = router({ const myCtx = ctx as RouterContext; const session: ClusterSession = ClusterSession.getSession(myCtx.sessionId); - const tableData = session.getCurrentPageAsTable(input); + const tablePage = session.getCurrentPageAsTable(input); - return tableData; + return tablePage; }), getCurrentPageAsTree: publicProcedureWithTelemetry // procedure type @@ -295,9 +295,9 @@ export const collectionsViewRouter = router({ const myCtx = ctx as RouterContext; const session: ClusterSession = ClusterSession.getSession(myCtx.sessionId); - const treeData = session.getCurrentPageAsTree(); + const treeNodes = session.getCurrentPageAsTree(); - return treeData; + return treeNodes; }), getCurrentPageAsJson: publicProcedureWithTelemetry // procedure type diff --git a/src/webviews/documentdb/collectionView/components/resultsTab/DataViewPanelTable.tsx b/src/webviews/documentdb/collectionView/components/resultsTab/DataViewPanelTable.tsx index ead594afe..142876c11 100644 --- a/src/webviews/documentdb/collectionView/components/resultsTab/DataViewPanelTable.tsx +++ b/src/webviews/documentdb/collectionView/components/resultsTab/DataViewPanelTable.tsx @@ -6,21 +6,28 @@ import * as React from 'react'; import { DataGrid } from 'react-data-grid'; import 'react-data-grid/lib/styles.css'; -import { type TableDataEntry } from '../../../../../documentdb/ClusterSession'; +import { type ColumnKey, type TablePage } from '../../../../../utils/documentGrid/types'; import { CollectionViewContext } from '../../collectionViewContext'; import { LoadingAnimationTable } from './LoadingAnimationTable'; -interface Props { - liveHeaders: string[]; - liveData: TableDataEntry[]; - handleStepIn: (row: number, cell: number) => void; +interface DataViewPanelTableProps { + readonly page: TablePage | undefined; + readonly selectedRowKeys: readonly string[]; + readonly onSelectedRowKeysChange: (rowKeys: readonly string[]) => void; + readonly onStepIn: (rowKey: string, columnKey: ColumnKey) => void; } -export function DataViewPanelTable({ liveHeaders, liveData, handleStepIn }: Props): React.JSX.Element { +export function DataViewPanelTable({ + page, + selectedRowKeys, + onSelectedRowKeysChange, + onStepIn, +}: DataViewPanelTableProps): React.JSX.Element { const [currentContext] = React.useContext(CollectionViewContext); - void liveHeaders; - void liveData; - void handleStepIn; + void page; + void selectedRowKeys; + void onStepIn; + React.useEffect(() => (): void => onSelectedRowKeysChange([]), [onSelectedRowKeysChange]); if (currentContext.isFirstTimeLoad) { return ; diff --git a/src/webviews/documentdb/collectionView/components/resultsTab/DataViewPanelTree.tsx b/src/webviews/documentdb/collectionView/components/resultsTab/DataViewPanelTree.tsx index 4da71f9c5..29791bfd9 100644 --- a/src/webviews/documentdb/collectionView/components/resultsTab/DataViewPanelTree.tsx +++ b/src/webviews/documentdb/collectionView/components/resultsTab/DataViewPanelTree.tsx @@ -4,12 +4,13 @@ *--------------------------------------------------------------------------------------------*/ import * as React from 'react'; +import { type TreeNode } from '../../../../../utils/documentGrid/types'; -interface Props { - liveData: { [key: string]: unknown }[]; +interface DataViewPanelTreeProps { + readonly nodes: readonly TreeNode[]; } -export const DataViewPanelTree = ({ liveData }: Props): React.JSX.Element => { - void liveData; +export const DataViewPanelTree = ({ nodes }: DataViewPanelTreeProps): React.JSX.Element => { + void nodes; return <>; }; diff --git a/src/webviews/utils/slickgrid/typeToDisplayString.ts b/src/webviews/utils/documentGrid/typeToDisplayString.ts similarity index 100% rename from src/webviews/utils/slickgrid/typeToDisplayString.ts rename to src/webviews/utils/documentGrid/typeToDisplayString.ts From 3e1002d8fd45c487990d463199088cedb7cb475d Mon Sep 17 00:00:00 2001 From: Tomasz Naumowicz Date: Thu, 26 Nov 2026 19:55:27 +0100 Subject: [PATCH 029/148] docs: record WI-2b acceptance and advisor verdict Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .../data-grid/iterations/02-rdg-execution-plan.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/docs/ai-and-plans/features/data-grid/iterations/02-rdg-execution-plan.md b/docs/ai-and-plans/features/data-grid/iterations/02-rdg-execution-plan.md index d9ed4a637..d7d52f0c0 100644 --- a/docs/ai-and-plans/features/data-grid/iterations/02-rdg-execution-plan.md +++ b/docs/ai-and-plans/features/data-grid/iterations/02-rdg-execution-plan.md @@ -863,6 +863,19 @@ parity. - Check: `npx vitest run src/utils/` and `npx tsc --noEmit -p .` - Advisor: logic review before commit (persisted-data and cross-module impact). +> **Done (2026-11-26), commit `80200fc6`:** `gpt-6.1-sol` migrated the table/tree shapers, +> default fixture and existing consumers to neutral shapes. The changes preserve root identity +> and reject unsafe or lossy IDs as targets without filtering row selection. Actions resolve +> against the current page; delete acknowledgements use a snapshot of requested IDs. Advised +> (`claude-opus-5.5`, approve at 84%): BSON round-trip and projection checks fail closed, +> stale targets cannot resolve to another ID, pre-delete find-response reappearance is a +> pre-existing non-destructive race for WI-7, and O5 remains out of scope. The leader accepted +> that verdict and kept current RPC names/inputs and telemetry. Seventeen cases added; shared +> build, browser type check and all 22 shaping tests passed. The browser suite's only failure +> was the concurrent WI-4b palette fixture (fixed there without changing the assertion). +> Usage: coding 79.9 AIU (20 requests, 8m05s); advisor 80.1 AIU (12 requests, 2m06s); +> shared checks 0.4 AIU (9 requests, 41s summed). + **WI-4b: grid theme** · `mai-code-2` (fallback `gpt-6.1-terra`) - Owns: a new `src/webviews/documentdb/collectionView/components/resultsTab/dataGridTheme.scss` From 51284437c5e722f1ed213f6c352d6c3b632aa177 Mon Sep 17 00:00:00 2001 From: Tomasz Naumowicz Date: Thu, 26 Nov 2026 19:55:39 +0100 Subject: [PATCH 030/148] feat: map document grid theme to VS Code colors (WI-4b) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- build/verification/browser/scenario-theme.css | 6 +++ .../components/resultsTab/dataGridTheme.scss | 51 +++++++++++++++++++ 2 files changed, 57 insertions(+) create mode 100644 src/webviews/documentdb/collectionView/components/resultsTab/dataGridTheme.scss diff --git a/build/verification/browser/scenario-theme.css b/build/verification/browser/scenario-theme.css index 1bd3e7957..80cf10fbf 100644 --- a/build/verification/browser/scenario-theme.css +++ b/build/verification/browser/scenario-theme.css @@ -21,6 +21,7 @@ --vscode-editorWidget-border: #454545; --vscode-panel-border: #2b2b2b; --vscode-widget-border: #313131; + --vscode-contrastBorder: initial; --vscode-focusBorder: #0078d4; --vscode-input-background: #313131; --vscode-input-foreground: #cccccc; @@ -32,6 +33,7 @@ --vscode-icon-foreground: #cccccc; --vscode-list-hoverBackground: #2a2d2e; --vscode-list-activeSelectionBackground: #04395e; + --vscode-list-activeSelectionForeground: #ffffff; --vscode-list-inactiveSelectionBackground: #37373d; --vscode-list-inactiveSelectionForeground: #cccccc; --vscode-toolbar-hoverBackground: #383b3d; @@ -66,6 +68,7 @@ --vscode-editorWidget-border: #d4d4d4; --vscode-panel-border: #d4d4d4; --vscode-widget-border: #d4d4d4; + --vscode-contrastBorder: initial; --vscode-focusBorder: #005fb8; --vscode-input-background: #ffffff; --vscode-input-foreground: #3b3b3b; @@ -77,6 +80,7 @@ --vscode-icon-foreground: #424242; --vscode-list-hoverBackground: #f2f2f2; --vscode-list-activeSelectionBackground: #e4e6f1; + --vscode-list-activeSelectionForeground: #3b3b3b; --vscode-list-inactiveSelectionBackground: #e4e6f1; --vscode-list-inactiveSelectionForeground: #3b3b3b; --vscode-toolbar-hoverBackground: #dddddd; @@ -111,6 +115,7 @@ --vscode-editorWidget-border: #6fc3df; --vscode-panel-border: #6fc3df; --vscode-widget-border: #6fc3df; + --vscode-contrastBorder: #6fc3df; --vscode-focusBorder: #f38518; --vscode-input-background: #000000; --vscode-input-foreground: #ffffff; @@ -122,6 +127,7 @@ --vscode-icon-foreground: #ffffff; --vscode-list-hoverBackground: #0f4a85; --vscode-list-activeSelectionBackground: #0f4a85; + --vscode-list-activeSelectionForeground: #ffffff; --vscode-list-inactiveSelectionBackground: #000000; --vscode-list-inactiveSelectionForeground: #ffffff; --vscode-toolbar-hoverBackground: #0f4a85; diff --git a/src/webviews/documentdb/collectionView/components/resultsTab/dataGridTheme.scss b/src/webviews/documentdb/collectionView/components/resultsTab/dataGridTheme.scss new file mode 100644 index 000000000..46355fdde --- /dev/null +++ b/src/webviews/documentdb/collectionView/components/resultsTab/dataGridTheme.scss @@ -0,0 +1,51 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +.documentDataGrid { + @media (forced-colors: none) { + --rdg-color: var(--vscode-editor-foreground, var(--vscode-foreground)); + --rdg-background-color: var(--vscode-editor-background); + --rdg-border-color: var( + --vscode-contrastBorder, + var(--vscode-panel-border, var(--vscode-widget-border, var(--vscode-editorWidget-border))) + ); + --rdg-header-background-color: var( + --vscode-editorWidget-background, + var(--vscode-editor-background) + ); + --rdg-header-draggable-background-color: var( + --vscode-list-hoverBackground, + var(--vscode-editorWidget-background, var(--vscode-editor-background)) + ); + --rdg-row-hover-background-color: var( + --vscode-list-hoverBackground, + var(--vscode-editorWidget-background, var(--vscode-editor-background)) + ); + --rdg-row-selected-background-color: var( + --vscode-list-inactiveSelectionBackground, + var(--vscode-list-activeSelectionBackground, var(--vscode-list-hoverBackground)) + ); + --rdg-row-selected-hover-background-color: var( + --vscode-list-activeSelectionBackground, + var(--vscode-list-inactiveSelectionBackground, var(--vscode-list-hoverBackground)) + ); + --rdg-selection-color: var(--vscode-focusBorder); + --rdg-checkbox-focus-color: var(--vscode-focusBorder); + + [role='row'][aria-selected='true'] { + color: var(--vscode-list-inactiveSelectionForeground, var(--vscode-editor-foreground)); + + &:hover { + color: var( + --vscode-list-activeSelectionForeground, + var( + --vscode-list-inactiveSelectionForeground, + var(--vscode-editor-foreground) + ) + ); + } + } + } +} From f2acf5ef69de14fb8cb57daa753618cea6fb6466 Mon Sep 17 00:00:00 2001 From: Tomasz Naumowicz Date: Thu, 26 Nov 2026 19:55:53 +0100 Subject: [PATCH 031/148] docs: record WI-4b theme verification Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .../data-grid/iterations/02-rdg-execution-plan.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/docs/ai-and-plans/features/data-grid/iterations/02-rdg-execution-plan.md b/docs/ai-and-plans/features/data-grid/iterations/02-rdg-execution-plan.md index d7d52f0c0..362a647b3 100644 --- a/docs/ai-and-plans/features/data-grid/iterations/02-rdg-execution-plan.md +++ b/docs/ai-and-plans/features/data-grid/iterations/02-rdg-execution-plan.md @@ -884,6 +884,14 @@ parity. - Not: the grid components (WI-5 imports the file). - Check: `npm run build`. Visual check happens in WI-5's scenarios and at G2. +> **Done (2026-11-26), commit `51284437`:** `mai-code-2` defined `.documentDataGrid` using +> editor/list/focus/contrast tokens and left RDG's OS forced-colors rules alone. Leader review +> (98%) confirmed the selector is scoped and distinguishes selection from focus. The unchanged +> palette contract found two missing fixture tokens, so one corrective turn supplied them in +> each simulated theme. Shared build, Sass compile and all 47 browser scenario tests passed; +> no runtime visual claim until WI-5/G2 applies the class. Usage: coding 7.5 AIU +> (12 requests, 1m36s); Sass and palette checks 0.2 AIU (5 requests, 28s summed). + **WI-3b: Collection View fixtures and scenarios** · `mai-code-2` (fallback `gpt-6.1-terra`) · after WI-2b, WI-3a, WI-4a - Owns: a new `build/verification/browser/collectionViewFixtures.ts`, the `collectionView` entry in From b6851a97450cd2209aabe104bddc6bc057fe0628 Mon Sep 17 00:00:00 2001 From: Tomasz Naumowicz Date: Thu, 26 Nov 2026 20:10:31 +0100 Subject: [PATCH 032/148] test: add Collection View grid scenario fixtures (WI-3b) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .../browser/collectionViewFixtures.ts | 506 ++++++++++++++++++ build/verification/browser/scenarios.test.ts | 66 ++- build/verification/browser/scenarios.ts | 29 +- 3 files changed, 597 insertions(+), 4 deletions(-) create mode 100644 build/verification/browser/collectionViewFixtures.ts diff --git a/build/verification/browser/collectionViewFixtures.ts b/build/verification/browser/collectionViewFixtures.ts new file mode 100644 index 000000000..b9b24ee45 --- /dev/null +++ b/build/verification/browser/collectionViewFixtures.ts @@ -0,0 +1,506 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +import { DocumentViewMode } from '../../../src/documentdb/DocumentViewMode'; +import { + fieldColumnKey, + ROOT_ID_COLUMN_KEY, + type TablePage, + type TableRow, + type TreeNode, +} from '../../../src/utils/documentGrid/types'; +import { type CollectionViewWebviewConfigurationType } from '../../../src/webviews/documentdb/collectionView/collectionViewController'; +import { type FixtureOutputs, type TypedRpcFixtures } from './core/fixtures'; + +type CollectionOutputs = FixtureOutputs['mongoClusters']['collectionView']; +type TablePageOutput = CollectionOutputs['getCurrentPageAsTable']; +type CollectionViewFixture = { + readonly config?: Partial; + readonly rpc: TypedRpcFixtures; + readonly readiness?: { + readonly selectors?: readonly string[]; + readonly noProgressbar?: boolean; + }; +} & ( + | { + readonly tablePage: TablePage; + readonly treeNodes?: never; + } + | { + readonly tablePage?: never; + readonly treeNodes: readonly TreeNode[]; + } +); + +const mixedTypesPage: TablePageOutput = { + path: [], + columns: [ + { key: ROOT_ID_COLUMN_KEY, label: '_id', isRootId: true }, + { key: fieldColumnKey('text'), label: 'text', isRootId: false }, + { key: fieldColumnKey('count'), label: 'count', isRootId: false }, + { key: fieldColumnKey('active'), label: 'active', isRootId: false }, + { key: fieldColumnKey('created'), label: 'created', isRootId: false }, + { key: fieldColumnKey('amount'), label: 'amount', isRootId: false }, + { key: fieldColumnKey('objectId'), label: 'objectId', isRootId: false }, + { key: fieldColumnKey('uuid'), label: 'uuid', isRootId: false }, + { key: fieldColumnKey('binary'), label: 'binary', isRootId: false }, + { key: fieldColumnKey('array'), label: 'array', isRootId: false }, + { key: fieldColumnKey('object'), label: 'object', isRootId: false }, + ], + rows: [ + { + rowKey: 'id:{"$oid":"000000000000000000000001"}', + documentId: '{"$oid":"000000000000000000000001"}', + cells: { + [ROOT_ID_COLUMN_KEY]: { display: '000000000000000000000001', type: 'objectid' }, + [fieldColumnKey('text')]: { display: 'fixture text', type: 'string' }, + [fieldColumnKey('count')]: { display: '7', type: 'int32' }, + [fieldColumnKey('active')]: { display: 'true', type: 'boolean' }, + [fieldColumnKey('created')]: { display: '2026-01-02T03:04:05.000Z', type: 'date' }, + [fieldColumnKey('amount')]: { display: '12.50', type: 'decimal128' }, + [fieldColumnKey('objectId')]: { display: '000000000000000000000002', type: 'objectid' }, + [fieldColumnKey('uuid')]: { + display: '00112233-4455-6677-8899-aabbccddeeff', + type: 'uuid', + }, + [fieldColumnKey('binary')]: { display: 'AQI=', type: 'binary' }, + [fieldColumnKey('array')]: { display: 'array[3]', type: 'array' }, + [fieldColumnKey('object')]: { display: '{...}', type: 'object' }, + }, + }, + { + rowKey: 'id:{"$binary":{"base64":"ABEiM0RVZneImaq7zN3u/w==","subType":"04"}}', + documentId: '{"$binary":{"base64":"ABEiM0RVZneImaq7zN3u/w==","subType":"04"}}', + cells: { + [ROOT_ID_COLUMN_KEY]: { + display: '00112233-4455-6677-8899-aabbccddeeff', + type: 'uuid', + }, + [fieldColumnKey('text')]: { display: '', type: 'string' }, + [fieldColumnKey('count')]: { display: '-4.5', type: 'double' }, + [fieldColumnKey('active')]: { display: 'false', type: 'boolean' }, + [fieldColumnKey('created')]: { display: '2026-01-03T00:00:00.000Z', type: 'date' }, + [fieldColumnKey('amount')]: { display: '0', type: 'long' }, + [fieldColumnKey('objectId')]: { display: '000000000000000000000003', type: 'objectid' }, + [fieldColumnKey('uuid')]: { + display: '00112233-4455-6677-8899-aabbccddee00', + type: 'uuid', + }, + [fieldColumnKey('binary')]: { display: 'AwQ=', type: 'binary' }, + [fieldColumnKey('array')]: { display: 'array[0]', type: 'array' }, + [fieldColumnKey('object')]: { display: '{...}', type: 'object' }, + }, + }, + ], +}; + +const missingVsNullPage: TablePageOutput = { + path: [], + columns: [ + { key: ROOT_ID_COLUMN_KEY, label: '_id', isRootId: true }, + { key: fieldColumnKey('value'), label: 'value', isRootId: false }, + ], + rows: [ + { + rowKey: 'id:"missing-value"', + documentId: '"missing-value"', + cells: { [ROOT_ID_COLUMN_KEY]: { display: 'missing-value', type: 'string' } }, + }, + { + rowKey: 'id:"null-value"', + documentId: '"null-value"', + cells: { + [ROOT_ID_COLUMN_KEY]: { display: 'null-value', type: 'string' }, + [fieldColumnKey('value')]: { display: 'null', type: 'null' }, + }, + }, + ], +}; + +const heterogeneousPage: TablePageOutput = { + path: [], + columns: [ + { key: ROOT_ID_COLUMN_KEY, label: '_id', isRootId: true }, + { key: fieldColumnKey('name'), label: 'name', isRootId: false }, + { key: fieldColumnKey('quantity'), label: 'quantity', isRootId: false }, + { key: fieldColumnKey('details'), label: 'details', isRootId: false }, + { key: fieldColumnKey('tags'), label: 'tags', isRootId: false }, + ], + rows: [ + { + rowKey: 'id:"heterogeneous-1"', + documentId: '"heterogeneous-1"', + cells: { + [ROOT_ID_COLUMN_KEY]: { display: 'heterogeneous-1', type: 'string' }, + [fieldColumnKey('name')]: { display: 'Alpha', type: 'string' }, + [fieldColumnKey('quantity')]: { display: '4', type: 'int32' }, + [fieldColumnKey('tags')]: { display: 'array[2]', type: 'array' }, + }, + }, + { + rowKey: 'id:"heterogeneous-2"', + documentId: '"heterogeneous-2"', + cells: { + [ROOT_ID_COLUMN_KEY]: { display: 'heterogeneous-2', type: 'string' }, + [fieldColumnKey('name')]: { display: 'Beta', type: 'string' }, + [fieldColumnKey('details')]: { display: '{...}', type: 'object' }, + }, + }, + { + rowKey: 'id:"heterogeneous-3"', + documentId: '"heterogeneous-3"', + cells: { + [ROOT_ID_COLUMN_KEY]: { display: 'heterogeneous-3', type: 'string' }, + [fieldColumnKey('quantity')]: { display: 'unavailable', type: 'string' }, + [fieldColumnKey('details')]: { display: 'null', type: 'null' }, + }, + }, + ], +}; + +const deepRowKey = 'id:"deep-root"'; +const deepRootKey = JSON.stringify([deepRowKey]); +const deepProfileKey = JSON.stringify([deepRowKey, 'profile']); +const deepAddressKey = JSON.stringify([deepRowKey, 'profile', 'address']); +const deepLocationKey = JSON.stringify([deepRowKey, 'profile', 'address', 'location']); +const deepNestingNodes: TreeNode[] = [ + { + key: deepRootKey, + parentKey: null, + depth: 0, + field: '"deep-root"', + value: { display: '{...}', type: 'object' }, + expandable: true, + }, + { + key: JSON.stringify([deepRowKey, '_id']), + parentKey: deepRootKey, + depth: 1, + field: '_id', + value: { display: 'deep-root', type: 'string' }, + expandable: false, + }, + { + key: deepProfileKey, + parentKey: deepRootKey, + depth: 1, + field: 'profile', + value: { display: '{...}', type: 'object' }, + expandable: true, + }, + { + key: deepAddressKey, + parentKey: deepProfileKey, + depth: 2, + field: 'address', + value: { display: '{...}', type: 'object' }, + expandable: true, + }, + { + key: deepLocationKey, + parentKey: deepAddressKey, + depth: 3, + field: 'location', + value: { display: '{...}', type: 'object' }, + expandable: true, + }, + { + key: JSON.stringify([deepRowKey, 'profile', 'address', 'location', 'coordinates']), + parentKey: deepLocationKey, + depth: 4, + field: 'coordinates', + value: { display: '{...}', type: 'object' }, + expandable: true, + }, + { + key: JSON.stringify([deepRowKey, 'profile', 'address', 'location', 'coordinates', 'latitude']), + parentKey: JSON.stringify([deepRowKey, 'profile', 'address', 'location', 'coordinates']), + depth: 5, + field: 'latitude', + value: { display: '47.6062', type: 'double' }, + expandable: false, + }, + { + key: JSON.stringify([deepRowKey, 'profile', 'address', 'location', 'coordinates', 'longitude']), + parentKey: JSON.stringify([deepRowKey, 'profile', 'address', 'location', 'coordinates']), + depth: 5, + field: 'longitude', + value: { display: '-122.3321', type: 'double' }, + expandable: false, + }, +]; + +const arraysRowKey = 'id:"arrays-root"'; +const arraysRootKey = JSON.stringify([arraysRowKey]); +const emptyArrayKey = JSON.stringify([arraysRowKey, 'empty']); +const tenArrayKey = JSON.stringify([arraysRowKey, 'ten']); +const elevenArrayKey = JSON.stringify([arraysRowKey, 'eleven']); +const arrayNodes: TreeNode[] = [ + { + key: arraysRootKey, + parentKey: null, + depth: 0, + field: '"arrays-root"', + value: { display: '{...}', type: 'object' }, + expandable: true, + }, + { + key: JSON.stringify([arraysRowKey, '_id']), + parentKey: arraysRootKey, + depth: 1, + field: '_id', + value: { display: 'arrays-root', type: 'string' }, + expandable: false, + }, + { + key: emptyArrayKey, + parentKey: arraysRootKey, + depth: 1, + field: 'empty', + value: { display: '(elements: 0)', type: 'array' }, + expandable: false, + }, + { + key: tenArrayKey, + parentKey: arraysRootKey, + depth: 1, + field: 'ten', + value: { display: '(elements: 10)', type: 'array' }, + expandable: true, + }, + ...Array.from({ length: 10 }, (_, index): TreeNode => ({ + key: JSON.stringify([arraysRowKey, 'ten', index]), + parentKey: tenArrayKey, + depth: 2, + field: `ten[${index}]`, + value: { display: `${index}`, type: 'int32' }, + expandable: false, + })), + { + key: elevenArrayKey, + parentKey: arraysRootKey, + depth: 1, + field: 'eleven', + value: { display: '(elements: 11)', type: 'array' }, + expandable: false, + }, +]; + +const page500Rows: TableRow[] = Array.from({ length: 500 }, (_, index): TableRow => { + const documentId = JSON.stringify(`page-${index.toString().padStart(3, '0')}`); + return { + rowKey: `id:${documentId}`, + documentId, + cells: { + [ROOT_ID_COLUMN_KEY]: { display: `page-${index.toString().padStart(3, '0')}`, type: 'string' }, + [fieldColumnKey('position')]: { display: `${index}`, type: 'int32' }, + }, + }; +}); +const page500: TablePageOutput = { + path: [], + columns: [ + { key: ROOT_ID_COLUMN_KEY, label: '_id', isRootId: true }, + { key: fieldColumnKey('position'), label: 'position', isRootId: false }, + ], + rows: page500Rows, +}; + +const htmlValuesPage: TablePageOutput = { + path: [], + columns: [ + { key: ROOT_ID_COLUMN_KEY, label: '_id', isRootId: true }, + { key: fieldColumnKey('displayText'), label: 'displayText', isRootId: false }, + ], + rows: [ + { + rowKey: 'id:"html-looking"', + documentId: '"html-looking"', + cells: { + [ROOT_ID_COLUMN_KEY]: { display: 'html-looking', type: 'string' }, + [fieldColumnKey('displayText')]: { + display: 'display-only text & literal angle brackets < >', + type: 'string', + }, + }, + }, + ], +}; + +const emptyPage: TablePageOutput = { + path: [], + columns: [{ key: ROOT_ID_COLUMN_KEY, label: '_id', isRootId: true }], + rows: [], +}; + +const noIdPage: TablePageOutput = { + path: [], + columns: [ + { key: ROOT_ID_COLUMN_KEY, label: '_id', isRootId: true }, + { key: fieldColumnKey('name'), label: 'name', isRootId: false }, + ], + rows: [ + { + rowKey: 'pos:0', + cells: { + [fieldColumnKey('name')]: { display: 'Browse only', type: 'string' }, + }, + }, + { + rowKey: 'id:"ordinary-target"', + documentId: '"ordinary-target"', + cells: { + [ROOT_ID_COLUMN_KEY]: { display: 'ordinary-target', type: 'string' }, + [fieldColumnKey('name')]: { display: 'Ordinary target', type: 'string' }, + }, + }, + ], +}; + +export const collectionViewFixtures = { + 'mixed-types': { + tablePage: mixedTypesPage, + rpc: { + 'mongoClusters.collectionView.runFindQuery': { + type: 'query', + results: [{ documentCount: mixedTypesPage.rows.length }], + }, + 'mongoClusters.collectionView.getCurrentPageAsTable': { + type: 'query', + results: [mixedTypesPage], + }, + }, + }, + 'missing-vs-null': { + tablePage: missingVsNullPage, + rpc: { + 'mongoClusters.collectionView.runFindQuery': { + type: 'query', + results: [{ documentCount: missingVsNullPage.rows.length }], + }, + 'mongoClusters.collectionView.getCurrentPageAsTable': { + type: 'query', + results: [missingVsNullPage], + }, + }, + }, + heterogeneous: { + tablePage: heterogeneousPage, + rpc: { + 'mongoClusters.collectionView.runFindQuery': { + type: 'query', + results: [{ documentCount: heterogeneousPage.rows.length }], + }, + 'mongoClusters.collectionView.getCurrentPageAsTable': { + type: 'query', + results: [heterogeneousPage], + }, + }, + }, + 'deep-nesting': { + config: { initialDocumentView: DocumentViewMode.TREE }, + treeNodes: deepNestingNodes, + rpc: { + 'mongoClusters.collectionView.runFindQuery': { type: 'query', results: [{ documentCount: 1 }] }, + 'mongoClusters.collectionView.getCurrentPageAsTree': { + type: 'query', + results: [deepNestingNodes], + }, + }, + }, + arrays: { + config: { initialDocumentView: DocumentViewMode.TREE }, + treeNodes: arrayNodes, + rpc: { + 'mongoClusters.collectionView.runFindQuery': { type: 'query', results: [{ documentCount: 1 }] }, + 'mongoClusters.collectionView.getCurrentPageAsTree': { + type: 'query', + results: [arrayNodes], + }, + }, + }, + 'page-500': { + config: { defaultPageSize: 500 }, + tablePage: page500, + rpc: { + 'mongoClusters.collectionView.runFindQuery': { + type: 'query', + results: [{ documentCount: page500.rows.length }], + }, + 'mongoClusters.collectionView.getCurrentPageAsTable': { + type: 'query', + results: [page500], + }, + }, + }, + 'html-values': { + tablePage: htmlValuesPage, + rpc: { + 'mongoClusters.collectionView.runFindQuery': { + type: 'query', + results: [{ documentCount: htmlValuesPage.rows.length }], + }, + 'mongoClusters.collectionView.getCurrentPageAsTable': { + type: 'query', + results: [htmlValuesPage], + }, + }, + }, + empty: { + tablePage: emptyPage, + rpc: { + 'mongoClusters.collectionView.runFindQuery': { type: 'query', results: [{ documentCount: 0 }] }, + 'mongoClusters.collectionView.getCurrentPageAsTable': { + type: 'query', + results: [emptyPage], + }, + }, + }, + 'no-id': { + tablePage: noIdPage, + rpc: { + 'mongoClusters.collectionView.runFindQuery': { + type: 'query', + results: [{ documentCount: noIdPage.rows.length }], + }, + 'mongoClusters.collectionView.getCurrentPageAsTable': { + type: 'query', + results: [noIdPage], + }, + }, + }, + 'first-load': { + tablePage: emptyPage, + readiness: { + selectors: ['.collectionView', '.monaco-editor'], + noProgressbar: false, + }, + rpc: { + 'mongoClusters.collectionView.runFindQuery': { + type: 'query', + results: [], + keepOpen: true, + }, + 'mongoClusters.collectionView.getCurrentPageAsTable': { + type: 'query', + results: [emptyPage], + }, + }, + }, +} as const satisfies Readonly< + Record< + | 'mixed-types' + | 'missing-vs-null' + | 'heterogeneous' + | 'deep-nesting' + | 'arrays' + | 'page-500' + | 'html-values' + | 'empty' + | 'no-id' + | 'first-load', + CollectionViewFixture + > +>; diff --git a/build/verification/browser/scenarios.test.ts b/build/verification/browser/scenarios.test.ts index 597b80ec6..4cc6130fa 100644 --- a/build/verification/browser/scenarios.test.ts +++ b/build/verification/browser/scenarios.test.ts @@ -6,6 +6,7 @@ import { readFileSync, readdirSync } from 'node:fs'; import { resolve } from 'node:path'; import { describe, expect, it } from 'vitest'; +import { collectionViewFixtures } from './collectionViewFixtures'; import { type TypedRpcFixtures } from './core/fixtures'; import { diagnosticsRowLabels, fixtures, type DiagnosticsRow } from './fixtures'; import { parseScenarioRoute, runnerRoutes, scenarioHtml, scenarioIndex, scenarioRunner } from './scenario-server'; @@ -32,11 +33,70 @@ describe('L2-dev manifest and routes', (): void => { it('round-trips every scenario and theme, without duplicate routes', (): void => { const routes = scenarioRoutes(); - expect(routes).toHaveLength(171); - expect(new Set(routes.map((route): string => route.path)).size).toBe(171); + expect(routes).toHaveLength(201); + expect(new Set(routes.map((route): string => route.path)).size).toBe(201); for (const route of routes) expect(parseScenarioRoute(route.path)).toEqual(route); }); + it('provides the ten Collection View fixtures in every theme', (): void => { + const expected = [ + 'mixed-types', + 'missing-vs-null', + 'heterogeneous', + 'deep-nesting', + 'arrays', + 'page-500', + 'html-values', + 'empty', + 'no-id', + 'first-load', + ]; + expect(Object.keys(collectionViewFixtures)).toEqual(expected); + for (const name of expected) { + expect( + scenarioRoutes() + .filter((route): boolean => route.view === 'collectionView' && route.scenario === name) + .map((route) => route.theme), + ).toEqual(['dark', 'light', 'high-contrast']); + expect(scenarios.collectionView[name as keyof typeof scenarios.collectionView].readiness.content).toEqual([ + 'Documents', + ]); + expect( + scenarios.collectionView[name as keyof typeof scenarios.collectionView].readiness.selectors, + ).not.toContainEqual(expect.stringMatching(/row|gridcell/i)); + } + }); + + it('provides exactly 500 distinct physical Collection View fixture rows', (): void => { + const page = collectionViewFixtures['page-500'].tablePage; + expect(page.rows).toHaveLength(500); + expect(new Set(page.rows.map((row) => row.rowKey)).size).toBe(500); + expect(collectionViewFixtures['page-500'].config.defaultPageSize).toBe(500); + }); + + it('keeps browse-only Collection View rows distinct from ordinary action targets', (): void => { + const page = collectionViewFixtures['no-id'].tablePage; + expect(page.rows[0]).toMatchObject({ rowKey: 'pos:0' }); + expect(page.rows[0]).not.toHaveProperty('documentId'); + expect(page.rows[1]).toMatchObject({ + rowKey: 'id:"ordinary-target"', + documentId: '"ordinary-target"', + }); + }); + + it('keeps the first-load query pending and readiness shell-based', (): void => { + const scenario = scenarios.collectionView['first-load']; + expect(scenario.rpc['mongoClusters.collectionView.runFindQuery']).toEqual({ + type: 'query', + results: [], + keepOpen: true, + }); + expect(scenario.readiness).toMatchObject({ + selectors: ['.collectionView', '.monaco-editor'], + noProgressbar: false, + }); + }); + it.each([ 'provisioning', 'success', @@ -71,7 +131,7 @@ describe('L2-dev manifest and routes', (): void => { }); it('provides path-only all/view/theme helpers and rejects unknown subsets', (): void => { - expect(runnerRoutes('/scenarios/run-all.js')).toHaveLength(171); + expect(runnerRoutes('/scenarios/run-all.js')).toHaveLength(201); expect(runnerRoutes('/scenarios/run-all/connectionDiagnostics.js')).toHaveLength(84); expect(runnerRoutes('/scenarios/run-all/localQuickStart.js')).toHaveLength(75); expect(runnerRoutes('/scenarios/run-all/localQuickStart/dark.js')).toHaveLength(25); diff --git a/build/verification/browser/scenarios.ts b/build/verification/browser/scenarios.ts index a98d8111f..dc1464b68 100644 --- a/build/verification/browser/scenarios.ts +++ b/build/verification/browser/scenarios.ts @@ -12,6 +12,7 @@ import { type FixturePaths, type TypedRpcFixtures, } from './core/fixtures'; +import { collectionViewFixtures } from './collectionViewFixtures'; import { diagnosticsCard, diagnosticsConnectedCard, @@ -249,6 +250,20 @@ function defaultScenario(view: V, steps: readonly Scenari } const base = fixtures.localQuickStart; +const collectionViewBase = defaultScenario('collectionView'); + +function collectionViewScenario(name: keyof typeof collectionViewFixtures): Scenario<'collectionView'> { + const fixture = collectionViewFixtures[name]; + return { + config: 'config' in fixture ? { ...collectionViewBase.config, ...fixture.config } : collectionViewBase.config, + rpc: { ...collectionViewBase.rpc, ...fixture.rpc }, + readiness: + 'readiness' in fixture + ? { ...collectionViewBase.readiness, ...fixture.readiness } + : collectionViewBase.readiness, + }; +} + const readyDocker = base.rpc['localQuickStart.getDockerStatus'].results[0]; const completedStages = [ { stage: 'checking', status: 'done', dockerReadiness: readyDocker.readiness }, @@ -2448,7 +2463,19 @@ const diagnosticsScenarios = { } as const satisfies Readonly>>; export const scenarios = { - collectionView: { default: defaultScenario('collectionView') }, + collectionView: { + default: collectionViewBase, + 'mixed-types': collectionViewScenario('mixed-types'), + 'missing-vs-null': collectionViewScenario('missing-vs-null'), + heterogeneous: collectionViewScenario('heterogeneous'), + 'deep-nesting': collectionViewScenario('deep-nesting'), + arrays: collectionViewScenario('arrays'), + 'page-500': collectionViewScenario('page-500'), + 'html-values': collectionViewScenario('html-values'), + empty: collectionViewScenario('empty'), + 'no-id': collectionViewScenario('no-id'), + 'first-load': collectionViewScenario('first-load'), + }, documentView: { default: defaultScenario('documentView') }, clusterDashboard: { default: defaultScenario('clusterDashboard') }, atlasCredentials: { default: defaultScenario('atlasCredentials', atlasSteps) }, From bfe204b62f1b120fbd47234e60d1ef87b5de8a71 Mon Sep 17 00:00:00 2001 From: Tomasz Naumowicz Date: Thu, 26 Nov 2026 20:10:45 +0100 Subject: [PATCH 033/148] docs: record WI-3b completion and A2 pass Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .../iterations/02-rdg-execution-plan.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/docs/ai-and-plans/features/data-grid/iterations/02-rdg-execution-plan.md b/docs/ai-and-plans/features/data-grid/iterations/02-rdg-execution-plan.md index 362a647b3..33e27ad68 100644 --- a/docs/ai-and-plans/features/data-grid/iterations/02-rdg-execution-plan.md +++ b/docs/ai-and-plans/features/data-grid/iterations/02-rdg-execution-plan.md @@ -176,6 +176,11 @@ identify the current and upcoming gates and what they block. `claude-opus-5.5` approved it at 86% (see the [WI-1c verdict](#wi-1c-interface-spec)). This is a read-only design gate, not runtime verification or release of G1. The operator choices remain open. +**A2 passed (2026-11-26), leader decision.** On the WI-3b revision: `npm run build` passed after +a type-only fixture correction, `npm run package` and `npm run verify:vsix` passed, and +`npx vitest run src/utils/documentGrid` passed all 22 tests. The scoped SlickGrid grep found no +tracked matches. The package graph still limits React Data Grid to Collection View. + ### Escalations | ID | Trigger | Operator chooses | @@ -901,6 +906,17 @@ parity. `_id`), `first-load`. Each in three themes (automatic). - Acceptance: routes load; `data-ready` succeeds against the placeholders. +> **Done (2026-11-26), commit `b6851a97`:** `mai-code-2` added the ten fixtures and 30 routes, +> preserving the three defaults. Leader review (98%) confirmed plain JSON, the 500-row and +> browse-only shapes, and shell-based readiness. Four fixture cases added; after one type-only +> correction to use inferred tRPC output types, build, browser type check and all 51 browser +> scenario tests passed. In the VS Code Integrated Browser, all 33 Collection View routes became +> ready with no reported harness/console/CSP errors; the first-load routes kept the intended +> progress indicator. The serialized helper needed a `page.waitForTimeout` timer bridge +> because the browser tool context does not supply `setTimeout`. No production behavior +> or browser test payload changed in the corrective turn. **A2 passed** on the evidence above. +> Usage: coding 19.3 AIU (25 requests, 5m19s); checks 1.5 AIU (23 requests, 2m10s). + **WI-3c: `TDD:` contract checks** · `gpt-6.1-sol` · after WI-3b - Owns: assertions and steps on the WI-3b scenarios, and `scenarios.test.ts` cases; CI workflow From eec82bff35309015fed33bb088f9db284ea0f964 Mon Sep 17 00:00:00 2001 From: Tomasz Naumowicz Date: Thu, 26 Nov 2026 21:19:30 +0100 Subject: [PATCH 034/148] docs: verify cross-collection isolation at G2 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .../data-grid/iterations/02-rdg-execution-plan.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/docs/ai-and-plans/features/data-grid/iterations/02-rdg-execution-plan.md b/docs/ai-and-plans/features/data-grid/iterations/02-rdg-execution-plan.md index 33e27ad68..84756efd4 100644 --- a/docs/ai-and-plans/features/data-grid/iterations/02-rdg-execution-plan.md +++ b/docs/ai-and-plans/features/data-grid/iterations/02-rdg-execution-plan.md @@ -131,6 +131,12 @@ identify the current and upcoming gates and what they block. View/Edit/Delete on a throwaway collection; page through 10/50/100/500; switch to Tree view, expand and collapse with arrow keys, check Narrator reads level and expanded state; switch the three VS Code themes. +- **Cross-collection isolation (added by operator, 2026-11-26):** Open two collection panels with + distinct document IDs. While a refresh in the first is pending, switch to the second, select a + row and open View. Check that the namespace and ID belong to the second collection before and + after the first panel updates. The existing L2-dev harness mounts one fixed collection, so + verify actual panel switching here rather than adding a multi-panel simulation. WI-3c still + verifies late responses within one collection. - **Operator decides:** the gestures (confirms or changes the G1 provisional choice); whether the look is acceptable; whether to open the draft PR now (C8). - **Release:** `G2 released` plus a numbered findings list. Findings become items WI-G2-1, WI-G2-2, @@ -929,6 +935,9 @@ parity. delete acknowledgement does not touch a newer selection). - Acceptance: A3. +> **Verification placement (2026-11-26), operator decision:** Cross-collection isolation moves +> to the two-panel workbench check at G2. It is not removed from scope or claimed by A3. + **WI-9a: tree keyboard spike** · `gpt-6.1-sol` · scratch worktree, throwaway - Build the smallest treegrid on RDG at the pinned version over `TreeNode[]`: flattened visible rows, From 418b7e8ade936e409124cd4fafe30b006775d3d7 Mon Sep 17 00:00:00 2001 From: Tomasz Naumowicz Date: Thu, 26 Nov 2026 21:23:58 +0100 Subject: [PATCH 035/148] docs: record tree spike and A4 pass (WI-9a) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .../iterations/02-rdg-execution-plan.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/docs/ai-and-plans/features/data-grid/iterations/02-rdg-execution-plan.md b/docs/ai-and-plans/features/data-grid/iterations/02-rdg-execution-plan.md index 84756efd4..e6b9bcf63 100644 --- a/docs/ai-and-plans/features/data-grid/iterations/02-rdg-execution-plan.md +++ b/docs/ai-and-plans/features/data-grid/iterations/02-rdg-execution-plan.md @@ -187,6 +187,10 @@ a type-only fixture correction, `npm run package` and `npm run verify:vsix` pass `npx vitest run src/utils/documentGrid` passed all 22 tests. The scoped SlickGrid grep found no tracked matches. The package graph still limits React Data Grid to Collection View. +**A4 passed (2026-11-26), leader decision.** The beta.64 scratch treegrid passed all 17 +keyboard, focus and ARIA checks in the VS Code Insiders Integrated Browser. The spike verifies +browser behavior, not screen reader announcements or the shipped UI. + ### Escalations | ID | Trigger | Operator chooses | @@ -946,6 +950,18 @@ parity. - Output: A4 evidence (Playwright run in the dev server) and a short note of the RDG APIs used. The code is not committed; WI-9 may reuse it. +> **Done (2026-11-26), scratch spike; no implementation commit:** `gpt-6.1-sol` used public +> beta.64 APIs: `DataGrid` with `role="treegrid"`, `getRowKey`, `onCellKeyDown`, +> `renderers.renderRow`/`Row`, `preventGridDefault` and `setActivePosition` with focus. +> `mai-code-2-flash` ran the Vite spike at `/tree-spike.html` in VS Code Insiders 1.149 +> (Chromium 150). All 17 stages passed: Right expands, Left collapses, Left from a child +> moves focus to its parent, levels are correct, `aria-expanded` is absent on leaves and +> updated on parents, and collapsed descendants are absent without disturbing siblings. +> No observed console, page, or CSP errors. Leader released A4 (99% confidence for that +> measured behavior); production styling, actual screen readers, and the full WI-9 +> navigation journey remain unverified. Coding usage: 34.1 AIU (12 requests, 3m26s). +> Shared A3/A4 checks used 1.4 AIU (20 requests, 2m02s) on the initial attempt. + ### Step 2 Each item ends at its automated gate. The leader runs `npm run build` and the browser suite From 799c509f4ce707603bbe65009a205de755867a4c Mon Sep 17 00:00:00 2001 From: Tomasz Naumowicz Date: Thu, 26 Nov 2026 21:44:18 +0100 Subject: [PATCH 036/148] test: pin Collection View grid behavior contracts (WI-3c) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .../browser/collectionViewFixtures.ts | 224 +++++++++- build/verification/browser/core.test.ts | 115 ++++- .../browser/core/fakeVsCodeApi.ts | 35 +- build/verification/browser/core/fixtures.ts | 32 +- build/verification/browser/fixtures.ts | 2 +- .../browser/scenario-playwright.ts | 97 +++- .../browser/scenario-runtime.test.ts | 82 +++- build/verification/browser/scenarios.test.ts | 167 ++++++- build/verification/browser/scenarios.ts | 415 +++++++++++++++++- 9 files changed, 1133 insertions(+), 36 deletions(-) diff --git a/build/verification/browser/collectionViewFixtures.ts b/build/verification/browser/collectionViewFixtures.ts index b9b24ee45..425075236 100644 --- a/build/verification/browser/collectionViewFixtures.ts +++ b/build/verification/browser/collectionViewFixtures.ts @@ -48,6 +48,7 @@ const mixedTypesPage: TablePageOutput = { { key: fieldColumnKey('binary'), label: 'binary', isRootId: false }, { key: fieldColumnKey('array'), label: 'array', isRootId: false }, { key: fieldColumnKey('object'), label: 'object', isRootId: false }, + { key: fieldColumnKey('legacyUuid'), label: 'legacyUuid', isRootId: false }, ], rows: [ { @@ -68,6 +69,10 @@ const mixedTypesPage: TablePageOutput = { [fieldColumnKey('binary')]: { display: 'AQI=', type: 'binary' }, [fieldColumnKey('array')]: { display: 'array[3]', type: 'array' }, [fieldColumnKey('object')]: { display: '{...}', type: 'object' }, + [fieldColumnKey('legacyUuid')]: { + display: '00112233-4455-6677-8899-aabbccddeeff', + type: 'uuid-legacy', + }, }, }, { @@ -116,6 +121,18 @@ const missingVsNullPage: TablePageOutput = { [fieldColumnKey('value')]: { display: 'null', type: 'null' }, }, }, + ...[ + { id: 'empty-string', display: '', type: 'string' }, + { id: 'false-value', display: 'false', type: 'boolean' }, + { id: 'zero-value', display: '0', type: 'int32' }, + ].map(({ id, display, type }): TablePageOutput['rows'][number] => ({ + rowKey: `id:${JSON.stringify(id)}`, + documentId: JSON.stringify(id), + cells: { + [ROOT_ID_COLUMN_KEY]: { display: id, type: 'string' }, + [fieldColumnKey('value')]: { display, type }, + }, + })), ], }; @@ -165,7 +182,7 @@ const deepRootKey = JSON.stringify([deepRowKey]); const deepProfileKey = JSON.stringify([deepRowKey, 'profile']); const deepAddressKey = JSON.stringify([deepRowKey, 'profile', 'address']); const deepLocationKey = JSON.stringify([deepRowKey, 'profile', 'address', 'location']); -const deepNestingNodes: TreeNode[] = [ +const deepNestingNodes: CollectionOutputs['getCurrentPageAsTree'] = [ { key: deepRootKey, parentKey: null, @@ -230,6 +247,22 @@ const deepNestingNodes: TreeNode[] = [ value: { display: '-122.3321', type: 'double' }, expandable: false, }, + { + key: JSON.stringify(['id:"second-root"']), + parentKey: null, + depth: 0, + field: '"second-root"', + value: { display: '{...}', type: 'object' }, + expandable: true, + }, + { + key: JSON.stringify(['id:"second-root"', '_id']), + parentKey: JSON.stringify(['id:"second-root"']), + depth: 1, + field: '_id', + value: { display: 'second-root', type: 'string' }, + expandable: false, + }, ]; const arraysRowKey = 'id:"arrays-root"'; @@ -237,7 +270,7 @@ const arraysRootKey = JSON.stringify([arraysRowKey]); const emptyArrayKey = JSON.stringify([arraysRowKey, 'empty']); const tenArrayKey = JSON.stringify([arraysRowKey, 'ten']); const elevenArrayKey = JSON.stringify([arraysRowKey, 'eleven']); -const arrayNodes: TreeNode[] = [ +const arrayNodes: CollectionOutputs['getCurrentPageAsTree'] = [ { key: arraysRootKey, parentKey: null, @@ -359,6 +392,124 @@ const noIdPage: TablePageOutput = { ], }; +const stepInPage: TablePageOutput = { + ...heterogeneousPage, + rows: heterogeneousPage.rows.map((row, index): TablePageOutput['rows'][number] => ({ + ...row, + cells: { + [ROOT_ID_COLUMN_KEY]: row.cells[ROOT_ID_COLUMN_KEY], + [fieldColumnKey('name')]: row.cells[fieldColumnKey('name')], + [fieldColumnKey('details')]: index === 0 ? { display: '{...}', type: 'object' } : undefined, + [fieldColumnKey('tags')]: { display: index === 0 ? 'array[2]' : 'array[0]', type: 'array' }, + }, + })), +}; +const nestedPage: TablePageOutput = { + path: ['details'], + columns: [ + { key: ROOT_ID_COLUMN_KEY, label: '_id', isRootId: true }, + { key: fieldColumnKey('nestedName'), label: 'nestedName', isRootId: false }, + { key: fieldColumnKey('child'), label: 'child', isRootId: false }, + ], + rows: stepInPage.rows.map((row, index): TablePageOutput['rows'][number] => ({ + rowKey: row.rowKey, + documentId: row.documentId, + cells: index === 0 + ? { + [ROOT_ID_COLUMN_KEY]: row.cells[ROOT_ID_COLUMN_KEY], + [fieldColumnKey('nestedName')]: { display: 'nested Alpha', type: 'string' }, + [fieldColumnKey('child')]: { display: '{...}', type: 'object' }, + } + : { [ROOT_ID_COLUMN_KEY]: row.cells[ROOT_ID_COLUMN_KEY] }, + })), +}; +const leafPage: TablePageOutput = { + ...nestedPage, + path: ['details', 'child'], + columns: [ + { key: ROOT_ID_COLUMN_KEY, label: '_id', isRootId: true }, + { key: fieldColumnKey('leafName'), label: 'leafName', isRootId: false }, + ], + rows: nestedPage.rows.map((row, index): TablePageOutput['rows'][number] => ({ + rowKey: row.rowKey, + documentId: row.documentId, + cells: { + [ROOT_ID_COLUMN_KEY]: row.cells[ROOT_ID_COLUMN_KEY], + ...(index === 0 ? { [fieldColumnKey('leafName')]: { display: 'leaf Alpha', type: 'string' } } : {}), + }, + })), +}; +const stepInRpc = { + 'mongoClusters.collectionView.runFindQuery': { type: 'query', results: [{ documentCount: 3 }] }, + 'mongoClusters.collectionView.getCurrentPageAsTable': { + type: 'query', + results: [stepInPage], + cases: [ + { input: ['details'], results: [nestedPage] }, + { input: ['details', 'child'], results: [leafPage] }, + ], + }, +} satisfies TypedRpcFixtures; + +const identityPage: TablePageOutput = { + path: [], + columns: [ + { key: ROOT_ID_COLUMN_KEY, label: '_id', isRootId: true }, + { key: fieldColumnKey('name'), label: 'name', isRootId: false }, + ], + rows: [ + { id: 'null', display: 'null', type: 'null', name: 'Null ID' }, + { id: '{"$numberInt":"0"}', display: '0', type: 'int32', name: 'Zero ID' }, + { id: 'false', display: 'false', type: 'boolean', name: 'False ID' }, + { id: '""', display: '', type: 'string', name: 'Empty ID' }, + { id: '{"tenant":{"$numberInt":"1"}}', display: '{...}', type: 'object', name: 'Composite ID' }, + ].map(({ id, display, type, name }): TablePageOutput['rows'][number] => ({ + rowKey: `id:${id}`, + documentId: id, + cells: { + [ROOT_ID_COLUMN_KEY]: { display, type }, + [fieldColumnKey('name')]: { display: name, type: 'string' }, + }, + })), +}; + +const arrayTablePage: TablePageOutput = { + path: [], + columns: [ + { key: ROOT_ID_COLUMN_KEY, label: '_id', isRootId: true }, + { key: fieldColumnKey('ten'), label: 'ten', isRootId: false }, + ], + rows: [{ + rowKey: arraysRowKey, + documentId: '"arrays-root"', + cells: { + [ROOT_ID_COLUMN_KEY]: { display: 'arrays-root', type: 'string' }, + [fieldColumnKey('ten')]: { display: 'array[10]', type: 'array' }, + }, + }], +}; +const arrayJsonDocuments: CollectionOutputs['getCurrentPageAsJson'] = [ + JSON.stringify({ + _id: 'arrays-root', + empty: [], + ten: Array.from({ length: 10 }, (_, index): number => index), + eleven: Array.from({ length: 11 }, (_, index): number => index), + }), +]; +const heterogeneousTreeNodes: CollectionOutputs['getCurrentPageAsTree'] = heterogeneousPage.rows.flatMap( + (row): CollectionOutputs['getCurrentPageAsTree'] => [ + { + key: JSON.stringify([row.rowKey]), parentKey: null, depth: 0, + field: row.documentId ?? '', value: { display: '{...}', type: 'object' }, expandable: true, + }, + { + key: JSON.stringify([row.rowKey, '_id']), parentKey: JSON.stringify([row.rowKey]), depth: 1, + field: '_id', value: { display: row.cells[ROOT_ID_COLUMN_KEY]?.display ?? '', type: 'string' }, + expandable: false, + }, + ], +); + export const collectionViewFixtures = { 'mixed-types': { tablePage: mixedTypesPage, @@ -403,7 +554,7 @@ export const collectionViewFixtures = { config: { initialDocumentView: DocumentViewMode.TREE }, treeNodes: deepNestingNodes, rpc: { - 'mongoClusters.collectionView.runFindQuery': { type: 'query', results: [{ documentCount: 1 }] }, + 'mongoClusters.collectionView.runFindQuery': { type: 'query', results: [{ documentCount: 2 }] }, 'mongoClusters.collectionView.getCurrentPageAsTree': { type: 'query', results: [deepNestingNodes], @@ -419,6 +570,11 @@ export const collectionViewFixtures = { type: 'query', results: [arrayNodes], }, + 'mongoClusters.collectionView.getCurrentPageAsTable': { type: 'query', results: [arrayTablePage] }, + 'mongoClusters.collectionView.getCurrentPageAsJson': { + type: 'query', + results: [arrayJsonDocuments], + }, }, }, 'page-500': { @@ -489,6 +645,59 @@ export const collectionViewFixtures = { }, }, }, + 'step-in': { tablePage: stepInPage, rpc: stepInRpc }, + selection: { + tablePage: heterogeneousPage, + rpc: { + 'mongoClusters.collectionView.runFindQuery': { type: 'query', results: [{ documentCount: 3 }] }, + 'mongoClusters.collectionView.getCurrentPageAsTable': { type: 'query', results: [heterogeneousPage] }, + 'mongoClusters.collectionView.getCurrentPageAsTree': { type: 'query', results: [heterogeneousTreeNodes] }, + }, + }, + identity: { + tablePage: identityPage, + rpc: { + 'mongoClusters.collectionView.runFindQuery': { type: 'query', results: [{ documentCount: 5 }] }, + 'mongoClusters.collectionView.getCurrentPageAsTable': { type: 'query', results: [identityPage] }, + }, + }, + 'late-delete': { + tablePage: heterogeneousPage, + rpc: { + 'mongoClusters.collectionView.runFindQuery': { type: 'query', results: [{ documentCount: 3 }] }, + 'mongoClusters.collectionView.getCurrentPageAsTable': { type: 'query', results: [heterogeneousPage] }, + 'mongoClusters.collectionView.deleteDocumentsById': { type: 'mutation', results: [true], hold: 'delete-alpha' }, + }, + }, + 'late-query': { + tablePage: stepInPage, + rpc: { + ...stepInRpc, + 'mongoClusters.collectionView.getCurrentPageAsTable': { + ...stepInRpc['mongoClusters.collectionView.getCurrentPageAsTable'], + cases: [{ input: ['details'], results: [nestedPage], hold: 'old-details' }], + }, + }, + }, + 'loading-to-results': { + tablePage: heterogeneousPage, + readiness: { selectors: ['.collectionView', '.monaco-editor'], noProgressbar: false }, + rpc: { + 'mongoClusters.collectionView.runFindQuery': { + type: 'query', results: [{ documentCount: 3 }], hold: 'initial-results', + }, + 'mongoClusters.collectionView.getCurrentPageAsTable': { type: 'query', results: [heterogeneousPage] }, + }, + }, + paging: { + config: { defaultPageSize: 10 }, + tablePage: heterogeneousPage, + rpc: { + 'mongoClusters.collectionView.runFindQuery': { type: 'query', results: [{ documentCount: 3 }] }, + 'mongoClusters.collectionView.getCurrentPageAsTable': { type: 'query', results: [heterogeneousPage] }, + 'mongoClusters.collectionView.getCurrentPageAsTree': { type: 'query', results: [heterogeneousTreeNodes] }, + }, + }, } as const satisfies Readonly< Record< | 'mixed-types' @@ -500,7 +709,14 @@ export const collectionViewFixtures = { | 'html-values' | 'empty' | 'no-id' - | 'first-load', + | 'first-load' + | 'step-in' + | 'selection' + | 'identity' + | 'late-delete' + | 'late-query' + | 'loading-to-results' + | 'paging', CollectionViewFixture > >; diff --git a/build/verification/browser/core.test.ts b/build/verification/browser/core.test.ts index 6131dce4c..c9ee81c5a 100644 --- a/build/verification/browser/core.test.ts +++ b/build/verification/browser/core.test.ts @@ -8,7 +8,7 @@ import { afterEach, describe, expect, it, vi } from 'vitest'; import { fakeVsCodeApi } from './core/fakeVsCodeApi'; -import { type FixtureOutputs, type RpcFixtures } from './core/fixtures'; +import { isRpcFixture, type FixtureOutputs, type RpcFixtures, type TypedRpcFixtures } from './core/fixtures'; const port: FixtureOutputs['localQuickStart']['checkPort'] = 'available'; const rpc = { @@ -133,4 +133,117 @@ describe('Shared browser fixture core', (): void => { expect(next.getState()).toBeUndefined(); expect(api.getState()).toEqual({ active: true }); }); + + it('uses the first JSON-input match and otherwise preserves the default response', async (): Promise => { + type Page = FixtureOutputs['mongoClusters']['collectionView']['getCurrentPageAsTable']; + const root: Page = { path: [], columns: [], rows: [] }; + const nested: Page = { path: ['details'], columns: [], rows: [] }; + const ignored: Page = { path: ['wrong'], columns: [], rows: [] }; + const responses = { + 'mongoClusters.collectionView.getCurrentPageAsTable': { + type: 'query', results: [root], + cases: [ + { input: ['details'], results: [nested] }, + { input: ['details'], results: [ignored] }, + ], + }, + } satisfies TypedRpcFixtures; + const messages = vi.spyOn(window, 'postMessage').mockImplementation((): void => {}); + const api = fakeVsCodeApi(responses, [])(); + api.postMessage({ id: 'nested', op: { type: 'query', path: 'mongoClusters.collectionView.getCurrentPageAsTable', input: ['details'] } }); + api.postMessage({ id: 'root', op: { type: 'query', path: 'mongoClusters.collectionView.getCurrentPageAsTable', input: [] } }); + await Promise.resolve(); + expect(messages.mock.calls.map((call): unknown => call[0])).toEqual([ + { id: 'nested', result: nested }, { id: 'nested', complete: true }, + { id: 'root', result: root }, { id: 'root', complete: true }, + ]); + }); + + it('holds a void reply until explicit release and sends null on the wire', async (): Promise => { + const errors: string[] = []; + const responses = { + 'mongoClusters.collectionView.viewDocumentById': { type: 'mutation', results: [null], hold: 'view' }, + } satisfies TypedRpcFixtures; + const messages = vi.spyOn(window, 'postMessage').mockImplementation((): void => {}); + const api = fakeVsCodeApi(responses, errors)(); + api.postMessage({ id: 'view', op: { type: 'mutation', path: 'mongoClusters.collectionView.viewDocumentById', input: '"a"' } }); + await Promise.resolve(); + expect(messages).not.toHaveBeenCalled(); + expect(window.__releaseScenarioReply?.('view')).toBe(true); + expect(messages.mock.calls.map((call): unknown => call[0])).toEqual([ + { id: 'view', result: null }, { id: 'view', complete: true }, + ]); + expect(window.__releaseScenarioReply?.('view')).toBe(false); + expect(errors).toEqual(['No held scenario reply: view']); + }); + + it('keeps case holds independent of the default hold', async (): Promise => { + const errors: string[] = []; + const responses = { + 'mongoClusters.collectionView.deleteDocumentsById': { + type: 'mutation', results: [true], hold: 'default', + cases: [ + { input: ['"a"'], results: [false], hold: 'cancelled' }, + { input: ['"immediate"'], results: [true] }, + ], + }, + } satisfies TypedRpcFixtures; + const messages = vi.spyOn(window, 'postMessage').mockImplementation((): void => {}); + const api = fakeVsCodeApi(responses, errors)(); + api.postMessage({ id: 'a', op: { type: 'mutation', path: 'mongoClusters.collectionView.deleteDocumentsById', input: ['"a"'] } }); + api.postMessage({ id: 'b', op: { type: 'mutation', path: 'mongoClusters.collectionView.deleteDocumentsById', input: ['"b"'] } }); + api.postMessage({ id: 'immediate', op: { type: 'mutation', path: 'mongoClusters.collectionView.deleteDocumentsById', input: ['"immediate"'] } }); + await Promise.resolve(); + expect(messages.mock.calls.map((call): unknown => call[0])).toEqual([ + { id: 'immediate', result: true }, { id: 'immediate', complete: true }, + ]); + messages.mockClear(); + expect(window.__releaseScenarioReply?.('cancelled')).toBe(true); + expect(messages.mock.calls.map((call): unknown => call[0])).toEqual([ + { id: 'a', result: false }, { id: 'a', complete: true }, + ]); + expect(window.__releaseScenarioReply?.('default')).toBe(true); + expect(messages.mock.calls.map((call): unknown => call[0]).slice(2)).toEqual([ + { id: 'b', result: true }, { id: 'b', complete: true }, + ]); + expect(errors).toEqual([]); + }); + + it('removes aborted held replies without discarding other pending requests', (): void => { + const errors: string[] = []; + const responses = { + 'mongoClusters.collectionView.deleteDocumentsById': { type: 'mutation', results: [true], hold: 'delete' }, + } satisfies TypedRpcFixtures; + const messages = vi.spyOn(window, 'postMessage').mockImplementation((): void => {}); + const api = fakeVsCodeApi(responses, errors)(); + for (const id of ['aborted', 'live']) { + api.postMessage({ id, op: { type: 'mutation', path: 'mongoClusters.collectionView.deleteDocumentsById', input: ['"a"'] } }); + } + api.postMessage({ id: 'aborted', op: { type: 'abort' } }); + expect(window.__releaseScenarioReply?.('delete')).toBe(true); + expect(messages.mock.calls.map((call): unknown => call[0])).toEqual([ + { id: 'live', result: true }, { id: 'live', complete: true }, + ]); + expect(errors).toEqual([]); + }); + + it('does not release a held reply belonging to an earlier fake installation', (): void => { + const responses = { + 'mongoClusters.collectionView.deleteDocumentsById': { type: 'mutation', results: [true], hold: 'old' }, + } satisfies TypedRpcFixtures; + const messages = vi.spyOn(window, 'postMessage').mockImplementation((): void => {}); + const api = fakeVsCodeApi(responses, [])(); + api.postMessage({ id: 'old', op: { type: 'mutation', path: 'mongoClusters.collectionView.deleteDocumentsById', input: [] } }); + const errors: string[] = []; + fakeVsCodeApi({}, errors); + expect(window.__releaseScenarioReply?.('old')).toBe(false); + expect(errors).toEqual(['No held scenario reply: old']); + expect(messages).not.toHaveBeenCalled(); + }); + + it('validates only well-formed optional input cases and hold tags', (): void => { + expect(isRpcFixture({ type: 'query', results: [], cases: [{ input: [], results: [null], hold: 'nested' }] })).toBe(true); + expect(isRpcFixture({ type: 'query', results: [], hold: 7 })).toBe(false); + expect(isRpcFixture({ type: 'query', results: [], cases: [{ input: [], results: null }] })).toBe(false); + }); }); diff --git a/build/verification/browser/core/fakeVsCodeApi.ts b/build/verification/browser/core/fakeVsCodeApi.ts index 8bbde9225..72a0f883f 100644 --- a/build/verification/browser/core/fakeVsCodeApi.ts +++ b/build/verification/browser/core/fakeVsCodeApi.ts @@ -19,6 +19,7 @@ export interface HarnessCall { declare global { interface Window { __harnessCalls: HarnessCall[]; + __releaseScenarioReply?: (tag: string) => boolean; } } @@ -38,8 +39,20 @@ export function fakeVsCodeApi(rpc: RpcFixtures, errors: string[]): typeof window const calls: HarnessCall[] = []; window.__harnessCalls = calls; const subscriptions = new Set(); + const held = new Map void }[]>(); let acquired = false; + window.__releaseScenarioReply = (tag: string): boolean => { + const replies = held.get(tag); + if (!replies?.length) { + errors.push(`No held scenario reply: ${tag}`); + return false; + } + held.delete(tag); + for (const { reply } of replies) reply(); + return true; + }; + function send(message: VsCodeLinkResponseMessage): void { window.postMessage(message, window.location.origin); } @@ -52,6 +65,11 @@ export function fakeVsCodeApi(rpc: RpcFixtures, errors: string[]): typeof window const { id, op } = value; if (op.type === 'subscription.stop' || op.type === 'abort') { subscriptions.delete(id); + for (const [tag, replies] of held) { + const remaining = replies.filter((reply): boolean => reply.id !== id); + if (remaining.length) held.set(tag, remaining); + else held.delete(tag); + } return; } calls.push({ path: op.path, type: op.type, input: op.input }); @@ -65,11 +83,14 @@ export function fakeVsCodeApi(rpc: RpcFixtures, errors: string[]): typeof window if (response.keepOpen) { subscriptions.add(id); } - queueMicrotask((): void => { + const selected = response.cases?.find( + (item): boolean => JSON.stringify(item.input) === JSON.stringify(op.input), + ); + const reply = (): void => { if (response.keepOpen && !subscriptions.has(id)) { return; } - for (const result of response.results) { + for (const result of selected?.results ?? response.results) { send({ id, result }); } if (response.undefinedResult) { @@ -78,7 +99,15 @@ export function fakeVsCodeApi(rpc: RpcFixtures, errors: string[]): typeof window if (!response.keepOpen) { send({ id, complete: true }); } - }); + }; + const tag = selected ? selected.hold : response.hold; + if (tag !== undefined) { + const replies = held.get(tag) ?? []; + replies.push({ id, reply }); + held.set(tag, replies); + } else { + queueMicrotask(reply); + } } return (): WebviewApi => { diff --git a/build/verification/browser/core/fixtures.ts b/build/verification/browser/core/fixtures.ts index 26316d7fb..141b0db3e 100644 --- a/build/verification/browser/core/fixtures.ts +++ b/build/verification/browser/core/fixtures.ts @@ -24,6 +24,12 @@ export interface RpcFixture { readonly results: readonly unknown[]; readonly keepOpen?: boolean; readonly undefinedResult?: boolean; + readonly cases?: readonly { + readonly input: unknown; + readonly results: readonly unknown[]; + readonly hold?: string; + }[]; + readonly hold?: string; } export type RpcFixtures = Readonly>>; @@ -38,11 +44,16 @@ export type FixtureAtPath = P extends `${infer Head}.${infe type StreamItem = T extends AsyncIterable ? Item : T; // tRPC's JSON-serialized output inference represents void procedures as never. The wire protocol -// deliberately supports explicit undefined results, so these fixtures retain the host's void type. -type FixtureResult = [T] extends [never] ? void : StreamItem; +// supports explicit undefined results and the host's null void replies. +type FixtureResult = [T] extends [void] ? void | null : StreamItem; export type TypedRpcFixtures = { - readonly [P in FixturePaths]?: Omit & { + readonly [P in FixturePaths]?: Omit & { readonly results: readonly FixtureResult>[]; + readonly cases?: readonly { + readonly input: FixtureAtPath; + readonly results: readonly FixtureResult>[]; + readonly hold?: string; + }[]; }; }; @@ -57,6 +68,19 @@ export function isRpcFixture(value: unknown): value is RpcFixture { (!('keepOpen' in value) || value.keepOpen === undefined || typeof value.keepOpen === 'boolean') && (!('undefinedResult' in value) || value.undefinedResult === undefined || - typeof value.undefinedResult === 'boolean') + typeof value.undefinedResult === 'boolean') && + (!('hold' in value) || value.hold === undefined || typeof value.hold === 'string') && + (!('cases' in value) || + value.cases === undefined || + (Array.isArray(value.cases) && + value.cases.every( + (item: unknown): boolean => + typeof item === 'object' && + item !== null && + 'input' in item && + 'results' in item && + Array.isArray(item.results) && + (!('hold' in item) || item.hold === undefined || typeof item.hold === 'string'), + ))) ); } diff --git a/build/verification/browser/fixtures.ts b/build/verification/browser/fixtures.ts index 1b55b0076..6e6f924a1 100644 --- a/build/verification/browser/fixtures.ts +++ b/build/verification/browser/fixtures.ts @@ -52,7 +52,7 @@ export interface HarnessFixture extends ViewFixture { function reply( type: RpcFixture['type'], result: T, -): Omit & { readonly results: readonly T[] } { +): Omit & { readonly results: readonly T[] } { if (result === undefined) { return { type, results: [], undefinedResult: true }; } diff --git a/build/verification/browser/scenario-playwright.ts b/build/verification/browser/scenario-playwright.ts index 523e13d9f..16d73df70 100644 --- a/build/verification/browser/scenario-playwright.ts +++ b/build/verification/browser/scenario-playwright.ts @@ -38,32 +38,54 @@ export async function runScenario(page: IntegratedPage, origin: string, route: S }); } }; - const steps = async (items: readonly ScenarioStep[]): Promise => { + const steps = async (items: readonly ScenarioStep[], guarded = false): Promise => { for (const step of items) { - const description = step.action === 'press' ? step.key : step.name; + const description = + step.action === 'press' ? step.key : step.action === 'releaseReply' ? step.tag : step.name; + const exact = !guarded || !('role' in step) || !['gridcell', 'row'].includes(step.role); if (await page.evaluate((): boolean => document.documentElement.dataset.ready === 'failed')) { throw new Error(`Page failed before step: ${description}`); } + if (guarded && 'role' in step) { + // A cell's name may include its type indicator as well as the displayed value. + const available = await page.getByRole(step.role, { name: step.name, exact }).evaluateAll( + (elements: Element[]): boolean => + elements.some((element): boolean => + !element.closest('[inert], [aria-hidden="true"], [aria-disabled="true"]') && + !element.matches(':disabled'), + ), + ); + if (!available) return `Unavailable accessible ${step.role}: ${step.name}`; + } switch (step.action) { + case 'releaseReply': { + const released = await page.evaluate( + (tag: string): boolean => window.__releaseScenarioReply?.(tag) ?? false, + step.tag, + ); + if (!released) throw new Error(`No held scenario reply: ${step.tag}`); + break; + } case 'press': await page.keyboard.press(step.key); break; case 'click': - await page.getByRole(step.role, { name: step.name, exact: true }).click({ timeout: 60000 }); + await page.getByRole(step.role, { name: step.name, exact }).click({ timeout: 60000 }); break; case 'fill': await page - .getByRole(step.role, { name: step.name, exact: true }) + .getByRole(step.role, { name: step.name, exact }) .fill(step.value, { timeout: 60000 }); break; case 'dblclick': - await page.getByRole(step.role, { name: step.name, exact: true }).dblclick({ timeout: 60000 }); + await page.getByRole(step.role, { name: step.name, exact }).dblclick({ timeout: 60000 }); break; case 'focus': - await page.getByRole(step.role, { name: step.name, exact: true }).focus({ timeout: 60000 }); + await page.getByRole(step.role, { name: step.name, exact }).focus({ timeout: 60000 }); break; } } + return undefined; }; await page.goto('about:blank', { waitUntil: 'domcontentloaded', timeout: 60000 }); page.on('console', onConsole); @@ -87,8 +109,42 @@ export async function runScenario(page: IntegratedPage, origin: string, route: S ); if (await page.evaluate((): boolean => document.documentElement.dataset.ready === 'true')) { for (const assertion of data.assertions ?? []) { + if (assertion.requiresGrid) { + const accessible = await page.locator(`[role="${assertion.requiresGrid}"]`).evaluateAll( + (elements: Element[]): boolean => + elements.some((element): boolean => { + if (element.closest('[inert], [aria-hidden="true"]')) return false; + for (let ancestor: Element | null = element; ancestor; ancestor = ancestor.parentElement) { + const style = getComputedStyle(ancestor); + if (style.display === 'none' || style.visibility === 'hidden') return false; + } + const box = element.getBoundingClientRect(); + return box.width > 0 && box.height > 0; + }), + ); + if (!accessible) { + assertions.push({ + name: assertion.name ?? 'Grid contract', + passed: false, + actual: `Absent accessible ${assertion.requiresGrid} (hidden/inert placeholders do not qualify)`, + expected: assertion.requiresGrid, + }); + continue; + } + } + if ('steps' in assertion && assertion.kind !== 'stableText') { + const unavailable = await steps(assertion.steps ?? [], !!assertion.requiresGrid); + if (unavailable) { + assertions.push({ + name: assertion.name, + passed: false, + actual: unavailable, + expected: 'available accessible step target', + }); + continue; + } + } if (assertion.kind === 'calls') { - await steps(assertion.steps); await wait( (expected: { path: string; count: number }): boolean => document.documentElement.dataset.ready === 'failed' || @@ -287,7 +343,6 @@ export async function runScenario(page: IntegratedPage, origin: string, route: S }, }); } else if (assertion.kind === 'attribute') { - await steps(assertion.steps ?? []); const actual = await page.evaluate( (expected: { selector: string; attribute: string }): string | null => document.querySelector(expected.selector)?.getAttribute(expected.attribute) ?? null, @@ -300,13 +355,12 @@ export async function runScenario(page: IntegratedPage, origin: string, route: S expected: assertion.expected, }); } else if (assertion.kind === 'focused') { - await steps(assertion.steps ?? []); const locator = 'selector' in assertion.target ? page.locator(assertion.target.selector) : page.getByRole(assertion.target.role, { name: assertion.target.name, - exact: true, + exact: !assertion.requiresGrid || !['gridcell', 'row'].includes(assertion.target.role), }); const actual = await locator.evaluateAll((elements: Element[]): boolean => elements.some((element): boolean => element === document.activeElement), @@ -331,7 +385,16 @@ export async function runScenario(page: IntegratedPage, origin: string, route: S .trim(); }, assertion.selector); const before = await read(); - await steps(assertion.steps); + const unavailable = await steps(assertion.steps, !!assertion.requiresGrid); + if (unavailable) { + assertions.push({ + name: assertion.name, + passed: false, + actual: unavailable, + expected: 'available accessible step target', + }); + continue; + } const after = await read(); assertions.push({ name: assertion.name, @@ -378,6 +441,16 @@ export async function runScenario(page: IntegratedPage, origin: string, route: S actual, expected: assertion.top, }); + } else if (assertion.kind === 'countAtMost') { + const actual = await page.locator(assertion.selector).evaluateAll( + (elements: Element[]): number => elements.length, + ); + assertions.push({ + name: assertion.name, + passed: actual <= assertion.max, + actual, + expected: `<= ${assertion.max}`, + }); } else { const actual = await page.evaluate((expected: typeof assertion): string => { const element = document.querySelector(expected.selector); @@ -386,7 +459,7 @@ export async function runScenario(page: IntegratedPage, origin: string, route: S : ''; }, assertion); assertions.push({ - name: `${assertion.selector} ${assertion.property}`, + name: assertion.name ?? `${assertion.selector} ${assertion.property}`, passed: actual === assertion.expected, actual, expected: assertion.expected, diff --git a/build/verification/browser/scenario-runtime.test.ts b/build/verification/browser/scenario-runtime.test.ts index 3294a1371..acb5544dc 100644 --- a/build/verification/browser/scenario-runtime.test.ts +++ b/build/verification/browser/scenario-runtime.test.ts @@ -134,6 +134,15 @@ describe('L2-dev layout assertions', (): void => { `
    ${heights .map((height): string => `
    `) .join('')}
    `; + // jsdom omits innerText; these disposable fixture getters track text mutations. + for (const element of document.body.querySelectorAll('*')) { + if (element instanceof HTMLElement) { + Object.defineProperty(element, 'innerText', { + configurable: true, + get: (): string => element.textContent ?? '', + }); + } + } vi.spyOn(Element.prototype, 'getBoundingClientRect').mockImplementation(function (this: Element): DOMRect { const data = (this as HTMLElement).dataset; const height = this.id === 'list' ? 120 : Number(data.height); @@ -190,7 +199,11 @@ describe('L2-dev layout assertions', (): void => { press: vi.fn(async (): Promise => {}), }, getByRole: vi.fn((): Locator => locator), - locator: vi.fn((): Locator => locator), + locator: vi.fn((selector: string): Locator => ({ + ...locator, + evaluateAll: async (operation: (elements: Element[]) => T): Promise => + operation([...document.querySelectorAll(selector)]), + })), // jsdom is the page: run each serialized operation in place. evaluate: vi .fn() @@ -204,6 +217,73 @@ describe('L2-dev layout assertions', (): void => { return report.assertions; } + it.each([ + '', + '
    ', + '', + '
    ', + ])('reports a missing accessible grid without executing that contract or skipping its sibling (%s)', async (grid): Promise => { + const results = await measure([], 100, [ + { + kind: 'attribute', name: 'TDD: K2 cannot pass with a missing grid', requiresGrid: 'grid', + selector: '[role="row"][aria-selected="true"]', attribute: 'role', expected: null, + steps: [{ action: 'releaseReply', tag: 'must-not-run' }], + }, + { kind: 'text', name: 'supporting shell', selector: 'h2', includes: ['Shell'], excludes: [] }, + ], `${grid}

    Shell

    `); + expect(results).toEqual([ + { + name: 'TDD: K2 cannot pass with a missing grid', passed: false, + actual: 'Absent accessible grid (hidden/inert placeholders do not qualify)', expected: 'grid', + }, + { + name: 'supporting shell', passed: true, + actual: { text: 'Shell', missing: [], found: [] }, expected: { includes: ['Shell'], excludes: [] }, + }, + ]); + expect(document.documentElement.dataset.ready).toBe('true'); + }); + + it('executes optional text steps after an accessible treegrid exists', async (): Promise => { + const release = vi.fn((tag: string): boolean => { + expect(tag).toBe('tree-result'); + const value = document.getElementById('value'); + if (!value) throw new Error('Missing release result target'); + value.textContent = 'Released result'; + return true; + }); + window.__releaseScenarioReply = release; + const [result] = await measure([], 100, [{ + kind: 'text', name: 'TDD: M4 released text', requiresGrid: 'treegrid', + selector: '#value', includes: ['Released result'], excludes: ['Pending'], + steps: [{ action: 'releaseReply', tag: 'tree-result' }], + }], '
    Pending
    '); + expect(result.passed).toBe(true); + expect(release).toHaveBeenCalledOnce(); + }); + + it('reports an unavailable contract target as an assertion result, not a harness failure', async (): Promise => { + const [result] = await measure([], 100, [{ + kind: 'focused', name: 'TDD: M6 missing cell', requiresGrid: 'grid', + target: { role: 'gridcell', name: 'Unavailable document' }, + steps: [{ action: 'focus', role: 'gridcell', name: 'Unavailable document' }], + }], '
    '); + expect(result).toMatchObject({ + passed: false, actual: 'Unavailable accessible gridcell: Unavailable document', + }); + expect(document.documentElement.dataset.ready).toBe('true'); + }); + + it('checks a DOM bound without claiming a timing or screen-reader measurement', async (): Promise => { + const assertion: ScenarioAssertion = { + kind: 'countAtMost', name: 'TDD: K11 mounted rows', requiresGrid: 'grid', + selector: '[role="row"]', max: 2, + }; + const html = '
    '; + expect((await measure([], 100, [assertion], html))[0]).toMatchObject({ passed: true, actual: 2, expected: '<= 2' }); + expect((await measure([], 100, [{ ...assertion, max: 1 }], html))[0]).toMatchObject({ passed: false, actual: 2 }); + }); + it('compares an attribute after its steps, and treats a missing element as null', async (): Promise => { const attribute = ( selector: string, diff --git a/build/verification/browser/scenarios.test.ts b/build/verification/browser/scenarios.test.ts index 4cc6130fa..4f6660ad6 100644 --- a/build/verification/browser/scenarios.test.ts +++ b/build/verification/browser/scenarios.test.ts @@ -5,6 +5,7 @@ import { readFileSync, readdirSync } from 'node:fs'; import { resolve } from 'node:path'; +import { EJSON } from 'bson'; import { describe, expect, it } from 'vitest'; import { collectionViewFixtures } from './collectionViewFixtures'; import { type TypedRpcFixtures } from './core/fixtures'; @@ -14,6 +15,7 @@ import { diagnosticsEntraRuleIds, diagnosticsForbiddenText, diagnosticsListTop, + collectionViewContracts, findScenario, scenarioRoutes, scenarios, @@ -21,6 +23,155 @@ import { type ScenarioAssertion, } from './scenarios'; +describe('TDD: Collection View grid contracts', (): void => { + const ids = ['M1', 'M2', 'M3', 'M4', 'M5', 'M6', 'M7', + 'K1', 'K2', 'K3', 'K4', 'K5', 'K6', 'K7', 'K8', 'K9', 'K10', 'K11']; + const assertions: readonly ScenarioAssertion[] = Object.values(collectionViewContracts).flat(); + + it.each(ids)('%s has executable user-outcome assertions, never a silent skip', (id): void => { + const matching = assertions.filter((assertion): boolean => assertion.name?.startsWith(`TDD: ${id} `) ?? false); + expect(matching.length).toBeGreaterThan(0); + for (const assertion of matching) { + expect(assertion.requiresGrid).toMatch(/^(grid|treegrid)$/); + expect(assertion).not.toHaveProperty('skip'); + if ('selector' in assertion) { + expect(assertion.selector).not.toMatch(/rdg|slickgrid/i); + } + if (assertion.kind === 'text') { + expect(assertion.includes.length + assertion.excludes.length).toBeGreaterThan(0); + } else if (assertion.kind === 'focused') { + expect(assertion.target).toBeDefined(); + } else if (assertion.kind === 'calls') { + expect(assertion.path).toMatch(/^mongoClusters\.collectionView\./); + } else if (assertion.kind === 'order') { + expect(assertion.texts.length).toBeGreaterThan(0); + } else if (assertion.kind === 'countAtMost') { + expect(assertion.max).toBeLessThan(500); + } + } + const routes = scenarioRoutes().filter((route): boolean => + route.view === 'collectionView' && + (findScenario(route).assertions?.some((assertion): boolean => assertion.name?.startsWith(`TDD: ${id} `) ?? false) ?? false), + ); + expect(new Set(routes.map((route): string => route.theme))).toEqual(new Set(['dark', 'light', 'high-contrast'])); + }); + + it('pins the single-selection and fail-closed no-ID regressions', (): void => { + expect(collectionViewContracts.selection).toContainEqual(expect.objectContaining({ + kind: 'calls', name: 'TDD: K1 exactly one selected document can be viewed', + requiresGrid: 'grid', path: 'mongoClusters.collectionView.viewDocumentById', input: '"heterogeneous-1"', count: 1, + })); + expect(collectionViewContracts['no-id']).toContainEqual(expect.objectContaining({ + kind: 'attribute', attribute: 'aria-selected', expected: 'true', + selector: '[role="grid"] [role="row"][aria-rowindex="2"]', + })); + for (const name of ['View selected document', 'Edit selected document', 'Delete selected document(s)']) { + expect(collectionViewContracts['no-id']).toContainEqual(expect.objectContaining({ + kind: 'attribute', selector: `.collectionView :is(button,[role="button"])[aria-label="${name}"]`, attribute: 'disabled', expected: '', + })); + } + }); + + it('pins deterministic late acknowledgements separately from same-panel stale results', (): void => { + expect(collectionViewContracts['late-delete']).toContainEqual(expect.objectContaining({ + kind: 'text', name: 'TDD: K2 late delete acknowledgement preserves the newer selection', + selector: '[role="grid"] [role="row"][aria-selected="true"]', + includes: ['Beta', 'heterogeneous-2'], excludes: ['Alpha'], + steps: [{ action: 'click', role: 'gridcell', name: 'Beta' }, { action: 'releaseReply', tag: 'delete-alpha' }], + })); + expect(collectionViewFixtures['late-delete'].rpc['mongoClusters.collectionView.deleteDocumentsById']).toMatchObject({ + hold: 'delete-alpha', results: [true], + }); + + expect(collectionViewFixtures['late-query'].rpc['mongoClusters.collectionView.getCurrentPageAsTable'].cases).toContainEqual( + expect.objectContaining({ input: ['details'], hold: 'old-details' }), + ); + expect(collectionViewContracts['late-query']).toContainEqual(expect.objectContaining({ + kind: 'calls', input: '"heterogeneous-2"', count: 1, path: 'mongoClusters.collectionView.viewDocumentById', + })); + expect(assertions.map((assertion): string => assertion.name ?? '')).not.toContainEqual(expect.stringMatching(/cross.collection|cross.panel/i)); + }); + + it('keeps identity fixtures canonical and synchronized with document action inputs', (): void => { + const documentIds = collectionViewFixtures.identity.tablePage.rows.map((row): string => { + if (row.documentId === undefined) throw new Error('Missing identity fixture document ID'); + expect(row.documentId).toBe(EJSON.stringify(EJSON.parse(row.documentId), { relaxed: false })); + return row.documentId; + }); + const identity: readonly ScenarioAssertion[] = collectionViewContracts.identity; + const targets = identity.flatMap((assertion): string[] => { + if (assertion.kind !== 'calls') return []; + if (assertion.path === 'mongoClusters.collectionView.deleteDocumentsById') return assertion.input; + if (assertion.path === 'mongoClusters.collectionView.viewDocumentById' || + assertion.path === 'mongoClusters.collectionView.editDocumentById') return [assertion.input]; + throw new Error('Unexpected identity fixture action'); + }); + expect(targets).toEqual(documentIds); + }); + + it('pins nested whole-page navigation, root identity and the accepted Enter gesture', (): void => { + expect(collectionViewContracts['step-in']).toContainEqual(expect.objectContaining({ + kind: 'text', includes: ['nested Alpha', 'heterogeneous-1', 'heterogeneous-2', 'heterogeneous-3'], + steps: [{ action: 'dblclick', role: 'gridcell', name: '{...}' }], + })); + expect(collectionViewContracts['step-in']).toContainEqual(expect.objectContaining({ + kind: 'calls', name: 'TDD: K4 nested inspection still targets the root document', input: '"heterogeneous-1"', + })); + expect(collectionViewContracts['step-in']).toContainEqual(expect.objectContaining({ + kind: 'text', name: 'TDD: M7 Enter on an object cell steps in', includes: ['leaf Alpha'], + steps: [{ action: 'focus', role: 'gridcell', name: '{...}' }, { action: 'press', key: 'Enter' }], + })); + expect(collectionViewContracts['missing-vs-null']).toContainEqual(expect.objectContaining({ + kind: 'order', texts: ['', 'null', 'Ab', 'false', '0'], + })); + }); + + it('pins theme outcomes and honest virtualization evidence in every palette', (): void => { + const colors = { + dark: ['rgb(31, 31, 31)', 'rgb(204, 204, 204)'], + light: ['rgb(255, 255, 255)', 'rgb(59, 59, 59)'], + 'high-contrast': ['rgb(0, 0, 0)', 'rgb(255, 255, 255)'], + }; + for (const route of scenarioRoutes().filter((route): boolean => route.view === 'collectionView' && route.scenario === 'mixed-types')) { + expect(findScenario(route).assertions?.filter((assertion): boolean => assertion.kind === 'style').map( + (assertion): string => assertion.kind === 'style' ? assertion.expected : '', + )).toEqual(colors[route.theme]); + } + expect(collectionViewContracts['page-500']).toContainEqual(expect.objectContaining({ + kind: 'countAtMost', selector: '[role="grid"] [role="row"]', max: 100, + })); + expect(collectionViewContracts['page-500']).toContainEqual(expect.objectContaining({ + kind: 'text', includes: ['page-499'], + steps: [{ action: 'focus', role: 'columnheader', name: '_id' }, { action: 'press', key: 'ArrowDown' }, { action: 'press', key: 'Control+End' }], + })); + }); + + it('pins only the accepted paging choices and loading-to-results workflow', (): void => { + const paging: readonly ScenarioAssertion[] = collectionViewContracts.paging; + expect(paging.flatMap((assertion): readonly string[] => + 'steps' in assertion ? (assertion.steps ?? []).flatMap((step): string[] => + step.action === 'click' && step.role === 'option' ? [step.name] : [], + ) : [], + )).toEqual(['50', '100', '500', '10', 'Tree View', 'Table View']); + expect(collectionViewFixtures['loading-to-results'].rpc['mongoClusters.collectionView.runFindQuery']).toMatchObject({ + hold: 'initial-results', results: [{ documentCount: 3 }], + }); + expect(collectionViewContracts['loading-to-results']).toContainEqual(expect.objectContaining({ + kind: 'text', requiresGrid: 'grid', includes: ['Alpha', 'Beta'], + })); + expect(collectionViewContracts.empty).toContainEqual(expect.objectContaining({ + kind: 'text', selector: '.collectionView [role="status"][aria-live="assertive"]', + includes: ['No results found'], + })); + expect(collectionViewContracts.empty).toContainEqual(expect.objectContaining({ + kind: 'attribute', requiresGrid: 'grid', attribute: 'aria-rowcount', expected: '1', + })); + expect(collectionViewContracts.empty).toContainEqual(expect.objectContaining({ + kind: 'countAtMost', requiresGrid: 'grid', selector: '[role="grid"] [role="row"] [role="gridcell"]', max: 0, + })); + }); +}); + describe('L2-dev manifest and routes', (): void => { it('imports, rather than duplicates, all six settled L2 fixtures', (): void => { for (const route of scenarioRoutes().filter((route): boolean => route.scenario === 'default')) { @@ -33,12 +184,12 @@ describe('L2-dev manifest and routes', (): void => { it('round-trips every scenario and theme, without duplicate routes', (): void => { const routes = scenarioRoutes(); - expect(routes).toHaveLength(201); - expect(new Set(routes.map((route): string => route.path)).size).toBe(201); + expect(routes).toHaveLength(222); + expect(new Set(routes.map((route): string => route.path)).size).toBe(222); for (const route of routes) expect(parseScenarioRoute(route.path)).toEqual(route); }); - it('provides the ten Collection View fixtures in every theme', (): void => { + it('provides the Collection View fixture presets and contracts in every theme', (): void => { const expected = [ 'mixed-types', 'missing-vs-null', @@ -50,6 +201,13 @@ describe('L2-dev manifest and routes', (): void => { 'empty', 'no-id', 'first-load', + 'step-in', + 'selection', + 'identity', + 'late-delete', + 'late-query', + 'loading-to-results', + 'paging', ]; expect(Object.keys(collectionViewFixtures)).toEqual(expected); for (const name of expected) { @@ -60,6 +218,7 @@ describe('L2-dev manifest and routes', (): void => { ).toEqual(['dark', 'light', 'high-contrast']); expect(scenarios.collectionView[name as keyof typeof scenarios.collectionView].readiness.content).toEqual([ 'Documents', + ...(name === 'empty' ? ['No results found'] : []), ]); expect( scenarios.collectionView[name as keyof typeof scenarios.collectionView].readiness.selectors, @@ -131,7 +290,7 @@ describe('L2-dev manifest and routes', (): void => { }); it('provides path-only all/view/theme helpers and rejects unknown subsets', (): void => { - expect(runnerRoutes('/scenarios/run-all.js')).toHaveLength(201); + expect(runnerRoutes('/scenarios/run-all.js')).toHaveLength(222); expect(runnerRoutes('/scenarios/run-all/connectionDiagnostics.js')).toHaveLength(84); expect(runnerRoutes('/scenarios/run-all/localQuickStart.js')).toHaveLength(75); expect(runnerRoutes('/scenarios/run-all/localQuickStart/dark.js')).toHaveLength(25); diff --git a/build/verification/browser/scenarios.ts b/build/verification/browser/scenarios.ts index dc1464b68..4457bad5a 100644 --- a/build/verification/browser/scenarios.ts +++ b/build/verification/browser/scenarios.ts @@ -56,9 +56,12 @@ export type ScenarioTargetRole = | 'gridcell' | 'columnheader' | 'grid' - | 'treegrid'; + | 'treegrid' + | 'combobox' + | 'option'; export type ScenarioStep = + | { readonly action: 'releaseReply'; readonly tag: string } | { readonly action: 'click'; readonly role: ScenarioTargetRole; readonly name: string } | { readonly action: 'fill'; readonly role: 'textbox'; readonly name: string; readonly value: string } | { readonly action: 'press'; readonly key: string } @@ -85,6 +88,7 @@ interface OrderAssertion { readonly name: string; readonly selector: string; readonly texts: readonly string[]; + readonly steps?: readonly ScenarioStep[]; } /** `below` follows `above` in the document and starts at or under its bottom edge. */ @@ -105,6 +109,7 @@ interface TextAssertion { readonly selector: string; readonly includes: readonly string[]; readonly excludes: readonly string[]; + readonly steps?: readonly ScenarioStep[]; } /** @@ -190,10 +195,10 @@ interface FocusedAssertion { readonly steps?: readonly ScenarioStep[]; } -export type ScenarioAssertion = +export type ScenarioAssertion = ( | CallAssertion | SequenceAssertion - | ({ readonly kind: 'style' } & StyleExpectation) + | ({ readonly kind: 'style'; readonly name?: string } & StyleExpectation) | OrderAssertion | BelowAssertion | TextAssertion @@ -202,7 +207,15 @@ export type ScenarioAssertion = | AttributeAssertion | FocusedAssertion | InsideAssertion - | StableTextAssertion; + | StableTextAssertion + | { + readonly kind: 'countAtMost'; + readonly name: string; + readonly selector: string; + readonly max: number; + readonly steps?: readonly ScenarioStep[]; + } +) & { readonly requiresGrid?: 'grid' | 'treegrid' }; export interface Scenario { readonly config: (typeof fixtures)[V]['config']; @@ -256,14 +269,379 @@ function collectionViewScenario(name: keyof typeof collectionViewFixtures): Scen const fixture = collectionViewFixtures[name]; return { config: 'config' in fixture ? { ...collectionViewBase.config, ...fixture.config } : collectionViewBase.config, - rpc: { ...collectionViewBase.rpc, ...fixture.rpc }, + rpc: { + ...collectionViewBase.rpc, + 'common.reportEvent': { type: 'mutation', results: [null] }, + 'common.reportError': { type: 'mutation', results: [null] }, + 'common.reportViewLoad': { type: 'mutation', results: [null] }, + 'mongoClusters.collectionView.viewDocumentById': { type: 'mutation', results: [null] }, + 'mongoClusters.collectionView.editDocumentById': { type: 'mutation', results: [null] }, + 'mongoClusters.collectionView.deleteDocumentsById': { type: 'mutation', results: [true] }, + 'mongoClusters.collectionView.setCollectionDocumentView': { type: 'mutation', results: [null] }, + ...fixture.rpc, + }, readiness: 'readiness' in fixture ? { ...collectionViewBase.readiness, ...fixture.readiness } : collectionViewBase.readiness, + assertions: collectionViewContracts[name], }; } +// These are browser user-outcome contracts, not assertions about the grid package's DOM classes. +export const collectionViewContracts = { + 'mixed-types': [ + { + kind: 'text', name: 'TDD: K5 BSON values retain their formatted text', + requiresGrid: 'grid', selector: '[role="grid"]', + includes: ['fixture text', '7', '-4.5', 'true', 'false', '2026-01-02T03:04:05.000Z', '12.50', + '000000000000000000000002', '00112233-4455-6677-8899-aabbccddeeff', 'AQI=', 'array[3]', 'array[0]'], + excludes: ['\\[object Object\\]'], + }, + ...[ + [2, 'Ab'], [3, 'i32'], [4, 'tf'], [5, 'DT'], [6, 'd128'], [7, 'ID'], + [8, 'U'], [9, '01'], [10, '[ ]'], [11, '{ }'], [12, 'U~'], + ].map(([column, label]): ScenarioAssertion => ({ + kind: 'text', name: `TDD: K7 distinct cell type indicator ${label}`, + requiresGrid: 'grid', + selector: `[role="grid"] [role="row"][aria-rowindex="2"] [role="gridcell"][aria-colindex="${column}"]`, + includes: [String(label)], excludes: [], + })), + ...[[3, '.12'], [6, 'L']].map(([column, label]): ScenarioAssertion => ({ + kind: 'text', name: `TDD: K5 numeric type ${label} is not reduced to an ordinary number`, + requiresGrid: 'grid', + selector: `[role="grid"] [role="row"][aria-rowindex="3"] [role="gridcell"][aria-colindex="${column}"]`, + includes: [String(label)], excludes: [], + })), + { + kind: 'style', name: 'TDD: K10 grid background follows the VS Code theme', + requiresGrid: 'grid', selector: '[role="grid"]', property: 'background-color', expected: '', + }, + { + kind: 'style', name: 'TDD: K10 grid text follows the VS Code theme', + requiresGrid: 'grid', selector: '[role="grid"]', property: 'color', expected: '', + }, + ], + 'missing-vs-null': [ + { kind: 'order', name: 'TDD: K6 missing, null, empty string, false and zero remain distinct', + requiresGrid: 'grid', selector: '[role="grid"] [role="row"][aria-rowindex] [role="gridcell"][aria-colindex="2"]', + texts: ['', 'null', 'Ab', 'false', '0'] }, + { kind: 'text', name: 'TDD: K6 missing value is blank rather than typed null or string', + requiresGrid: 'grid', selector: '[role="grid"] [role="row"][aria-rowindex="2"] [role="gridcell"][aria-colindex="2"]', + includes: [], excludes: ['null', 'Ab'] }, + ], + heterogeneous: [ + { kind: 'order', name: 'TDD: K3 columns include fields absent from the first document', + requiresGrid: 'grid', selector: '[role="grid"] [role="columnheader"]', + texts: ['_id', 'name', 'quantity', 'details', 'tags'] }, + { kind: 'text', name: 'TDD: K3 heterogeneous documents remain rows', + requiresGrid: 'grid', selector: '[role="grid"]', + includes: ['Alpha', 'Beta', 'unavailable', 'null'], excludes: [] }, + { kind: 'focused', name: 'TDD: M6 arrows navigate headers', + requiresGrid: 'grid', target: { role: 'columnheader', name: 'name' }, + steps: [{ action: 'focus', role: 'columnheader', name: '_id' }, { action: 'press', key: 'ArrowRight' }] }, + { kind: 'focused', name: 'TDD: M6 Down enters cells and Right moves to the next cell', + requiresGrid: 'grid', target: { selector: '[role="grid"] [role="row"][aria-rowindex="2"] [role="gridcell"][aria-colindex="2"]' }, + steps: [{ action: 'press', key: 'ArrowLeft' }, { action: 'press', key: 'ArrowDown' }, { action: 'press', key: 'ArrowRight' }] }, + { kind: 'focused', name: 'TDD: M6 Down moves to the next document without changing column', + requiresGrid: 'grid', target: { selector: '[role="grid"] [role="row"][aria-rowindex="3"] [role="gridcell"][aria-colindex="2"]' }, + steps: [{ action: 'press', key: 'ArrowDown' }] }, + { kind: 'focused', name: 'TDD: M6 Up returns to the header', + requiresGrid: 'grid', target: { role: 'columnheader', name: 'name' }, + steps: [{ action: 'press', key: 'ArrowUp' }, { action: 'press', key: 'ArrowUp' }] }, + ], + 'deep-nesting': [ + { kind: 'order', name: 'TDD: M4 tree exposes Field, Value and Type columns', + requiresGrid: 'treegrid', selector: '[role="treegrid"] [role="columnheader"]', texts: ['Field', 'Value', 'Type'] }, + { kind: 'text', name: 'TDD: M4 document root is labelled by its ID and starts collapsed', + requiresGrid: 'treegrid', selector: '[role="treegrid"]', + includes: ['"deep-root"', '{...}'], excludes: ['profile', 'latitude'] }, + { kind: 'order', name: 'TDD: M4 each document has its own initially visible root', + requiresGrid: 'treegrid', selector: '[role="treegrid"] [role="row"][aria-level="1"]', + texts: ['"deep-root"', '"second-root"'] }, + { kind: 'attribute', name: 'TDD: M5 root exposes collapsed state and level', + requiresGrid: 'treegrid', selector: '[role="treegrid"] [role="row"][aria-level="1"]', + attribute: 'aria-expanded', expected: 'false' }, + { kind: 'attribute', name: 'TDD: M5 Right expands a focused root', + requiresGrid: 'treegrid', selector: '[role="treegrid"] [role="row"][aria-level="1"]', + attribute: 'aria-expanded', expected: 'true', + steps: [{ action: 'focus', role: 'gridcell', name: '"deep-root"' }, { action: 'press', key: 'ArrowRight' }] }, + { kind: 'focused', name: 'TDD: M5 Right on expanded parent moves to its first child', + requiresGrid: 'treegrid', target: { selector: '[role="treegrid"] [role="row"][aria-level="2"] [role="gridcell"][aria-colindex="1"]' }, + steps: [{ action: 'press', key: 'ArrowRight' }] }, + { kind: 'focused', name: 'TDD: M5 Left on a child moves to its parent', + requiresGrid: 'treegrid', target: { role: 'gridcell', name: '"deep-root"' }, + steps: [{ action: 'press', key: 'ArrowLeft' }] }, + { kind: 'attribute', name: 'TDD: M5 Left collapses the parent', + requiresGrid: 'treegrid', selector: '[role="treegrid"] [role="row"][aria-level="1"]', + attribute: 'aria-expanded', expected: 'false', steps: [{ action: 'press', key: 'ArrowLeft' }] }, + { kind: 'text', name: 'TDD: M4 deeply nested document fields remain browsable', + requiresGrid: 'treegrid', selector: '[role="treegrid"]', includes: ['latitude', '47.6062', 'longitude', '-122.3321'], excludes: [], + steps: [ + { action: 'press', key: 'ArrowRight' }, + { action: 'focus', role: 'gridcell', name: 'profile' }, { action: 'press', key: 'ArrowRight' }, + { action: 'focus', role: 'gridcell', name: 'address' }, { action: 'press', key: 'ArrowRight' }, + { action: 'focus', role: 'gridcell', name: 'location' }, { action: 'press', key: 'ArrowRight' }, + { action: 'focus', role: 'gridcell', name: 'coordinates' }, { action: 'press', key: 'ArrowRight' }, + ] }, + { kind: 'text', name: 'TDD: M5 deep children expose the correct hierarchy level', + requiresGrid: 'treegrid', selector: '[role="treegrid"] [role="row"][aria-level="6"]', + includes: ['latitude'], excludes: [] }, + ], + arrays: [ + { kind: 'text', name: 'TDD: M4 tree summaries retain counts for 0, 10 and 11 elements', + requiresGrid: 'treegrid', selector: '[role="treegrid"]', + includes: ['(elements: 0)', '(elements: 10)', '(elements: 11)'], excludes: ['ten[0]', 'eleven[0]'], + steps: [{ action: 'focus', role: 'gridcell', name: '"arrays-root"' }, { action: 'press', key: 'ArrowRight' }] }, + { kind: 'text', name: 'TDD: M4 arrays of ten expand from the keyboard', + requiresGrid: 'treegrid', selector: '[role="treegrid"]', includes: ['ten[0]', 'ten[9]'], excludes: ['eleven[0]'], + steps: [{ action: 'focus', role: 'gridcell', name: 'ten' }, { action: 'press', key: 'ArrowRight' }] }, + { kind: 'stableText', name: 'TDD: M4 arrays over ten do not gain children', + requiresGrid: 'treegrid', selector: '[role="treegrid"]', + steps: [{ action: 'focus', role: 'gridcell', name: 'eleven' }, { action: 'press', key: 'ArrowRight' }] }, + { kind: 'text', name: 'TDD: M4 JSON view retains the existing document payload', + requiresGrid: 'treegrid', + selector: '.monaco-editor:has([role="textbox"][aria-label="JSON results view: Read-only display of query results in JSON format"])', + includes: ['arrays-root'], excludes: [], + steps: [{ action: 'click', role: 'combobox', name: 'Select view type' }, { action: 'click', role: 'option', name: 'JSON View' }] }, + { kind: 'text', name: 'M4 supporting switch back to Table', + requiresGrid: undefined, selector: '[role="grid"]', + includes: ['arrays-root', 'array[10]'], excludes: [], + steps: [{ action: 'click', role: 'combobox', name: 'Select view type' }, { action: 'click', role: 'option', name: 'Table View' }] }, + { kind: 'text', name: 'TDD: M4 Table and Tree present the same document identity', + requiresGrid: 'grid', selector: '[role="grid"]', includes: ['arrays-root', 'array[10]'], excludes: [] }, + ], + 'page-500': [ + { kind: 'attribute', name: 'TDD: K11 the accessible grid reports the loaded 500-row page', + requiresGrid: 'grid', selector: '[role="grid"]', attribute: 'aria-rowcount', expected: '501' }, + { kind: 'countAtMost', name: 'TDD: K11 virtualization bounds mounted rows below the full page', + requiresGrid: 'grid', selector: '[role="grid"] [role="row"]', max: 100 }, + { kind: 'text', name: 'TDD: K11 keyboard scrolling reaches the last document', + requiresGrid: 'grid', selector: '[role="grid"]', includes: ['page-499'], excludes: [], + steps: [{ action: 'focus', role: 'columnheader', name: '_id' }, { action: 'press', key: 'ArrowDown' }, { action: 'press', key: 'Control+End' }] }, + { kind: 'countAtMost', name: 'TDD: K11 mounted rows stay bounded near the last document', + requiresGrid: 'grid', selector: '[role="grid"] [role="row"]', max: 100 }, + ], + 'html-values': [ + { kind: 'text', name: 'TDD: K8 HTML-looking data remains literal cell text', + requiresGrid: 'grid', selector: '[role="grid"]', + includes: ['display-only text & literal angle brackets < >'], excludes: [] }, + { kind: 'countAtMost', name: 'TDD: K8 data never creates HTML elements', + requiresGrid: 'grid', selector: '[role="gridcell"] strong, [role="gridcell"] img, [role="gridcell"] script', max: 0 }, + ], + empty: [ + { kind: 'text', name: 'K9 supporting empty-result announcement', + selector: '.collectionView [role="status"][aria-live="assertive"]', + includes: ['No results found'], excludes: [] }, + { kind: 'attribute', name: 'TDD: K9 empty results leave only the grid header', + requiresGrid: 'grid', selector: '[role="grid"]', attribute: 'aria-rowcount', expected: '1' }, + { kind: 'countAtMost', name: 'TDD: K9 the completed empty query has no document cells', + requiresGrid: 'grid', selector: '[role="grid"] [role="row"] [role="gridcell"]', max: 0 }, + ], + 'no-id': [ + { kind: 'attribute', name: 'TDD: K1 no-ID rows remain selectable for browsing', + requiresGrid: 'grid', selector: '[role="grid"] [role="row"][aria-rowindex="2"]', + attribute: 'aria-selected', expected: 'true', + steps: [{ action: 'click', role: 'gridcell', name: 'Browse only' }] }, + ...['View selected document', 'Edit selected document', 'Delete selected document(s)'].map((name): ScenarioAssertion => ({ + kind: 'attribute', name: `TDD: K2 no-ID selection never enables ${name}`, + requiresGrid: 'grid', selector: `.collectionView :is(button,[role="button"])[aria-label="${name}"]`, + attribute: 'disabled', expected: '', + })), + { kind: 'calls', name: 'TDD: K2 no-ID rows never become a delete target', + requiresGrid: 'grid', path: 'mongoClusters.collectionView.deleteDocumentsById', input: [], count: 0, steps: [] }, + { kind: 'calls', name: 'TDD: K2 a safe row beside a no-ID row still opens the right document', + requiresGrid: 'grid', path: 'mongoClusters.collectionView.viewDocumentById', input: '"ordinary-target"', count: 1, + steps: [{ action: 'click', role: 'gridcell', name: 'Ordinary target' }, { action: 'click', role: 'button', name: 'View selected document' }] }, + { kind: 'attribute', name: 'TDD: K1 a no-ID row can join an ordinary row selection', + requiresGrid: 'grid', selector: '[role="grid"] [role="row"][aria-rowindex="2"]', + attribute: 'aria-selected', expected: 'true', + steps: [{ action: 'focus', role: 'gridcell', name: 'Browse only' }, { action: 'press', key: 'Space' }] }, + ...['View selected document', 'Edit selected document', 'Delete selected document(s)'].map((name): ScenarioAssertion => ({ + kind: 'attribute', name: `TDD: K2 a selection containing a no-ID row withholds ${name}`, + requiresGrid: 'grid', selector: `.collectionView :is(button,[role="button"])[aria-label="${name}"]`, attribute: 'disabled', expected: '', + })), + ], + 'first-load': [], + 'step-in': [ + { kind: 'text', name: 'TDD: M1 double-click steps into the field across the whole page', + requiresGrid: 'grid', selector: '[role="grid"]', + includes: ['nested Alpha', 'heterogeneous-1', 'heterogeneous-2', 'heterogeneous-3'], excludes: ['Beta'], + steps: [{ action: 'dblclick', role: 'gridcell', name: '{...}' }] }, + { kind: 'order', name: 'TDD: K3 nested columns come from the current object level', + requiresGrid: 'grid', selector: '[role="grid"] [role="columnheader"]', texts: ['_id', 'nestedName', 'child'] }, + { kind: 'text', name: 'TDD: K4 root IDs remain visible while inspecting nested fields', + requiresGrid: 'grid', selector: '[role="grid"]', + includes: ['heterogeneous-1', 'heterogeneous-2', 'heterogeneous-3'], excludes: [] }, + { kind: 'calls', name: 'TDD: K4 nested inspection still targets the root document', + requiresGrid: 'grid', path: 'mongoClusters.collectionView.viewDocumentById', input: '"heterogeneous-1"', count: 1, + steps: [{ action: 'click', role: 'gridcell', name: 'nested Alpha' }, { action: 'click', role: 'button', name: 'View selected document' }] }, + { kind: 'text', name: 'TDD: M7 Enter on an object cell steps in', + requiresGrid: 'grid', selector: '[role="grid"]', includes: ['leaf Alpha'], excludes: ['nested Alpha'], + steps: [{ action: 'focus', role: 'gridcell', name: '{...}' }, { action: 'press', key: 'Enter' }] }, + { kind: 'text', name: 'TDD: M2 Level up returns to the parent data', + requiresGrid: 'grid', selector: '[role="grid"]', includes: ['nested Alpha'], excludes: ['leaf Alpha'], + steps: [{ action: 'click', role: 'button', name: 'Up' }] }, + { kind: 'text', name: 'TDD: M2 breadcrumb jumps to an ancestor', + requiresGrid: 'grid', selector: '[role="grid"]', includes: ['nested Alpha'], excludes: ['leaf Alpha'], + steps: [{ action: 'dblclick', role: 'gridcell', name: '{...}' }, { action: 'click', role: 'button', name: 'details' }] }, + { kind: 'text', name: 'TDD: M2 Root Level returns to root data', + requiresGrid: 'grid', selector: '[role="grid"]', includes: ['Alpha', 'Beta'], excludes: ['nested Alpha', 'leaf Alpha'], + steps: [{ action: 'click', role: 'button', name: 'Root Level' }] }, + { kind: 'stableText', name: 'TDD: M1 scalar and array cells are not step-in targets', + requiresGrid: 'grid', selector: '[role="grid"]', + steps: [{ action: 'dblclick', role: 'gridcell', name: 'Alpha' }, { action: 'dblclick', role: 'gridcell', name: 'array[2]' }] }, + { kind: 'stableText', name: 'TDD: M7 Enter on a scalar does not step in', + requiresGrid: 'grid', selector: '[role="grid"]', + steps: [{ action: 'focus', role: 'gridcell', name: 'Beta' }, { action: 'press', key: 'Enter' }] }, + ], + selection: [ + ...['View selected document', 'Edit selected document', 'Delete selected document(s)'].map((name): ScenarioAssertion => ({ + kind: 'attribute', name: `TDD: K1 no selection disables ${name}`, + requiresGrid: 'grid', selector: `.collectionView :is(button,[role="button"])[aria-label="${name}"]`, attribute: 'disabled', expected: '', + })), + { kind: 'attribute', name: 'TDD: K1 one clicked row is selected, not treated as none', + requiresGrid: 'grid', selector: '[role="grid"] [role="row"][aria-rowindex="2"]', + attribute: 'aria-selected', expected: 'true', steps: [{ action: 'click', role: 'gridcell', name: 'Alpha' }] }, + { kind: 'calls', name: 'TDD: K1 exactly one selected document can be viewed', + requiresGrid: 'grid', path: 'mongoClusters.collectionView.viewDocumentById', input: '"heterogeneous-1"', count: 1, + steps: [{ action: 'click', role: 'button', name: 'View selected document' }] }, + { kind: 'calls', name: 'TDD: K1 exactly one selected document can be edited', + requiresGrid: 'grid', path: 'mongoClusters.collectionView.editDocumentById', input: '"heterogeneous-1"', count: 1, + steps: [{ action: 'click', role: 'button', name: 'Edit selected document' }] }, + { kind: 'order', name: 'TDD: K1 Space adds a document to the selection', + requiresGrid: 'grid', selector: '[role="grid"] [role="row"][aria-selected="true"]', texts: ['Alpha', 'Beta'], + steps: [{ action: 'focus', role: 'gridcell', name: 'Beta' }, { action: 'press', key: 'Space' }] }, + ...['View selected document', 'Edit selected document'].map((name): ScenarioAssertion => ({ + kind: 'attribute', name: `TDD: K1 multiple rows disable ${name}`, + requiresGrid: 'grid', selector: `.collectionView :is(button,[role="button"])[aria-label="${name}"]`, attribute: 'disabled', expected: '', + })), + { kind: 'order', name: 'TDD: K1 arrow focus does not change the selected documents', + requiresGrid: 'grid', selector: '[role="grid"] [role="row"][aria-selected="true"]', texts: ['Alpha', 'Beta'], + steps: [{ action: 'press', key: 'ArrowDown' }] }, + { kind: 'order', name: 'TDD: K1 Shift+Space extends the keyboard selection', + requiresGrid: 'grid', selector: '[role="grid"] [role="row"][aria-selected="true"]', texts: ['Alpha', 'Beta', 'heterogeneous-3'], + steps: [{ action: 'press', key: 'Shift+Space' }] }, + { kind: 'calls', name: 'TDD: K2 multi-delete sends canonical IDs, never row positions', + requiresGrid: 'grid', path: 'mongoClusters.collectionView.deleteDocumentsById', + input: ['"heterogeneous-1"', '"heterogeneous-2"', '"heterogeneous-3"'], count: 1, + steps: [{ action: 'click', role: 'button', name: 'Delete selected document(s)' }] }, + { kind: 'attribute', name: 'TDD: K2 acknowledged deletion clears selection', + requiresGrid: 'grid', selector: '[role="grid"] [role="row"][aria-selected="true"]', attribute: 'role', expected: null }, + { kind: 'attribute', name: 'TDD: K1 no remaining selection disables Delete', + requiresGrid: 'grid', selector: '.collectionView :is(button,[role="button"])[aria-label="Delete selected document(s)"]', + attribute: 'disabled', expected: '' }, + { kind: 'text', name: 'TDD: K2 acknowledged deletion removes the deleted rows locally', + requiresGrid: 'grid', selector: '[role="grid"]', includes: [], excludes: ['heterogeneous-[123]', 'Alpha', 'Beta'] }, + ], + identity: [ + { kind: 'stableText', name: 'TDD: M1 object-valued root IDs are not step-in targets', + requiresGrid: 'grid', selector: '[role="grid"]', + steps: [{ action: 'dblclick', role: 'gridcell', name: '{...}' }] }, + { kind: 'stableText', name: 'TDD: M7 Enter on an object-valued root ID does not step in', + requiresGrid: 'grid', selector: '[role="grid"]', + steps: [{ action: 'focus', role: 'gridcell', name: '{...}' }, { action: 'press', key: 'Enter' }] }, + { kind: 'calls', name: 'TDD: K2 null is a valid canonical ID for View', + requiresGrid: 'grid', path: 'mongoClusters.collectionView.viewDocumentById', input: 'null', count: 1, + steps: [{ action: 'click', role: 'gridcell', name: 'Null ID' }, { action: 'click', role: 'button', name: 'View selected document' }] }, + { kind: 'calls', name: 'TDD: K2 zero is a valid canonical ID for Edit', + requiresGrid: 'grid', path: 'mongoClusters.collectionView.editDocumentById', input: '{"$numberInt":"0"}', count: 1, + steps: [{ action: 'click', role: 'gridcell', name: 'Zero ID' }, { action: 'click', role: 'button', name: 'Edit selected document' }] }, + { kind: 'calls', name: 'TDD: K2 false, empty-string and composite IDs stay canonical for Delete', + requiresGrid: 'grid', path: 'mongoClusters.collectionView.deleteDocumentsById', + input: ['false', '""', '{"tenant":{"$numberInt":"1"}}'], count: 1, + steps: [ + { action: 'click', role: 'gridcell', name: 'False ID' }, + { action: 'focus', role: 'gridcell', name: 'Empty ID' }, { action: 'press', key: 'Space' }, + { action: 'focus', role: 'gridcell', name: 'Composite ID' }, { action: 'press', key: 'Space' }, + { action: 'click', role: 'button', name: 'Delete selected document(s)' }, + ] }, + ], + 'late-delete': [ + { kind: 'calls', name: 'TDD: K2 delete starts against the originally selected ID', + requiresGrid: 'grid', path: 'mongoClusters.collectionView.deleteDocumentsById', input: ['"heterogeneous-1"'], count: 1, + steps: [{ action: 'click', role: 'gridcell', name: 'Alpha' }, { action: 'click', role: 'button', name: 'Delete selected document(s)' }] }, + { kind: 'text', name: 'TDD: K2 late delete acknowledgement preserves the newer selection', + requiresGrid: 'grid', selector: '[role="grid"] [role="row"][aria-selected="true"]', + includes: ['Beta', 'heterogeneous-2'], excludes: ['Alpha'], + steps: [{ action: 'click', role: 'gridcell', name: 'Beta' }, { action: 'releaseReply', tag: 'delete-alpha' }] }, + { kind: 'text', name: 'TDD: K2 late acknowledgement removes only the requested document', + requiresGrid: 'grid', selector: '[role="grid"]', includes: ['Beta', 'heterogeneous-3'], excludes: ['Alpha', 'heterogeneous-1'] }, + { kind: 'calls', name: 'TDD: K2 the preserved selection still opens the newer document', + requiresGrid: 'grid', path: 'mongoClusters.collectionView.viewDocumentById', input: '"heterogeneous-2"', count: 1, + steps: [{ action: 'click', role: 'button', name: 'View selected document' }] }, + ], + 'late-query': [ + { kind: 'text', name: 'TDD: K2 an old nested request can remain pending while returning to Root', + requiresGrid: 'grid', selector: '[aria-label="Small breadcrumb example with buttons"]', + includes: ['details'], excludes: [], + steps: [{ action: 'dblclick', role: 'gridcell', name: '{...}' }] }, + { kind: 'text', name: 'TDD: K2 late same-panel data cannot replace current root results', + requiresGrid: 'grid', selector: '[role="grid"]', includes: ['Alpha', 'Beta'], excludes: ['nested Alpha'], + steps: [{ action: 'click', role: 'button', name: 'Root Level' }, { action: 'click', role: 'gridcell', name: 'Beta' }, + { action: 'releaseReply', tag: 'old-details' }] }, + { kind: 'calls', name: 'TDD: K2 late same-panel data cannot retarget the newer selection', + requiresGrid: 'grid', path: 'mongoClusters.collectionView.viewDocumentById', input: '"heterogeneous-2"', count: 1, + steps: [{ action: 'click', role: 'button', name: 'View selected document' }] }, + ], + 'loading-to-results': [ + { kind: 'attribute', name: 'K9 supporting first-load shell shows loading content', + selector: '[aria-label="Loading Content"]', attribute: 'aria-label', expected: 'Loading Content' }, + { kind: 'calls', name: 'K9 supporting first-load request was observed before release', + path: 'mongoClusters.collectionView.runFindQuery', count: 1, steps: [], + input: { filter: '{ }', project: '{ }', sort: '{ }', skip: 0, limit: 0, + pageNumber: 1, pageSize: 50, executionIntent: 'pagination' } }, + { kind: 'calls', name: 'K9 supporting first-load request releases without a clock delay', + path: 'mongoClusters.collectionView.getCurrentPageAsTable', input: [], count: 1, + steps: [{ action: 'releaseReply', tag: 'initial-results' }] }, + { kind: 'text', name: 'TDD: K9 loading resolves to browsable document rows', + requiresGrid: 'grid', selector: '[role="grid"]', includes: ['Alpha', 'Beta'], excludes: [] }, + ], + paging: [ + { kind: 'text', name: 'TDD: M3 Next shows page two with loaded document rows', + requiresGrid: 'grid', selector: '.collectionView', includes: ['Page 2', 'Alpha', 'Beta'], excludes: [], + steps: [{ action: 'click', role: 'gridcell', name: 'Alpha' }, { action: 'click', role: 'button', name: 'Go to next page' }] }, + { kind: 'attribute', name: 'TDD: K2 paging clears the old row selection', + requiresGrid: 'grid', selector: '[role="grid"] [role="row"][aria-selected="true"]', attribute: 'role', expected: null }, + { kind: 'text', name: 'TDD: M3 Previous returns to page one', + requiresGrid: 'grid', selector: '.collectionView', includes: ['Page 1', 'Alpha'], excludes: [], + steps: [{ action: 'click', role: 'button', name: 'Go to previous page' }] }, + { kind: 'text', name: 'TDD: M3 First returns to page one', + requiresGrid: 'grid', selector: '.collectionView', includes: ['Page 1', 'Alpha'], excludes: [], + steps: [{ action: 'click', role: 'button', name: 'Go to next page' }, { action: 'click', role: 'button', name: 'Go to start' }] }, + ...['50', '100', '500', '10'].flatMap((size): ScenarioAssertion[] => [{ + kind: 'text', name: `TDD: M3 page size ${size} retains loaded rows and resets page one`, + requiresGrid: 'grid', selector: '.collectionView', includes: ['Page 1', 'Alpha', 'Beta'], excludes: [], + steps: [ + { action: 'click', role: 'button', name: 'Go to next page' }, + { action: 'click', role: 'combobox', name: 'Change page size' }, + { action: 'click', role: 'option', name: size }, + ], + }, { + kind: 'text', name: `TDD: M3 page size ${size} is shown as the current choice`, + requiresGrid: 'grid', selector: '[role="combobox"][aria-label="Change page size"]', + includes: [size], excludes: ['10', '50', '100', '500'].filter((other): boolean => other !== size).map((other): string => `^${other}$`), + }]), + { kind: 'text', name: 'TDD: M3 a new find query returns to page one with browsable results', + requiresGrid: 'grid', selector: '.collectionView', includes: ['Page 1', 'Alpha'], excludes: [], + steps: [{ action: 'click', role: 'button', name: 'Go to next page' }, + { action: 'click', role: 'button', name: 'Find Query: execute the current editor values' }] }, + { kind: 'attribute', name: 'TDD: K2 refresh clears old selection instead of retargeting it', + requiresGrid: 'grid', selector: '[role="grid"] [role="row"][aria-selected="true"]', attribute: 'role', expected: null, + steps: [{ action: 'click', role: 'gridcell', name: 'Alpha' }, + { action: 'click', role: 'button', name: 'Refresh: Rerun the last executed query' }] }, + { kind: 'attribute', name: 'TDD: K2 view switching clears invisible table selection', + requiresGrid: 'grid', selector: '[role="grid"] [role="row"][aria-selected="true"]', attribute: 'role', expected: null, + steps: [ + { action: 'click', role: 'gridcell', name: 'Alpha' }, + { action: 'click', role: 'combobox', name: 'Select view type' }, + { action: 'click', role: 'option', name: 'Tree View' }, + { action: 'click', role: 'combobox', name: 'Select view type' }, + { action: 'click', role: 'option', name: 'Table View' }, + ] }, + ], +} satisfies Record; + const readyDocker = base.rpc['localQuickStart.getDockerStatus'].results[0]; const completedStages = [ { stage: 'checking', status: 'done', dockerReadiness: readyDocker.readiness }, @@ -2472,9 +2850,19 @@ export const scenarios = { arrays: collectionViewScenario('arrays'), 'page-500': collectionViewScenario('page-500'), 'html-values': collectionViewScenario('html-values'), - empty: collectionViewScenario('empty'), + empty: { + ...collectionViewScenario('empty'), + readiness: { ...collectionViewBase.readiness, content: ['Documents', 'No results found'] }, + }, 'no-id': collectionViewScenario('no-id'), 'first-load': collectionViewScenario('first-load'), + 'step-in': collectionViewScenario('step-in'), + selection: collectionViewScenario('selection'), + identity: collectionViewScenario('identity'), + 'late-delete': collectionViewScenario('late-delete'), + 'late-query': collectionViewScenario('late-query'), + 'loading-to-results': collectionViewScenario('loading-to-results'), + paging: collectionViewScenario('paging'), }, documentView: { default: defaultScenario('documentView') }, clusterDashboard: { default: defaultScenario('clusterDashboard') }, @@ -3534,5 +3922,20 @@ export function findScenario(route: ScenarioRoute): Scenario { if (!scenario) { throw new Error(`Unknown scenario: ${route.path}`); } + if (route.view === 'collectionView' && route.scenario === 'mixed-types') { + const palette = { + dark: { background: 'rgb(31, 31, 31)', foreground: 'rgb(204, 204, 204)' }, + light: { background: 'rgb(255, 255, 255)', foreground: 'rgb(59, 59, 59)' }, + 'high-contrast': { background: 'rgb(0, 0, 0)', foreground: 'rgb(255, 255, 255)' }, + }[route.theme]; + return { + ...scenario, + assertions: scenario.assertions?.map((assertion): ScenarioAssertion => + assertion.kind === 'style' && assertion.requiresGrid + ? { ...assertion, expected: assertion.property === 'color' ? palette.foreground : palette.background } + : assertion, + ), + }; + } return scenario; } From 42648bc4fe3ea78c0dd9257f96641e932e7312ad Mon Sep 17 00:00:00 2001 From: Tomasz Naumowicz Date: Thu, 26 Nov 2026 21:44:41 +0100 Subject: [PATCH 037/148] docs: record WI-3c completion and A3 gate Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .../iterations/02-rdg-execution-plan.md | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/docs/ai-and-plans/features/data-grid/iterations/02-rdg-execution-plan.md b/docs/ai-and-plans/features/data-grid/iterations/02-rdg-execution-plan.md index e6b9bcf63..1fd371f70 100644 --- a/docs/ai-and-plans/features/data-grid/iterations/02-rdg-execution-plan.md +++ b/docs/ai-and-plans/features/data-grid/iterations/02-rdg-execution-plan.md @@ -187,6 +187,13 @@ a type-only fixture correction, `npm run package` and `npm run verify:vsix` pass `npx vitest run src/utils/documentGrid` passed all 22 tests. The scoped SlickGrid grep found no tracked matches. The package graph still limits React Data Grid to Collection View. +**A3 passed (2026-11-26), leader decision.** In the Integrated Browser, all 54 Collection View +routes were ready, with no reported harness or console/CSP failures. Per theme, all 110 +`TDD:` assertions were red for missing accessible implementations (96 table, 14 tree). +No `TDD:` assertion passed against a placeholder. The separate Table return check also +expects rows the placeholder does not render. Browser TypeScript and 107 focused Vitest +tests passed. Cross-collection panel isolation is a G2 workbench check, per the operator. + **A4 passed (2026-11-26), leader decision.** The beta.64 scratch treegrid passed all 17 keyboard, focus and ARIA checks in the VS Code Insiders Integrated Browser. The spike verifies browser behavior, not screen reader announcements or the shipped UI. @@ -942,6 +949,18 @@ parity. > **Verification placement (2026-11-26), operator decision:** Cross-collection isolation moves > to the two-panel workbench check at G2. It is not removed from scope or claimed by A3. +> **Done (2026-11-26), commit `799c509f`:** `gpt-6.1-sol` added M1–M7/K1–K11 contracts, +> named regressions and test-only input-specific replies and controlled acknowledgement release. +> No masked harness failure counts as an expected red assertion. The leader selected these +> deterministic harness mechanics (98%) and released A3 (99%) on the evidence above. +> Corrective turns fixed draft syntax, mock types and jsdom text handling; no accepted +> contract was weakened. Thirty-seven focused cases added; browser type check, 107 focused +> tests and whitespace checks passed. All 330 TDD executions were expected red. Paging +> controls in the harness use repeated data; distinct server pages, cross-collection panel +> isolation and assistive-technology behavior remain for the real workbench check. +> Usage: coding 237.7 AIU (56 requests, 22m04s); shared A3/A4 checks 3.9 AIU (50 requests, +> 4m47s summed, including prior attempts). + **WI-9a: tree keyboard spike** · `gpt-6.1-sol` · scratch worktree, throwaway - Build the smallest treegrid on RDG at the pinned version over `TreeNode[]`: flattened visible rows, @@ -1145,3 +1164,8 @@ and behavior listed at G1; the RDG dependency is not yet in the product manifest published artifacts, scratch Chromium 142/148 and Insiders behavior, Vite CSS delivery and the packaged-theme caveat. The operator accepted release metadata for the support floor; the exact stable workbench smoke, a real collection, screen readers and high-contrast were not run. + +Step 1 is complete. A2, A3 and A4 passed. Product Table and Tree are still placeholders; +the behavior contracts provide the red baseline for Step 2. Resume with WI-5, WI-6 and WI-9 +in the documented lanes; WI-6's integration waits for WI-5. Do not reopen G1 decisions or +claim placeholder behavior as implementation. G2 remains the next operator gate. From f301fa07a0f053e564844192475cc8ff830c6fc8 Mon Sep 17 00:00:00 2001 From: Tomasz Naumowicz Date: Thu, 26 Nov 2026 22:09:39 +0100 Subject: [PATCH 038/148] feat: render Collection View table with React Data Grid (WI-5) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .../iterations/02-rdg-execution-plan.md | 5 +++ .../resultsTab/DataViewPanelTable.tsx | 45 ++++++++++++++++--- .../resultsTab/dataViewPanelTable.scss | 14 ++++++ 3 files changed, 58 insertions(+), 6 deletions(-) create mode 100644 src/webviews/documentdb/collectionView/components/resultsTab/dataViewPanelTable.scss diff --git a/docs/ai-and-plans/features/data-grid/iterations/02-rdg-execution-plan.md b/docs/ai-and-plans/features/data-grid/iterations/02-rdg-execution-plan.md index 1fd371f70..a8c59c046 100644 --- a/docs/ai-and-plans/features/data-grid/iterations/02-rdg-execution-plan.md +++ b/docs/ai-and-plans/features/data-grid/iterations/02-rdg-execution-plan.md @@ -992,6 +992,11 @@ through `mai-code-2-flash` after each pair of items, not after every commit. - Scope rows M3, M6, K3, K4, K9, K11; D1–D3, D5–D6. Plain text cells until WI-6 lands. - Acceptance: A5. +> **Implementation (2026-11-26):** `mai-code-2` replaced the Table placeholder with the +> themed beta.64 grid, using neutral columns and row keys, native keyboard navigation, +> resizing and virtualization. Paging stays in Collection View; the first-load skeleton is +> unchanged. A5 is shared with WI-6 and remains pending. Coding usage: 12.8 AIU (20 requests). + **WI-6: typed value cell** · `mai-code-2` (fallback `gpt-6.1-terra`) - Owns: a new `TypedValueCell.tsx` with a jsdom test. Last step, after WI-5 commits: wire it into diff --git a/src/webviews/documentdb/collectionView/components/resultsTab/DataViewPanelTable.tsx b/src/webviews/documentdb/collectionView/components/resultsTab/DataViewPanelTable.tsx index 142876c11..424a014af 100644 --- a/src/webviews/documentdb/collectionView/components/resultsTab/DataViewPanelTable.tsx +++ b/src/webviews/documentdb/collectionView/components/resultsTab/DataViewPanelTable.tsx @@ -4,11 +4,20 @@ *--------------------------------------------------------------------------------------------*/ import * as React from 'react'; -import { DataGrid } from 'react-data-grid'; +import { DataGrid, type Column, type DefaultColumnOptions } from 'react-data-grid'; import 'react-data-grid/lib/styles.css'; -import { type ColumnKey, type TablePage } from '../../../../../utils/documentGrid/types'; +import * as l10n from '@vscode/l10n'; +import { + getCell, + type ColumnKey, + type TableColumn, + type TablePage, + type TableRow, +} from '../../../../../utils/documentGrid/types'; import { CollectionViewContext } from '../../collectionViewContext'; import { LoadingAnimationTable } from './LoadingAnimationTable'; +import './dataGridTheme.scss'; +import './dataViewPanelTable.scss'; interface DataViewPanelTableProps { readonly page: TablePage | undefined; @@ -17,6 +26,14 @@ interface DataViewPanelTableProps { readonly onStepIn: (rowKey: string, columnKey: ColumnKey) => void; } +const defaultColumnOptions: DefaultColumnOptions = { + resizable: true, +}; + +function renderTableCell(row: TableRow, column: TableColumn): React.ReactNode { + return getCell(row, column.key)?.display ?? ''; +} + export function DataViewPanelTable({ page, selectedRowKeys, @@ -24,18 +41,34 @@ export function DataViewPanelTable({ onStepIn, }: DataViewPanelTableProps): React.JSX.Element { const [currentContext] = React.useContext(CollectionViewContext); - void page; void selectedRowKeys; void onStepIn; React.useEffect(() => (): void => onSelectedRowKeysChange([]), [onSelectedRowKeysChange]); + const columns = React.useMemo[]>( + () => + (page?.columns ?? []).map( + (column): Column => ({ + key: column.key, + name: column.label, + renderCell: ({ row }): React.ReactNode => renderTableCell(row, column), + }), + ), + [page?.columns], + ); + if (currentContext.isFirstTimeLoad) { return ; } return ( - + row.rowKey} + rows={page?.rows ?? []} + /> ); } diff --git a/src/webviews/documentdb/collectionView/components/resultsTab/dataViewPanelTable.scss b/src/webviews/documentdb/collectionView/components/resultsTab/dataViewPanelTable.scss new file mode 100644 index 000000000..a85e54b25 --- /dev/null +++ b/src/webviews/documentdb/collectionView/components/resultsTab/dataViewPanelTable.scss @@ -0,0 +1,14 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +.dataViewPanelTable { + block-size: 100%; + min-block-size: 0; + user-select: text; + + &.rdg-viewport-dragging { + user-select: none; + } +} From 1c4e7b03c86ac8d9d1de33127d0e12eef9f35121 Mon Sep 17 00:00:00 2001 From: Tomasz Naumowicz Date: Thu, 26 Nov 2026 22:40:22 +0100 Subject: [PATCH 039/148] test: visit virtualized columns before checking BSON values (E3) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- build/verification/browser/scenarios.ts | 75 +++++++++++++------ .../iterations/02-rdg-execution-plan.md | 9 +++ 2 files changed, 62 insertions(+), 22 deletions(-) diff --git a/build/verification/browser/scenarios.ts b/build/verification/browser/scenarios.ts index 4457bad5a..734a6dd8b 100644 --- a/build/verification/browser/scenarios.ts +++ b/build/verification/browser/scenarios.ts @@ -288,31 +288,62 @@ function collectionViewScenario(name: keyof typeof collectionViewFixtures): Scen }; } +interface MixedTypesColumnExpectation { + readonly texts?: readonly [string | undefined, string | undefined]; + readonly indicator?: string; + readonly numericIndicator?: string; +} + +const mixedTypesExpectations: Readonly> = { + 2: { texts: ['fixture text', undefined], indicator: 'Ab' }, + 3: { texts: ['7', '-4.5'], indicator: 'i32', numericIndicator: '.12' }, + 4: { texts: ['true', 'false'], indicator: 'tf' }, + 5: { texts: ['2026-01-02T03:04:05.000Z', undefined], indicator: 'DT' }, + 6: { texts: ['12.50', undefined], indicator: 'd128', numericIndicator: 'L' }, + 7: { texts: ['000000000000000000000002', undefined], indicator: 'ID' }, + 8: { texts: ['00112233-4455-6677-8899-aabbccddeeff', undefined], indicator: 'U' }, + 9: { texts: ['AQI=', undefined], indicator: '01' }, + 10: { texts: ['array[3]', 'array[0]'], indicator: '[ ]' }, + 11: { indicator: '{ }' }, + 12: { indicator: 'U~' }, +}; + // These are browser user-outcome contracts, not assertions about the grid package's DOM classes. export const collectionViewContracts = { 'mixed-types': [ - { - kind: 'text', name: 'TDD: K5 BSON values retain their formatted text', - requiresGrid: 'grid', selector: '[role="grid"]', - includes: ['fixture text', '7', '-4.5', 'true', 'false', '2026-01-02T03:04:05.000Z', '12.50', - '000000000000000000000002', '00112233-4455-6677-8899-aabbccddeeff', 'AQI=', 'array[3]', 'array[0]'], - excludes: ['\\[object Object\\]'], - }, - ...[ - [2, 'Ab'], [3, 'i32'], [4, 'tf'], [5, 'DT'], [6, 'd128'], [7, 'ID'], - [8, 'U'], [9, '01'], [10, '[ ]'], [11, '{ }'], [12, 'U~'], - ].map(([column, label]): ScenarioAssertion => ({ - kind: 'text', name: `TDD: K7 distinct cell type indicator ${label}`, - requiresGrid: 'grid', - selector: `[role="grid"] [role="row"][aria-rowindex="2"] [role="gridcell"][aria-colindex="${column}"]`, - includes: [String(label)], excludes: [], - })), - ...[[3, '.12'], [6, 'L']].map(([column, label]): ScenarioAssertion => ({ - kind: 'text', name: `TDD: K5 numeric type ${label} is not reduced to an ordinary number`, - requiresGrid: 'grid', - selector: `[role="grid"] [role="row"][aria-rowindex="3"] [role="gridcell"][aria-colindex="${column}"]`, - includes: [String(label)], excludes: [], - })), + ...collectionViewFixtures['mixed-types'].tablePage.columns.flatMap(({ label }, index): ScenarioAssertion[] => { + const column = index + 1; + const expectation = mixedTypesExpectations[column]; + // Assertions run after readiness; finish both rows/types before advancing the header. + const advance: ScenarioStep = column === 1 + ? { action: 'focus', role: 'columnheader', name: '_id' } + : { action: 'press', key: 'ArrowRight' }; + return [ + ...[2, 3].map((row): ScenarioAssertion => { + const text = expectation?.texts?.[row - 2]; + return { + kind: 'text', name: `TDD: K5 BSON values retain their formatted text (${label}, row ${row - 1})`, + requiresGrid: 'grid', + selector: `[role="grid"] [role="row"][aria-rowindex="${row}"] [role="gridcell"][aria-colindex="${column}"]`, + includes: text === undefined ? [] : [text], + excludes: ['\\[object Object\\]'], + steps: row === 2 ? [advance] : [], + }; + }), + ...(expectation?.indicator === undefined ? [] : [{ + kind: 'text', name: `TDD: K7 distinct cell type indicator ${expectation.indicator}`, + requiresGrid: 'grid', + selector: `[role="grid"] [role="row"][aria-rowindex="2"] [role="gridcell"][aria-colindex="${column}"]`, + includes: [expectation.indicator], excludes: [], + } as const]), + ...(expectation?.numericIndicator === undefined ? [] : [{ + kind: 'text', name: `TDD: K5 numeric type ${expectation.numericIndicator} is not reduced to an ordinary number`, + requiresGrid: 'grid', + selector: `[role="grid"] [role="row"][aria-rowindex="3"] [role="gridcell"][aria-colindex="${column}"]`, + includes: [expectation.numericIndicator], excludes: [], + } as const]), + ]; + }), { kind: 'style', name: 'TDD: K10 grid background follows the VS Code theme', requiresGrid: 'grid', selector: '[role="grid"]', property: 'background-color', expected: '', diff --git a/docs/ai-and-plans/features/data-grid/iterations/02-rdg-execution-plan.md b/docs/ai-and-plans/features/data-grid/iterations/02-rdg-execution-plan.md index a8c59c046..5fbc82607 100644 --- a/docs/ai-and-plans/features/data-grid/iterations/02-rdg-execution-plan.md +++ b/docs/ai-and-plans/features/data-grid/iterations/02-rdg-execution-plan.md @@ -961,6 +961,15 @@ parity. > Usage: coding 237.7 AIU (56 requests, 22m04s); shared A3/A4 checks 3.9 AIU (50 requests, > 4m47s summed, including prior attempts). +> **E3 approved during A5 (2026-11-26):** The first high-contrast `mixed-types` report ran +> before columns 10–12 were mounted. A later Integrated Browser snapshot showed all the +> expected values and type indicators without a scroll command; the precise timing or layout +> trigger was not measured. The operator approved waiting for or navigating to the target +> columns in the test setup, with the same expected content and no product behavior change. +> `gpt-6.1-sol` made one keyboard pass across the columns after readiness. All 39 +> `mixed-types` assertions passed in each theme in the Integrated Browser; 75 scenario +> unit tests and the browser type check passed. Contract coding: 43.1 AIU (17 requests). + **WI-9a: tree keyboard spike** · `gpt-6.1-sol` · scratch worktree, throwaway - Build the smallest treegrid on RDG at the pinned version over `TreeNode[]`: flattened visible rows, From bf2686fd8b66601bea33e581a22fe4020eedeccb Mon Sep 17 00:00:00 2001 From: Tomasz Naumowicz Date: Thu, 26 Nov 2026 22:40:35 +0100 Subject: [PATCH 040/148] feat: render typed BSON values in Collection View (WI-6) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .../iterations/02-rdg-execution-plan.md | 27 ++++-- .../resultsTab/DataViewPanelTable.tsx | 10 +-- .../resultsTab/TypedValueCell.test.tsx | 81 +++++++++++++++++ .../components/resultsTab/TypedValueCell.tsx | 90 +++++++++++++++++++ 4 files changed, 197 insertions(+), 11 deletions(-) create mode 100644 src/webviews/documentdb/collectionView/components/resultsTab/TypedValueCell.test.tsx create mode 100644 src/webviews/documentdb/collectionView/components/resultsTab/TypedValueCell.tsx diff --git a/docs/ai-and-plans/features/data-grid/iterations/02-rdg-execution-plan.md b/docs/ai-and-plans/features/data-grid/iterations/02-rdg-execution-plan.md index 5fbc82607..6b77ac633 100644 --- a/docs/ai-and-plans/features/data-grid/iterations/02-rdg-execution-plan.md +++ b/docs/ai-and-plans/features/data-grid/iterations/02-rdg-execution-plan.md @@ -198,6 +198,15 @@ tests passed. Cross-collection panel isolation is a G2 workbench check, per the keyboard, focus and ARIA checks in the VS Code Insiders Integrated Browser. The spike verifies browser behavior, not screen reader announcements or the shipped UI. +**A5 evidence (2026-11-26), not yet released.** The build, 25 focused tests, 75 scenario unit +tests and browser TypeScript passed. After the approved E3 test setup correction, the Insiders +Integrated Browser reported 237 passing assertions across 30 Table routes in dark, light and +high contrast, with all routes ready and no reported errors. This covers the table core, +typed values, paging, column and cell navigation, loading/empty states and 500-row +virtualization. The root-ID shaping test passes, but the nested K3/K4 journey still needs +WI-7 document actions and WI-8 step-in. Run those pinned assertions alongside A7 before +releasing A5; do not treat incidental K2 passes before selection exists as A6 evidence. + ### Escalations | ID | Trigger | Operator chooses | @@ -1004,7 +1013,8 @@ through `mai-code-2-flash` after each pair of items, not after every commit. > **Implementation (2026-11-26):** `mai-code-2` replaced the Table placeholder with the > themed beta.64 grid, using neutral columns and row keys, native keyboard navigation, > resizing and virtualization. Paging stays in Collection View; the first-load skeleton is -> unchanged. A5 is shared with WI-6 and remains pending. Coding usage: 12.8 AIU (20 requests). +> unchanged. The implementation is committed at `f301fa07`; the shared A5 evidence above +> records what passed and the nested journey still due. Coding usage: 12.8 AIU (20 requests). **WI-6: typed value cell** · `mai-code-2` (fallback `gpt-6.1-terra`) @@ -1013,6 +1023,13 @@ through `mai-code-2-flash` after each pair of items, not after every commit. - Scope rows K5–K8; D8. Text only, never HTML (K8). - Acceptance: A5. +> **Implementation complete (2026-11-26):** `mai-code-2` added BSON text, type indicators and +> hover descriptions with an explicit missing state and no extra Tab stops. The component is +> wired into the table; all K5–K8 browser checks passed in three themes. Shared A5 is pending +> the nested table journey, not a typed-cell failure. Coding: 18.8 AIU (24 requests). +> Shared A5 verification: 1.3 AIU on `mai-code-2-flash` (22 requests) for build, tests and +> initial browser attempt; 20.9 AIU on `gpt-6.1-terra` (28 requests) for the Integrated Browser. + **WI-7: selection and document actions** · `gpt-6.1-sol` · after WI-5 - Owns: `DataViewPanelTable.tsx` (selection), `CollectionView.tsx` (delete flow and its @@ -1179,7 +1196,7 @@ published artifacts, scratch Chromium 142/148 and Insiders behavior, Vite CSS de packaged-theme caveat. The operator accepted release metadata for the support floor; the exact stable workbench smoke, a real collection, screen readers and high-contrast were not run. -Step 1 is complete. A2, A3 and A4 passed. Product Table and Tree are still placeholders; -the behavior contracts provide the red baseline for Step 2. Resume with WI-5, WI-6 and WI-9 -in the documented lanes; WI-6's integration waits for WI-5. Do not reopen G1 decisions or -claim placeholder behavior as implementation. G2 remains the next operator gate. +Step 1 is complete. A2, A3 and A4 passed. The product Table renders real rows and typed cells +after WI-5/WI-6. A5 still needs the nested journey that becomes reachable after WI-7/WI-8. +WI-7 selection and WI-9 Tree are the next parallel lanes; the Tree remains a placeholder until +WI-9. G2 remains the next operator gate. diff --git a/src/webviews/documentdb/collectionView/components/resultsTab/DataViewPanelTable.tsx b/src/webviews/documentdb/collectionView/components/resultsTab/DataViewPanelTable.tsx index 424a014af..99e1a3156 100644 --- a/src/webviews/documentdb/collectionView/components/resultsTab/DataViewPanelTable.tsx +++ b/src/webviews/documentdb/collectionView/components/resultsTab/DataViewPanelTable.tsx @@ -10,12 +10,12 @@ import * as l10n from '@vscode/l10n'; import { getCell, type ColumnKey, - type TableColumn, type TablePage, type TableRow, } from '../../../../../utils/documentGrid/types'; import { CollectionViewContext } from '../../collectionViewContext'; import { LoadingAnimationTable } from './LoadingAnimationTable'; +import { TypedValueCell } from './TypedValueCell'; import './dataGridTheme.scss'; import './dataViewPanelTable.scss'; @@ -30,10 +30,6 @@ const defaultColumnOptions: DefaultColumnOptions = { resizable: true, }; -function renderTableCell(row: TableRow, column: TableColumn): React.ReactNode { - return getCell(row, column.key)?.display ?? ''; -} - export function DataViewPanelTable({ page, selectedRowKeys, @@ -51,7 +47,9 @@ export function DataViewPanelTable({ (column): Column => ({ key: column.key, name: column.label, - renderCell: ({ row }): React.ReactNode => renderTableCell(row, column), + renderCell: ({ row }): React.ReactNode => ( + + ), }), ), [page?.columns], diff --git a/src/webviews/documentdb/collectionView/components/resultsTab/TypedValueCell.test.tsx b/src/webviews/documentdb/collectionView/components/resultsTab/TypedValueCell.test.tsx new file mode 100644 index 000000000..8c7a1bac2 --- /dev/null +++ b/src/webviews/documentdb/collectionView/components/resultsTab/TypedValueCell.test.tsx @@ -0,0 +1,81 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +// @vitest-environment jsdom + +import { act, type ReactNode } from 'react'; +import { createRoot, type Root } from 'react-dom/client'; // eslint-disable-line import/no-internal-modules +import { afterEach, describe, expect, it, vi } from 'vitest'; +import { TypedValueCell } from './TypedValueCell'; + +(globalThis as { IS_REACT_ACT_ENVIRONMENT?: boolean }).IS_REACT_ACT_ENVIRONMENT = true; + +vi.mock('@vscode/l10n', () => ({ + t: (message: string): string => message, +})); + +const mounted: { host: HTMLElement; root: Root }[] = []; + +async function render(node: ReactNode): Promise { + const host = document.createElement('div'); + document.body.appendChild(host); + const root = createRoot(host); + mounted.push({ host, root }); + await act(async () => { + root.render(node); + }); + return host; +} + +function referencedText(element: Element, attribute: string): string | undefined { + const id = element.getAttribute(attribute)?.split(' ')[0]; + return id === undefined ? undefined : document.getElementById(id)?.textContent ?? undefined; +} + +afterEach(async () => { + for (const { host, root } of mounted.splice(0)) { + await act(async () => { + root.unmount(); + }); + host.remove(); + } + document.body.replaceChildren(); +}); + +describe('TypedValueCell', () => { + it('renders the formatted value with its existing type glyph and accessible full type name', async () => { + const host = await render( + , + ); + const cell = host.firstElementChild; + + expect(host.textContent).toBe('12.50d128'); + expect(cell?.hasAttribute('tabindex')).toBe(false); + expect(referencedText(cell ?? host, 'aria-describedby')).toBe('Decimal128'); + expect(cell?.getAttribute('aria-label')).toBeNull(); + }); + + it('keeps missing and explicit null as distinct accessible cell states', async () => { + const missingHost = await render(); + const missing = missingHost.firstElementChild; + const nullHost = await render(); + const explicitNull = nullHost.firstElementChild; + + expect(missingHost.textContent).toBe(''); + expect(missing?.hasAttribute('tabindex')).toBe(false); + expect(missing?.getAttribute('role')).toBe('group'); + expect(missing?.getAttribute('aria-label')).toBe('This field is not set'); + expect(nullHost.textContent).toBe('nullØ'); + expect(referencedText(explicitNull ?? nullHost, 'aria-describedby')).toBe('Null'); + }); + + it('renders untrusted display strings only as React text', async () => { + const value = 'display-only text '; + const host = await render(); + + expect(host.textContent).toBe(`${value}Ab`); + expect(host.querySelector('strong, img, script')).toBeNull(); + }); +}); diff --git a/src/webviews/documentdb/collectionView/components/resultsTab/TypedValueCell.tsx b/src/webviews/documentdb/collectionView/components/resultsTab/TypedValueCell.tsx new file mode 100644 index 000000000..04c90f2d7 --- /dev/null +++ b/src/webviews/documentdb/collectionView/components/resultsTab/TypedValueCell.tsx @@ -0,0 +1,90 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +import { makeStyles, Tooltip } from '@fluentui/react-components'; +import * as l10n from '@vscode/l10n'; +import { type JSX } from 'react'; +import { type GridCellValue } from '../../../../../utils/documentGrid/types'; +import { bsonStringToDisplayString } from '../../../../utils/documentGrid/typeToDisplayString'; + +const typeGlyphs: Readonly> = { + string: 'Ab', + number: '12', + int32: 'i32', + double: '.12', + decimal128: 'd128', + long: 'L', + boolean: 'tf', + object: '{ }', + array: '[ ]', + null: 'Ø', + undefined: '?', + date: 'DT', + regexp: '/./', + binary: '01', + objectid: 'ID', + symbol: 'Σ', + timestamp: 'TS', + minkey: 'Min', + maxkey: 'Max', + dbref: 'DB', + uuid: 'U', + 'uuid-legacy': 'U~', + code: '', + codewithscope: '', + map: 'map', + _unknown_: '??', + unknown: '??', +}; + +const useStyles = makeStyles({ + root: { + display: 'flex', + alignItems: 'baseline', + width: '100%', + minWidth: 0, + minBlockSize: '1lh', + }, + value: { + minWidth: 0, + }, + type: { + flexShrink: 0, + marginInlineStart: 'auto', + paddingInlineStart: '3px', + fontSize: 'smaller', + opacity: 0.4, + }, +}); + +export interface TypedValueCellProps { + readonly value: GridCellValue | undefined; + readonly isRootId: boolean; +} + +export function TypedValueCell({ value }: TypedValueCellProps): JSX.Element { + const styles = useStyles(); + + if (value === undefined) { + const content = l10n.t('This field is not set'); + return ( + + + + ); + } + + const glyph = typeGlyphs[value.type] ?? '??'; + const typeName = bsonStringToDisplayString(value.type); + + return ( + + + {value.display} + {glyph} + + + ); +} From 25d0baabc600e65cc5bc206a64a8ca5ac58a29f5 Mon Sep 17 00:00:00 2001 From: Tomasz Naumowicz Date: Thu, 26 Nov 2026 22:52:51 +0100 Subject: [PATCH 041/148] feat: select Collection View rows and guard document actions (WI-7) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .../iterations/02-rdg-execution-plan.md | 10 ++ .../collectionView/CollectionView.tsx | 32 ++++-- .../resultsTab/DataViewPanelTable.tsx | 100 +++++++++++++++++- 3 files changed, 130 insertions(+), 12 deletions(-) diff --git a/docs/ai-and-plans/features/data-grid/iterations/02-rdg-execution-plan.md b/docs/ai-and-plans/features/data-grid/iterations/02-rdg-execution-plan.md index 6b77ac633..27bf5e7b1 100644 --- a/docs/ai-and-plans/features/data-grid/iterations/02-rdg-execution-plan.md +++ b/docs/ai-and-plans/features/data-grid/iterations/02-rdg-execution-plan.md @@ -1038,6 +1038,16 @@ through `mai-code-2-flash` after each pair of items, not after every commit. - Scope rows K1–K2; D9. Gestures as released at G1. - Acceptance: A6, including the advisor's logic review (lifecycle and data-loss risk). +> **Implementation complete (2026-11-26):** `gpt-6.1-sol` added the released selection gestures +> and guarded action eligibility against the current table request. The build and 33 focused +> tests passed. In each theme, 49 assertions passed across selection, no-ID, identity, +> late-delete and paging. `claude-opus-5.5` approved the action logic (85% confidence). +> Run the pinned late-query scenario with WI-8 before closing A6. G2 should confirm modifier +> clicks and whether re-extending toward the anchor should keep the already selected rows +> (current behavior) or shrink the range; no gesture choice changed here. +> Coding: 39.1 AIU (15 requests). Shared A6/A8 first pass: 235.7 AIU advisor (39 requests), +> 0.4 AIU terminal (9), 6.7 AIU Integrated Browser (13). + **WI-8: step in and out** · `mai-code-2` (fallback `gpt-6.1-sol`) · after WI-7 - Owns: `DataViewPanelTable.tsx` (double-click and key), `CollectionView.tsx` diff --git a/src/webviews/documentdb/collectionView/CollectionView.tsx b/src/webviews/documentdb/collectionView/CollectionView.tsx index bc5d6a18e..a97883d41 100644 --- a/src/webviews/documentdb/collectionView/CollectionView.tsx +++ b/src/webviews/documentdb/collectionView/CollectionView.tsx @@ -168,20 +168,24 @@ export const CollectionView = (): JSX.Element => { const dataRequestRef = useRef(0); const cachedQueryRef = useRef(undefined); const tablePageQueryRef = useRef(undefined); + const tablePageRequestRef = useRef(undefined); currentQueryResultsRef.current = currentQueryResults; currentContextRef.current = currentContext; const handleSelectedRowKeysChange = useCallback((selectedRowKeys: readonly string[]): void => { setCurrentContext((prev) => { - const targets = + const isCurrentPage = !prev.isLoading && prev.currentView === Views.TABLE && - tablePageQueryRef.current === prev.activeQuery - ? resolveDocumentTargets(currentQueryResultsRef.current?.tablePage, selectedRowKeys) - : undefined; + tablePageQueryRef.current === prev.activeQuery && + tablePageRequestRef.current === dataRequestRef.current; + const nextRowKeys = isCurrentPage ? [...selectedRowKeys] : []; + const targets = isCurrentPage + ? resolveDocumentTargets(currentQueryResultsRef.current?.tablePage, nextRowKeys) + : undefined; const next = { ...prev, - dataSelection: { selectedRowKeys: [...selectedRowKeys] }, + dataSelection: { selectedRowKeys: nextRowKeys }, commands: { disableAddDocument: false, disableViewDocument: targets?.length !== 1, @@ -320,6 +324,7 @@ export const CollectionView = (): JSX.Element => { return; } const request = ++dataRequestRef.current; + handleSelectedRowKeysChange([]); const query = currentContextRef.current.activeQuery; const path = [...(currentContextRef.current.currentViewState?.currentPath ?? [])]; const isCurrentRequest = (): boolean => @@ -338,6 +343,7 @@ export const CollectionView = (): JSX.Element => { return; } tablePageQueryRef.current = query; + tablePageRequestRef.current = request; currentQueryResultsRef.current = { ...currentQueryResultsRef.current, tablePage: result }; setCurrentQueryResults((prev) => ({ ...prev, @@ -444,6 +450,7 @@ export const CollectionView = (): JSX.Element => { setCurrentContext((prev) => ({ ...prev, isLoading: true, + dataSelection: { selectedRowKeys: [] }, commands: { ...prev.commands, disableViewDocument: true, @@ -561,7 +568,8 @@ export const CollectionView = (): JSX.Element => { if ( context.isLoading || context.currentView !== Views.TABLE || - tablePageQueryRef.current !== context.activeQuery + tablePageQueryRef.current !== context.activeQuery || + tablePageRequestRef.current !== dataRequestRef.current ) { return; } @@ -573,6 +581,7 @@ export const CollectionView = (): JSX.Element => { return; } const requestedIds = targets.map((target) => target.documentId); + const requestedIdSet = new Set(requestedIds); trpcClient.mongoClusters.collectionView.deleteDocumentsById .mutate(requestedIds) .then((acknowledged) => { @@ -592,7 +601,7 @@ export const CollectionView = (): JSX.Element => { } const removedKeys = new Set( page.rows - .filter((row) => row.documentId !== undefined && requestedIds.includes(row.documentId)) + .filter((row) => row.documentId !== undefined && requestedIdSet.has(row.documentId)) .map((row) => row.rowKey), ); const nextPage = { ...page, rows: page.rows.filter((row) => !removedKeys.has(row.rowKey)) }; @@ -603,7 +612,8 @@ export const CollectionView = (): JSX.Element => { const remainingTargets = !prev.isLoading && prev.currentView === Views.TABLE && - tablePageQueryRef.current === prev.activeQuery + tablePageQueryRef.current === prev.activeQuery && + tablePageRequestRef.current === dataRequestRef.current ? resolveDocumentTargets(currentQueryResultsRef.current?.tablePage, selectedRowKeys) : undefined; const next = { @@ -634,7 +644,8 @@ export const CollectionView = (): JSX.Element => { if ( context.isLoading || context.currentView !== Views.TABLE || - tablePageQueryRef.current !== context.activeQuery + tablePageQueryRef.current !== context.activeQuery || + tablePageRequestRef.current !== dataRequestRef.current ) { return; } @@ -661,7 +672,8 @@ export const CollectionView = (): JSX.Element => { if ( context.isLoading || context.currentView !== Views.TABLE || - tablePageQueryRef.current !== context.activeQuery + tablePageQueryRef.current !== context.activeQuery || + tablePageRequestRef.current !== dataRequestRef.current ) { return; } diff --git a/src/webviews/documentdb/collectionView/components/resultsTab/DataViewPanelTable.tsx b/src/webviews/documentdb/collectionView/components/resultsTab/DataViewPanelTable.tsx index 99e1a3156..7fb4d4657 100644 --- a/src/webviews/documentdb/collectionView/components/resultsTab/DataViewPanelTable.tsx +++ b/src/webviews/documentdb/collectionView/components/resultsTab/DataViewPanelTable.tsx @@ -4,7 +4,7 @@ *--------------------------------------------------------------------------------------------*/ import * as React from 'react'; -import { DataGrid, type Column, type DefaultColumnOptions } from 'react-data-grid'; +import { DataGrid, Row, type Column, type DataGridHandle, type DefaultColumnOptions } from 'react-data-grid'; import 'react-data-grid/lib/styles.css'; import * as l10n from '@vscode/l10n'; import { @@ -37,10 +37,88 @@ export function DataViewPanelTable({ onStepIn, }: DataViewPanelTableProps): React.JSX.Element { const [currentContext] = React.useContext(CollectionViewContext); - void selectedRowKeys; void onStepIn; + const gridRef = React.useRef(null); + const anchorRef = React.useRef(undefined); + const selectionScopeRef = React.useRef({ + query: currentContext.activeQuery, + path: page?.path, + }); + if ( + selectionScopeRef.current.query !== currentContext.activeQuery || + selectionScopeRef.current.path !== page?.path + ) { + selectionScopeRef.current = { query: currentContext.activeQuery, path: page?.path }; + anchorRef.current = undefined; + } + const selectedRows = React.useMemo(() => new Set(selectedRowKeys), [selectedRowKeys]); React.useEffect(() => (): void => onSelectedRowKeysChange([]), [onSelectedRowKeysChange]); + function selectRow(row: TableRow, gesture: 'replace' | 'toggle' | 'extend'): void { + const rows = page?.rows; + if (!rows || !rows.includes(row)) { + return; + } + const next = new Set(selectedRowKeys); + if (gesture === 'extend') { + const anchorIndex = rows.findIndex((candidate) => candidate.rowKey === anchorRef.current); + const rowIndex = rows.indexOf(row); + if (anchorIndex === -1) { + anchorRef.current = row.rowKey; + next.add(row.rowKey); + } else { + const range = rows.slice(Math.min(anchorIndex, rowIndex), Math.max(anchorIndex, rowIndex) + 1); + for (const candidate of range) { + next.add(candidate.rowKey); + } + } + } else { + anchorRef.current = row.rowKey; + if (gesture === 'replace') { + next.clear(); + next.add(row.rowKey); + } else if (!next.delete(row.rowKey)) { + next.add(row.rowKey); + } + } + onSelectedRowKeysChange([...next]); + } + + function handleRowKeyDown(row: TableRow, event: React.KeyboardEvent): void { + if (event.key !== ' ') { + return; + } + // RDG's native Shift+Space toggles its active row; use the actually focused row instead. + event.stopPropagation(); + if ( + event.defaultPrevented || + event.altKey || + event.ctrlKey || + event.metaKey || + !(event.target instanceof HTMLElement) || + event.target.getAttribute('role') !== 'gridcell' || + event.target.parentElement !== event.currentTarget + ) { + return; + } + event.preventDefault(); + if (!event.repeat) { + const columnIndex = Number(event.target.getAttribute('aria-colindex')) - 1; + const rowIndex = page?.rows.indexOf(row) ?? -1; + if ( + rowIndex === -1 || + !Number.isInteger(columnIndex) || + columnIndex < 0 || + columnIndex >= columns.length + ) { + return; + } + // Keep subsequent native arrow navigation aligned when a cell was focused directly. + gridRef.current?.setActivePosition({ idx: columnIndex, rowIdx: rowIndex }, { shouldFocus: false }); + selectRow(row, event.shiftKey ? 'extend' : 'toggle'); + } + } + const columns = React.useMemo[]>( () => (page?.columns ?? []).map( @@ -61,12 +139,30 @@ export function DataViewPanelTable({ return ( row.rowKey} rows={page?.rows ?? []} + selectedRows={selectedRows} + onSelectedRowsChange={(rowKeys): void => onSelectedRowKeysChange([...rowKeys])} + onCellClick={({ row }, event): void => { + if (event.defaultPrevented || event.button !== 0 || event.altKey) { + return; + } + if (event.shiftKey) { + selectRow(row, 'extend'); + } else { + selectRow(row, event.ctrlKey || event.metaKey ? 'toggle' : 'replace'); + } + }} + renderers={{ + renderRow: (key, props): React.JSX.Element => ( + handleRowKeyDown(props.row, event)} /> + ), + }} /> ); } From e7090a51d1d44ecb6d146c3803b47a5982c4551d Mon Sep 17 00:00:00 2001 From: Tomasz Naumowicz Date: Fri, 27 Nov 2026 06:53:44 +0100 Subject: [PATCH 042/148] test: wait for the M7 step-in result before asserting (E3) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .../browser/scenario-playwright.ts | 38 ++++++++++- .../browser/scenario-runtime.test.ts | 66 ++++++++++++++++++- build/verification/browser/scenarios.ts | 3 + 3 files changed, 103 insertions(+), 4 deletions(-) diff --git a/build/verification/browser/scenario-playwright.ts b/build/verification/browser/scenario-playwright.ts index 16d73df70..12deea94b 100644 --- a/build/verification/browser/scenario-playwright.ts +++ b/build/verification/browser/scenario-playwright.ts @@ -27,8 +27,13 @@ export async function runScenario(page: IntegratedPage, origin: string, route: S const onError = (error: Error): void => { errors.push(`pageerror: ${error.message}`); }; - const wait = async (predicate: (argument: A) => boolean, argument: A, description: string): Promise => { - const deadline = Date.now() + 60000; + const wait = async ( + predicate: (argument: A) => boolean, + argument: A, + description: string, + timeoutMs = 60000, + ): Promise => { + const deadline = Date.now() + timeoutMs; while (!(await page.evaluate(predicate, argument))) { if (Date.now() > deadline) { throw new Error(`Timed out waiting for ${description}`); @@ -223,6 +228,33 @@ export async function runScenario(page: IntegratedPage, origin: string, route: S expected: { follows: true, gap: '>= 0' }, }); } else if (assertion.kind === 'text') { + let synchronized = true; + if (assertion.waitForText) { + try { + await wait( + (expected: typeof assertion): boolean => { + if (document.documentElement.dataset.ready === 'failed') { + throw new Error(`Page failed while waiting for ${expected.name}`); + } + const element = document.querySelector(expected.selector); + if (!element) return false; + const text = ( + element instanceof HTMLElement ? element.innerText : (element.textContent ?? '') + ) + .replace(/\s+/g, ' ') + .trim(); + return expected.includes.every((value): boolean => text.includes(value)) && + expected.excludes.every((pattern): boolean => !new RegExp(pattern, 'i').test(text)); + }, + assertion, + assertion.name, + 3000, + ); + } catch (error) { + synchronized = false; + errors.push(error instanceof Error ? error.message : String(error)); + } + } const text = await page.evaluate((selector: string): string | null => { const element = document.querySelector(selector); if (!element) { @@ -246,7 +278,7 @@ export async function runScenario(page: IntegratedPage, origin: string, route: S ); assertions.push({ name: assertion.name, - passed: text !== null && missing.length === 0 && found.length === 0, + passed: synchronized && text !== null && missing.length === 0 && found.length === 0, actual: { text, missing, found }, expected: { includes: assertion.includes, excludes: assertion.excludes }, }); diff --git a/build/verification/browser/scenario-runtime.test.ts b/build/verification/browser/scenario-runtime.test.ts index acb5544dc..0d01e15f7 100644 --- a/build/verification/browser/scenario-runtime.test.ts +++ b/build/verification/browser/scenario-runtime.test.ts @@ -106,6 +106,7 @@ describe('L2-dev readiness', (): void => { describe('L2-dev layout assertions', (): void => { afterEach((): void => { vi.restoreAllMocks(); + vi.useRealTimers(); document.body.innerHTML = ''; }); @@ -128,6 +129,7 @@ describe('L2-dev layout assertions', (): void => { listTop: number, assertions: readonly ScenarioAssertion[], html?: string, + expectedErrors: readonly string[] = [], ): Promise>['assertions']> { document.body.innerHTML = html ?? @@ -213,7 +215,7 @@ describe('L2-dev layout assertions', (): void => { ), }; const report = await runScenario(page, 'http://localhost:18080', route); - expect(report.errors).toEqual([]); + expect(report.errors).toEqual(expectedErrors); return report.assertions; } @@ -262,6 +264,68 @@ describe('L2-dev layout assertions', (): void => { expect(release).toHaveBeenCalledOnce(); }); + it.each([false, true])('synchronizes text only when opted in (%s), without repeating its steps', async (waitForText): Promise => { + vi.useFakeTimers(); + const release = vi.fn((): boolean => { + const value = document.getElementById('value'); + if (!value) throw new Error('Missing text result target'); + setTimeout((): void => { value.textContent = 'leaf Alpha nested Alpha'; }, 100); + setTimeout((): void => { value.textContent = 'leaf \n Alpha'; }, 200); + return true; + }); + window.__releaseScenarioReply = release; + const run = measure([], 100, [{ + kind: 'text', name: 'step-in result', selector: '#value', + includes: ['leaf Alpha'], excludes: ['NESTED Alpha'], + ...(waitForText ? { waitForText: true } : {}), + steps: [{ action: 'releaseReply', tag: 'step-in' }], + }], 'nested Alpha'); + await vi.advanceTimersByTimeAsync(250); + expect((await run)[0]).toEqual({ + name: 'step-in result', + passed: waitForText, + actual: waitForText + ? { text: 'leaf Alpha', missing: [], found: [] } + : { text: 'nested Alpha', missing: ['leaf Alpha'], found: ['NESTED Alpha'] }, + expected: { includes: ['leaf Alpha'], excludes: ['NESTED Alpha'] }, + }); + expect(release).toHaveBeenCalledOnce(); + }); + + it.each([false, true])('keeps a synchronized text assertion failing on timeout or page failure (%s)', async (pageFails): Promise => { + vi.useFakeTimers(); + const release = vi.fn((): boolean => { + if (pageFails) { + setTimeout((): void => { + const value = document.getElementById('value'); + if (!value) throw new Error('Missing text result target'); + value.textContent = 'leaf Alpha'; + document.documentElement.dataset.ready = 'failed'; + }, 100); + } + return true; + }); + window.__releaseScenarioReply = release; + const run = measure([], 100, [{ + kind: 'text', name: 'step-in result', selector: '#value', + includes: ['leaf Alpha'], excludes: ['nested Alpha'], waitForText: true, + steps: [{ action: 'releaseReply', tag: 'step-in' }], + }], 'nested Alpha', [ + pageFails ? 'Page failed while waiting for step-in result' : 'Timed out waiting for step-in result', + ]); + await vi.advanceTimersByTimeAsync(3100); + expect((await run)[0]).toEqual({ + name: 'step-in result', + passed: false, + actual: pageFails + ? { text: 'leaf Alpha', missing: [], found: [] } + : { text: 'nested Alpha', missing: ['leaf Alpha'], found: ['nested Alpha'] }, + expected: { includes: ['leaf Alpha'], excludes: ['nested Alpha'] }, + }); + expect(release).toHaveBeenCalledOnce(); + expect(document.documentElement.dataset.ready).toBe('failed'); + }); + it('reports an unavailable contract target as an assertion result, not a harness failure', async (): Promise => { const [result] = await measure([], 100, [{ kind: 'focused', name: 'TDD: M6 missing cell', requiresGrid: 'grid', diff --git a/build/verification/browser/scenarios.ts b/build/verification/browser/scenarios.ts index 734a6dd8b..2a925a4b3 100644 --- a/build/verification/browser/scenarios.ts +++ b/build/verification/browser/scenarios.ts @@ -110,6 +110,8 @@ interface TextAssertion { readonly includes: readonly string[]; readonly excludes: readonly string[]; readonly steps?: readonly ScenarioStep[]; + /** Poll the same text condition for up to 3 seconds after the steps instead of snapshotting once. */ + readonly waitForText?: boolean; } /** @@ -509,6 +511,7 @@ export const collectionViewContracts = { steps: [{ action: 'click', role: 'gridcell', name: 'nested Alpha' }, { action: 'click', role: 'button', name: 'View selected document' }] }, { kind: 'text', name: 'TDD: M7 Enter on an object cell steps in', requiresGrid: 'grid', selector: '[role="grid"]', includes: ['leaf Alpha'], excludes: ['nested Alpha'], + waitForText: true, steps: [{ action: 'focus', role: 'gridcell', name: '{...}' }, { action: 'press', key: 'Enter' }] }, { kind: 'text', name: 'TDD: M2 Level up returns to the parent data', requiresGrid: 'grid', selector: '[role="grid"]', includes: ['nested Alpha'], excludes: ['leaf Alpha'], From d06bbd645d7fa2ca082c921e80ed2194e83da27d Mon Sep 17 00:00:00 2001 From: Tomasz Naumowicz Date: Fri, 27 Nov 2026 06:53:44 +0100 Subject: [PATCH 043/148] feat: restore nested Collection View navigation (WI-8) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .../iterations/02-rdg-execution-plan.md | 53 ++++++++++++++--- .../collectionView/CollectionView.tsx | 57 +++++++------------ .../resultsTab/DataViewPanelTable.tsx | 26 +++++++-- .../toolbar/ToolbarTableNavigation.tsx | 10 ++-- 4 files changed, 92 insertions(+), 54 deletions(-) diff --git a/docs/ai-and-plans/features/data-grid/iterations/02-rdg-execution-plan.md b/docs/ai-and-plans/features/data-grid/iterations/02-rdg-execution-plan.md index 27bf5e7b1..0592e832e 100644 --- a/docs/ai-and-plans/features/data-grid/iterations/02-rdg-execution-plan.md +++ b/docs/ai-and-plans/features/data-grid/iterations/02-rdg-execution-plan.md @@ -198,14 +198,25 @@ tests passed. Cross-collection panel isolation is a G2 workbench check, per the keyboard, focus and ARIA checks in the VS Code Insiders Integrated Browser. The spike verifies browser behavior, not screen reader announcements or the shipped UI. -**A5 evidence (2026-11-26), not yet released.** The build, 25 focused tests, 75 scenario unit +**A5 passed (2026-11-27).** The build, 25 focused tests, 75 scenario unit tests and browser TypeScript passed. After the approved E3 test setup correction, the Insiders Integrated Browser reported 237 passing assertions across 30 Table routes in dark, light and high contrast, with all routes ready and no reported errors. This covers the table core, typed values, paging, column and cell navigation, loading/empty states and 500-row -virtualization. The root-ID shaping test passes, but the nested K3/K4 journey still needs -WI-7 document actions and WI-8 step-in. Run those pinned assertions alongside A7 before -releasing A5; do not treat incidental K2 passes before selection exists as A6 evidence. +virtualization. The root-ID shaping test passed. When WI-8 made the nested journey reachable, +all three themes passed the pinned K3/K4 checks, including opening the root document from a +nested row. The separate M7 timing failure does not invalidate those earlier assertions. + +**A6 passed (2026-11-27).** The WI-7 logic review approved at 85% confidence. In the +Integrated Browser, 49 assertions passed per theme across selection, no-ID, identity, +late-delete and paging. Once WI-8 enabled the held nested query, all three late-query +assertions passed in each theme. Cross-collection panel isolation and gesture feel remain G2 +workbench checks. + +**A7 passed (2026-11-27).** All 10 `step-in` assertions passed in each Integrated Browser +theme with no reported console, page or CSP errors. Each run recorded `common.reportEvent` +`stepIn` calls in order: `step-in-button` depths 1 and 2, `step-out-button` depth 1, +`step-in-button` depth 2, and `breadcrumb` depths 1 and 0. ### Escalations @@ -1042,7 +1053,7 @@ through `mai-code-2-flash` after each pair of items, not after every commit. > and guarded action eligibility against the current table request. The build and 33 focused > tests passed. In each theme, 49 assertions passed across selection, no-ID, identity, > late-delete and paging. `claude-opus-5.5` approved the action logic (85% confidence). -> Run the pinned late-query scenario with WI-8 before closing A6. G2 should confirm modifier +> The pinned late-query scenario passed with WI-8, closing A6. G2 should confirm modifier > clicks and whether re-extending toward the anchor should keep the already selected rows > (current behavior) or shrink the range; no gesture choice changed here. > Coding: 39.1 AIU (15 requests). Shared A6/A8 first pass: 235.7 AIU advisor (39 requests), @@ -1055,6 +1066,15 @@ through `mai-code-2-flash` after each pair of items, not after every commit. - Scope rows M1–M2, M7. Telemetry kept. - Acceptance: A7. +> **Done (2026-11-27):** `mai-code-2` implemented step-in with Enter and double-click, +> shared the current-table path guard with document actions, and corrected the breadcrumb +> divider markup. The named `gpt-6.1-sol` fallback diagnosed the intermittent M7 read of the +> parent rows without changing production code. The operator approved an E3 bounded wait for +> the same M7 text outcome, with no repeated key press or changes to other contracts. +> Build, 33 focused tests, 100 browser-runner tests, browser TypeScript and A7 passed. +> Coding: 23.0 AIU on `mai-code-2` (21 requests), 23.0 AIU fallback (7); E3 test coding +> 17.7 AIU on `gpt-6.1-sol` (8); A7 terminal 0.4 AIU (7), Integrated Browser 24.8 AIU (25). + **WI-9: accessible document tree** · `gpt-6.1-sol` · after WI-6 and A4; beside WI-7/WI-8 - Owns: `DataViewPanelTree.tsx`, a new tree hook file and its tests. It must not touch @@ -1062,6 +1082,20 @@ through `mai-code-2-flash` after each pair of items, not after every commit. - Scope rows M4–M5; D7. - Acceptance: A8, including the advisor's logic review. Two failures of A8: E1. +> **A8 blocked; E1 raised (2026-11-26).** The first dark run did not expand the directly +> focused Field cell. The advisor-guided retry fixed that keyboard path and restored Field +> sorting for roots; `claude-opus-5.5` approved the revision at 85% confidence. On the retry, +> deep-nesting passed all 10 executed assertions, but both dark routes reported a +> `ResizeObserver` page error, and the ten-element array assertion could see `ten[0]` through +> `ten[7]`, not `ten[9]`. Light and high contrast were not rerun. The cause of the resize +> loop and whether the last array rows are merely outside the mounted viewport are not yet +> established. No pinned contract changed. Further tree work and A9/G2 await the E1 decision. +> The operator authorized the bounded `hydrafusion-max` retry and asked to consider a visual +> confirmation. In the dark Integrated Browser array scenario, the operator confirmed that +> `ten[9]` appeared after scrolling and the grid stayed stable. This rules out a missing row +> in that observation; it does not clear the recorded page error or authorize a pin or contract +> change. Pause after the current checks to collect the operator's other accessibility feedback. + ### Step 3 Leader runs A9 through `mai-code-2-flash`, then raises **G2**. After release: WI-G2-n items, each @@ -1206,7 +1240,8 @@ published artifacts, scratch Chromium 142/148 and Insiders behavior, Vite CSS de packaged-theme caveat. The operator accepted release metadata for the support floor; the exact stable workbench smoke, a real collection, screen readers and high-contrast were not run. -Step 1 is complete. A2, A3 and A4 passed. The product Table renders real rows and typed cells -after WI-5/WI-6. A5 still needs the nested journey that becomes reachable after WI-7/WI-8. -WI-7 selection and WI-9 Tree are the next parallel lanes; the Tree remains a placeholder until -WI-9. G2 remains the next operator gate. +Step 1 is complete. A1–A7 passed; the Table works through WI-8, including nested actions and +the held late query. WI-9 is not accepted: A8 remains under E1, with the operator confirming +that the end of the ten-element array can be reached by scrolling. Pause to collect the +operator's accessibility feedback before taking another implementation step. A9 and G2 are +not reached, and no draft PR has been opened. diff --git a/src/webviews/documentdb/collectionView/CollectionView.tsx b/src/webviews/documentdb/collectionView/CollectionView.tsx index a97883d41..ff66c1eb1 100644 --- a/src/webviews/documentdb/collectionView/CollectionView.tsx +++ b/src/webviews/documentdb/collectionView/CollectionView.tsx @@ -172,13 +172,22 @@ export const CollectionView = (): JSX.Element => { currentQueryResultsRef.current = currentQueryResults; currentContextRef.current = currentContext; + const isCurrentTablePage = useCallback((context: CollectionViewContextType): boolean => { + const page = currentQueryResultsRef.current?.tablePage; + return ( + !context.isLoading && + context.currentView === Views.TABLE && + page !== undefined && + tablePageQueryRef.current === context.activeQuery && + tablePageRequestRef.current === dataRequestRef.current && + JSON.stringify(page.path) === + JSON.stringify(context.currentViewState?.currentPath ?? []) + ); + }, []); + const handleSelectedRowKeysChange = useCallback((selectedRowKeys: readonly string[]): void => { setCurrentContext((prev) => { - const isCurrentPage = - !prev.isLoading && - prev.currentView === Views.TABLE && - tablePageQueryRef.current === prev.activeQuery && - tablePageRequestRef.current === dataRequestRef.current; + const isCurrentPage = isCurrentTablePage(prev); const nextRowKeys = isCurrentPage ? [...selectedRowKeys] : []; const targets = isCurrentPage ? resolveDocumentTargets(currentQueryResultsRef.current?.tablePage, nextRowKeys) @@ -196,7 +205,7 @@ export const CollectionView = (): JSX.Element => { currentContextRef.current = next; return next; }); - }, []); + }, [isCurrentTablePage]); /** * Reset query insights when query changes (not on pagination) @@ -565,12 +574,7 @@ export const CollectionView = (): JSX.Element => { function handleDeleteDocumentRequest(): void { const context = currentContextRef.current; - if ( - context.isLoading || - context.currentView !== Views.TABLE || - tablePageQueryRef.current !== context.activeQuery || - tablePageRequestRef.current !== dataRequestRef.current - ) { + if (!isCurrentTablePage(context)) { return; } const targets = resolveDocumentTargets( @@ -609,13 +613,9 @@ export const CollectionView = (): JSX.Element => { setCurrentQueryResults((prev) => ({ ...prev, tablePage: nextPage })); setCurrentContext((prev) => { const selectedRowKeys = prev.dataSelection.selectedRowKeys.filter((key) => !removedKeys.has(key)); - const remainingTargets = - !prev.isLoading && - prev.currentView === Views.TABLE && - tablePageQueryRef.current === prev.activeQuery && - tablePageRequestRef.current === dataRequestRef.current - ? resolveDocumentTargets(currentQueryResultsRef.current?.tablePage, selectedRowKeys) - : undefined; + const remainingTargets = isCurrentTablePage(prev) + ? resolveDocumentTargets(currentQueryResultsRef.current?.tablePage, selectedRowKeys) + : undefined; const next = { ...prev, dataSelection: { selectedRowKeys }, @@ -641,12 +641,7 @@ export const CollectionView = (): JSX.Element => { function handleViewDocumentRequest(): void { const context = currentContextRef.current; - if ( - context.isLoading || - context.currentView !== Views.TABLE || - tablePageQueryRef.current !== context.activeQuery || - tablePageRequestRef.current !== dataRequestRef.current - ) { + if (!isCurrentTablePage(context)) { return; } const targets = resolveDocumentTargets( @@ -669,12 +664,7 @@ export const CollectionView = (): JSX.Element => { function handleEditDocumentRequest(): void { const context = currentContextRef.current; - if ( - context.isLoading || - context.currentView !== Views.TABLE || - tablePageQueryRef.current !== context.activeQuery || - tablePageRequestRef.current !== dataRequestRef.current - ) { + if (!isCurrentTablePage(context)) { return; } const targets = resolveDocumentTargets( @@ -714,10 +704,7 @@ export const CollectionView = (): JSX.Element => { if ( !page || !row || - context.isLoading || - context.currentView !== Views.TABLE || - tablePageQueryRef.current !== context.activeQuery || - JSON.stringify(page.path) !== JSON.stringify(path) || + !isCurrentTablePage(context) || columnKey === ROOT_ID_COLUMN_KEY || field === undefined || field === '_id' || diff --git a/src/webviews/documentdb/collectionView/components/resultsTab/DataViewPanelTable.tsx b/src/webviews/documentdb/collectionView/components/resultsTab/DataViewPanelTable.tsx index 7fb4d4657..169b9eb06 100644 --- a/src/webviews/documentdb/collectionView/components/resultsTab/DataViewPanelTable.tsx +++ b/src/webviews/documentdb/collectionView/components/resultsTab/DataViewPanelTable.tsx @@ -37,7 +37,6 @@ export function DataViewPanelTable({ onStepIn, }: DataViewPanelTableProps): React.JSX.Element { const [currentContext] = React.useContext(CollectionViewContext); - void onStepIn; const gridRef = React.useRef(null); const anchorRef = React.useRef(undefined); const selectionScopeRef = React.useRef({ @@ -85,10 +84,9 @@ export function DataViewPanelTable({ } function handleRowKeyDown(row: TableRow, event: React.KeyboardEvent): void { - if (event.key !== ' ') { + if (event.key !== ' ' && event.key !== 'Enter') { return; } - // RDG's native Shift+Space toggles its active row; use the actually focused row instead. event.stopPropagation(); if ( event.defaultPrevented || @@ -105,17 +103,24 @@ export function DataViewPanelTable({ if (!event.repeat) { const columnIndex = Number(event.target.getAttribute('aria-colindex')) - 1; const rowIndex = page?.rows.indexOf(row) ?? -1; + const columnKey = page?.columns[columnIndex]?.key; if ( rowIndex === -1 || !Number.isInteger(columnIndex) || columnIndex < 0 || - columnIndex >= columns.length + columnKey === undefined ) { return; } - // Keep subsequent native arrow navigation aligned when a cell was focused directly. + // RDG's active position can lag direct focus, so sync it from the actual focused cell. gridRef.current?.setActivePosition({ idx: columnIndex, rowIdx: rowIndex }, { shouldFocus: false }); - selectRow(row, event.shiftKey ? 'extend' : 'toggle'); + if (event.key === 'Enter') { + if (!event.shiftKey) { + onStepIn(row.rowKey, columnKey); + } + } else { + selectRow(row, event.shiftKey ? 'extend' : 'toggle'); + } } } @@ -158,6 +163,15 @@ export function DataViewPanelTable({ selectRow(row, event.ctrlKey || event.metaKey ? 'toggle' : 'replace'); } }} + onCellDoubleClick={({ column, row }, event): void => { + if (event.defaultPrevented || event.button !== 0) { + return; + } + const columnKey = page?.columns.find((candidate) => candidate.key === column.key)?.key; + if (columnKey !== undefined) { + onStepIn(row.rowKey, columnKey); + } + }} renderers={{ renderRow: (key, props): React.JSX.Element => ( handleRowKeyDown(props.row, event)} /> diff --git a/src/webviews/documentdb/collectionView/components/toolbar/ToolbarTableNavigation.tsx b/src/webviews/documentdb/collectionView/components/toolbar/ToolbarTableNavigation.tsx index 156a5c573..0682b8c19 100644 --- a/src/webviews/documentdb/collectionView/components/toolbar/ToolbarTableNavigation.tsx +++ b/src/webviews/documentdb/collectionView/components/toolbar/ToolbarTableNavigation.tsx @@ -16,7 +16,7 @@ import { } from '@fluentui/react-components'; import { ArrowUp16Filled } from '@fluentui/react-icons'; import * as l10n from '@vscode/l10n'; -import { useContext } from 'react'; +import { Fragment, useContext } from 'react'; import { useTrpcClient } from '../../../../_integration/useTrpcClient'; import { CollectionViewContext, Views } from '../../collectionViewContext'; @@ -114,10 +114,12 @@ export const ToolbarTableNavigation = (): React.JSX.Element => { {items?.map((item, index) => ( - - jumpToLevel(index)}>{item.item} + + + jumpToLevel(index)}>{item.item} + {index < items.length - 1 && } - + ))} Date: Fri, 27 Nov 2026 07:23:37 +0100 Subject: [PATCH 044/148] docs: schedule grid keyboard navigation follow-up (WI-9b) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .../iterations/02-rdg-execution-plan.md | 59 +++++++++++++++---- 1 file changed, 46 insertions(+), 13 deletions(-) diff --git a/docs/ai-and-plans/features/data-grid/iterations/02-rdg-execution-plan.md b/docs/ai-and-plans/features/data-grid/iterations/02-rdg-execution-plan.md index 0592e832e..cbee6db23 100644 --- a/docs/ai-and-plans/features/data-grid/iterations/02-rdg-execution-plan.md +++ b/docs/ai-and-plans/features/data-grid/iterations/02-rdg-execution-plan.md @@ -124,13 +124,14 @@ identify the current and upcoming gates and what they block. ### G2: hands-on direction check (operator test gate) -- **When:** A2–A8 have passed (WI-5 to WI-9 done) and the VSIX for G2 is built (A9). +- **When:** A2–A8 have passed (including WI-9b) and the VSIX for G2 is built (A9). - **Steps for the operator:** install the VSIX in VS Code; against a real cluster, open a collection with wide and nested data; in Table view step into an object by double-click and by the G1 key, step out by Level up and a breadcrumb; select one, several and no rows and try - View/Edit/Delete on a throwaway collection; page through 10/50/100/500; switch to Tree view, - expand and collapse with arrow keys, check Narrator reads level and expanded state; switch the - three VS Code themes. + View/Edit/Delete on a throwaway collection; page through 10/50/100/500. In both grids, check + arrow and forward/reverse Tab navigation, Escape to the view picker, and that only the + currently focused control shows a focus ring. In Tree view, expand and collapse with Enter + and check Narrator reads level and expanded state. Switch the three VS Code themes. - **Cross-collection isolation (added by operator, 2026-11-26):** Open two collection panels with distinct document IDs. While a refresh in the first is pending, switch to the second, select a row and open View. Check that the namespace and ID belong to the second collection before and @@ -173,7 +174,7 @@ identify the current and upcoming gates and what they block. | A5 | WI-5, WI-6 | Their scope rows' contract checks pass; no earlier passing check regresses; build green. | | A6 | WI-7 | K1–K2 checks pass, including the late-delete and missing-`_id` cases; advisor logic review approved. | | A7 | WI-8 | M1, M2, M7 checks pass; step-in telemetry still fires (unit test or harness call log). | -| A8 | WI-9 | M4–M5 checks pass; advisor logic review approved. | +| A8 | WI-9, WI-9b | M4–M5 and the shared focus/navigation checks pass; advisor logic review approved; the resize investigation is resolved separately. | | A9 | Before G2 | `npm run package` succeeds; L1 and L3 checks green; a VSIX path is in the G2 message. | | A10 | WI-10 | Sweep report written with "verified" and "not verified" lists; no console errors or CSP violations in any Collection View route. | | A11 | Before G3b | Full Case 2 list from `.github/copilot-instructions.md` ran and passed, each result reported separately. | @@ -242,17 +243,17 @@ theme with no reported console, page or CSP errors. Each run recorded `common.re | 1 | WI-2b ∥ WI-4b | WI-2b after WI-4a (placeholders); WI-4b owns a new theme file | — | | 1 | WI-3b | After WI-2b, WI-3a, WI-4a (shares `fixtures.ts` and `scenarios.ts`) | A2 | | 1 | WI-3c ∥ WI-9a | WI-9a in a scratch worktree | A3, A4 | -| 2 | WI-5 ∥ WI-6 ∥ WI-9 | WI-6 owns the cell; WI-5 the table; WI-9 the tree. WI-6's last step wires the cell into the table after WI-5 commits. | A5, A8 | +| 2 | WI-5 ∥ WI-6 ∥ WI-9 | WI-6 owns the cell; WI-5 the table; WI-9 the tree. WI-6's last step wires the cell into the table after WI-5 commits. | A5 | | 2 | WI-7 → WI-8 | Same files; one after the other | A6, A7 | +| 2 | WI-9b | Follow-up to the WI-9 implementation; the WI-9 resize investigation remains separate. | A8 | | 3 | (build) | — | A9, **G2** | | 3 | WI-G2-n | Findings from G2, sized by the leader | — | | 4 | WI-10 ∥ WI-11 | WI-10 owns checks; WI-11 owns docs | A10 | | 4 | WI-12 | Needs the draft PR | **G3a** | | 4 | WI-G3-n, then Case 2 | — | A11, **G3b** | -Critical path: G1 → WI-4a → WI-2b → WI-3b → WI-3c → WI-5 → WI-7 → WI-8 → G2 → WI-10 → WI-12 → G3a -→ G3b. The tree (WI-9a, WI-9) runs beside the table and must not become the critical path; if A4 -fails, it does, through E1. +Current critical path: WI-9 resize investigation and WI-9b → A8 → A9 → G2 → WI-10 → WI-12 +→ G3a → G3b. The main table lane through WI-8 is complete. ### Models @@ -1096,6 +1097,38 @@ through `mai-code-2-flash` after each pair of items, not after every commit. > in that observation; it does not clear the recorded page error or authorize a pin or contract > change. Pause after the current checks to collect the operator's other accessibility feedback. +> **Resize investigation (E1), still open:** The authorized `hydrafusion-max` model was +> unavailable, so the diagnosis did not run. Keep the resize error in WI-9, separate from +> WI-9b. Diagnose it without suppressing page errors or counting the manual scroll check as +> an A8 pass. If the array assertion needs to navigate to a virtualized row to check its +> contents, handle that setup change under E3 separately. + +**WI-9b: Table and Tree keyboard navigation** · scheduled in Step 2, before A8/A9 and G2 + +- **Found during WI-9 testing (2026-11-27):** On `arrays/dark`, Right on the expandable Field + cell opened the node instead of moving to Value, so the operator used Tab to move across. + Shift+Tab then moved focus to the view picker while the old cell retained its focus-coloured + outline. RDG styles its remembered active cell independently of browser focus; the exact + cause of the early reverse-Tab exit has not been reproduced. +- **Operator decision:** In both grids, arrows move among visible cells and Tab/Shift+Tab move + forward/backward across cells and row boundaries. Shift+Tab leaves from the upper-left + header; Tab leaves from the last cell. Escape leaves either grid and focuses the view picker. + A popup that already handles Escape gets first use of the key. In Tree, Enter on an + expandable Field cell toggles it without moving focus; the pointer chevron still works. + Up/Down through the visible hierarchy is sufficient; no separate parent shortcut. +- **Scope:** Fix the shared focus ring without removing Table's selected-row styling. + Reproduce and fix the early reverse-Tab exit independently of the ring. Keep native RDG + navigation where it meets the agreed behavior and add only the focus wiring needed for + Escape. Preserve Table Enter-to-step-in and the existing selection gestures. When implementing + the revised M5 behavior, replace the pinned Left/Right tree-action expectations with + Enter and visible-cell navigation expectations; retain the hierarchy and expansion-state + checks. No changes to the ResizeObserver investigation, pin, or unrelated contracts. +- **Acceptance:** Integrated Browser checks in dark, light and high contrast for focus + entry/exit, both Tab directions across rows, Ctrl+Home to the start, Escape to the picker, + one visible focus ring, and tree expansion and navigation with an unchanged array cap. + Cover the 500-row Table case and verify the keyboard path and announcements with Narrator at G2. + Finish the current WI-9 resize track separately; do not edit shared tree files concurrently. + ### Step 3 Leader runs A9 through `mai-code-2-flash`, then raises **G2**. After release: WI-G2-n items, each @@ -1241,7 +1274,7 @@ packaged-theme caveat. The operator accepted release metadata for the support fl stable workbench smoke, a real collection, screen readers and high-contrast were not run. Step 1 is complete. A1–A7 passed; the Table works through WI-8, including nested actions and -the held late query. WI-9 is not accepted: A8 remains under E1, with the operator confirming -that the end of the ten-element array can be reached by scrolling. Pause to collect the -operator's accessibility feedback before taking another implementation step. A9 and G2 are -not reached, and no draft PR has been opened. +the held late query. WI-9 is not accepted: A8 remains under E1 for the resize error, with the +operator confirming that the end of the ten-element array can be reached by scrolling. +The navigation feedback is scheduled separately as WI-9b before A8/A9 and G2. Implementation +remains paused. No draft PR has been opened. From 59281cdbf34a21e6f91c858b3cb81f5f7827e1e9 Mon Sep 17 00:00:00 2001 From: Tomasz Naumowicz Date: Fri, 27 Nov 2026 07:55:24 +0100 Subject: [PATCH 045/148] feat: render the Collection View document tree (WI-9) Implementation only; A8 remains open for the resize investigation. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .../resultsTab/DataViewPanelTree.tsx | 177 +++++++++++++++++- .../components/resultsTab/useTreeRows.test.ts | 158 ++++++++++++++++ .../components/resultsTab/useTreeRows.ts | 125 +++++++++++++ 3 files changed, 458 insertions(+), 2 deletions(-) create mode 100644 src/webviews/documentdb/collectionView/components/resultsTab/useTreeRows.test.ts create mode 100644 src/webviews/documentdb/collectionView/components/resultsTab/useTreeRows.ts diff --git a/src/webviews/documentdb/collectionView/components/resultsTab/DataViewPanelTree.tsx b/src/webviews/documentdb/collectionView/components/resultsTab/DataViewPanelTree.tsx index 29791bfd9..03bb357cc 100644 --- a/src/webviews/documentdb/collectionView/components/resultsTab/DataViewPanelTree.tsx +++ b/src/webviews/documentdb/collectionView/components/resultsTab/DataViewPanelTree.tsx @@ -4,13 +4,186 @@ *--------------------------------------------------------------------------------------------*/ import * as React from 'react'; +import * as l10n from '@vscode/l10n'; +import { + Cell, + DataGrid, + Row, + type Column, + type DataGridHandle, +} from 'react-data-grid'; +import 'react-data-grid/lib/styles.css'; import { type TreeNode } from '../../../../../utils/documentGrid/types'; +import { bsonStringToDisplayString } from '../../../../utils/documentGrid/typeToDisplayString'; +import { getTreeKeyAction, useTreeRows } from './useTreeRows'; +import './dataGridTheme.scss'; interface DataViewPanelTreeProps { readonly nodes: readonly TreeNode[]; } export const DataViewPanelTree = ({ nodes }: DataViewPanelTreeProps): React.JSX.Element => { - void nodes; - return <>; + const gridRef = React.useRef(null); + const { rows, expandedKeys, setExpanded } = useTreeRows(nodes); + const columns = React.useMemo[]>( + (): readonly Column[] => [ + { + key: 'field', + name: l10n.t('Field'), + renderCell: ({ row, rowIdx }): React.ReactNode => ( + <> + + {row.expandable ? ( + + ) : ( + + )} + {row.field} + + ), + }, + { + key: 'value', + name: l10n.t('Value'), + renderCell: ({ row }): string => row.value.display, + }, + { + key: 'type', + name: l10n.t('Type'), + renderCell: ({ row }): string => + row.depth === 0 ? l10n.t('Document') : bsonStringToDisplayString(row.value.type), + }, + ], + [expandedKeys, setExpanded], + ); + + function onTreeKeyDown( + row: TreeNode, + rowIdx: number, + idx: number, + setActivePosition: DataGridHandle['setActivePosition'], + event: React.KeyboardEvent, + ): void { + if ( + (event.key !== 'ArrowRight' && event.key !== 'ArrowLeft') || + event.altKey || + event.ctrlKey || + event.metaKey || + event.shiftKey + ) { + return; + } + + const action = getTreeKeyAction(rows, row, expandedKeys, event.key); + if (!action) { + return; + } + // Handle the focused row locally, before RDG can use a stale active position. + event.stopPropagation(); + event.preventDefault(); + if (action.type === 'focus') { + const targetRowIdx = rows.findIndex((node): boolean => node.key === action.key); + if (targetRowIdx >= 0) { + setActivePosition( + { rowIdx: targetRowIdx, idx }, + { shouldFocus: true }, + ); + } + } else { + setActivePosition({ rowIdx, idx }, { shouldFocus: true }); + setExpanded(row, action.type === 'expand'); + } + } + + return ( + row.key} + defaultColumnOptions={{ minWidth: 100, resizable: true }} + renderers={{ + // Name the Field cell from its value, not its nested expander's action label. + renderCell: (key, props): React.ReactNode => ( + { + props.onFocusCapture?.(event); + if (!event.defaultPrevented) { + // Keep Cell's own bubbling onFocus for native roving focus. + props.setActivePosition({ rowIdx: props.rowIdx, idx: props.column.idx }); + } + }} + onKeyDown={(event): void => { + props.onKeyDown?.(event); + if (!event.defaultPrevented && props.column.key === 'field') { + onTreeKeyDown( + props.row, + props.rowIdx, + props.column.idx, + props.setActivePosition, + event, + ); + } + }} + /> + ), + renderRow: (key, props): React.ReactNode => ( + { + props.onFocusCapture?.(event); + if (!event.defaultPrevented && event.target === event.currentTarget) { + props.setActivePosition({ rowIdx: props.rowIdx, idx: -1 }); + } + }} + onKeyDown={(event): void => { + props.onKeyDown?.(event); + if (!event.defaultPrevented && event.target === event.currentTarget) { + onTreeKeyDown( + props.row, + props.rowIdx, + -1, + props.setActivePosition, + event, + ); + } + }} + /> + ), + }} + /> + ); }; diff --git a/src/webviews/documentdb/collectionView/components/resultsTab/useTreeRows.test.ts b/src/webviews/documentdb/collectionView/components/resultsTab/useTreeRows.test.ts new file mode 100644 index 000000000..661caf090 --- /dev/null +++ b/src/webviews/documentdb/collectionView/components/resultsTab/useTreeRows.test.ts @@ -0,0 +1,158 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +import { describe, expect, it } from 'vitest'; +import { type TreeNode } from '../../../../../utils/documentGrid/types'; +import { getTreeKeyAction, getVisibleTreeRows, setTreeNodeExpanded } from './useTreeRows'; + +const root: TreeNode = { + key: '["id:\\"z-root\\""]', + parentKey: null, + depth: 0, + field: '"z-root"', + value: { display: '{...}', type: 'object' }, + expandable: true, +}; +const object: TreeNode = { + key: '["id:\\"z-root\\"","a.b"]', + parentKey: root.key, + depth: 1, + field: 'a.b', + value: { display: '{...}', type: 'object' }, + expandable: true, +}; +const leaf: TreeNode = { + key: '["id:\\"z-root\\"","a.b",""]', + parentKey: object.key, + depth: 2, + field: '', + value: { display: '42', type: 'int32' }, + expandable: false, +}; +const sibling: TreeNode = { + key: '["id:\\"z-root\\"","z"]', + parentKey: root.key, + depth: 1, + field: 'z', + value: { display: 'text', type: 'string' }, + expandable: false, +}; +const otherRoot: TreeNode = { + ...root, + key: '["id:\\"a-root\\""]', + field: '"a-root"', + expandable: false, +}; +const nodes: readonly TreeNode[] = [root, sibling, object, leaf, otherRoot]; + +describe('tree expansion and navigation', () => { + it('starts with just document roots in Field-ascending order', () => { + expect(getVisibleTreeRows(nodes, new Set())).toEqual([otherRoot, root]); + }); + + it('sorts siblings by Field without separating them from their keyed parents', () => { + const expanded = new Set([root.key, object.key]); + expect(getVisibleTreeRows(nodes, expanded)).toEqual([otherRoot, root, object, leaf, sibling]); + expect(nodes).toEqual([root, sibling, object, leaf, otherRoot]); + }); + + it('hides collapsed descendants while preserving their expansion on reopening', () => { + const expanded = new Set([root.key, object.key]); + const collapsed = setTreeNodeExpanded(root, expanded, false); + expect(getVisibleTreeRows(nodes, collapsed)).toEqual([otherRoot, root]); + expect(expanded.has(root.key)).toBe(true); + expect(collapsed.has(object.key)).toBe(true); + expect(getVisibleTreeRows(nodes, setTreeNodeExpanded(root, collapsed, true))).toEqual([ + otherRoot, root, object, leaf, sibling, + ]); + }); + + it('traverses arbitrary depth without recursive calls', () => { + const deepNodes: TreeNode[] = [root]; + const expanded = new Set([root.key]); + let parent = root; + for (let depth = 1; depth <= 3000; depth++) { + const child: TreeNode = { + key: `deep:${depth}`, + parentKey: parent.key, + depth, + field: 'nested', + value: { display: '{...}', type: 'object' }, + expandable: depth < 3000, + }; + deepNodes.push(child); + expanded.add(child.key); + parent = child; + } + expect(getVisibleTreeRows(deepNodes, expanded)).toEqual(deepNodes); + expect(getVisibleTreeRows(deepNodes, setTreeNodeExpanded(root, expanded, false))).toEqual([root]); + }); + + it('respects host array expansion eligibility and never fabricates capped children', () => { + const empty: TreeNode = { + ...sibling, key: 'empty', field: 'empty', + value: { display: '(elements: 0)', type: 'array' }, + }; + const ten: TreeNode = { + ...object, key: 'ten', field: 'ten', + value: { display: '(elements: 10)', type: 'array' }, + }; + const eleven: TreeNode = { + ...sibling, key: 'eleven', field: 'eleven', + value: { display: '(elements: 11)', type: 'array' }, + }; + const elements: TreeNode[] = Array.from({ length: 10 }, (_, index): TreeNode => ({ + ...leaf, key: `ten:${index}`, parentKey: ten.key, field: `ten[${index}]`, + })); + const arrayNodes = [root, empty, ten, ...elements, eleven]; + let expanded: ReadonlySet = new Set([root.key]); + expanded = setTreeNodeExpanded(eleven, expanded, true); + expanded = setTreeNodeExpanded(empty, expanded, true); + expect([...expanded]).toEqual([root.key]); + expect(getVisibleTreeRows(arrayNodes, expanded)).toEqual([root, eleven, empty, ten]); + expanded = setTreeNodeExpanded(ten, expanded, true); + expect(getVisibleTreeRows(arrayNodes, expanded)).toEqual([root, eleven, empty, ten, ...elements]); + expect(getTreeKeyAction(getVisibleTreeRows(arrayNodes, expanded), eleven, expanded, 'ArrowRight')) + .toBeUndefined(); + }); + + it('Right opens a parent, then focuses its first Field-ascending child', () => { + const collapsed = new Set(); + expect(getTreeKeyAction(getVisibleTreeRows(nodes, collapsed), root, collapsed, 'ArrowRight')) + .toEqual({ type: 'expand', key: root.key }); + const expanded = setTreeNodeExpanded(root, collapsed, true); + const rows = getVisibleTreeRows(nodes, expanded); + expect(getTreeKeyAction(rows, root, expanded, 'ArrowRight')) + .toEqual({ type: 'focus', key: object.key }); + expect(getTreeKeyAction(rows, object, expanded, 'ArrowRight')) + .toEqual({ type: 'expand', key: object.key }); + expect(getTreeKeyAction(rows, sibling, expanded, 'ArrowRight')).toBeUndefined(); + }); + + it('Left collapses an open parent before moving from a closed parent or leaf to its parent', () => { + const expanded = new Set([root.key, object.key]); + const rows = getVisibleTreeRows(nodes, expanded); + expect(getTreeKeyAction(rows, object, expanded, 'ArrowLeft')) + .toEqual({ type: 'collapse', key: object.key }); + expect(getTreeKeyAction(rows, leaf, expanded, 'ArrowLeft')) + .toEqual({ type: 'focus', key: object.key }); + const collapsedObject = setTreeNodeExpanded(object, expanded, false); + expect(getTreeKeyAction(getVisibleTreeRows(nodes, collapsedObject), object, collapsedObject, 'ArrowLeft')) + .toEqual({ type: 'focus', key: root.key }); + expect(getTreeKeyAction(rows, root, expanded, 'ArrowLeft')) + .toEqual({ type: 'collapse', key: root.key }); + const collapsedRoot = setTreeNodeExpanded(root, expanded, false); + expect(getTreeKeyAction(getVisibleTreeRows(nodes, collapsedRoot), root, collapsedRoot, 'ArrowLeft')) + .toBeUndefined(); + }); + + it('does not supply actions for native vertical navigation or Tab', () => { + const expanded = new Set([root.key]); + const rows = getVisibleTreeRows(nodes, expanded); + for (const key of ['ArrowUp', 'ArrowDown', 'Tab', 'Home', 'End']) { + expect(getTreeKeyAction(rows, root, expanded, key)).toBeUndefined(); + } + }); +}); diff --git a/src/webviews/documentdb/collectionView/components/resultsTab/useTreeRows.ts b/src/webviews/documentdb/collectionView/components/resultsTab/useTreeRows.ts new file mode 100644 index 000000000..2276163a3 --- /dev/null +++ b/src/webviews/documentdb/collectionView/components/resultsTab/useTreeRows.ts @@ -0,0 +1,125 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +import { useCallback, useMemo, useState } from 'react'; +import { type TreeNode } from '../../../../../utils/documentGrid/types'; + +const COLLAPSED_KEYS: ReadonlySet = new Set(); + +interface TreeExpansionState { + readonly nodes: readonly TreeNode[]; + readonly expandedKeys: ReadonlySet; +} + +interface TreeRows { + readonly rows: readonly TreeNode[]; + readonly expandedKeys: ReadonlySet; + readonly setExpanded: (node: TreeNode, expanded: boolean) => void; +} + +type TreeKeyAction = + | { readonly type: 'expand' | 'collapse'; readonly key: string } + | { readonly type: 'focus'; readonly key: string }; + +export function getVisibleTreeRows( + nodes: readonly TreeNode[], + expandedKeys: ReadonlySet, +): TreeNode[] { + const children = new Map(); + for (const node of nodes) { + const siblings = children.get(node.parentKey); + if (siblings) { + siblings.push(node); + } else { + children.set(node.parentKey, [node]); + } + } + for (const siblings of children.values()) { + siblings.sort((left, right): number => left.field.localeCompare(right.field)); + } + + const rows: TreeNode[] = []; + const stack = [...(children.get(null) ?? [])].reverse(); + while (stack.length > 0) { + const node = stack.pop(); + if (!node) { + continue; + } + rows.push(node); + if (node.expandable && expandedKeys.has(node.key)) { + const descendants = children.get(node.key) ?? []; + for (let index = descendants.length - 1; index >= 0; index--) { + stack.push(descendants[index]); + } + } + } + return rows; +} + +export function setTreeNodeExpanded( + node: TreeNode, + expandedKeys: ReadonlySet, + expanded: boolean, +): ReadonlySet { + if (!node.expandable || expandedKeys.has(node.key) === expanded) { + return expandedKeys; + } + const next = new Set(expandedKeys); + if (expanded) { + next.add(node.key); + } else { + next.delete(node.key); + } + return next; +} + +export function getTreeKeyAction( + rows: readonly TreeNode[], + node: TreeNode, + expandedKeys: ReadonlySet, + key: string, +): TreeKeyAction | undefined { + if (key === 'ArrowRight' && node.expandable) { + if (!expandedKeys.has(node.key)) { + return { type: 'expand', key: node.key }; + } + const child = rows.find((row): boolean => row.parentKey === node.key); + if (child) { + return { type: 'focus', key: child.key }; + } + } else if (key === 'ArrowLeft') { + if (node.expandable && expandedKeys.has(node.key)) { + return { type: 'collapse', key: node.key }; + } + if (node.parentKey !== null) { + return { type: 'focus', key: node.parentKey }; + } + } + return undefined; +} + +export function useTreeRows(nodes: readonly TreeNode[]): TreeRows { + const [state, setState] = useState({ nodes, expandedKeys: COLLAPSED_KEYS }); + // A replacement page starts collapsed, including position-keyed roots reused by the host. + if (state.nodes !== nodes) { + setState({ nodes, expandedKeys: COLLAPSED_KEYS }); + } + const expandedKeys = state.nodes === nodes ? state.expandedKeys : COLLAPSED_KEYS; + const rows = useMemo((): TreeNode[] => getVisibleTreeRows(nodes, expandedKeys), [nodes, expandedKeys]); + const setExpanded = useCallback( + (node: TreeNode, expanded: boolean): void => { + setState((previous): TreeExpansionState => ({ + nodes, + expandedKeys: setTreeNodeExpanded( + node, + previous.nodes === nodes ? previous.expandedKeys : COLLAPSED_KEYS, + expanded, + ), + })); + }, + [nodes], + ); + return { rows, expandedKeys, setExpanded }; +} From a2cdd238a7631cc5de49cb60db465d9b24c6a264 Mon Sep 17 00:00:00 2001 From: Tomasz Naumowicz Date: Fri, 27 Nov 2026 07:55:38 +0100 Subject: [PATCH 046/148] fix: make Collection View grid keyboard focus predictable (WI-9b) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- build/verification/browser/scenarios.test.ts | 52 ++++++ build/verification/browser/scenarios.ts | 162 ++++++++++++++++-- .../iterations/02-rdg-execution-plan.md | 33 +++- .../collectionView/CollectionView.tsx | 36 +++- .../resultsTab/DataViewPanelTable.tsx | 15 +- .../resultsTab/DataViewPanelTree.tsx | 55 ++---- .../components/resultsTab/dataGridTheme.scss | 5 + .../components/resultsTab/useTreeRows.test.ts | 44 +---- .../components/resultsTab/useTreeRows.ts | 29 ---- .../components/toolbar/ViewSwitcher.tsx | 10 +- 10 files changed, 301 insertions(+), 140 deletions(-) diff --git a/build/verification/browser/scenarios.test.ts b/build/verification/browser/scenarios.test.ts index 4f6660ad6..39b0fce6a 100644 --- a/build/verification/browser/scenarios.test.ts +++ b/build/verification/browser/scenarios.test.ts @@ -126,6 +126,58 @@ describe('TDD: Collection View grid contracts', (): void => { })); }); + it('pins Enter tree activation without weakening the hierarchy or array viewport contract', (): void => { + const tree: readonly ScenarioAssertion[] = collectionViewContracts['deep-nesting']; + expect(tree).toContainEqual(expect.objectContaining({ + kind: 'attribute', name: 'TDD: M5 Enter expands a focused root', + attribute: 'aria-expanded', expected: 'true', + steps: [{ action: 'press', key: 'ArrowLeft' }, { action: 'press', key: 'Enter' }], + })); + expect(tree).toContainEqual(expect.objectContaining({ + kind: 'focused', name: 'TDD: M5 Up visits the previous visible sibling rather than a direct parent shortcut', + steps: [{ action: 'press', key: 'ArrowUp' }], + })); + expect(tree).toContainEqual(expect.objectContaining({ + kind: 'text', selector: '[role="treegrid"] [role="row"][aria-level="6"]', includes: ['latitude'], + })); + expect(collectionViewContracts.arrays).toContainEqual(expect.objectContaining({ + kind: 'text', name: 'TDD: M4 arrays of ten expand from the keyboard', + selector: '[role="treegrid"]', includes: ['ten[0]', 'ten[9]'], excludes: ['eleven[0]'], + steps: [{ action: 'focus', role: 'gridcell', name: 'ten' }, { action: 'press', key: 'Enter' }], + })); + expect(collectionViewContracts.arrays).toContainEqual(expect.objectContaining({ + kind: 'stableText', name: 'TDD: M4 arrays over ten do not gain children', + steps: [{ action: 'focus', role: 'gridcell', name: 'eleven' }, { action: 'press', key: 'Enter' }], + })); + }); + + it('pins symmetric grid traversal, explicit Escape exit and focus-only outlines in both grids', (): void => { + for (const [scenario, id, role] of [ + ['heterogeneous', 'M6', 'grid'], + ['deep-nesting', 'M5', 'treegrid'], + ['page-500', 'M6', 'grid'], + ] as const) { + const navigation: readonly ScenarioAssertion[] = collectionViewContracts[scenario]; + expect(navigation).toContainEqual(expect.objectContaining({ + kind: 'focused', name: `TDD: ${id} Shift+Tab crosses the same data row boundary backwards`, + requiresGrid: role, steps: [{ action: 'press', key: 'Shift+Tab' }], + })); + expect(navigation).toContainEqual(expect.objectContaining({ + kind: 'focused', name: `TDD: ${id} Escape focuses the existing view picker`, + target: { selector: '.collectionDocumentViewSwitcher [role="combobox"]' }, + steps: [{ action: 'press', key: 'Escape' }], + })); + expect(navigation).toContainEqual(expect.objectContaining({ + kind: 'style', name: `TDD: ${id} the remembered cell has no focus outline after Escape`, + property: 'outline-style', expected: 'none', + })); + expect(navigation).toContainEqual(expect.objectContaining({ + kind: 'focused', name: `TDD: ${id} Tab leaves at the last cell`, + steps: [{ action: 'press', key: 'Control+End' }, { action: 'press', key: 'Tab' }], + })); + } + }); + it('pins theme outcomes and honest virtualization evidence in every palette', (): void => { const colors = { dark: ['rgb(31, 31, 31)', 'rgb(204, 204, 204)'], diff --git a/build/verification/browser/scenarios.ts b/build/verification/browser/scenarios.ts index 2a925a4b3..fedeacf1a 100644 --- a/build/verification/browser/scenarios.ts +++ b/build/verification/browser/scenarios.ts @@ -310,6 +310,91 @@ const mixedTypesExpectations: Readonly + `${grid} [role="row"][aria-rowindex="${row}"] [role="gridcell"][aria-colindex="${column}"]`; + const focused = (name: string, selector: string, steps: readonly ScenarioStep[]): ScenarioAssertion => ({ + kind: 'focused', name: `TDD: ${contract} ${name}`, requiresGrid: role, target: { selector }, steps, + }); + return [ + focused('Ctrl+Home reaches the upper-left header', `${grid} [role="columnheader"][aria-colindex="1"]`, [ + { action: 'focus', role: 'columnheader', name: firstHeader }, { action: 'press', key: 'Control+Home' }, + ]), + focused('Tab moves to the next header', `${grid} [role="columnheader"][aria-colindex="2"]`, [ + { action: 'press', key: 'Tab' }, + ]), + focused('Shift+Tab returns to the previous header', `${grid} [role="columnheader"][aria-colindex="1"]`, [ + { action: 'press', key: 'Shift+Tab' }, + ]), + focused('Tab crosses from headers to the first data cell', cell(2, 1), + Array.from({ length: columnCount }, (): ScenarioStep => ({ action: 'press', key: 'Tab' }))), + focused('Shift+Tab crosses back to the last header', `${grid} [role="columnheader"][aria-colindex="${columnCount}"]`, [ + { action: 'press', key: 'Shift+Tab' }, + ]), + focused('Tab crosses a data row boundary', cell(3, 1), [ + { action: 'press', key: 'Tab' }, { action: 'press', key: 'End' }, { action: 'press', key: 'Tab' }, + ]), + focused('Shift+Tab crosses the same data row boundary backwards', cell(2, columnCount), [ + { action: 'press', key: 'Shift+Tab' }, + ]), + focused('Ctrl+End reaches the last column at the end of the grid', + cell(visibleRowCount + 1, columnCount), [{ action: 'press', key: 'Control+End' }]), + focused('Shift+Tab crosses the final data row boundary backwards', cell(visibleRowCount, columnCount), [ + { action: 'press', key: 'Home' }, { action: 'press', key: 'Shift+Tab' }, + ]), + focused('Tab crosses the final data row boundary forwards', cell(visibleRowCount + 1, 1), [ + { action: 'press', key: 'Tab' }, + ]), + focused('End returns to the final cell', cell(visibleRowCount + 1, columnCount), [ + { action: 'press', key: 'End' }, + ]), + focused('Escape focuses the existing view picker', '.collectionDocumentViewSwitcher [role="combobox"]', [ + { action: 'press', key: 'Escape' }, + ]), + { kind: 'style', name: `TDD: ${contract} the remembered cell has no focus outline after Escape`, + requiresGrid: role, selector: `${grid} [role="gridcell"][aria-selected="true"]`, + property: 'outline-style', expected: 'none' }, + focused('Tab reentry preserves the active cell', cell(visibleRowCount + 1, columnCount), [ + { action: 'press', key: 'Tab' }, + ]), + { kind: 'style', name: `TDD: ${contract} the focused active cell has a focus outline`, + requiresGrid: role, selector: `${grid} [role="gridcell"]:focus`, + property: 'outline-style', expected: 'solid' }, + focused('Ctrl+Home returns from the last cell to the upper-left header', + `${grid} [role="columnheader"][aria-colindex="1"]`, [{ action: 'press', key: 'Control+Home' }]), + focused('Shift+Tab leaves only at the upper-left header', '.collectionDocumentViewSwitcher [role="combobox"]', [ + { action: 'press', key: 'Shift+Tab' }, + ]), + { kind: 'style', name: `TDD: ${contract} the remembered header has no focus outline after exit`, + requiresGrid: role, selector: `${grid} [role="columnheader"][aria-selected="true"]`, + property: 'outline-style', expected: 'none' }, + focused('Tab enters the remembered header', `${grid} [role="columnheader"][aria-colindex="1"]`, [ + { action: 'press', key: 'Tab' }, + ]), + focused('Escape from a header also focuses the existing view picker', '.collectionDocumentViewSwitcher [role="combobox"]', [ + { action: 'press', key: 'Escape' }, + ]), + focused('Tab reenters the header after Escape', `${grid} [role="columnheader"][aria-colindex="1"]`, [ + { action: 'press', key: 'Tab' }, + ]), + focused('Tab leaves at the last cell', + ':not([role="grid"], [role="treegrid"], [role="grid"] *, [role="treegrid"] *)', [ + { action: 'press', key: 'Control+End' }, { action: 'press', key: 'Tab' }, + ]), + { kind: 'attribute', name: `TDD: ${contract} the view picker popup handles its own Escape`, + requiresGrid: role, selector: '.collectionDocumentViewSwitcher [role="combobox"]', + attribute: 'aria-expanded', expected: 'false', + steps: [{ action: 'click', role: 'combobox', name: 'Select view type' }, { action: 'press', key: 'Escape' }] }, + ]; +} + // These are browser user-outcome contracts, not assertions about the grid package's DOM classes. export const collectionViewContracts = { 'mixed-types': [ @@ -382,6 +467,7 @@ export const collectionViewContracts = { { kind: 'focused', name: 'TDD: M6 Up returns to the header', requiresGrid: 'grid', target: { role: 'columnheader', name: 'name' }, steps: [{ action: 'press', key: 'ArrowUp' }, { action: 'press', key: 'ArrowUp' }] }, + ...resultsGridNavigationContracts('grid', '_id', 5, 3), ], 'deep-nesting': [ { kind: 'order', name: 'TDD: M4 tree exposes Field, Value and Type columns', @@ -395,43 +481,86 @@ export const collectionViewContracts = { { kind: 'attribute', name: 'TDD: M5 root exposes collapsed state and level', requiresGrid: 'treegrid', selector: '[role="treegrid"] [role="row"][aria-level="1"]', attribute: 'aria-expanded', expected: 'false' }, - { kind: 'attribute', name: 'TDD: M5 Right expands a focused root', + { kind: 'attribute', name: 'TDD: M5 Right navigates without expanding a focused root', requiresGrid: 'treegrid', selector: '[role="treegrid"] [role="row"][aria-level="1"]', - attribute: 'aria-expanded', expected: 'true', + attribute: 'aria-expanded', expected: 'false', steps: [{ action: 'focus', role: 'gridcell', name: '"deep-root"' }, { action: 'press', key: 'ArrowRight' }] }, - { kind: 'focused', name: 'TDD: M5 Right on expanded parent moves to its first child', - requiresGrid: 'treegrid', target: { selector: '[role="treegrid"] [role="row"][aria-level="2"] [role="gridcell"][aria-colindex="1"]' }, + { kind: 'focused', name: 'TDD: M5 Right moves from Field to Value', + requiresGrid: 'treegrid', target: { selector: '[role="treegrid"] [role="row"][aria-rowindex="2"] [role="gridcell"][aria-colindex="2"]' } }, + { kind: 'attribute', name: 'TDD: M5 Enter expands a focused root', + requiresGrid: 'treegrid', selector: '[role="treegrid"] [role="row"][aria-level="1"]', + attribute: 'aria-expanded', expected: 'true', + steps: [{ action: 'press', key: 'ArrowLeft' }, { action: 'press', key: 'Enter' }] }, + { kind: 'focused', name: 'TDD: M5 expansion keeps focus on the surviving Field cell', + requiresGrid: 'treegrid', target: { role: 'gridcell', name: '"deep-root"' } }, + { kind: 'focused', name: 'TDD: M5 Right on an expanded Field still moves to Value', + requiresGrid: 'treegrid', target: { selector: '[role="treegrid"] [role="row"][aria-rowindex="2"] [role="gridcell"][aria-colindex="2"]' }, steps: [{ action: 'press', key: 'ArrowRight' }] }, - { kind: 'focused', name: 'TDD: M5 Left on a child moves to its parent', - requiresGrid: 'treegrid', target: { role: 'gridcell', name: '"deep-root"' }, + { kind: 'attribute', name: 'TDD: M5 Left at an expanded Field does not collapse the node', + requiresGrid: 'treegrid', selector: '[role="treegrid"] [role="row"][aria-level="1"]', + attribute: 'aria-expanded', expected: 'true', + steps: [{ action: 'press', key: 'ArrowLeft' }, { action: 'press', key: 'ArrowLeft' }] }, + { kind: 'focused', name: 'TDD: M5 Down reaches the next visible child Field', + requiresGrid: 'treegrid', target: { selector: '[role="treegrid"] [role="row"][aria-level="2"] [role="gridcell"][aria-colindex="1"]' }, + steps: [{ action: 'press', key: 'ArrowDown' }] }, + { kind: 'focused', name: 'TDD: M5 Left at Field stays in the cell rather than focusing the row or parent', + requiresGrid: 'treegrid', target: { selector: '[role="treegrid"] [role="row"][aria-level="2"] [role="gridcell"][aria-colindex="1"]' }, steps: [{ action: 'press', key: 'ArrowLeft' }] }, - { kind: 'attribute', name: 'TDD: M5 Left collapses the parent', + { kind: 'focused', name: 'TDD: M5 Down visits the next visible sibling rather than a direct child shortcut', + requiresGrid: 'treegrid', target: { role: 'gridcell', name: 'profile' }, + steps: [{ action: 'press', key: 'ArrowDown' }] }, + { kind: 'focused', name: 'TDD: M5 Up visits the previous visible sibling rather than a direct parent shortcut', + requiresGrid: 'treegrid', target: { selector: '[role="treegrid"] [role="row"][aria-level="2"] [role="gridcell"][aria-colindex="1"]' }, + steps: [{ action: 'press', key: 'ArrowUp' }] }, + { kind: 'focused', name: 'TDD: M5 Up reaches the preceding visible parent', + requiresGrid: 'treegrid', target: { role: 'gridcell', name: '"deep-root"' }, + steps: [{ action: 'press', key: 'ArrowUp' }] }, + { kind: 'attribute', name: 'TDD: M5 Enter collapses the parent', requiresGrid: 'treegrid', selector: '[role="treegrid"] [role="row"][aria-level="1"]', - attribute: 'aria-expanded', expected: 'false', steps: [{ action: 'press', key: 'ArrowLeft' }] }, + attribute: 'aria-expanded', expected: 'false', steps: [{ action: 'press', key: 'Enter' }] }, + { kind: 'focused', name: 'TDD: M5 collapse keeps focus on the surviving Field cell', + requiresGrid: 'treegrid', target: { role: 'gridcell', name: '"deep-root"' } }, { kind: 'text', name: 'TDD: M4 deeply nested document fields remain browsable', requiresGrid: 'treegrid', selector: '[role="treegrid"]', includes: ['latitude', '47.6062', 'longitude', '-122.3321'], excludes: [], steps: [ - { action: 'press', key: 'ArrowRight' }, - { action: 'focus', role: 'gridcell', name: 'profile' }, { action: 'press', key: 'ArrowRight' }, - { action: 'focus', role: 'gridcell', name: 'address' }, { action: 'press', key: 'ArrowRight' }, - { action: 'focus', role: 'gridcell', name: 'location' }, { action: 'press', key: 'ArrowRight' }, - { action: 'focus', role: 'gridcell', name: 'coordinates' }, { action: 'press', key: 'ArrowRight' }, + { action: 'press', key: 'Enter' }, + { action: 'focus', role: 'gridcell', name: 'profile' }, { action: 'press', key: 'Enter' }, + { action: 'focus', role: 'gridcell', name: 'address' }, { action: 'press', key: 'Enter' }, + { action: 'focus', role: 'gridcell', name: 'location' }, { action: 'press', key: 'Enter' }, + { action: 'focus', role: 'gridcell', name: 'coordinates' }, { action: 'press', key: 'Enter' }, ] }, { kind: 'text', name: 'TDD: M5 deep children expose the correct hierarchy level', requiresGrid: 'treegrid', selector: '[role="treegrid"] [role="row"][aria-level="6"]', includes: ['latitude'], excludes: [] }, + { kind: 'stableText', name: 'TDD: M5 Enter on a leaf does nothing', + requiresGrid: 'treegrid', selector: '[role="treegrid"]', + steps: [{ action: 'focus', role: 'gridcell', name: 'latitude' }, { action: 'press', key: 'Enter' }] }, + { kind: 'focused', name: 'TDD: M5 leaf Enter preserves cell focus', + requiresGrid: 'treegrid', target: { role: 'gridcell', name: 'latitude' } }, + { kind: 'focused', name: 'TDD: M5 the pointer chevron collapses and focuses its surviving Field cell', + requiresGrid: 'treegrid', target: { role: 'gridcell', name: 'coordinates' }, + steps: [{ action: 'click', role: 'button', name: 'Collapse fields for coordinates' }] }, + { kind: 'attribute', name: 'TDD: M5 pointer collapse retains the correct expanded state', + requiresGrid: 'treegrid', selector: '[role="treegrid"] [role="row"][aria-level="5"]', + attribute: 'aria-expanded', expected: 'false' }, + { kind: 'text', name: 'TDD: M5 the pointer chevron restores the deep children', + requiresGrid: 'treegrid', selector: '[role="treegrid"] [role="row"][aria-level="6"]', + includes: ['latitude'], excludes: [], + steps: [{ action: 'click', role: 'button', name: 'Expand fields for coordinates' }] }, + // Nine visible rows: the deep chain is open; the second root remains collapsed. + ...resultsGridNavigationContracts('treegrid', 'Field', 3, 9), ], arrays: [ { kind: 'text', name: 'TDD: M4 tree summaries retain counts for 0, 10 and 11 elements', requiresGrid: 'treegrid', selector: '[role="treegrid"]', includes: ['(elements: 0)', '(elements: 10)', '(elements: 11)'], excludes: ['ten[0]', 'eleven[0]'], - steps: [{ action: 'focus', role: 'gridcell', name: '"arrays-root"' }, { action: 'press', key: 'ArrowRight' }] }, + steps: [{ action: 'focus', role: 'gridcell', name: '"arrays-root"' }, { action: 'press', key: 'Enter' }] }, { kind: 'text', name: 'TDD: M4 arrays of ten expand from the keyboard', requiresGrid: 'treegrid', selector: '[role="treegrid"]', includes: ['ten[0]', 'ten[9]'], excludes: ['eleven[0]'], - steps: [{ action: 'focus', role: 'gridcell', name: 'ten' }, { action: 'press', key: 'ArrowRight' }] }, + steps: [{ action: 'focus', role: 'gridcell', name: 'ten' }, { action: 'press', key: 'Enter' }] }, { kind: 'stableText', name: 'TDD: M4 arrays over ten do not gain children', requiresGrid: 'treegrid', selector: '[role="treegrid"]', - steps: [{ action: 'focus', role: 'gridcell', name: 'eleven' }, { action: 'press', key: 'ArrowRight' }] }, + steps: [{ action: 'focus', role: 'gridcell', name: 'eleven' }, { action: 'press', key: 'Enter' }] }, { kind: 'text', name: 'TDD: M4 JSON view retains the existing document payload', requiresGrid: 'treegrid', selector: '.monaco-editor:has([role="textbox"][aria-label="JSON results view: Read-only display of query results in JSON format"])', @@ -454,6 +583,7 @@ export const collectionViewContracts = { steps: [{ action: 'focus', role: 'columnheader', name: '_id' }, { action: 'press', key: 'ArrowDown' }, { action: 'press', key: 'Control+End' }] }, { kind: 'countAtMost', name: 'TDD: K11 mounted rows stay bounded near the last document', requiresGrid: 'grid', selector: '[role="grid"] [role="row"]', max: 100 }, + ...resultsGridNavigationContracts('grid', '_id', 2, 500), ], 'html-values': [ { kind: 'text', name: 'TDD: K8 HTML-looking data remains literal cell text', diff --git a/docs/ai-and-plans/features/data-grid/iterations/02-rdg-execution-plan.md b/docs/ai-and-plans/features/data-grid/iterations/02-rdg-execution-plan.md index cbee6db23..1adea7109 100644 --- a/docs/ai-and-plans/features/data-grid/iterations/02-rdg-execution-plan.md +++ b/docs/ai-and-plans/features/data-grid/iterations/02-rdg-execution-plan.md @@ -1096,12 +1096,16 @@ through `mai-code-2-flash` after each pair of items, not after every commit. > `ten[9]` appeared after scrolling and the grid stayed stable. This rules out a missing row > in that observation; it does not clear the recorded page error or authorize a pin or contract > change. Pause after the current checks to collect the operator's other accessibility feedback. +> The initial WI-9 implementation is committed at `59281cdb`, not accepted. Coding used +> 49.2 AIU on `gpt-6.1-sol` (17 requests), including the keyboard retry. -> **Resize investigation (E1), still open:** The authorized `hydrafusion-max` model was -> unavailable, so the diagnosis did not run. Keep the resize error in WI-9, separate from -> WI-9b. Diagnose it without suppressing page errors or counting the manual scroll check as -> an A8 pass. If the array assertion needs to navigate to a virtualized row to check its -> contents, handle that setup change under E3 separately. +> **Resize investigation (E1), paused:** The authorized `hydrafusion-max` model was unavailable +> on both attempts; neither did any work. The operator asked to pause this track and receive a +> detailed prompt for a separate session once the A8 keyboard checks are complete. Keep the +> resize error separate from WI-9b. It remains open for A8 release; do not suppress page +> errors or count the manual scroll check as an A8 pass. If the array assertion needs to +> navigate to a virtualized row to check its contents, handle that setup change under E3 +> separately. **WI-9b: Table and Tree keyboard navigation** · scheduled in Step 2, before A8/A9 and G2 @@ -1129,6 +1133,17 @@ through `mai-code-2-flash` after each pair of items, not after every commit. Cover the 500-row Table case and verify the keyboard path and announcements with Narrator at G2. Finish the current WI-9 resize track separately; do not edit shared tree files concurrently. +> **Done (2026-11-27), keyboard scope only:** The shared focus ring follows DOM focus without +> clearing row selection. Scoped Tabster opt-out lets RDG handle forward and reverse Tab +> inside both grids without changing JSON or the surrounding controls. The build, 30 focused +> tests, 102 browser-runner tests and browser TypeScript passed. Integrated Browser Table: +> 29/29 in each theme; 27/27 for the 500-row dark route. Targeted Tree checks for Enter, +> arrows, Tab, Escape and focus passed in all three themes. The advisor approved the revised +> keyboard logic (85% confidence). Full Tree checks still stop on the ResizeObserver error, +> so A8 is not released. The required separate-session investigation is ready for handoff. +> Coding: 109.5 AIU on `gpt-6.1-sol` (37 requests); advisor: 160.0 AIU on `claude-opus-5.5` +> (11); browser: 32.0 AIU on `gpt-6.1-terra` (37); terminal: 0.3 AIU on `mai-code-2-flash` (4). + ### Step 3 Leader runs A9 through `mai-code-2-flash`, then raises **G2**. After release: WI-G2-n items, each @@ -1274,7 +1289,7 @@ packaged-theme caveat. The operator accepted release metadata for the support fl stable workbench smoke, a real collection, screen readers and high-contrast were not run. Step 1 is complete. A1–A7 passed; the Table works through WI-8, including nested actions and -the held late query. WI-9 is not accepted: A8 remains under E1 for the resize error, with the -operator confirming that the end of the ten-element array can be reached by scrolling. -The navigation feedback is scheduled separately as WI-9b before A8/A9 and G2. Implementation -remains paused. No draft PR has been opened. +the held late query. WI-9b keyboard navigation is complete. WI-9 is implemented but not +accepted: A8 remains under E1 for the resize error, with the operator confirming that the +end of the ten-element array can be reached by scrolling. The resize investigation remains +paused for the operator's separate session. A9 and G2 are blocked; no draft PR has been opened. diff --git a/src/webviews/documentdb/collectionView/CollectionView.tsx b/src/webviews/documentdb/collectionView/CollectionView.tsx index ff66c1eb1..361c5e895 100644 --- a/src/webviews/documentdb/collectionView/CollectionView.tsx +++ b/src/webviews/documentdb/collectionView/CollectionView.tsx @@ -139,6 +139,7 @@ export const CollectionView = (): JSX.Element => { // that's the local view of query results // TODO: it's a potential data duplication in the end, consider moving it into the global context of the view const [currentQueryResults, setCurrentQueryResults] = useState(); + const viewPickerRef = useRef(null); // Track which tab is currently active. Honors `configuration.initialTab` // so an external caller (e.g. the "Indexes" tree node) can open the view @@ -874,10 +875,41 @@ export const CollectionView = (): JSX.Element => { onViewClick={handleViewDocumentRequest} onAddClick={handleAddDocumentRequest} /> - + -
    +
    { + const picker = viewPickerRef.current; + if ( + event.key !== 'Escape' || + event.defaultPrevented || + event.altKey || + event.ctrlKey || + event.metaKey || + event.shiftKey || + !(event.target instanceof HTMLElement) || + !event.target.matches('[role="gridcell"], [role="columnheader"]') || + !event.target.closest('[role="grid"], [role="treegrid"]') || + !picker || + picker.disabled + ) { + return; + } + // Bubble after cell/popup handlers; only grid cells can request this exit. + event.preventDefault(); + event.stopPropagation(); + picker.focus(); + }} + > { { 'Table View': ( diff --git a/src/webviews/documentdb/collectionView/components/resultsTab/DataViewPanelTable.tsx b/src/webviews/documentdb/collectionView/components/resultsTab/DataViewPanelTable.tsx index 169b9eb06..5d0ec05e4 100644 --- a/src/webviews/documentdb/collectionView/components/resultsTab/DataViewPanelTable.tsx +++ b/src/webviews/documentdb/collectionView/components/resultsTab/DataViewPanelTable.tsx @@ -4,7 +4,7 @@ *--------------------------------------------------------------------------------------------*/ import * as React from 'react'; -import { DataGrid, Row, type Column, type DataGridHandle, type DefaultColumnOptions } from 'react-data-grid'; +import { Cell, DataGrid, Row, type Column, type DataGridHandle, type DefaultColumnOptions } from 'react-data-grid'; import 'react-data-grid/lib/styles.css'; import * as l10n from '@vscode/l10n'; import { @@ -173,6 +173,19 @@ export function DataViewPanelTable({ } }} renderers={{ + renderCell: (key, props): React.JSX.Element => ( + { + props.onFocusCapture?.(event); + if (!event.defaultPrevented && event.target === event.currentTarget) { + // Native Tab exit uses the remembered position, not the focused DOM cell. + props.setActivePosition({ rowIdx: props.rowIdx, idx: props.column.idx }); + } + }} + /> + ), renderRow: (key, props): React.JSX.Element => ( handleRowKeyDown(props.row, event)} /> ), diff --git a/src/webviews/documentdb/collectionView/components/resultsTab/DataViewPanelTree.tsx b/src/webviews/documentdb/collectionView/components/resultsTab/DataViewPanelTree.tsx index 03bb357cc..3423af5d2 100644 --- a/src/webviews/documentdb/collectionView/components/resultsTab/DataViewPanelTree.tsx +++ b/src/webviews/documentdb/collectionView/components/resultsTab/DataViewPanelTree.tsx @@ -15,7 +15,7 @@ import { import 'react-data-grid/lib/styles.css'; import { type TreeNode } from '../../../../../utils/documentGrid/types'; import { bsonStringToDisplayString } from '../../../../utils/documentGrid/typeToDisplayString'; -import { getTreeKeyAction, useTreeRows } from './useTreeRows'; +import { useTreeRows } from './useTreeRows'; import './dataGridTheme.scss'; interface DataViewPanelTreeProps { @@ -50,6 +50,7 @@ export const DataViewPanelTree = ({ nodes }: DataViewPanelTreeProps): React.JSX. onClick={(event): void => { event.stopPropagation(); // Focus the surviving cell before hiding any active descendant. + event.currentTarget.closest('[role="gridcell"]')?.focus(); gridRef.current?.setActivePosition( { rowIdx, idx: 0 }, { shouldFocus: true }, @@ -84,12 +85,20 @@ export const DataViewPanelTree = ({ nodes }: DataViewPanelTreeProps): React.JSX. function onTreeKeyDown( row: TreeNode, rowIdx: number, - idx: number, setActivePosition: DataGridHandle['setActivePosition'], event: React.KeyboardEvent, ): void { + if (event.target !== event.currentTarget) { + return; + } + // RDG's treegrid Left boundary otherwise selects the whole row (idx: -1). + if (event.key === 'ArrowLeft') { + event.stopPropagation(); + event.preventDefault(); + return; + } if ( - (event.key !== 'ArrowRight' && event.key !== 'ArrowLeft') || + event.key !== 'Enter' || event.altKey || event.ctrlKey || event.metaKey || @@ -98,24 +107,11 @@ export const DataViewPanelTree = ({ nodes }: DataViewPanelTreeProps): React.JSX. return; } - const action = getTreeKeyAction(rows, row, expandedKeys, event.key); - if (!action) { - return; - } - // Handle the focused row locally, before RDG can use a stale active position. event.stopPropagation(); event.preventDefault(); - if (action.type === 'focus') { - const targetRowIdx = rows.findIndex((node): boolean => node.key === action.key); - if (targetRowIdx >= 0) { - setActivePosition( - { rowIdx: targetRowIdx, idx }, - { shouldFocus: true }, - ); - } - } else { - setActivePosition({ rowIdx, idx }, { shouldFocus: true }); - setExpanded(row, action.type === 'expand'); + if (row.expandable && !event.repeat) { + setActivePosition({ rowIdx, idx: 0 }, { shouldFocus: true }); + setExpanded(row, !expandedKeys.has(row.key)); } } @@ -138,7 +134,7 @@ export const DataViewPanelTree = ({ nodes }: DataViewPanelTreeProps): React.JSX. aria-label={props.column.key === 'field' ? props.row.field : undefined} onFocusCapture={(event): void => { props.onFocusCapture?.(event); - if (!event.defaultPrevented) { + if (!event.defaultPrevented && event.target === event.currentTarget) { // Keep Cell's own bubbling onFocus for native roving focus. props.setActivePosition({ rowIdx: props.rowIdx, idx: props.column.idx }); } @@ -149,7 +145,6 @@ export const DataViewPanelTree = ({ nodes }: DataViewPanelTreeProps): React.JSX. onTreeKeyDown( props.row, props.rowIdx, - props.column.idx, props.setActivePosition, event, ); @@ -163,24 +158,6 @@ export const DataViewPanelTree = ({ nodes }: DataViewPanelTreeProps): React.JSX. {...props} aria-level={props.row.depth + 1} aria-expanded={props.row.expandable ? expandedKeys.has(props.row.key) : undefined} - onFocusCapture={(event): void => { - props.onFocusCapture?.(event); - if (!event.defaultPrevented && event.target === event.currentTarget) { - props.setActivePosition({ rowIdx: props.rowIdx, idx: -1 }); - } - }} - onKeyDown={(event): void => { - props.onKeyDown?.(event); - if (!event.defaultPrevented && event.target === event.currentTarget) { - onTreeKeyDown( - props.row, - props.rowIdx, - -1, - props.setActivePosition, - event, - ); - } - }} /> ), }} diff --git a/src/webviews/documentdb/collectionView/components/resultsTab/dataGridTheme.scss b/src/webviews/documentdb/collectionView/components/resultsTab/dataGridTheme.scss index 46355fdde..c31debe24 100644 --- a/src/webviews/documentdb/collectionView/components/resultsTab/dataGridTheme.scss +++ b/src/webviews/documentdb/collectionView/components/resultsTab/dataGridTheme.scss @@ -4,6 +4,11 @@ *--------------------------------------------------------------------------------------------*/ .documentDataGrid { + // RDG remembers its active cell on blur. That memory is not a second focus indicator. + :is([role='gridcell'], [role='columnheader']):not(:focus-within) { + outline: none; + } + @media (forced-colors: none) { --rdg-color: var(--vscode-editor-foreground, var(--vscode-foreground)); --rdg-background-color: var(--vscode-editor-background); diff --git a/src/webviews/documentdb/collectionView/components/resultsTab/useTreeRows.test.ts b/src/webviews/documentdb/collectionView/components/resultsTab/useTreeRows.test.ts index 661caf090..32ff35ae6 100644 --- a/src/webviews/documentdb/collectionView/components/resultsTab/useTreeRows.test.ts +++ b/src/webviews/documentdb/collectionView/components/resultsTab/useTreeRows.test.ts @@ -5,7 +5,7 @@ import { describe, expect, it } from 'vitest'; import { type TreeNode } from '../../../../../utils/documentGrid/types'; -import { getTreeKeyAction, getVisibleTreeRows, setTreeNodeExpanded } from './useTreeRows'; +import { getVisibleTreeRows, setTreeNodeExpanded } from './useTreeRows'; const root: TreeNode = { key: '["id:\\"z-root\\""]', @@ -47,7 +47,7 @@ const otherRoot: TreeNode = { }; const nodes: readonly TreeNode[] = [root, sibling, object, leaf, otherRoot]; -describe('tree expansion and navigation', () => { +describe('tree expansion and visible rows', () => { it('starts with just document roots in Field-ascending order', () => { expect(getVisibleTreeRows(nodes, new Set())).toEqual([otherRoot, root]); }); @@ -114,45 +114,5 @@ describe('tree expansion and navigation', () => { expect(getVisibleTreeRows(arrayNodes, expanded)).toEqual([root, eleven, empty, ten]); expanded = setTreeNodeExpanded(ten, expanded, true); expect(getVisibleTreeRows(arrayNodes, expanded)).toEqual([root, eleven, empty, ten, ...elements]); - expect(getTreeKeyAction(getVisibleTreeRows(arrayNodes, expanded), eleven, expanded, 'ArrowRight')) - .toBeUndefined(); - }); - - it('Right opens a parent, then focuses its first Field-ascending child', () => { - const collapsed = new Set(); - expect(getTreeKeyAction(getVisibleTreeRows(nodes, collapsed), root, collapsed, 'ArrowRight')) - .toEqual({ type: 'expand', key: root.key }); - const expanded = setTreeNodeExpanded(root, collapsed, true); - const rows = getVisibleTreeRows(nodes, expanded); - expect(getTreeKeyAction(rows, root, expanded, 'ArrowRight')) - .toEqual({ type: 'focus', key: object.key }); - expect(getTreeKeyAction(rows, object, expanded, 'ArrowRight')) - .toEqual({ type: 'expand', key: object.key }); - expect(getTreeKeyAction(rows, sibling, expanded, 'ArrowRight')).toBeUndefined(); - }); - - it('Left collapses an open parent before moving from a closed parent or leaf to its parent', () => { - const expanded = new Set([root.key, object.key]); - const rows = getVisibleTreeRows(nodes, expanded); - expect(getTreeKeyAction(rows, object, expanded, 'ArrowLeft')) - .toEqual({ type: 'collapse', key: object.key }); - expect(getTreeKeyAction(rows, leaf, expanded, 'ArrowLeft')) - .toEqual({ type: 'focus', key: object.key }); - const collapsedObject = setTreeNodeExpanded(object, expanded, false); - expect(getTreeKeyAction(getVisibleTreeRows(nodes, collapsedObject), object, collapsedObject, 'ArrowLeft')) - .toEqual({ type: 'focus', key: root.key }); - expect(getTreeKeyAction(rows, root, expanded, 'ArrowLeft')) - .toEqual({ type: 'collapse', key: root.key }); - const collapsedRoot = setTreeNodeExpanded(root, expanded, false); - expect(getTreeKeyAction(getVisibleTreeRows(nodes, collapsedRoot), root, collapsedRoot, 'ArrowLeft')) - .toBeUndefined(); - }); - - it('does not supply actions for native vertical navigation or Tab', () => { - const expanded = new Set([root.key]); - const rows = getVisibleTreeRows(nodes, expanded); - for (const key of ['ArrowUp', 'ArrowDown', 'Tab', 'Home', 'End']) { - expect(getTreeKeyAction(rows, root, expanded, key)).toBeUndefined(); - } }); }); diff --git a/src/webviews/documentdb/collectionView/components/resultsTab/useTreeRows.ts b/src/webviews/documentdb/collectionView/components/resultsTab/useTreeRows.ts index 2276163a3..9b4f5288b 100644 --- a/src/webviews/documentdb/collectionView/components/resultsTab/useTreeRows.ts +++ b/src/webviews/documentdb/collectionView/components/resultsTab/useTreeRows.ts @@ -19,10 +19,6 @@ interface TreeRows { readonly setExpanded: (node: TreeNode, expanded: boolean) => void; } -type TreeKeyAction = - | { readonly type: 'expand' | 'collapse'; readonly key: string } - | { readonly type: 'focus'; readonly key: string }; - export function getVisibleTreeRows( nodes: readonly TreeNode[], expandedKeys: ReadonlySet, @@ -75,31 +71,6 @@ export function setTreeNodeExpanded( return next; } -export function getTreeKeyAction( - rows: readonly TreeNode[], - node: TreeNode, - expandedKeys: ReadonlySet, - key: string, -): TreeKeyAction | undefined { - if (key === 'ArrowRight' && node.expandable) { - if (!expandedKeys.has(node.key)) { - return { type: 'expand', key: node.key }; - } - const child = rows.find((row): boolean => row.parentKey === node.key); - if (child) { - return { type: 'focus', key: child.key }; - } - } else if (key === 'ArrowLeft') { - if (node.expandable && expandedKeys.has(node.key)) { - return { type: 'collapse', key: node.key }; - } - if (node.parentKey !== null) { - return { type: 'focus', key: node.parentKey }; - } - } - return undefined; -} - export function useTreeRows(nodes: readonly TreeNode[]): TreeRows { const [state, setState] = useState({ nodes, expandedKeys: COLLAPSED_KEYS }); // A replacement page starts collapsed, including position-keyed roots reused by the host. diff --git a/src/webviews/documentdb/collectionView/components/toolbar/ViewSwitcher.tsx b/src/webviews/documentdb/collectionView/components/toolbar/ViewSwitcher.tsx index 0090563da..ed72017ba 100644 --- a/src/webviews/documentdb/collectionView/components/toolbar/ViewSwitcher.tsx +++ b/src/webviews/documentdb/collectionView/components/toolbar/ViewSwitcher.tsx @@ -5,10 +5,15 @@ import { Dropdown, Option } from '@fluentui/react-components'; import * as l10n from '@vscode/l10n'; -import { useContext, type JSX } from 'react'; +import { useContext, type JSX, type Ref } from 'react'; import { CollectionViewContext, Views } from '../../collectionViewContext'; -export function ViewSwitcher({ onViewChanged }: { onViewChanged: (view: Views) => void }): JSX.Element { +interface ViewSwitcherProps { + readonly onViewChanged: (view: Views) => void; + readonly focusTargetRef?: Ref; +} + +export function ViewSwitcher({ onViewChanged, focusTargetRef }: ViewSwitcherProps): JSX.Element { const [currentContext] = useContext(CollectionViewContext); const labels = { [Views.TABLE]: l10n.t('Table View'), @@ -18,6 +23,7 @@ export function ViewSwitcher({ onViewChanged }: { onViewChanged: (view: Views) = return ( Date: Fri, 27 Nov 2026 09:54:12 +0100 Subject: [PATCH 047/148] test: reach virtualized tree array children by keyboard (E3) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- build/verification/browser/scenarios.test.ts | 13 ++++++++++++- build/verification/browser/scenarios.ts | 14 ++++++++++++-- 2 files changed, 24 insertions(+), 3 deletions(-) diff --git a/build/verification/browser/scenarios.test.ts b/build/verification/browser/scenarios.test.ts index 39b0fce6a..423946d05 100644 --- a/build/verification/browser/scenarios.test.ts +++ b/build/verification/browser/scenarios.test.ts @@ -142,9 +142,20 @@ describe('TDD: Collection View grid contracts', (): void => { })); expect(collectionViewContracts.arrays).toContainEqual(expect.objectContaining({ kind: 'text', name: 'TDD: M4 arrays of ten expand from the keyboard', - selector: '[role="treegrid"]', includes: ['ten[0]', 'ten[9]'], excludes: ['eleven[0]'], + selector: '[role="treegrid"]', includes: ['ten[0]'], excludes: ['eleven\\[0\\]'], steps: [{ action: 'focus', role: 'gridcell', name: 'ten' }, { action: 'press', key: 'Enter' }], })); + expect(collectionViewContracts.arrays).toContainEqual(expect.objectContaining({ + kind: 'text', name: 'TDD: M4 keyboard scrolling reaches the last child of an array of ten', + selector: '[role="treegrid"]', includes: ['ten[9]'], excludes: ['eleven\\[0\\]'], + waitForText: true, + steps: [{ action: 'press', key: 'Control+End' }], + })); + expect(collectionViewContracts.arrays).toContainEqual(expect.objectContaining({ + kind: 'text', name: 'TDD: M4 the top viewport is mounted before comparing over-ten array text', + requiresGrid: 'treegrid', selector: '[role="treegrid"]', + includes: ['"arrays-root"', '(elements: 11)'], excludes: ['eleven\\[0\\]'], waitForText: true, + })); expect(collectionViewContracts.arrays).toContainEqual(expect.objectContaining({ kind: 'stableText', name: 'TDD: M4 arrays over ten do not gain children', steps: [{ action: 'focus', role: 'gridcell', name: 'eleven' }, { action: 'press', key: 'Enter' }], diff --git a/build/verification/browser/scenarios.ts b/build/verification/browser/scenarios.ts index fedeacf1a..7b7afae2f 100644 --- a/build/verification/browser/scenarios.ts +++ b/build/verification/browser/scenarios.ts @@ -553,11 +553,21 @@ export const collectionViewContracts = { arrays: [ { kind: 'text', name: 'TDD: M4 tree summaries retain counts for 0, 10 and 11 elements', requiresGrid: 'treegrid', selector: '[role="treegrid"]', - includes: ['(elements: 0)', '(elements: 10)', '(elements: 11)'], excludes: ['ten[0]', 'eleven[0]'], + includes: ['(elements: 0)', '(elements: 10)', '(elements: 11)'], excludes: ['ten\\[0\\]', 'eleven\\[0\\]'], steps: [{ action: 'focus', role: 'gridcell', name: '"arrays-root"' }, { action: 'press', key: 'Enter' }] }, { kind: 'text', name: 'TDD: M4 arrays of ten expand from the keyboard', - requiresGrid: 'treegrid', selector: '[role="treegrid"]', includes: ['ten[0]', 'ten[9]'], excludes: ['eleven[0]'], + requiresGrid: 'treegrid', selector: '[role="treegrid"]', includes: ['ten[0]'], excludes: ['eleven\\[0\\]'], steps: [{ action: 'focus', role: 'gridcell', name: 'ten' }, { action: 'press', key: 'Enter' }] }, + { kind: 'text', name: 'TDD: M4 keyboard scrolling reaches the last child of an array of ten', + requiresGrid: 'treegrid', selector: '[role="treegrid"]', includes: ['ten[9]'], excludes: ['eleven\\[0\\]'], + waitForText: true, + steps: [{ action: 'press', key: 'Control+End' }] }, + { kind: 'focused', name: 'TDD: M4 returning to the top restores focus to the over-ten array', + requiresGrid: 'treegrid', target: { role: 'gridcell', name: 'eleven' }, + steps: [{ action: 'press', key: 'Control+Home' }, { action: 'focus', role: 'gridcell', name: 'eleven' }] }, + { kind: 'text', name: 'TDD: M4 the top viewport is mounted before comparing over-ten array text', + requiresGrid: 'treegrid', selector: '[role="treegrid"]', + includes: ['"arrays-root"', '(elements: 11)'], excludes: ['eleven\\[0\\]'], waitForText: true }, { kind: 'stableText', name: 'TDD: M4 arrays over ten do not gain children', requiresGrid: 'treegrid', selector: '[role="treegrid"]', steps: [{ action: 'focus', role: 'gridcell', name: 'eleven' }, { action: 'press', key: 'Enter' }] }, From 20c1c7ab67edc0f468a54d9f9d2d90abb74825f7 Mon Sep 17 00:00:00 2001 From: Tomasz Naumowicz Date: Fri, 27 Nov 2026 09:54:13 +0100 Subject: [PATCH 048/148] fix: stabilize Tree scrollbar measurements (WI-9) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .../iterations/02-rdg-execution-plan.md | 44 +++++++++++++------ .../components/resultsTab/dataGridTheme.scss | 5 +++ 2 files changed, 36 insertions(+), 13 deletions(-) diff --git a/docs/ai-and-plans/features/data-grid/iterations/02-rdg-execution-plan.md b/docs/ai-and-plans/features/data-grid/iterations/02-rdg-execution-plan.md index 1adea7109..ad88b8351 100644 --- a/docs/ai-and-plans/features/data-grid/iterations/02-rdg-execution-plan.md +++ b/docs/ai-and-plans/features/data-grid/iterations/02-rdg-execution-plan.md @@ -219,6 +219,13 @@ theme with no reported console, page or CSP errors. Each run recorded `common.re `stepIn` calls in order: `step-in-button` depths 1 and 2, `step-out-button` depth 1, `step-in-button` depth 2, and `breadcrumb` depths 1 and 0. +**A8 passed (2026-11-27).** WI-9 and WI-9b passed advisor logic review. With the Tree-only +stable scrollbar gutter and the approved E3 array navigation setup, all six Integrated +Browser routes were ready: `deep-nesting` 47/47 and `arrays` 9/9 in each of dark, light and +high contrast (168 assertions). No ResizeObserver, console, page or CSP errors were +reported. The dark Table regression passed 29/29; computed gutter was `auto` for Table and +`stable` for Tree. This releases A8, not the G2 Narrator or packaged-workbench check. + ### Escalations | ID | Trigger | Operator chooses | @@ -1099,13 +1106,25 @@ through `mai-code-2-flash` after each pair of items, not after every commit. > The initial WI-9 implementation is committed at `59281cdb`, not accepted. Coding used > 49.2 AIU on `gpt-6.1-sol` (17 requests), including the keyboard retry. -> **Resize investigation (E1), paused:** The authorized `hydrafusion-max` model was unavailable -> on both attempts; neither did any work. The operator asked to pause this track and receive a -> detailed prompt for a separate session once the A8 keyboard checks are complete. Keep the -> resize error separate from WI-9b. It remains open for A8 release; do not suppress page -> errors or count the manual scroll check as an A8 pass. If the array assertion needs to -> navigate to a virtualized row to check its contents, handle that setup change under E3 -> separately. +> **Resize investigation (E1), diagnosis returned (2026-11-27):** Both delegated model calls +> were unavailable. In the operator's separate diagnosis session, a same-tab trace +> on `a2cdd238` showed RDG remeasuring the treegrid when expansion adds a vertical scrollbar. +> The old column widths briefly cause a horizontal scrollbar; removing it changes the same +> observed content box again during delivery. Parent size, focus and scroll position did not +> change. A temporary Tree-only `scrollbar-gutter: stable` eliminated the observer error in +> both dark routes; removing it reproduced the error. `deep-nesting` passed 47/47, and +> `arrays` passed 5/6 before navigating to the unmounted `ten[9]`. The operator approved the +> scoped CSS fix and, separately under E3, keyboard navigation to check the last array child +> without weakening the expansion cap. + +> **Done (2026-11-27):** The Tree-only gutter fix eliminated the observer error without +> changing keyboard handling or filtering errors. The E3 follow-up verifies the first child +> after Enter and the last after Ctrl+End, then waits for the returned viewport before the +> unchanged over-ten non-expansion comparison. The build, 102 browser-runner unit tests, +> browser TypeScript and all six live Tree routes passed. Follow-up usage: 26.6 AIU coding +> on `gpt-6.1-sol` (16 requests), 37.7 AIU browser on `gpt-6.1-terra` (27), and 0.6 AIU +> terminal on `mai-code-2-flash` (6). The separate diagnosis log recorded 107.7 AIU across +> 17 requests on `gpt-6.2-astra`, under Auto selection. **WI-9b: Table and Tree keyboard navigation** · scheduled in Step 2, before A8/A9 and G2 @@ -1139,8 +1158,8 @@ through `mai-code-2-flash` after each pair of items, not after every commit. > tests, 102 browser-runner tests and browser TypeScript passed. Integrated Browser Table: > 29/29 in each theme; 27/27 for the 500-row dark route. Targeted Tree checks for Enter, > arrows, Tab, Escape and focus passed in all three themes. The advisor approved the revised -> keyboard logic (85% confidence). Full Tree checks still stop on the ResizeObserver error, -> so A8 is not released. The required separate-session investigation is ready for handoff. +> keyboard logic (85% confidence). At WI-9b completion, the full Tree run was still blocked +> by the ResizeObserver error. The separate WI-9 fix and three-theme rerun closed A8. > Coding: 109.5 AIU on `gpt-6.1-sol` (37 requests); advisor: 160.0 AIU on `claude-opus-5.5` > (11); browser: 32.0 AIU on `gpt-6.1-terra` (37); terminal: 0.3 AIU on `mai-code-2-flash` (4). @@ -1289,7 +1308,6 @@ packaged-theme caveat. The operator accepted release metadata for the support fl stable workbench smoke, a real collection, screen readers and high-contrast were not run. Step 1 is complete. A1–A7 passed; the Table works through WI-8, including nested actions and -the held late query. WI-9b keyboard navigation is complete. WI-9 is implemented but not -accepted: A8 remains under E1 for the resize error, with the operator confirming that the -end of the ten-element array can be reached by scrolling. The resize investigation remains -paused for the operator's separate session. A9 and G2 are blocked; no draft PR has been opened. +the held late query. WI-9 Tree and WI-9b keyboard navigation are complete. The separate +resize fix and approved E3 viewport setup passed A8 in all three themes. A9 packages and +checks the VSIX before G2. No draft PR has been opened. diff --git a/src/webviews/documentdb/collectionView/components/resultsTab/dataGridTheme.scss b/src/webviews/documentdb/collectionView/components/resultsTab/dataGridTheme.scss index c31debe24..a792b54db 100644 --- a/src/webviews/documentdb/collectionView/components/resultsTab/dataGridTheme.scss +++ b/src/webviews/documentdb/collectionView/components/resultsTab/dataGridTheme.scss @@ -4,6 +4,11 @@ *--------------------------------------------------------------------------------------------*/ .documentDataGrid { + // Reserve Tree scrollbar width to keep RDG's ResizeObserver measurements stable. + &[role='treegrid'] { + scrollbar-gutter: stable; + } + // RDG remembers its active cell on blur. That memory is not a second focus indicator. :is([role='gridcell'], [role='columnheader']):not(:focus-within) { outline: none; From 2dd820f1f1f8f630115a940ae69446443d382c84 Mon Sep 17 00:00:00 2001 From: Tomasz Naumowicz Date: Fri, 27 Nov 2026 10:06:53 +0100 Subject: [PATCH 049/148] docs: record verified G2 package and raise gate (A9) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .../data-grid/iterations/02-rdg-execution-plan.md | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/docs/ai-and-plans/features/data-grid/iterations/02-rdg-execution-plan.md b/docs/ai-and-plans/features/data-grid/iterations/02-rdg-execution-plan.md index ad88b8351..34ec9ec4b 100644 --- a/docs/ai-and-plans/features/data-grid/iterations/02-rdg-execution-plan.md +++ b/docs/ai-and-plans/features/data-grid/iterations/02-rdg-execution-plan.md @@ -226,6 +226,14 @@ high contrast (168 assertions). No ResizeObserver, console, page or CSP errors w reported. The dark Table regression passed 29/29; computed gutter was `auto` for Table and `stable` for Tree. This releases A8, not the G2 Narrator or packaged-workbench check. +**A9 passed (2026-11-27).** `npm run package` produced +`vscode-documentdb-1.1.1-alpha.0.vsix` from `20c1c7ab` (9,217,565 bytes, SHA-256 +`37E65BC00A9C8191A44F21AA61044E7E1C32F31EE3CF99B7772B6C364C84E640`). L1 verified RDG +is reachable only from Collection View; all 26 inspection negative controls passed. +L3 installed and activated the VSIX in isolated VS Code 1.123.0, with final commands +registered and clean logs; the injected activation failure was correctly rejected. +`mai-code-2-flash` used 1.1 AIU (18 requests). G2 is raised and awaits operator release. + ### Escalations | ID | Trigger | Operator chooses | @@ -1309,5 +1317,6 @@ stable workbench smoke, a real collection, screen readers and high-contrast were Step 1 is complete. A1–A7 passed; the Table works through WI-8, including nested actions and the held late query. WI-9 Tree and WI-9b keyboard navigation are complete. The separate -resize fix and approved E3 viewport setup passed A8 in all three themes. A9 packages and -checks the VSIX before G2. No draft PR has been opened. +resize fix and approved E3 viewport setup passed A8 in all three themes. A9 passed at +`20c1c7ab` and the verified VSIX is ready for the operator's G2 workbench check. G2 is +not released, and no draft PR has been opened. From bd4d0240c6ecce2a3ebdc424856129a157262238 Mon Sep 17 00:00:00 2001 From: Tomasz Naumowicz Date: Fri, 27 Nov 2026 11:19:59 +0100 Subject: [PATCH 050/148] docs: release G2 and schedule grid follow-ups Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .../iterations/02-rdg-execution-plan.md | 60 ++++++++++++++++++- 1 file changed, 57 insertions(+), 3 deletions(-) diff --git a/docs/ai-and-plans/features/data-grid/iterations/02-rdg-execution-plan.md b/docs/ai-and-plans/features/data-grid/iterations/02-rdg-execution-plan.md index 34ec9ec4b..6ae133053 100644 --- a/docs/ai-and-plans/features/data-grid/iterations/02-rdg-execution-plan.md +++ b/docs/ai-and-plans/features/data-grid/iterations/02-rdg-execution-plan.md @@ -232,7 +232,7 @@ reported. The dark Table regression passed 29/29; computed gutter was `auto` for is reachable only from Collection View; all 26 inspection negative controls passed. L3 installed and activated the VSIX in isolated VS Code 1.123.0, with final commands registered and clean logs; the injected activation failure was correctly rejected. -`mai-code-2-flash` used 1.1 AIU (18 requests). G2 is raised and awaits operator release. +`mai-code-2-flash` used 1.1 AIU (18 requests). G2 was then raised for hands-on testing. ### Escalations @@ -1176,6 +1176,60 @@ through `mai-code-2-flash` after each pair of items, not after every commit. Leader runs A9 through `mai-code-2-flash`, then raises **G2**. After release: WI-G2-n items, each with a model chosen by the same rules; then the draft PR push if authorised. +#### G2 findings and approved schedule (2026-11-27) + +Hands-on testing confirmed the current Table Space/Shift+Space behavior, Tree arrow/Tab/Escape +navigation, and cross-collection panel isolation. There is no obvious keyboard equivalent of +clicking a single Table row to replace the selection. The operator also reported stale +breadcrumb help, Table values clipping or covering their type indicators, a Tree grid using +only part of the results area, and expanders that look like gray native buttons. + +**G2 released (2026-11-27), operator decision.** The operator approved the schedule below +with chevron rotation included. The follow-ups may start. No draft PR push was authorized +in the release message. + +| Item | When | Accepted scope | +| ---- | ---- | ---------------- | +| WI-G2-1: Tree height | After G2, before draft PR | Size Tree to the available results area, like Table, without changing paging, the stable scrollbar gutter, or virtualization. Check short and tall views, a large result, keyboard scrolling, and no observer errors. | +| WI-G2-2: Tree expander | After WI-G2-1, before draft PR | Use a transparent Fluent-style chevron for branches, with a matching empty slot for leaves. Animate the chevron's rotation on expansion and collapse; use an instant state change with reduced motion. Keep the current named button, pointer hit area, Enter and focus behavior, and high-contrast visibility. | +| WI-G2-3: Table cell readability | After G2, before draft PR | Reserve space for the type indicator; ellipsize only the overflowing value. Keep full text available through existing document inspection/JSON and preserve the cell's accessible text. Check narrow columns, long strings, and zoom without adding per-cell Tab stops. | +| WI-G2-4: Breadcrumb help | After G2, before draft PR; carry the same guidance into WI-11 | Update in-product help for Enter or double-click on an object cell, and for Level Up or activating an ancestor breadcrumb. Replace example accessibility labels with product labels and localize changed strings. Any pinned locator changes follow E3. | +| WI-G2-5: Keyboard-only replace selection | Evaluate at WI-10; decide before G3a | Preserve Space toggle, Shift+Space range, and the current safe-ID rules. Assess a discoverable, conflict-free way to replace the selection with the focused Table row. No binding change until the operator approves one. | + +**Implementation notes:** + +- **Height:** RDG defaults to a 350 px scrollport. Table overrides that to fill the results + container; Tree does not. Reuse that sizing approach for Tree, then verify the larger + viewport does not reintroduce the resize or virtualized-array failures from A8. +- **Expander:** The installed [Fluent Tree](https://storybooks.fluentui.dev/react/?path=/docs/components-tree--docs) + uses `ChevronRight12Regular` in a 24 px slot and rotates it 90° when expanded. Its + plus/minus story swaps glyphs; the rotation is on the default chevron. The + [Cosmos DB results tree](https://github.com/microsoft/vscode-cosmosdb/blob/563c9d47/src/webviews/cosmosdb/QueryEditor/ResultPanel/ReactDataGrid/ResultTabViewTree.tsx) + also styles a transparent button inside RDG, swapping right/down icons. Borrow the + Fluent chevron and aligned slot, not either widget's focus model. Animate only the + icon's transform, not the hit area or rows; do not animate for reduced-motion users. + Preserve branch labels, `aria-expanded`, and the single grid focus target. + Advisor: `claude-opus-5.5`, 71.8 AIU (15 requests). +- **Truncation:** Use a single-line visual ellipsis on the value alone; keep the type + indicator in a nonshrinking slot and the text intact in the DOM. The + [WCAG resize-text guidance](https://www.w3.org/WAI/WCAG22/Understanding/resize-text.html) + allows truncation where full content remains available on focus or activation and + that route is discoverable. Verify keyboard access to full values through existing + View/JSON, including rows without actionable IDs. Don't add hover-only tooltips. +- **Selection:** Current Table code handles plain Space and Shift+Space, but does not + bind Ctrl+Space as a row action. Record the reported experience without treating + Ctrl+Space as an existing contract. Evaluate it only as a candidate, alongside + discoverability and platform/grid conflicts, before proposing a binding. + +**Tree Space behavior:** Keep Space/Shift+Space as scrolling and Ctrl+Space without a +Tree action; Tree has no row selection and Enter is its activation key. Do not add selection +or another binding just for parity. + +**Verification:** Rerun affected on-demand scenarios and the resize regression before the +draft. A10 covers the full sweep; G3b retains the packaged screen-reader and Windows contrast +checks. The G2 feedback did not include a Narrator announcement result; do not mark that check +passed. The existing VSIX is the G2 baseline, not an artifact containing these follow-ups. + ### Step 4 **WI-10: automated sweep** · `mai-code-2` (fallback `gpt-6.1-sol`), runs by `mai-code-2-flash` @@ -1318,5 +1372,5 @@ stable workbench smoke, a real collection, screen readers and high-contrast were Step 1 is complete. A1–A7 passed; the Table works through WI-8, including nested actions and the held late query. WI-9 Tree and WI-9b keyboard navigation are complete. The separate resize fix and approved E3 viewport setup passed A8 in all three themes. A9 passed at -`20c1c7ab` and the verified VSIX is ready for the operator's G2 workbench check. G2 is -not released, and no draft PR has been opened. +`20c1c7ab`. The operator completed the workbench check and released G2 after approving the +follow-up schedule. No draft PR has been opened. From 0b1c70a549387038078dbafb2e7adb17e35408ca Mon Sep 17 00:00:00 2001 From: Tomasz Naumowicz Date: Fri, 27 Nov 2026 11:33:38 +0100 Subject: [PATCH 051/148] fix: fill the available Tree results area (WI-G2-1) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .../features/data-grid/iterations/02-rdg-execution-plan.md | 6 ++++++ .../collectionView/components/resultsTab/dataGridTheme.scss | 2 ++ 2 files changed, 8 insertions(+) diff --git a/docs/ai-and-plans/features/data-grid/iterations/02-rdg-execution-plan.md b/docs/ai-and-plans/features/data-grid/iterations/02-rdg-execution-plan.md index 6ae133053..7590e664d 100644 --- a/docs/ai-and-plans/features/data-grid/iterations/02-rdg-execution-plan.md +++ b/docs/ai-and-plans/features/data-grid/iterations/02-rdg-execution-plan.md @@ -1230,6 +1230,12 @@ draft. A10 covers the full sweep; G3b retains the packaged screen-reader and Win checks. The G2 feedback did not include a Narrator announcement result; do not mark that check passed. The existing VSIX is the G2 baseline, not an artifact containing these follow-ups. +> **WI-G2-1 done (2026-11-27):** Tree now fills the results area and retains its stable +> gutter. In the Integrated Browser the grid and its parent matched at four viewport +> heights (400–1045 px). At the shortest height the grid remained an internal scrollport +> and reached `ten[9]`. Dark deep-nesting and dark/light arrays were ready and passed +> without reported errors. Coding: 2.4 AIU on `mai-code-2` (5 requests). + ### Step 4 **WI-10: automated sweep** · `mai-code-2` (fallback `gpt-6.1-sol`), runs by `mai-code-2-flash` diff --git a/src/webviews/documentdb/collectionView/components/resultsTab/dataGridTheme.scss b/src/webviews/documentdb/collectionView/components/resultsTab/dataGridTheme.scss index a792b54db..049acc451 100644 --- a/src/webviews/documentdb/collectionView/components/resultsTab/dataGridTheme.scss +++ b/src/webviews/documentdb/collectionView/components/resultsTab/dataGridTheme.scss @@ -6,6 +6,8 @@ .documentDataGrid { // Reserve Tree scrollbar width to keep RDG's ResizeObserver measurements stable. &[role='treegrid'] { + block-size: 100%; + min-block-size: 0; scrollbar-gutter: stable; } From c69951d53b080a945ae3d5aa71224996148f0862 Mon Sep 17 00:00:00 2001 From: Tomasz Naumowicz Date: Fri, 27 Nov 2026 11:33:50 +0100 Subject: [PATCH 052/148] fix: ellipsize Table values without clipping BSON types (WI-G2-3) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .../data-grid/iterations/02-rdg-execution-plan.md | 9 +++++++++ .../components/resultsTab/TypedValueCell.tsx | 4 ++++ 2 files changed, 13 insertions(+) diff --git a/docs/ai-and-plans/features/data-grid/iterations/02-rdg-execution-plan.md b/docs/ai-and-plans/features/data-grid/iterations/02-rdg-execution-plan.md index 7590e664d..d9fbbd883 100644 --- a/docs/ai-and-plans/features/data-grid/iterations/02-rdg-execution-plan.md +++ b/docs/ai-and-plans/features/data-grid/iterations/02-rdg-execution-plan.md @@ -1236,6 +1236,15 @@ passed. The existing VSIX is the G2 baseline, not an artifact containing these f > and reached `ten[9]`. Dark deep-nesting and dark/light arrays were ready and passed > without reported errors. Coding: 2.4 AIU on `mai-code-2` (5 requests). +> **WI-G2-3 done (2026-11-27):** Only the value span clips and ellipsizes; the BSON indicator +> stays beside it. A resized column showed 429 px of value text in a 16 px slot without +> covering the glyph or changing the full DOM text. The short-value control fit, no focus +> stops were added, and the dark literal-text and mixed-types contracts passed. The build +> and 25 focused tests passed for the WI-G2-1/3 batch. Coding: 6.8 AIU on `mai-code-2` +> (12 requests); shared checks: 0.2 AIU on `mai-code-2-flash` (3) and 14.2 AIU on +> `gpt-6.1-terra` (19). The keyboard path to full values in View/JSON still merits a +> workbench check, especially for projected rows without an actionable ID. + ### Step 4 **WI-10: automated sweep** · `mai-code-2` (fallback `gpt-6.1-sol`), runs by `mai-code-2-flash` diff --git a/src/webviews/documentdb/collectionView/components/resultsTab/TypedValueCell.tsx b/src/webviews/documentdb/collectionView/components/resultsTab/TypedValueCell.tsx index 04c90f2d7..91c134978 100644 --- a/src/webviews/documentdb/collectionView/components/resultsTab/TypedValueCell.tsx +++ b/src/webviews/documentdb/collectionView/components/resultsTab/TypedValueCell.tsx @@ -48,7 +48,11 @@ const useStyles = makeStyles({ minBlockSize: '1lh', }, value: { + flexShrink: 1, minWidth: 0, + overflow: 'hidden', + textOverflow: 'ellipsis', + whiteSpace: 'nowrap', }, type: { flexShrink: 0, From ada44f402b8ccc4d333e5516c6f672c9c162269d Mon Sep 17 00:00:00 2001 From: Tomasz Naumowicz Date: Fri, 27 Nov 2026 11:50:39 +0100 Subject: [PATCH 053/148] fix: explain keyboard Table navigation (WI-G2-4) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- build/verification/browser/scenarios.ts | 2 +- .../iterations/02-rdg-execution-plan.md | 9 +++++++ .../toolbar/ToolbarTableNavigation.tsx | 26 +++++-------------- 3 files changed, 16 insertions(+), 21 deletions(-) diff --git a/build/verification/browser/scenarios.ts b/build/verification/browser/scenarios.ts index 7b7afae2f..356229fb7 100644 --- a/build/verification/browser/scenarios.ts +++ b/build/verification/browser/scenarios.ts @@ -747,7 +747,7 @@ export const collectionViewContracts = { ], 'late-query': [ { kind: 'text', name: 'TDD: K2 an old nested request can remain pending while returning to Root', - requiresGrid: 'grid', selector: '[aria-label="Small breadcrumb example with buttons"]', + requiresGrid: 'grid', selector: '[aria-label="Document field path"]', includes: ['details'], excludes: [], steps: [{ action: 'dblclick', role: 'gridcell', name: '{...}' }] }, { kind: 'text', name: 'TDD: K2 late same-panel data cannot replace current root results', diff --git a/docs/ai-and-plans/features/data-grid/iterations/02-rdg-execution-plan.md b/docs/ai-and-plans/features/data-grid/iterations/02-rdg-execution-plan.md index d9fbbd883..4f2335b30 100644 --- a/docs/ai-and-plans/features/data-grid/iterations/02-rdg-execution-plan.md +++ b/docs/ai-and-plans/features/data-grid/iterations/02-rdg-execution-plan.md @@ -1245,6 +1245,15 @@ passed. The existing VSIX is the G2 baseline, not an artifact containing these f > `gpt-6.1-terra` (19). The keyboard path to full values in View/JSON still merits a > workbench check, especially for projected rows without an actionable ID. +> **WI-G2-4 done (2026-11-27):** Localized help now describes Enter or double-click to +> step in, Level Up, ancestor breadcrumbs, and Root Level. The toolbar and breadcrumb +> have descriptive names. Under operator-approved E3, only the late-query breadcrumb +> locator changed; its behavior assertions are unchanged. The build and 102 targeted +> tests passed. The Integrated Browser displayed the help and passed `step-in` 10/10 +> and `late-query` 3/3 in each theme. Localization bundle regeneration remains Case 2. +> Coding: 5.7 AIU on `mai-code-2` (8 requests); shared WI-G2-2/4 initial checks: +> 0.2 AIU terminal (3), 13.5 AIU Integrated Browser (23). + ### Step 4 **WI-10: automated sweep** · `mai-code-2` (fallback `gpt-6.1-sol`), runs by `mai-code-2-flash` diff --git a/src/webviews/documentdb/collectionView/components/toolbar/ToolbarTableNavigation.tsx b/src/webviews/documentdb/collectionView/components/toolbar/ToolbarTableNavigation.tsx index 0682b8c19..f1b925582 100644 --- a/src/webviews/documentdb/collectionView/components/toolbar/ToolbarTableNavigation.tsx +++ b/src/webviews/documentdb/collectionView/components/toolbar/ToolbarTableNavigation.tsx @@ -86,7 +86,7 @@ export const ToolbarTableNavigation = (): React.JSX.Element => { }; const items: Item[] = [ - { key: -1, item: 'Root Level' }, + { key: -1, item: l10n.t('Root Level') }, ...(currentContext.currentViewState?.currentPath.map( (label, index): Item => ({ key: index, @@ -96,7 +96,7 @@ export const ToolbarTableNavigation = (): React.JSX.Element => { ]; return ( - + { - + {items?.map((item, index) => ( @@ -125,27 +125,13 @@ export const ToolbarTableNavigation = (): React.JSX.Element => { - {l10n.t( - 'Your database stores documents with embedded fields, allowing for hierarchical data organization.', - )} + {l10n.t('To step into an object field, focus its cell and press Enter, or double-click the cell.')}
    - {l10n.t('This table view presents data at the root level by default.')}{' '} {l10n.t( - 'Using the table navigation, you can explore deeper levels or move back and forth between them.', + 'Use Level Up to return one level, or activate an ancestor breadcrumb to jump to it.', )}
    -
      -
    • - To navigate back to any level: Simply click on the{' '} - desired level in the navigation path. -
    • -
    • - To dive deeper into document fields: Double-click on fields of type{' '} - object, marked by the{' '} - {' {} '} icon, directly in the table - view. -
    • -
    + {l10n.t('Activate Root Level to return to the document root.')} } /> From dc2d3886e75df7d71c3d050c84e7ef5317dcefd9 Mon Sep 17 00:00:00 2001 From: Tomasz Naumowicz Date: Fri, 27 Nov 2026 11:53:11 +0100 Subject: [PATCH 054/148] fix: animate the Fluent Tree expander chevron (WI-G2-2) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .../iterations/02-rdg-execution-plan.md | 9 ++++ .../resultsTab/DataViewPanelTree.tsx | 9 +++- .../components/resultsTab/dataGridTheme.scss | 43 +++++++++++++++++++ 3 files changed, 59 insertions(+), 2 deletions(-) diff --git a/docs/ai-and-plans/features/data-grid/iterations/02-rdg-execution-plan.md b/docs/ai-and-plans/features/data-grid/iterations/02-rdg-execution-plan.md index 4f2335b30..b893f6a23 100644 --- a/docs/ai-and-plans/features/data-grid/iterations/02-rdg-execution-plan.md +++ b/docs/ai-and-plans/features/data-grid/iterations/02-rdg-execution-plan.md @@ -1236,6 +1236,15 @@ passed. The existing VSIX is the G2 baseline, not an artifact containing these f > and reached `ten[9]`. Dark deep-nesting and dark/light arrays were ready and passed > without reported errors. Coding: 2.4 AIU on `mai-code-2` (5 requests). +> **WI-G2-2 done (2026-11-27):** The transparent 24 px expander and leaf slot align the +> field text. The Fluent chevron rotates 90° over 100 ms, with no transition when reduced +> motion is enabled. Enter and pointer activation retain Field focus. The build, +> 102 targeted tests and both dark Tree contracts passed. After a scoped `CanvasText` +> correction, the icon measured 21:1 against the actual gridcell in both emulated +> forced-colors palettes, including hover and expanded states. Windows contrast themes +> remain a packaged workbench check. Coding: 7.0 AIU on `mai-code-2` (15 requests); +> corrective browser checks: 5.4 AIU on `gpt-6.1-terra` (7), plus the shared checks below. + > **WI-G2-3 done (2026-11-27):** Only the value span clips and ellipsizes; the BSON indicator > stays beside it. A resized column showed 429 px of value text in a 16 px slot without > covering the glyph or changing the full DOM text. The short-value control fit, no focus diff --git a/src/webviews/documentdb/collectionView/components/resultsTab/DataViewPanelTree.tsx b/src/webviews/documentdb/collectionView/components/resultsTab/DataViewPanelTree.tsx index 3423af5d2..9a84ea39e 100644 --- a/src/webviews/documentdb/collectionView/components/resultsTab/DataViewPanelTree.tsx +++ b/src/webviews/documentdb/collectionView/components/resultsTab/DataViewPanelTree.tsx @@ -5,6 +5,7 @@ import * as React from 'react'; import * as l10n from '@vscode/l10n'; +import { ChevronRight12Regular } from '@fluentui/react-icons'; import { Cell, DataGrid, @@ -35,6 +36,7 @@ export const DataViewPanelTree = ({ nodes }: DataViewPanelTreeProps): React.JSX. {row.expandable ? ( ) : ( - +