From da2f77948a1762e6a6f7e99034955561fac7afc3 Mon Sep 17 00:00:00 2001 From: Tomasz Naumowicz Date: Tue, 1 Dec 2026 15:13:45 +0100 Subject: [PATCH 01/12] docs: record Copilot review triage for #1142 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .../iterations/08-copilot-pr-review-triage.md | 405 ++++++++++++++++++ 1 file changed, 405 insertions(+) create mode 100644 docs/ai-and-plans/features/data-grid/iterations/08-copilot-pr-review-triage.md diff --git a/docs/ai-and-plans/features/data-grid/iterations/08-copilot-pr-review-triage.md b/docs/ai-and-plans/features/data-grid/iterations/08-copilot-pr-review-triage.md new file mode 100644 index 000000000..bb262fa95 --- /dev/null +++ b/docs/ai-and-plans/features/data-grid/iterations/08-copilot-pr-review-triage.md @@ -0,0 +1,405 @@ +--- +feature: data-grid +kind: review +status: historical +prs: [1142] +created: 2026-12-01 +--- + +# PR #1142: triage of the Copilot reviewer comments + +> **Who this is for:** the PR author, who will reply to each review thread on GitHub. +> **What this is:** every comment from the Copilot reviewer on #1142 (reviews on 27 Nov, 29 Nov and +> 1 Dec 2026). Each comment was checked against `feature/rdg-migration` at `52e1ce26`. Each entry +> has a severity, fix options with their pros and cons, and a recommendation. Won't-fix is an +> accepted outcome. + +## Severity scale + +| Label | Meaning | +| ------------ | ----------------------------------------------------------------------------------------- | +| **Critical** | Data loss or security issue that the PR introduces. Blocks merge. | +| **High** | Users are likely to hit a broken flow or a serious accessibility failure. Fix in this PR. | +| **Medium** | A real defect, but it needs unusual input or timing, or it already exists on `main`. | +| **Low** | A small correctness, accessibility or efficiency issue. Fixing it is cheap and optional. | +| **Nit** | Cosmetic, or already addressed. | + +## Summary + +| # | Thread | Area | Verdict | Severity | Recommendation | +| --- | ---------------------------------------------------------------------------------------------- | ------------------------------------------------------------- | ----------------------------------------------------- | ---------- | -------------------------------------------------------------------------------------------- | +| C1 | [r4719030349](https://github.com/microsoft/vscode-documentdb/pull/1142#discussion_r4719030349) | Table: focus after keyboard step-in | Already fixed (`9eb782bd7`), thread resolved | Nit | Reply with the fix commit | +| C2 | [r4719030434](https://github.com/microsoft/vscode-documentdb/pull/1142#discussion_r4719030434) | Tree: focus after a replacement page | Confirmed and reproduced | Low–Medium | Fix: refocus a surviving cell (option A) | +| C3 | [r4719030494](https://github.com/microsoft/vscode-documentdb/pull/1142#discussion_r4719030494) | Type tooltip on a span that can't take focus | Already fixed (decision 0004 R5), thread resolved | Nit | Reply with R5 | +| C4 | [r4731075196](https://github.com/microsoft/vscode-documentdb/pull/1142#discussion_r4731075196) | Tree keys repeat the full `_id` | Confirmed and measured | Medium | Fix: compact Tree keys (option A); needs a contract decision | +| C5 | [r4731075215](https://github.com/microsoft/vscode-documentdb/pull/1142#discussion_r4731075215) | Add mode upsert overwrites | Already on `main`; this PR adds the four falsy IDs | Medium | Keep the PR change; open a follow-up for `insertOne` | +| C6 | [r4731075237](https://github.com/microsoft/vscode-documentdb/pull/1142#discussion_r4731075237) | Tree: focus after a replacement page | Duplicate of C2 | (see C2) | Reply as a duplicate of C2 | +| C7 | [r4731075251](https://github.com/microsoft/vscode-documentdb/pull/1142#discussion_r4731075251) | Tree index rebuilt on every expand | Confirmed; costs under one frame | Low | Fix: memoize the index (cheap); won't-fix is defensible | +| C8 | [r4731075266](https://github.com/microsoft/vscode-documentdb/pull/1142#discussion_r4731075266) | Last breadcrumb not marked current | Confirmed (also on `main`) | Low | Fix: `current` + no handler | +| C9 | [r4731075276](https://github.com/microsoft/vscode-documentdb/pull/1142#discussion_r4731075276) | Accessible name "Up" vs. help "Level Up" | Confirmed; the PR's new help text causes the mismatch | Low | Fix: Tooltip `relationship="label"` | +| C10 | [r4753656709](https://github.com/microsoft/vscode-documentdb/pull/1142#discussion_r4753656709) | Test DNS stub leaks a UDP socket | Confirmed (test-only) | Low | Fix: always close the UDP socket | +| C11 | [r4753656794](https://github.com/microsoft/vscode-documentdb/pull/1142#discussion_r4753656794) | Code and CodeWithScope share a glyph | Partially confirmed (the collision is on `main` too) | Low | Fix: give CodeWithScope its own glyph (**operator: won't fix, option C**) | +| C12 | [r4753656866](https://github.com/microsoft/vscode-documentdb/pull/1142#discussion_r4753656866) | Type glyph at 40% opacity is too faint | Confirmed (also on `main`) | Low–Medium | Fix: `descriptionForeground` instead of opacity (**operator: won't fix here; #382 / #1147**) | +| C13 | [r4753656957](https://github.com/microsoft/vscode-documentdb/pull/1142#discussion_r4753656957) | Skill docs describe a deleted hook and an old selection shape | Confirmed | Low | Fix: update both docs | + +Nothing is Critical or High. The fixes worth doing in this PR are cheap ones: C2, C8, C9, C10, +C11, C12 and C13, plus C7 if you want it. C4 changes a spec contract, so it needs your decision +first. C5 is better as a tracked follow-up than as a change in this PR. + +## Operator decisions (2026-12-01) + +The operator accepted every recommendation in this document, except C11 (option C, won't fix) +and C12 (won't fix in #1142; tracked in #382 and the accessibility PR #1147 for release 1.2.0). +These decisions are binding work items. The C4 decision approves changing the Tree key format, +which `02-rdg-execution-plan.md:669` specified, and the test that pins it. + +| WI | Comments | Accepted option | Outcome | +| ------ | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------- | +| WI-R1 | C4 | A: Tree keys from page position, `JSON.stringify([index, ...segments])`; update the key-format test and docs | Code commit + reply | +| WI-R2 | C2, C6 | A: after a replacement page, refocus a surviving Tree cell (root ancestor, same column, else row 0), only if focus was on the body or in the grid; interaction test | Code commit + reply on both threads | +| WI-R3 | C7 | A: memoize the sorted parent-to-children index on `nodes`; traverse on `expandedKeys` | Code commit + reply | +| WI-R4 | C8 | A: `current` on the last `BreadcrumbButton`, no `onClick` | Code commit + reply | +| WI-R5 | C9 | A: Tooltip `relationship="label"` "Level up", remove `aria-label`, regenerate l10n | Code commit + reply | +| WI-R6 | C10 | A: always close the UDP socket in `close()`; no regression test | Code commit + reply | +| WI-R7 | C13 | A: remove both hook references, align the refs pitfall, update the selection shape | Docs commit + reply | +| WI-R8 | C5 | Keep the PR change; open a follow-up issue for option A (insert-only first Add save), linked to the `upsertDocument` TODO | Issue + reply | +| WI-R9 | C1, C3 | No change; already fixed (`9eb782bd7`, decision 0004 R5 / `c09cdb6d`) | Reply only | +| WI-R10 | C11 | C: won't fix; the Tree view's Type column shows the full type, and the full value tells them apart | Reply only | +| WI-R11 | C12 | Won't fix in #1142; covered by #382 and #1147 (milestone 1.2.0) | Reply only | + +--- + +## C1: Table, focus lost after keyboard step-in + +- **Thread:** (resolved) +- **File:** `src/webviews/documentdb/collectionView/components/resultsTab/DataViewPanelTable.tsx` +- **Claim:** pressing Enter to step into an object unmounts the focused column, which leaves focus on the document body. + +**Verification: already fixed.** Commit `9eb782bd7` ("restore keyboard step-in focus (WI-G3-3)") landed about 5 hours after the comment. + +- `CollectionView.tsx:778-825` records the row key and destination path for a keyboard step-in. A `focusin` listener cancels the request if focus leaves the results area. +- `CollectionView.tsx:442-469` creates `setTableFocusRequest({ page: result, rowKey })` only for the matching response. +- `DataViewPanelTable.tsx:74-90` acts only if focus is on the body or inside the grid. It then calls `setActivePosition({ idx: 0, rowIdx }, { shouldFocus: true })`. +- Reproduced with the real RDG beta.64 in jsdom. Without the focus request, focus ended on `BODY`. With it, focus moved to `gridcell row=2 col=1`. +- The existing tests at `CollectionView.test.tsx:572` and `DataViewPanelTable.test.tsx:285` cover this. + +**Left as designed:** pointer step-in doesn't move focus. If the stepped-into row is missing from the nested page, focus stays on the body. + +**Severity:** Nit, because it's fixed. + +**Recommendation:** reply with a link to `9eb782bd7` and the two tests. Keep the thread resolved. + +--- + +## C2: Tree, focus lost when replacement results arrive (C6 is a duplicate) + +- **Thread:** +- **File:** `src/webviews/documentdb/collectionView/components/resultsTab/DataViewPanelTree.tsx:136` +- **Claim:** when new Tree results arrive while a descendant cell has focus, `useTreeRows` collapses every branch and the focused cell is removed. Focus ends up outside the grid. + +**Verification: confirmed and reproduced.** + +- `useTreeRows.ts:74-76` collapses everything whenever a new array arrives, even when the contents are identical: + ```ts + if (state.nodes !== nodes) { + setState({ nodes, expandedKeys: COLLAPSED_KEYS }); + } + ``` +- `CollectionView.tsx:497-500` creates a new `treeNodes` array for every Tree response. +- RDG's `useActivePosition.ts:91-97` resets an out-of-bounds active position but never sets `positionToFocus`. Nothing moves focus to a cell that still exists. +- Reproduced with the real RDG. Focus was on `gridcell row=3 col=2 text=42`. After a refresh with identical data it was on `BODY`, with 1 row showing. A focused root row keeps focus, because root keys don't change. +- No other code restores focus. The Tree's focus handling covers only expander clicks and Enter (`DataViewPanelTree.tsx:64-67`, `:128`). + +**How users hit it:** Run, Refresh and paging all start outside the grid. The user has to move focus into an expanded descendant while a slow response is still loading. That's uncommon, but it breaks the "never leave focus on a removed DOM node" requirement in `migration-parity.md` (W09, R07). + +**Severity:** Low to Medium. Screen-reader users lose their place, but only within a narrow timing window. + +| Option | Pros | Cons | Size | +| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------- | ------------------------ | +| **A. Refocus a surviving cell.** On focus, record the node key and column index. After the reset, in a layout effect, act only if focus is on the body or in the grid: focus the root ancestor in the same column, or row 0 if there isn't one. | Keeps the collapsed-page policy (R03). Matches the Table focus-request pattern. | Adds one ref, one effect, and a test that renders the real RDG. | ~30–50 lines plus a test | +| **B. Keep expansion when results are identical.** Compare node keys and skip the collapse. | An identical refresh keeps the user's place. | Changes policy R03. Focus is still lost when results change, so A is needed anyway. | Small, plus a decision | +| **C. Won't fix.** Record it as a known limitation in `design.md`. | No code. | The W09 gap stays open. | Docs only | + +**Recommendation:** **A**, for the Tree only, with one interaction test: a delayed refresh while a descendant has focus. If it doesn't fit in this PR, do C and open a follow-up issue. +The same kind of loss can also happen in the Table when a delayed refresh changes the columns. Copilot didn't raise that case. Consider covering it in the same follow-up. + +--- + +## C3: Type tooltip on a span that can't take focus + +- **Thread:** (resolved, outdated) +- **File:** `src/webviews/documentdb/collectionView/components/resultsTab/TypedValueCell.tsx` +- **Claim:** keyboard focus lands on the outer grid cell, but the tooltip and `aria-describedby` sit on an inner span that can't take focus. + +**Verification: already fixed.** Commit `c09cdb6d` made the change deliberately, following operator decision 0004 R5 (`decisions.md:148-150`). For values that are set, the tooltip is gone. A visually hidden full type name now comes before the value (`TypedValueCell.tsx:97`), and the glyph is `aria-hidden`. A focused cell is announced as, for example, "Int32 7". +Missing-field cells still put the tooltip on a span (`:86-87`), but "This field is not set" is part of the cell's accessible name, so screen readers still hear it. R5 keeps this on purpose. + +**Severity:** Nit. + +**Recommendation:** reply with links to R5 and `c09cdb6d`. Won't fix the missing-field tooltip. + +--- + +## C4: Tree keys repeat the full `_id` + +- **Thread:** +- **File:** `src/utils/documentGrid/toTreeNodes.ts:68` +- **Claim:** every descendant key and parent key contains the full canonical `_id`. A pathological composite `_id` produces about 62 MB of key text. + +**Verification: confirmed and measured.** + +- The extension host builds the nodes (`ClusterSession.ts:330`) and sends the full array to the webview over tRPC (`collectionViewRouter.ts:298`). +- The row key is `id:${documentId}`, the full EJSON of `_id` with no length limit (`documentIdentity.ts:90`). The root key is `JSON.stringify([rowKey])` (`toTreeNodes.ts:36`). Each descendant key is `JSON.stringify([rowKey, ...segments])` (`:68`). Because `parentKey` repeats the parent's key, the `_id` text appears twice per node. +- `main` used short keys (`${index}/${randomId}-${n}`), so this growth is new in the PR. +- The webview never reads the `_id` back out of a Tree key. It uses the keys only for Map and Set lookups. + +| Case | Nodes | Key + parentKey | Serialized payload | +| --------------------------------------------- | ------ | --------------- | ------------------------- | +| 1 doc, 1000-field `_id` (Copilot's case) | 2,002 | 67.93 MB | 98.72 MB | +| 500 docs × 50 fields, 1 KB string `_id` | 58,500 | 113.69 MB | 122.12 MB | +| 100 docs × 50 fields, 10-field compound `_id` | 12,700 | 4.86 MB | 8.42 MB | +| 500 docs × 50 fields, ObjectId `_id` | 58,500 | 6.06 MB | 13.99 MB (43% of it keys) | + +**Realism:** Azure DocumentDB caps `_id` at 2 KB, so Copilot's 19 KB `_id` can't exist there. On MongoDB 4.2 and later, `_id` is limited only by the 16 MB document size. An `_id` of 1–2 KB (a URL or a natural composite key) is legal on both. On a 500-row page that produces a message of more than 100 MB. + +**Severity:** Medium. Typical pages are fine, but a legal input can stall both the host and the webview. Execution-plan risk A1 already listed this ("deep-tree payload size", `02-rdg-execution-plan.md:839`). + +| Option | Pros | Cons | Size | +| ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------ | ------------------------ | +| **A. Key by page position:** `JSON.stringify([index, ...segments])` | Key size no longer depends on `_id` size. Nothing reads `_id` from Tree keys. The Tree has no selection or document actions. | Changes the documented key format and the "independent of root document position" test (`02-rdg-execution-plan.md:669`). | S (~5 lines plus a test) | +| **B. Full `rowKey` on the root node only; descendants use `[rootOrdinal, ...segments]`** | The root keeps the document identity, and descendant keys stay small. | Two key formats to maintain. | S–M | +| **C. Send nested documents and build child nodes in the webview when a row is expanded** | Also removes the up-front node build, which the PR carried over from SlickGrid. | Moves the conversion into the webview. Much larger change. | L | + +**Recommendation:** **A** in this PR, after you confirm the contract change. Position-independent keys don't help at runtime today, because every new page starts collapsed (`useTreeRows.ts:73`). If the PR has to ship first, defer this with a tracked issue. + +--- + +## C5: Add mode, a falsy `_id` reaches the upsert and can overwrite a document + +- **Thread:** +- **File:** `src/webviews/documentdb/documentView/documentsViewRouter.ts:96` +- **Claim:** on the first save in Add mode, a falsy `_id` (`0`, `false`, `""` or `null`) now reaches `upsertDocument`. Its `replaceOne(..., { upsert: true })` can silently overwrite an existing document. + +**Verification: the claim is true, but the overwrite already exists on `main`.** + +- `main` checked truthiness: `if (documentBson['_id']) { documentId = documentBson['_id']; }`. HEAD checks whether `_id` is present: `Object.prototype.hasOwnProperty.call(documentBson, '_id') ? EJSON.stringify(documentBson._id) : ''`. The change came in commit `8cc23e156` (WI-G3-1). +- This PR doesn't change `ClustersClient.upsertDocument` (`ClustersClient.ts:1215-1250`). It always runs `replaceOne({ _id }, doc, { upsert: true })`. A TODO there already asks for a dedicated insert function. +- The router has no Add or Edit mode, so every save targets the `_id` written in the editor. + +| Add-mode input | `main` | HEAD | +| ------------------------------------- | ---------------------------------------------------- | --------------------------------------------------------------------------- | +| No `_id` | Generates a new ObjectId and inserts | Same | +| `{_id: 5}` (truthy) | **Silently overwrites an existing `_id: 5`** | Same | +| `_id` of `0`, `false`, `""` or `null` | Ignores the `_id` and saves under a new ObjectId | Saves with the correct `_id`, and overwrites a document that already has it | +| Edit a document with a falsy `_id` | **Silently creates a duplicate** (High in review R1) | Fixed | + +There is no test for an Add save whose `_id` matches an existing document. + +**Severity:** Medium. Silent overwrite is real data loss, but it has always happened for every truthy `_id`. The PR adds four rare values to that set and fixes a more likely duplicate bug, so overall it is an improvement. + +| Option | Pros | Cons | Size | +| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------- | ------------------------ | +| **A. Insert-only first save.** Pass `isNew` to `saveDocument` and add `ClustersClient.insertDocument` (`insertOne`). Show duplicate-key errors (E11000). Later saves target the returned `_id`. | Fixes the root cause for every `_id`. Resolves the existing TODO. Can also handle `_id` changes in Edit mode. | Touches the webview, router and client. Adds a new l10n string. | ~60–100 lines plus tests | +| **B. Revert to the truthiness check** | Removes the four new overwrite cases. | Brings back the High-severity R1 duplicate bug, which is the more likely of the two. | ~5 lines | +| **C. `replaceOne` without upsert when an `_id` is present** | Edit can't create stray documents. | Breaks Add with a user-chosen `_id` unless you also do A. Doesn't fix overwrites in Add mode. | ~15 lines | + +**Recommendation:** keep the PR change. Reply that the overwrite already exists for every `_id`, that this PR adds only the four falsy values, and that it fixes a worse duplicate bug. Open a follow-up issue for **A**, linked to the `upsertDocument` TODO. If the reviewer insists on a fix in this PR, A is the right one, not B. + +--- + +## C6: Tree refresh collapses branches and loses focus + +- **Thread:** +- **File:** `src/webviews/documentdb/collectionView/components/resultsTab/useTreeRows.ts:75` + +**Verification:** this is a **duplicate of C2**. It points at the same reset in `useTreeRows.ts:73-76`. It adds a correct point about RDG: its out-of-bounds reset doesn't request focus on a replacement cell, even at beta.64. + +**Severity:** see C2. + +**Recommendation:** reply "tracked in C2" (link the C2 thread) and resolve both threads with the same fix. + +--- + +## C7: The Tree index is rebuilt on every expand + +- **Thread:** +- **File:** `src/webviews/documentdb/collectionView/components/resultsTab/useTreeRows.ts:78` +- **Claim:** grouping and sorting depend only on `nodes`, but `getVisibleTreeRows(nodes, expandedKeys)` repeats them on every expand. + +**Verification: confirmed, but the cost is small.** `useTreeRows.ts:23-34` groups every node and sorts every list of siblings with `localeCompare`, including collapsed ones. Measured in Node without React, averaged over 10 expands: + +| Page | Nodes | Current, per expand | Memoized, per expand | One-time index | +| -------------------- | ------ | ------------------- | -------------------- | -------------- | +| 100 docs × 25 fields | 6,600 | 1.28 ms | 0.031 ms | 2.24 ms | +| 100 docs × 50 fields | 11,700 | 1.25 ms | 0.033 ms | 1.52 ms | +| 500 docs × 50 fields | 58,500 | 7.70 ms | 0.020 ms | 11.95 ms | + +Even the worst case is under one 16 ms frame. Long `_id` keys (C4) make the Map lookups slower, so fixing C4 helps here too. + +**Severity:** Low. + +| Option | Pros | Cons | Size | +| ---------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------- | ------------------------------------------------ | --------- | +| **A. Split into `buildTreeIndex(nodes)`, memoized on `[nodes]`, plus a traversal memoized on `[index, expandedKeys]`** | Expanding becomes almost free. Low risk, and the existing tests keep passing. | One more `useMemo`. | ~15 lines | +| **B. Sort once on the host in `toTreeNodes`** | Takes the sorting off the UI thread. | Changes what the host guarantees to the webview. | S–M | +| **C. Won't fix** | No change. | Keeps the small amount of wasted work. | — | + +**Recommendation:** **A**, which is cheap and safe. C is also defensible, given the measurements. + +--- + +## C8: The last breadcrumb isn't marked as current + +- **Thread:** +- **File:** `src/webviews/documentdb/collectionView/components/toolbar/ToolbarTableNavigation.tsx:119` + +**Verification: confirmed. `main` has the same line.** Every crumb is ` jumpToLevel(index)}>`, and no crumb gets `current`. The pattern Copilot cites exists in `DashboardBreadcrumb.tsx:22-25`: `current={...}` and `onClick={current ? undefined : ...}`. In Fluent, `current` sets `aria-current="page"`. Clicking the last crumb today changes nothing on screen, but it still sends a `stepIn` telemetry event with `source: 'breadcrumb'`. + +**Severity:** Low. + +| Option | Pros | Cons | +| ------------------------------------------------------------ | -------------------------------------------------------------------- | ---------------------------------------- | +| **A. `current={isLast}` and no `onClick` on the last crumb** | Two lines. Matches the Dashboard. Removes the no-op telemetry event. | None. | +| **B. Set `aria-current` only** | Smallest change. | Keeps the no-op click and its telemetry. | +| **C. Show the last crumb as plain text** | Clear. | Looks different from the other crumbs. | + +**Recommendation:** **A**. + +--- + +## C9: The help says "Level Up", but the button's accessible name is "Up" + +- **Thread:** +- **File:** `src/webviews/documentdb/collectionView/components/toolbar/ToolbarTableNavigation.tsx:132` + +**Verification: confirmed.** Help text added in this PR (`ada44f40`, WI-G2-4) says "Use Level Up to return one level…". The button (`:100-103`) has `aria-label={l10n.t('Up')}`, and its Tooltip uses `relationship="description"`, so "Level up" is only a description. The button is icon-only, so WCAG 2.5.3 (Label in Name) doesn't strictly apply. Still, a voice-control user who says "click Level up" won't match it, and the help text doesn't match what screen readers announce. + +**Severity:** Low. + +| Option | Pros | Cons | +| ------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------- | -------------------------------------------- | +| **A. Tooltip `relationship="label"` with "Level up", remove the `aria-label`, then run `npm run l10n`** | The standard Fluent pattern for icon-only buttons. Name and help match. | "Up" leaves the l10n bundle (no cost). | +| **B. Change the `aria-label` to "Level up" and keep the description** | Minimal change. | Screen readers announce the same text twice. | +| **C. Change the help text to "Up"** | No l10n change. | "Up" is a less clear name. | + +**Recommendation:** **A**. + +--- + +## C10: The test DNS stub leaks a UDP socket after a failed bind + +- **Thread:** +- **File:** `packages/documentdb-js-srv-resolver/src/test/dnsStubServer.ts:71` + +**Verification: confirmed.** `dgram.createSocket` allocates the handle in the constructor. When `bind()` fails with `EADDRINUSE`, `udpBound` stays `false`, so `close()` skips `this.udp.close()`. `start()` retries with a new stub up to 9 times, which leaves the failed socket open on each retry. + +Repro script (Node): + +```js +const dgram = require('node:dgram'); +const a = dgram.createSocket('udp4'); +a.bind(0, '127.0.0.1', () => { + const port = a.address().port; + const before = process._getActiveHandles().length; + const b = dgram.createSocket('udp4'); + b.once('error', (e) => { + setTimeout(() => { + console.log('bind error:', e.code); + console.log('handles before second socket:', before, 'after failed bind (not closed):', process._getActiveHandles().length); + b.close(() => { a.close(); }); + }, 50); + }); + b.bind(port, '127.0.0.1'); +}); +``` + +``` +bind error: EADDRINUSE +handles before second socket: 3 after failed bind (not closed): 4 +``` + +A second run showed that an unbound socket left open does **not** keep the process alive, so the test runner won't hang. The cost is at most 9 descriptors per `start()`, and only when a randomly chosen port is already taken. `close()` on an unbound dgram socket doesn't throw. + +**Severity:** Low (test-only, rare, bounded). + +| Option | Pros | Cons | Size | +| --------------------------------------------------------------------------------------------------------------------- | --------------------------------------- | ------------------------------------------------------------------------------------------------------------ | --------- | +| **A. Always close the UDP socket in `close()`: drop the `udpBound` guard and track only whether it's already closed** | Correct, simple, and removes one field. | None. | ~5 lines | +| **B. Close the UDP socket in the `bind` error path before rejecting** | Fixes the leak where it happens. | Two close paths to keep in sync. | ~5 lines | +| **C. A + a collision regression test** (pre-bind a port and force `start()` to choose it) | Copilot's full request. | `randomInt` must be injectable or mocked to force the collision, and the test checks a private handle count. | ~30 lines | + +**Recommendation:** **A**. Skip the regression test: it would need a seam added just for the test, and it would check Node internals, not product behavior. + +--- + +## C11: Code and CodeWithScope share the same glyph + +- **Thread:** +- **File:** `src/webviews/documentdb/collectionView/components/resultsTab/TypedValueCell.tsx:36` + +**Verification: partially confirmed.** In the glyph map (`:12-40`), `code` and `codewithscope` both use ``. This is the only collision between two real BSON types (`_unknown_` and `unknown` both map to `??` on purpose). `main` had the same collision (`content: ''` in the old SCSS), but its hover tooltip told the two apart. Decision R5 removed that tooltip on purpose. If the value isn't truncated, it still shows the difference (`{"code":…}` vs `{"code":…,"scope":…}`). The Tree view's "Type" column (`DataViewPanelTree.tsx:84-86`) shows the full type name. + +**Severity:** Low. CodeWithScope is rare and deprecated. + +| Option | Pros | Cons | +| -------------------------------------------------------------------- | --------------------------------------------- | ---------------------------------------------------------------- | +| **A. A distinct glyph for CodeWithScope, such as `{}` or `+`** | A one-line change that removes the ambiguity. | One more symbol for users to learn. | +| **B. Bring back a hover-only tooltip on the glyph** | Shows the full name. | Goes against decision R5. | +| **C. Won't fix; point to the Tree view's Type column** | No change. | The two stay ambiguous in the Table when the value is truncated. | + +**Recommendation:** **A**. C is acceptable if you'd rather not add glyphs. + +**Operator decision (2026-12-01):** **C**, won't fix (WI-R10). + +--- + +## C12: The type glyph at 40% opacity doesn't meet text contrast requirements + +- **Thread:** +- **File:** `src/webviews/documentdb/collectionView/components/resultsTab/TypedValueCell.tsx:62` + +**Verification: confirmed. `main` uses the same `opacity: 0.4`.** The glyphs are text ("Ab", "i32") at `fontSize: 'smaller'`, so the 4.5:1 text contrast requirement (WCAG 1.4.3) applies. They carry meaning for sighted users, so they don't count as decoration. Blended colour = 0.4·fg + 0.6·bg: + +| Theme | fg / bg | 40% | 60% | 70% | 100% | +| ------------------- | ----------------- | ---------- | ---- | ---- | ----- | +| Dark Modern | #CCCCCC / #1F1F1F | **2.79:1** | 4.59 | 5.71 | 10.26 | +| Light Modern | #3B3B3B / #FFFFFF | **2.14:1** | 3.50 | 4.54 | 11.20 | +| High Contrast Dark | #FFFFFF / #000000 | **3.66:1** | — | — | — | +| High Contrast Light | #292929 / #FFFFFF | **2.35:1** | — | — | — | + +The selected-row background lowers these values further. The full type name is available to screen readers and in the Tree view's Type column, but sighted Table users have no other way to see it. + +**Severity:** Low to Medium. It fails in every theme, including High Contrast, but it isn't new. + +| Option | Pros | Cons | +| ---------------------------------------------------------------------------- | ------------------------------------------------------------------------------- | -------------------------------------------------------------------------- | +| **A. Replace the opacity with `color: var(--vscode-descriptionForeground)`** | Still looks secondary. Each theme, High Contrast included, supplies the colour. | Each theme needs a visual check, and the contrast in each wasn't measured. | +| **B. Use opacity 0.7** | Passes in the four themes measured (Light Modern only just). | Opacity combines unpredictably with selection and focus backgrounds. | +| **C. Use full opacity (Copilot's suggestion)** | Always passes. | The glyph competes with the value for attention. | + +**Recommendation:** **A**. Check it in Dark, Light and High Contrast through the L2-dev scenarios. + +**Operator decision (2026-12-01):** won't fix in #1142. The glyph contrast is tracked in #382 and +handled by the accessibility PR #1147 for release 1.2.0 (WI-R11). + +--- + +## C13: The skill docs describe the deleted hook and the old selection shape + +- **Thread:** +- **File:** `.github/skills/react-webview-architecture/SKILL.md:123` + +**Verification: confirmed.** + +- This PR deletes `useHideScrollbarsDuringResize.ts`, and nothing under `src/` references it anymore. Two docs still describe it: `SKILL.md:210` (hook table) and `references/REACT_ARCHITECTURE_GUIDELINES.md:772-780` (example). +- `SKILL.md:243`, pitfall 1 ("Forgetting refs with third-party components → stale data"), contradicts the new "Event Handler Freshness" section at `:120-125`, which says refs should be the exception. +- `REACT_ARCHITECTURE_GUIDELINES.md:130-133` still shows `selectedDocumentObjectIds` / `selectedDocumentIndexes`. The current shape is `{ readonly selectedRowKeys: readonly string[] }` (`collectionViewContext.ts:326`). + +**Severity:** Low. Agents that follow the stale docs would write code that doesn't compile, or would add unnecessary refs. + +| Option | Pros | Cons | +| ----------------------------------------- | ------------------------------------------ | ------------------------------------------------------------- | +| **A. Make the three edits Copilot lists** | The docs match the code. Docs-only change. | None. | +| **B. Remove only the hook references** | Smallest change. | Leaves the pitfall contradiction and the old selection shape. | + +**Recommendation:** **A**. From 8bc293a777ffbd1003ca1168fbebc8de58598d72 Mon Sep 17 00:00:00 2001 From: Tomasz Naumowicz Date: Tue, 1 Dec 2026 15:18:32 +0100 Subject: [PATCH 02/12] docs: refresh React webview guidance (WI-R7) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .github/skills/react-webview-architecture/SKILL.md | 3 +-- .../references/REACT_ARCHITECTURE_GUIDELINES.md | 13 +------------ 2 files changed, 2 insertions(+), 14 deletions(-) diff --git a/.github/skills/react-webview-architecture/SKILL.md b/.github/skills/react-webview-architecture/SKILL.md index b10f088c7..813eb2930 100644 --- a/.github/skills/react-webview-architecture/SKILL.md +++ b/.github/skills/react-webview-architecture/SKILL.md @@ -207,7 +207,6 @@ Animations: `Collapse` from `@fluentui/react-motion-components-preview` | Hook | Purpose | | ------------------------------------- | -------------------------------------------------------------------------------------------- | | `useSelectiveContextMenuPrevention()` | Prevents browser context menu everywhere except Monaco editors. Call once in top-level view. | -| `useHideScrollbarsDuringResize()` | Returns a function that temporarily hides scrollbars during layout transitions (500ms). | ## Conditional Rendering Patterns @@ -240,7 +239,7 @@ try { ## Common Pitfalls -1. **Forgetting refs with third-party components** → stale data in event handlers +1. **Using refs for event-handler freshness** → event handlers refresh during rendering; use refs only for a stable callback in a long-lived subscription or imperative API, and keep current values synchronized 2. **Not cleaning up** event listeners, Monaco instances, AbortControllers in `useEffect` return 3. **Not calling `editor.layout()`** after resize → blank Monaco panels 4. **Using `any`** → use proper types or `unknown` with type guards diff --git a/.github/skills/react-webview-architecture/references/REACT_ARCHITECTURE_GUIDELINES.md b/.github/skills/react-webview-architecture/references/REACT_ARCHITECTURE_GUIDELINES.md index 47482308b..0e2f132e2 100644 --- a/.github/skills/react-webview-architecture/references/REACT_ARCHITECTURE_GUIDELINES.md +++ b/.github/skills/react-webview-architecture/references/REACT_ARCHITECTURE_GUIDELINES.md @@ -128,8 +128,7 @@ export type CollectionViewContextType = { disableDeleteDocument: boolean; }; dataSelection: { - selectedDocumentObjectIds: string[]; - selectedDocumentIndexes: number[]; + readonly selectedRowKeys: readonly string[]; }; queryEditor?: { getCurrentQuery: () => { @@ -769,16 +768,6 @@ const configuration = useConfiguration() Prevents browser context menus everywhere except Monaco editors. Call once in the top-level view component. -### `useHideScrollbarsDuringResize` - -Temporarily hides scrollbars during layout transitions (e.g., QueryEditor collapse animations) to prevent flickering: - -```tsx -const hideScrollbarsTemporarily = useHideScrollbarsDuringResize(); -// Call before triggering a layout change -hideScrollbarsTemporarily(); -``` - For tRPC-related hooks (`useTrpcClient`) and patterns, see the **webview-trpc-messaging** skill. --- From 67c5ef934c81ed53efa9de13965b2bfff0202c7d Mon Sep 17 00:00:00 2001 From: Tomasz Naumowicz Date: Tue, 1 Dec 2026 15:20:43 +0100 Subject: [PATCH 03/12] fix: compact Tree result keys (WI-R1) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .../browser/collectionViewFixtures.ts | 39 ++++---- .../ai-and-plans/features/data-grid/README.md | 2 + .../features/data-grid/decisions.md | 14 +++ .../ai-and-plans/features/data-grid/design.md | 9 +- .../iterations/02-rdg-execution-plan.md | 5 ++ src/documentdb/ClusterSession.ts | 2 +- src/utils/documentGrid/toTreeNodes.test.ts | 88 +++++++++---------- src/utils/documentGrid/toTreeNodes.ts | 9 +- src/utils/documentGrid/types.ts | 2 +- 9 files changed, 94 insertions(+), 76 deletions(-) diff --git a/build/verification/browser/collectionViewFixtures.ts b/build/verification/browser/collectionViewFixtures.ts index c34655850..926f2abf0 100644 --- a/build/verification/browser/collectionViewFixtures.ts +++ b/build/verification/browser/collectionViewFixtures.ts @@ -177,11 +177,10 @@ const heterogeneousPage: TablePageOutput = { ], }; -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 deepRootKey = JSON.stringify([0]); +const deepProfileKey = JSON.stringify([0, 'profile']); +const deepAddressKey = JSON.stringify([0, 'profile', 'address']); +const deepLocationKey = JSON.stringify([0, 'profile', 'address', 'location']); const deepNestingNodes: CollectionOutputs['getCurrentPageAsTree'] = [ { key: deepRootKey, @@ -192,7 +191,7 @@ const deepNestingNodes: CollectionOutputs['getCurrentPageAsTree'] = [ expandable: true, }, { - key: JSON.stringify([deepRowKey, '_id']), + key: JSON.stringify([0, '_id']), parentKey: deepRootKey, depth: 1, field: '_id', @@ -224,7 +223,7 @@ const deepNestingNodes: CollectionOutputs['getCurrentPageAsTree'] = [ expandable: true, }, { - key: JSON.stringify([deepRowKey, 'profile', 'address', 'location', 'coordinates']), + key: JSON.stringify([0, 'profile', 'address', 'location', 'coordinates']), parentKey: deepLocationKey, depth: 4, field: 'coordinates', @@ -232,23 +231,23 @@ const deepNestingNodes: CollectionOutputs['getCurrentPageAsTree'] = [ expandable: true, }, { - key: JSON.stringify([deepRowKey, 'profile', 'address', 'location', 'coordinates', 'latitude']), - parentKey: JSON.stringify([deepRowKey, 'profile', 'address', 'location', 'coordinates']), + key: JSON.stringify([0, 'profile', 'address', 'location', 'coordinates', 'latitude']), + parentKey: JSON.stringify([0, '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']), + key: JSON.stringify([0, 'profile', 'address', 'location', 'coordinates', 'longitude']), + parentKey: JSON.stringify([0, 'profile', 'address', 'location', 'coordinates']), depth: 5, field: 'longitude', value: { display: '-122.3321', type: 'double' }, expandable: false, }, { - key: JSON.stringify(['id:"second-root"']), + key: JSON.stringify([1]), parentKey: null, depth: 0, field: '"second-root"', @@ -256,8 +255,8 @@ const deepNestingNodes: CollectionOutputs['getCurrentPageAsTree'] = [ expandable: true, }, { - key: JSON.stringify(['id:"second-root"', '_id']), - parentKey: JSON.stringify(['id:"second-root"']), + key: JSON.stringify([1, '_id']), + parentKey: JSON.stringify([1]), depth: 1, field: '_id', value: { display: 'second-root', type: 'string' }, @@ -266,10 +265,10 @@ const deepNestingNodes: CollectionOutputs['getCurrentPageAsTree'] = [ ]; 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 arraysRootKey = JSON.stringify([0]); +const emptyArrayKey = JSON.stringify([0, 'empty']); +const tenArrayKey = JSON.stringify([0, 'ten']); +const elevenArrayKey = JSON.stringify([0, 'eleven']); const arrayNodes: CollectionOutputs['getCurrentPageAsTree'] = [ { key: arraysRootKey, @@ -280,7 +279,7 @@ const arrayNodes: CollectionOutputs['getCurrentPageAsTree'] = [ expandable: true, }, { - key: JSON.stringify([arraysRowKey, '_id']), + key: JSON.stringify([0, '_id']), parentKey: arraysRootKey, depth: 1, field: '_id', @@ -306,7 +305,7 @@ const arrayNodes: CollectionOutputs['getCurrentPageAsTree'] = [ ...Array.from( { length: 10 }, (_, index): TreeNode => ({ - key: JSON.stringify([arraysRowKey, 'ten', index]), + key: JSON.stringify([0, 'ten', index]), parentKey: tenArrayKey, depth: 2, field: `ten[${index}]`, diff --git a/docs/ai-and-plans/features/data-grid/README.md b/docs/ai-and-plans/features/data-grid/README.md index d8b2abee2..fd0806b21 100644 --- a/docs/ai-and-plans/features/data-grid/README.md +++ b/docs/ai-and-plans/features/data-grid/README.md @@ -37,6 +37,8 @@ released extension version or completion of the remaining handover gates. visual glyph is decorative and there is no BSON type hover tooltip. - Row selection and document-action eligibility are separate. Rows without a safe, unique identity remain browsable and selectable, but cannot become View/Edit/Delete targets. +- Tree node keys use the zero-based page position plus typed field/array path segments, so their + size does not depend on `_id`; Table identity and actions keep the existing `rowKey` contract. - Object `_id` values with more than one own key and an integer-like key at any depth are conservatively ineligible for document actions. Their rows remain displayed and selectable. - Table column sizing keeps neighbors stable during resizing, then reflows diff --git a/docs/ai-and-plans/features/data-grid/decisions.md b/docs/ai-and-plans/features/data-grid/decisions.md index 6fbee50fb..c7a4087ec 100644 --- a/docs/ai-and-plans/features/data-grid/decisions.md +++ b/docs/ai-and-plans/features/data-grid/decisions.md @@ -19,6 +19,7 @@ implementation remains subject to the planned work items and later gates. | 0005 | Object `_id` values with integer-like keys | Accepted | The user-facing explanation moved to #1144 | 2026-11-27 | #1142 | | 0006 | UX review: sizing gate, previews, copy and hover | Accepted | Sizing accepted; native platform Copy clarified | 2026-11-30 | #1142 | | 0007 | Column-width hold release and width scope | Accepted | Remount by scope rejected; frozen widths deferred | 2026-12-01 | #1142 | +| 0008 | Position-based Tree node keys | Accepted | Replaces document-identity-based Tree keys | 2026-12-01 | #1142 | ## 0001 - React Data Grid, beta candidate and document tree @@ -311,3 +312,16 @@ never fires, the hold stays until the next gesture or column change. registered in the capture phase instead. - `CollectionView.test.tsx` checks that each Table page keeps the query and path it was loaded for, through step-in, view switches and a new query. + +## 0008 - Position-based Tree node keys + +**Status:** Accepted · **Date:** 2026-12-01 + +The Tree key contract is `JSON.stringify([index, ...segments])`, where `index` is the document's +zero-based position in the current page and path segments retain their field-string or array-index +number types. Table row identity and document-action eligibility are unchanged and continue to +use `documentId`/`rowKey`. This changes only Tree node identity; root labels and display values, +field/path order, preorder, and the array expansion bound remain unchanged. + +This approval is recorded as WI-R1/C4 option A in the +[Copilot PR review triage table](./iterations/08-copilot-pr-review-triage.md#operator-decisions-2026-12-01). diff --git a/docs/ai-and-plans/features/data-grid/design.md b/docs/ai-and-plans/features/data-grid/design.md index 915da8b90..6302143f3 100644 --- a/docs/ai-and-plans/features/data-grid/design.md +++ b/docs/ai-and-plans/features/data-grid/design.md @@ -21,9 +21,10 @@ shapes fetched documents into the grid-neutral types in `src/utils/documentGrid/ components consume `TablePage` and `TreeNode` data rather than raw database documents. `TablePage` contains the root `_id` column, the fields at the active nested path, and rows in -server order. Each cell has separate display text and BSON type metadata. `toTreeNodes` creates -stable hierarchical nodes from documents; `useTreeRows` sorts siblings by field name and exposes -only roots and descendants whose ancestors are expanded. The tree is application-owned rather +server order. Each cell has separate display text and BSON type metadata. `toTreeNodes` creates hierarchical nodes from documents; `useTreeRows` sorts siblings by field +name and exposes only roots and descendants whose ancestors are expanded. Its node keys are +`JSON.stringify([index, ...segments])`, with a zero-based page index and typed string/number +path segments. The keys do not contain or depend on `_id`. The tree is application-owned rather than RDG's `TreeDataGrid`, so it can represent arbitrary document nesting and the current array expansion bound. @@ -41,6 +42,8 @@ Identity and action eligibility are distinct from whether a row can be browsed o JavaScript array-index range are still guarded. - IDs are counted within the current fetched page. A unique safe ID yields `id:`; otherwise the row gets a page-position key (`pos:`) and no `documentId`. +- Table row identity remains separate from Tree node keys. Tree keys identify nodes only within + the current page and never imply action eligibility. - All rows remain visible and selectable. Document actions resolve selected keys against the current `TablePage` and fail closed if a page/key is stale or any row lacks `documentId`. - A Document View save preserves an owned falsy `_id` (`0`, `false`, `""`, or `null`) by passing its 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 4a5dabe62..6029435b8 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 @@ -708,6 +708,11 @@ export function toTablePage( export function toTreeNodes(documents: readonly Document[], identityTrusted: boolean): TreeNode[]; ``` +**Contract amendment (2026-12-01, WI-R1/C4):** the approved Tree contract is now +`toTreeNodes(documents: readonly Document[])`, with keys +`JSON.stringify([index, ...segments])` using a zero-based page index and typed path segments. +Table identity and `rowKey` are unchanged. See [decision 0008](../decisions.md#0008---position-based-tree-node-keys). + **Host invariants:** - `toDocumentId`: require an own `_id` and reject `undefined`, array, regexp, DBRef, Map and unknown diff --git a/src/documentdb/ClusterSession.ts b/src/documentdb/ClusterSession.ts index 32af25b92..3514dd414 100644 --- a/src/documentdb/ClusterSession.ts +++ b/src/documentdb/ClusterSession.ts @@ -327,7 +327,7 @@ export class ClusterSession { } public getCurrentPageAsTree(): TreeNode[] { - return toTreeNodes(this._currentRawDocuments, this._currentPageIdentityTrusted); + return toTreeNodes(this._currentRawDocuments); } async deleteDocuments(databaseName: string, collectionName: string, documentIds: string[]): Promise { diff --git a/src/utils/documentGrid/toTreeNodes.test.ts b/src/utils/documentGrid/toTreeNodes.test.ts index 3dfeab47d..27ada55f9 100644 --- a/src/utils/documentGrid/toTreeNodes.test.ts +++ b/src/utils/documentGrid/toTreeNodes.test.ts @@ -56,7 +56,7 @@ const documents: WithId[] = jsonDocuments.map((doc) => { describe('toTreeNodes', () => { it('1 doc -> tree data', () => { - const tree = toTreeNodes([documents[0]], true); + const tree = toTreeNodes([documents[0]]); // 1 root node for 1 document expect(tree.filter((node) => node.parentKey === null)).toHaveLength(1); @@ -64,7 +64,7 @@ describe('toTreeNodes', () => { }); it('n docs -> tree data', () => { - const tree = toTreeNodes(documents, true); + const tree = toTreeNodes(documents); // 4 root nodes for 4 documents expect(tree.filter((node) => node.parentKey === null)).toHaveLength(4); @@ -73,10 +73,7 @@ describe('toTreeNodes', () => { 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, - ); + const tree = toTreeNodes([{ _id: null }, {}, { _id: objectId }, { _id: false, nested: { _id: 'child' } }]); expect(tree.filter((node) => node.parentKey === null).map((node) => node.field)).toEqual([ 'null', '', @@ -88,15 +85,14 @@ describe('toTreeNodes', () => { expect(tree.find((node) => node.value.type === 'null')?.value.display).toBe('null'); }); - it('emits unambiguous path keys in preorder, independent of root document position', () => { + it('emits unambiguous positional path keys in preorder', () => { const document = { _id: 'stable', 'a.b': { '': null }, a: { b: false }, values: [{ x: 0 }] }; - const tree = toTreeNodes([document], true); + const tree = toTreeNodes([document]); 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', '']), + JSON.stringify([0, 'a.b', '']), ); - expect(tree.find((node) => node.field === 'x')?.key).toBe(JSON.stringify([rootKey, 'values', 0, 'x'])); + expect(tree.find((node) => node.field === 'x')?.key).toBe(JSON.stringify([0, 'values', 0, 'x'])); tree.forEach((node, index) => { if (node.parentKey !== null) { const parentIndex = tree.findIndex((parent) => parent.key === node.parentKey); @@ -104,23 +100,30 @@ describe('toTreeNodes', () => { 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); + const reordered = toTreeNodes([{ _id: 'other' }, document]); + const shiftedSubtree = reordered + .filter((node) => (JSON.parse(node.key) as readonly unknown[])[0] === 1) + .map((node) => ({ + ...node, + key: JSON.stringify([0, ...(JSON.parse(node.key) as readonly unknown[]).slice(1)]), + parentKey: + node.parentKey === null + ? null + : JSON.stringify([0, ...(JSON.parse(node.parentKey) as readonly unknown[]).slice(1)]), + })); + expect(shiftedSubtree).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 tree = toTreeNodes([ + { + _id: 'root', + empty: [], + ten: Array.from({ length: 10 }, (_, i) => i), + eleven: Array(11).fill(null), + }, + ]); const empty = tree.find((node) => node.field === 'empty'); const ten = tree.find((node) => node.field === 'ten'); const eleven = tree.find((node) => node.field === 'eleven'); @@ -128,23 +131,20 @@ describe('toTreeNodes', () => { expect(ten).toMatchObject({ expandable: true, value: { display: '[ 10 elements ]', type: 'array' } }); expect(eleven).toMatchObject({ expandable: false, value: { display: '[ 11 elements ]', 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.find((node) => node.field === 'ten[0]')?.key).toBe(JSON.stringify([0, 'ten', 0])); expect(tree.filter((node) => node.parentKey === eleven?.key)).toHaveLength(0); }); it('shows localized direct field and element counts for zero, one and many', () => { - const tree = toTreeNodes( - [ - { - _id: 'root', - empty: {}, - oneField: { value: 1 }, - twoFields: { first: 1, second: 2 }, - oneElement: [1], - }, - ], - true, - ); + const tree = toTreeNodes([ + { + _id: 'root', + empty: {}, + oneField: { value: 1 }, + twoFields: { first: 1, second: 2 }, + oneElement: [1], + }, + ]); const root = tree.find((node) => node.parentKey === null); expect(root?.value.display).toBe('{ 5 fields }'); @@ -154,13 +154,11 @@ describe('toTreeNodes', () => { expect(tree.find((node) => node.field === 'oneElement')?.value.display).toBe('[ 1 element ]'); }); - 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); - } + it('keeps all roots distinct for missing and duplicate identities', () => { + const tree = toTreeNodes([{ _id: 'same' }, { _id: 'same' }, {}]); + const roots = tree.filter((node) => node.parentKey === null); + expect(roots.map((node) => node.key)).toEqual([JSON.stringify([0]), JSON.stringify([1]), JSON.stringify([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 index 410235503..c40b1f7c3 100644 --- a/src/utils/documentGrid/toTreeNodes.ts +++ b/src/utils/documentGrid/toTreeNodes.ts @@ -6,7 +6,6 @@ import { BSONTypes } from '@documentdb-js/schema-analyzer'; import * as l10n from '@vscode/l10n'; import { type Document, type ObjectId } from 'mongodb'; -import { assignRowIdentities } from './documentIdentity'; import { toGridCellValue } from './toTablePage'; import { type GridCellValue, type TreeNode } from './types'; @@ -28,12 +27,10 @@ function toArrayDisplay(elementCount: number): string { return `[ ${count} ]`; } -export function toTreeNodes(documents: readonly Document[], identityTrusted: boolean): TreeNode[] { +export function toTreeNodes(documents: readonly Document[]): TreeNode[] { const nodes: TreeNode[] = []; - const identities = assignRowIdentities(documents, identityTrusted); documents.forEach((document, index) => { - const rowKey = identities[index].rowKey; - const rootKey = JSON.stringify([rowKey]); + const rootKey = JSON.stringify([index]); const id: unknown = Object.prototype.hasOwnProperty.call(document, '_id') ? document._id : undefined; let field: string; if (id === null) { @@ -65,7 +62,7 @@ export function toTreeNodes(documents: readonly Document[], identityTrusted: boo if (!entry) { continue; } - const key = JSON.stringify([rowKey, ...entry.segments]); + const key = JSON.stringify([index, ...entry.segments]); const type = BSONTypes.inferType(entry.value); const children: { segment: string | number; field: string; value: unknown }[] = []; let value: GridCellValue; diff --git a/src/utils/documentGrid/types.ts b/src/utils/documentGrid/types.ts index c580ff2f4..cac6f18db 100644 --- a/src/utils/documentGrid/types.ts +++ b/src/utils/documentGrid/types.ts @@ -46,7 +46,7 @@ export interface TablePage { } export interface TreeNode { - /** JSON.stringify([rowKey, ...segments]); segments are field strings or array index numbers. */ + /** JSON.stringify([index, ...segments]); index is zero-based page position; segments retain string/number types. */ readonly key: string; readonly parentKey: string | null; /** Document root = 0; aria-level = depth + 1. */ From be840c6b6a2dbd58ceb97c0963f2bf0e1d6f109f Mon Sep 17 00:00:00 2001 From: Tomasz Naumowicz Date: Tue, 1 Dec 2026 15:21:17 +0100 Subject: [PATCH 04/12] fix: mark current Table breadcrumb (WI-R4) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .../toolbar/ToolbarTableNavigation.tsx | 24 ++++++++++++------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/src/webviews/documentdb/collectionView/components/toolbar/ToolbarTableNavigation.tsx b/src/webviews/documentdb/collectionView/components/toolbar/ToolbarTableNavigation.tsx index 086a85809..cb6a3c7f8 100644 --- a/src/webviews/documentdb/collectionView/components/toolbar/ToolbarTableNavigation.tsx +++ b/src/webviews/documentdb/collectionView/components/toolbar/ToolbarTableNavigation.tsx @@ -113,14 +113,22 @@ export const ToolbarTableNavigation = (): React.JSX.Element => { - {items?.map((item, index) => ( - - - jumpToLevel(index)}>{item.item} - - {index < items.length - 1 && } - - ))} + {items?.map((item, index) => { + const isLast = index === items.length - 1; + return ( + + + jumpToLevel(index)} + > + {item.item} + + + {index < items.length - 1 && } + + ); + })} Date: Tue, 1 Dec 2026 15:23:40 +0100 Subject: [PATCH 05/12] fix: close UDP socket after DNS stub bind failure (WI-R6) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .../src/test/dnsStubServer.test.ts | 8 ++++---- .../src/test/dnsStubServer.ts | 10 +++------- 2 files changed, 7 insertions(+), 11 deletions(-) diff --git a/packages/documentdb-js-srv-resolver/src/test/dnsStubServer.test.ts b/packages/documentdb-js-srv-resolver/src/test/dnsStubServer.test.ts index 4b46a0b0d..ce7668d9e 100644 --- a/packages/documentdb-js-srv-resolver/src/test/dnsStubServer.test.ts +++ b/packages/documentdb-js-srv-resolver/src/test/dnsStubServer.test.ts @@ -100,7 +100,7 @@ describe('DNS stub server lifecycle', (): void => { }); it.each(['EADDRINUSE', 'EACCES'])( - 'retries UDP %s without trying to close an unbound socket', + 'retries UDP %s after closing the failed unbound socket', async (code): Promise => { const error = Object.assign(new Error(code), { code }); const bind = vi.spyOn(dgram.Socket.prototype, 'bind').mockImplementationOnce(function ( @@ -118,7 +118,7 @@ describe('DNS stub server lifecycle', (): void => { stubs.push(server); expect(bind).toHaveBeenCalledTimes(2); - expect(close).not.toHaveBeenCalled(); + expect(close).toHaveBeenCalledTimes(1); expect(listen).toHaveBeenCalledTimes(1); }, ); @@ -127,7 +127,7 @@ describe('DNS stub server lifecycle', (): void => { ['EACCES', 10], ['EADDRINUSE', 10], ['EINVAL', 1], - ])('preserves UDP %s after %i attempts without closing unbound sockets', async (code, attempts): Promise => { + ])('preserves UDP %s after %i attempts and cleans up each failed socket', async (code, attempts): Promise => { const error = Object.assign(new Error(code), { code }); const bind = vi.spyOn(dgram.Socket.prototype, 'bind').mockImplementation(function ( this: dgram.Socket, @@ -143,7 +143,7 @@ describe('DNS stub server lifecycle', (): void => { await expect(DnsStubServer.start((): void => {})).rejects.toBe(error); expect(bind).toHaveBeenCalledTimes(attempts); - expect(close).not.toHaveBeenCalled(); + expect(close).toHaveBeenCalledTimes(attempts); expect(listen).not.toHaveBeenCalled(); }); diff --git a/packages/documentdb-js-srv-resolver/src/test/dnsStubServer.ts b/packages/documentdb-js-srv-resolver/src/test/dnsStubServer.ts index a2cb6de27..a7f108833 100644 --- a/packages/documentdb-js-srv-resolver/src/test/dnsStubServer.ts +++ b/packages/documentdb-js-srv-resolver/src/test/dnsStubServer.ts @@ -22,7 +22,6 @@ export class DnsStubServer { public address = ''; private readonly udp = dgram.createSocket('udp4'); private readonly tcp = net.createServer(); - private udpBound = false; private closed = false; private constructor(private readonly handler: (request: StubRequest) => void) { @@ -69,7 +68,6 @@ export class DnsStubServer { stub.udp.once('error', reject); // UDP and TCP reservations differ; random candidates avoid walking a reserved block. stub.udp.bind(crypto.randomInt(49152, 65536), '127.0.0.1', (): void => { - stub.udpBound = true; stub.udp.removeListener('error', reject); resolve(); }); @@ -109,11 +107,9 @@ export class DnsStubServer { socket.destroy(); } await Promise.all([ - this.udpBound - ? new Promise((resolve): void => { - this.udp.close((): void => resolve()); - }) - : Promise.resolve(), + new Promise((resolve): void => { + this.udp.close((): void => resolve()); + }), this.tcp.listening ? new Promise((resolve, reject): void => { this.tcp.close((error): void => { From e70794034ffcef34ff3f61ae7ad00b1035e2e13a Mon Sep 17 00:00:00 2001 From: Tomasz Naumowicz Date: Tue, 1 Dec 2026 15:25:45 +0100 Subject: [PATCH 06/12] perf: memoize the Tree node index (WI-R3) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .../components/resultsTab/useTreeRows.test.ts | 23 +++++++++++-------- .../components/resultsTab/useTreeRows.ts | 14 +++++++---- 2 files changed, 24 insertions(+), 13 deletions(-) diff --git a/src/webviews/documentdb/collectionView/components/resultsTab/useTreeRows.test.ts b/src/webviews/documentdb/collectionView/components/resultsTab/useTreeRows.test.ts index 08eb7ce27..20ca57104 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 { getVisibleTreeRows, setTreeNodeExpanded } from './useTreeRows'; +import { buildTreeIndex, getVisibleTreeRows, setTreeNodeExpanded } from './useTreeRows'; const root: TreeNode = { key: '["id:\\"z-root\\""]', @@ -49,22 +49,25 @@ const nodes: readonly TreeNode[] = [root, sibling, object, leaf, otherRoot]; describe('tree expansion and visible rows', () => { it('starts with just document roots in Field-ascending order', () => { - expect(getVisibleTreeRows(nodes, new Set())).toEqual([otherRoot, root]); + const index = buildTreeIndex(nodes); + expect(getVisibleTreeRows(index, new Set())).toEqual([otherRoot, root]); }); it('sorts siblings by Field without separating them from their keyed parents', () => { + const index = buildTreeIndex(nodes); const expanded = new Set([root.key, object.key]); - expect(getVisibleTreeRows(nodes, expanded)).toEqual([otherRoot, root, object, leaf, sibling]); + expect(getVisibleTreeRows(index, 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 index = buildTreeIndex(nodes); const expanded = new Set([root.key, object.key]); const collapsed = setTreeNodeExpanded(root, expanded, false); - expect(getVisibleTreeRows(nodes, collapsed)).toEqual([otherRoot, root]); + expect(getVisibleTreeRows(index, 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([ + expect(getVisibleTreeRows(index, setTreeNodeExpanded(root, collapsed, true))).toEqual([ otherRoot, root, object, @@ -90,8 +93,9 @@ describe('tree expansion and visible rows', () => { expanded.add(child.key); parent = child; } - expect(getVisibleTreeRows(deepNodes, expanded)).toEqual(deepNodes); - expect(getVisibleTreeRows(deepNodes, setTreeNodeExpanded(root, expanded, false))).toEqual([root]); + const index = buildTreeIndex(deepNodes); + expect(getVisibleTreeRows(index, expanded)).toEqual(deepNodes); + expect(getVisibleTreeRows(index, setTreeNodeExpanded(root, expanded, false))).toEqual([root]); }); it('respects host array expansion eligibility and never fabricates capped children', () => { @@ -123,12 +127,13 @@ describe('tree expansion and visible rows', () => { }), ); const arrayNodes = [root, empty, ten, ...elements, eleven]; + const index = buildTreeIndex(arrayNodes); 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]); + expect(getVisibleTreeRows(index, expanded)).toEqual([root, eleven, empty, ten]); expanded = setTreeNodeExpanded(ten, expanded, true); - expect(getVisibleTreeRows(arrayNodes, expanded)).toEqual([root, eleven, empty, ten, ...elements]); + expect(getVisibleTreeRows(index, expanded)).toEqual([root, eleven, empty, ten, ...elements]); }); }); diff --git a/src/webviews/documentdb/collectionView/components/resultsTab/useTreeRows.ts b/src/webviews/documentdb/collectionView/components/resultsTab/useTreeRows.ts index 7f68770ab..4b79c124a 100644 --- a/src/webviews/documentdb/collectionView/components/resultsTab/useTreeRows.ts +++ b/src/webviews/documentdb/collectionView/components/resultsTab/useTreeRows.ts @@ -19,7 +19,9 @@ interface TreeRows { readonly setExpanded: (node: TreeNode, expanded: boolean) => void; } -export function getVisibleTreeRows(nodes: readonly TreeNode[], expandedKeys: ReadonlySet): TreeNode[] { +export type TreeIndex = ReadonlyMap; + +export function buildTreeIndex(nodes: readonly TreeNode[]): TreeIndex { const children = new Map(); for (const node of nodes) { const siblings = children.get(node.parentKey); @@ -32,9 +34,12 @@ export function getVisibleTreeRows(nodes: readonly TreeNode[], expandedKeys: Rea for (const siblings of children.values()) { siblings.sort((left, right): number => left.field.localeCompare(right.field)); } + return children; +} +export function getVisibleTreeRows(index: TreeIndex, expandedKeys: ReadonlySet): TreeNode[] { const rows: TreeNode[] = []; - const stack = [...(children.get(null) ?? [])].reverse(); + const stack = [...(index.get(null) ?? [])].reverse(); while (stack.length > 0) { const node = stack.pop(); if (!node) { @@ -42,7 +47,7 @@ export function getVisibleTreeRows(nodes: readonly TreeNode[], expandedKeys: Rea } rows.push(node); if (node.expandable && expandedKeys.has(node.key)) { - const descendants = children.get(node.key) ?? []; + const descendants = index.get(node.key) ?? []; for (let index = descendants.length - 1; index >= 0; index--) { stack.push(descendants[index]); } @@ -75,7 +80,8 @@ export function useTreeRows(nodes: readonly TreeNode[]): TreeRows { setState({ nodes, expandedKeys: COLLAPSED_KEYS }); } const expandedKeys = state.nodes === nodes ? state.expandedKeys : COLLAPSED_KEYS; - const rows = useMemo((): TreeNode[] => getVisibleTreeRows(nodes, expandedKeys), [nodes, expandedKeys]); + const index = useMemo((): TreeIndex => buildTreeIndex(nodes), [nodes]); + const rows = useMemo((): TreeNode[] => getVisibleTreeRows(index, expandedKeys), [index, expandedKeys]); const setExpanded = useCallback( (node: TreeNode, expanded: boolean): void => { setState( From 2caae4e562197c146a9a091e961177246de99133 Mon Sep 17 00:00:00 2001 From: Tomasz Naumowicz Date: Tue, 1 Dec 2026 15:27:49 +0100 Subject: [PATCH 07/12] fix: name the Table navigation button Level up (WI-R5) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- build/verification/browser/scenarios.ts | 2 +- l10n/bundle.l10n.json | 1 - .../components/toolbar/ToolbarTableNavigation.tsx | 3 +-- 3 files changed, 2 insertions(+), 4 deletions(-) diff --git a/build/verification/browser/scenarios.ts b/build/verification/browser/scenarios.ts index 216b13bf5..fb2596bcf 100644 --- a/build/verification/browser/scenarios.ts +++ b/build/verification/browser/scenarios.ts @@ -1163,7 +1163,7 @@ export const collectionViewContracts = { selector: '[role="grid"]', includes: ['nested Alpha'], excludes: ['leaf Alpha'], - steps: [{ action: 'click', role: 'button', name: 'Up' }], + steps: [{ action: 'click', role: 'button', name: 'Level up' }], }, { kind: 'text', diff --git a/l10n/bundle.l10n.json b/l10n/bundle.l10n.json index cec4661e1..f0649312b 100644 --- a/l10n/bundle.l10n.json +++ b/l10n/bundle.l10n.json @@ -3385,7 +3385,6 @@ "Unsupported view for an authentication retry.": "Unsupported view for an authentication retry.", "Unused": "Unused", "Unused Indexes": "Unused Indexes", - "Up": "Up", "Update Azure Account Extension to at least version \"{0}\"...": "Update Azure Account Extension to at least version \"{0}\"...", "Update cluster credentials": "Update cluster credentials", "Update Connection String": "Update Connection String", diff --git a/src/webviews/documentdb/collectionView/components/toolbar/ToolbarTableNavigation.tsx b/src/webviews/documentdb/collectionView/components/toolbar/ToolbarTableNavigation.tsx index cb6a3c7f8..ac0adac71 100644 --- a/src/webviews/documentdb/collectionView/components/toolbar/ToolbarTableNavigation.tsx +++ b/src/webviews/documentdb/collectionView/components/toolbar/ToolbarTableNavigation.tsx @@ -97,10 +97,9 @@ export const ToolbarTableNavigation = (): React.JSX.Element => { return ( - + } disabled={ currentContext.currentView !== Views.TABLE || From 5bafef2e79f5d8b1bd624e4eb08f958da20c4c3c Mon Sep 17 00:00:00 2001 From: Tomasz Naumowicz Date: Tue, 1 Dec 2026 15:37:06 +0100 Subject: [PATCH 08/12] fix: restore Tree focus after a results refresh (WI-R2) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .../DataViewPanelTree.focus.test.tsx | 145 ++++++++++++++++++ .../resultsTab/DataViewPanelTree.tsx | 56 +++++++ 2 files changed, 201 insertions(+) create mode 100644 src/webviews/documentdb/collectionView/components/resultsTab/DataViewPanelTree.focus.test.tsx diff --git a/src/webviews/documentdb/collectionView/components/resultsTab/DataViewPanelTree.focus.test.tsx b/src/webviews/documentdb/collectionView/components/resultsTab/DataViewPanelTree.focus.test.tsx new file mode 100644 index 000000000..ee272e6c3 --- /dev/null +++ b/src/webviews/documentdb/collectionView/components/resultsTab/DataViewPanelTree.focus.test.tsx @@ -0,0 +1,145 @@ +/*--------------------------------------------------------------------------------------------- + * 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 } from 'react'; +import { createRoot, type Root } from 'react-dom/client'; // eslint-disable-line import/no-internal-modules +import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'; +import { type TreeNode } from '../../../../../utils/documentGrid/types'; +import { DataViewPanelTree } from './DataViewPanelTree'; + +(globalThis as { IS_REACT_ACT_ENVIRONMENT?: boolean }).IS_REACT_ACT_ENVIRONMENT = true; + +vi.mock('@vscode/l10n', () => ({ t: (message: string): string => message })); + +const nodes: readonly TreeNode[] = [ + { + key: '[0]', + parentKey: null, + depth: 0, + field: '"zulu"', + value: { display: '{ 1 field }', type: 'object' }, + expandable: true, + }, + { + key: '[0,"answer"]', + parentKey: '[0]', + depth: 1, + field: 'answer', + value: { display: '42', type: 'int32' }, + expandable: false, + }, + { + key: '[1]', + parentKey: null, + depth: 0, + field: '"alpha"', + value: { display: '{}', type: 'object' }, + expandable: false, + }, +]; + +let host: HTMLDivElement; +let root: Root; + +function gridCell(rowIndex: number, columnIndex: number): HTMLElement { + const cell = host.querySelector( + `[role="row"][aria-rowindex="${rowIndex}"] [role="gridcell"][aria-colindex="${columnIndex}"]`, + ); + if (!cell) { + throw new Error(`Missing Tree cell at row ${rowIndex}, column ${columnIndex}`); + } + return cell; +} + +beforeEach((): void => { + vi.stubGlobal('CSS', { escape: (value: string): string => value }); + const querySelector = Element.prototype.querySelector; + vi.spyOn(Element.prototype, 'querySelector').mockImplementation(function ( + this: Element, + selector: string, + ): Element | null { + // jsdom's selector engine does not support RDG's nesting selector. + return querySelector.call(this, selector.replace(/^&/, ':scope')); + }); + vi.spyOn(HTMLElement.prototype, 'clientWidth', 'get').mockReturnValue(800); + vi.spyOn(HTMLElement.prototype, 'clientHeight', 'get').mockReturnValue(600); + Object.defineProperty(HTMLElement.prototype, 'scrollIntoView', { configurable: true, value: vi.fn() }); + host = document.createElement('div'); + document.body.appendChild(host); + root = createRoot(host); +}); + +afterEach(async (): Promise => { + await act(async () => root.unmount()); + host.remove(); + vi.restoreAllMocks(); + vi.unstubAllGlobals(); + Reflect.deleteProperty(HTMLElement.prototype, 'scrollIntoView'); +}); + +describe('DataViewPanelTree replacement focus', (): void => { + it('restores a removed descendant to its sorted root Value cell after a delayed refresh without stealing outside focus', async (): Promise => { + await act(async () => root.render()); + const expander = gridCell(3, 1).querySelector('button'); + if (!expander) { + throw new Error('Missing Tree root expander'); + } + await act(async () => expander.click()); + + let resolveRefresh!: (replacement: readonly TreeNode[]) => void; + const refresh = new Promise((resolve): void => { + resolveRefresh = resolve; + }); + const descendant = gridCell(4, 2); + await act(async () => descendant.focus()); + expect(descendant.textContent).toBe('42'); + expect(document.activeElement).toBe(descendant); + + await act(async () => { + resolveRefresh([...nodes]); + const replacement = await refresh; + root.render(); + }); + + expect(descendant.isConnected).toBe(false); + expect(host.querySelectorAll('[role="gridcell"]')).toHaveLength(6); + expect(gridCell(3, 1).textContent).toContain('"zulu"'); + expect(document.activeElement).toBe(gridCell(3, 2)); + expect(document.activeElement?.textContent).toBe('{ 1 field }'); + + await act(async () => expander.click()); + await act(async () => gridCell(4, 2).focus()); + const outside = document.createElement('button'); + host.appendChild(outside); + outside.focus(); + await act(async () => root.render()); + + expect(host.querySelectorAll('[role="gridcell"]')).toHaveLength(6); + expect(document.activeElement).toBe(outside); + + await act(async () => expander.click()); + const samePositionDescendant = gridCell(4, 2); + await act(async () => samePositionDescendant.focus()); + expect(document.activeElement).toBe(samePositionDescendant); + + const extraRoot: TreeNode = { + key: '[2]', + parentKey: null, + depth: 0, + field: '"mike"', + value: { display: '{}', type: 'object' }, + expandable: false, + }; + await act(async () => root.render()); + + expect(samePositionDescendant.isConnected).toBe(false); + expect(host.querySelectorAll('[role="gridcell"]')).toHaveLength(9); + expect(gridCell(4, 1).textContent).toContain('"zulu"'); + expect(document.activeElement).toBe(gridCell(4, 2)); + expect(document.activeElement?.textContent).toBe('{ 1 field }'); + }); +}); diff --git a/src/webviews/documentdb/collectionView/components/resultsTab/DataViewPanelTree.tsx b/src/webviews/documentdb/collectionView/components/resultsTab/DataViewPanelTree.tsx index 86ba1c037..a36df53d1 100644 --- a/src/webviews/documentdb/collectionView/components/resultsTab/DataViewPanelTree.tsx +++ b/src/webviews/documentdb/collectionView/components/resultsTab/DataViewPanelTree.tsx @@ -19,6 +19,12 @@ interface DataViewPanelTreeProps { readonly nodes: readonly TreeNode[]; } +interface TreeFocusRecord { + readonly key: string; + readonly idx: number; + readonly rowIdx: number; +} + function treeCellText(row: TreeNode, key: Column['key']): string { switch (key) { case 'field': @@ -34,6 +40,8 @@ function treeCellText(row: TreeNode, key: Column['key']): string { export const DataViewPanelTree = ({ nodes }: DataViewPanelTreeProps): React.JSX.Element => { const gridRef = React.useRef(null); + const focusedCellRef = React.useRef(undefined); + const previousNodesRef = React.useRef(nodes); const { rows, expandedKeys, setExpanded } = useTreeRows(nodes); const columns = React.useMemo[]>( (): readonly Column[] => [ @@ -98,6 +106,49 @@ export const DataViewPanelTree = ({ nodes }: DataViewPanelTreeProps): React.JSX. ); useFocusedCellCopyFallback(gridRef, focusedCellText); + React.useLayoutEffect(() => { + if (previousNodesRef.current === nodes) { + return; + } + previousNodesRef.current = nodes; + const focusedCell = focusedCellRef.current; + focusedCellRef.current = undefined; + if (!focusedCell || rows.length === 0 || rows.some((row) => row.key === focusedCell.key)) { + return; + } + const grid = gridRef.current?.element; + if (!grid) { + return; + } + const ownerDocument = grid.ownerDocument; + const activeElement = ownerDocument.activeElement; + if (activeElement !== ownerDocument.body && !grid.contains(activeElement)) { + return; + } + let rootKey: string | undefined; + try { + const segments: unknown = JSON.parse(focusedCell.key); + if ( + Array.isArray(segments) && + typeof segments[0] === 'number' && + Number.isInteger(segments[0]) && + segments[0] >= 0 + ) { + rootKey = JSON.stringify([segments[0]]); + } + } catch { + // A key without a positional root falls back to the first visible row. + } + const rowIdx = Math.max(0, rows.findIndex((row) => row.key === rootKey)); + gridRef.current?.setActivePosition({ rowIdx, idx: focusedCell.idx }, { shouldFocus: true }); + if (rowIdx === focusedCell.rowIdx) { + // RDG beta.64 does not refocus when the active coordinates are unchanged. + grid.querySelector( + `[role="row"][aria-rowindex="${rowIdx + 2}"] [role="gridcell"][aria-colindex="${focusedCell.idx + 1}"]`, + )?.focus(); + } + }, [nodes, rows]); + function onTreeKeyDown( row: TreeNode, rowIdx: number, @@ -149,6 +200,11 @@ export const DataViewPanelTree = ({ nodes }: DataViewPanelTreeProps): React.JSX. onFocusCapture={(event): void => { props.onFocusCapture?.(event); if (!event.defaultPrevented && event.target === event.currentTarget) { + focusedCellRef.current = { + key: props.row.key, + idx: props.column.idx, + rowIdx: props.rowIdx, + }; // Native Tab exit uses the remembered position, not the focused DOM cell. props.setActivePosition({ rowIdx: props.rowIdx, idx: props.column.idx }); } From f031df5fbc781fb832a485ac9c81d16dfa65e813 Mon Sep 17 00:00:00 2001 From: Tomasz Naumowicz Date: Tue, 1 Dec 2026 15:38:42 +0100 Subject: [PATCH 09/12] docs: record Copilot review fixes and Tree navigation Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .../ai-and-plans/features/data-grid/README.md | 3 + .../ai-and-plans/features/data-grid/design.md | 4 ++ .../iterations/08-copilot-pr-review-triage.md | 67 +++++++++++++++++++ docs/user-manual/collection-view-querying.md | 4 +- 4 files changed, 77 insertions(+), 1 deletion(-) diff --git a/docs/ai-and-plans/features/data-grid/README.md b/docs/ai-and-plans/features/data-grid/README.md index fd0806b21..ad591b26c 100644 --- a/docs/ai-and-plans/features/data-grid/README.md +++ b/docs/ai-and-plans/features/data-grid/README.md @@ -39,6 +39,9 @@ released extension version or completion of the remaining handover gates. identity remain browsable and selectable, but cannot become View/Edit/Delete targets. - Tree node keys use the zero-based page position plus typed field/array path segments, so their size does not depend on `_id`; Table identity and actions keep the existing `rowKey` contract. +- A replacement Tree page starts collapsed. When that removes the focused cell, the Tree restores + focus in the same column at the root row, or the first row if the root is absent. It leaves + focus on controls outside the grid alone. - Object `_id` values with more than one own key and an integer-like key at any depth are conservatively ineligible for document actions. Their rows remain displayed and selectable. - Table column sizing keeps neighbors stable during resizing, then reflows diff --git a/docs/ai-and-plans/features/data-grid/design.md b/docs/ai-and-plans/features/data-grid/design.md index 6302143f3..1e1c7e452 100644 --- a/docs/ai-and-plans/features/data-grid/design.md +++ b/docs/ai-and-plans/features/data-grid/design.md @@ -131,6 +131,10 @@ The 24 px expander and matching leaf slot align field names. The Fluent chevron over 100 ms when motion is allowed; reduced-motion preference removes the transition. The Tree fills the results area and reserves a stable scrollbar gutter. +A replacement Tree page starts collapsed. If that removes the focused descendant, focus returns +to its root row in the same column, or to the first row in that column if the root key is absent. +The restore runs only when focus is on the document body or inside the Tree grid. + RDG owns grid-cell navigation. Arrow keys move through visible cells; Tab and Shift+Tab traverse cells and row boundaries. Focus capture synchronizes RDG's active position with the cell reached by native Tab navigation. A popup gets Escape first. In Table, when rows are selected, the first diff --git a/docs/ai-and-plans/features/data-grid/iterations/08-copilot-pr-review-triage.md b/docs/ai-and-plans/features/data-grid/iterations/08-copilot-pr-review-triage.md index bb262fa95..c02959d09 100644 --- a/docs/ai-and-plans/features/data-grid/iterations/08-copilot-pr-review-triage.md +++ b/docs/ai-and-plans/features/data-grid/iterations/08-copilot-pr-review-triage.md @@ -89,6 +89,10 @@ which `02-rdg-execution-plan.md:669` specified, and the test that pins it. **Recommendation:** reply with a link to `9eb782bd7` and the two tests. Keep the thread resolved. +**WI-R9 done (2026-12-01), existing commit `9eb782bd7`:** The operator accepted the existing +keyboard step-in fix and its two tests. [Reply posted](https://github.com/microsoft/vscode-documentdb/pull/1142#discussion_r4755487506); +no code or tests changed, and the thread state was left alone. + --- ## C2: Tree, focus lost when replacement results arrive (C6 is a duplicate) @@ -123,6 +127,14 @@ which `02-rdg-execution-plan.md:669` specified, and the test that pins it. **Recommendation:** **A**, for the Tree only, with one interaction test: a delayed refresh while a descendant has focus. If it doesn't fit in this PR, do C and open a follow-up issue. The same kind of loss can also happen in the Table when a delayed refresh changes the columns. Copilot didn't raise that case. Consider covering it in the same follow-up. +**WI-R2 done (2026-12-01), commit `5bafef2e7`:** `gpt-6.1-sol` implemented the operator-approved +same-column focus restore on collapsed replacement pages, without taking focus from outside +the grid. Advised (`claude-opus-5.5`, ~90% on the final revision) to focus the target cell +directly when RDG beta.64 sees unchanged coordinates and skips a focus request. One real-RDG +interaction test covers delayed refresh, outside focus, and the same-coordinate regression; 12 +focused tests passed. Replies: [C2](https://github.com/microsoft/vscode-documentdb/pull/1142#discussion_r4755768619), +[C6](https://github.com/microsoft/vscode-documentdb/pull/1142#discussion_r4755768636) (duplicate). + --- ## C3: Type tooltip on a span that can't take focus @@ -138,6 +150,11 @@ Missing-field cells still put the tooltip on a span (`:86-87`), but "This field **Recommendation:** reply with links to R5 and `c09cdb6d`. Won't fix the missing-field tooltip. +**WI-R9 done (2026-12-01), existing commit `c09cdb6d`:** The operator accepted decision 0004 R5: +defined values expose their full type in the cell's accessible name. +[Reply posted](https://github.com/microsoft/vscode-documentdb/pull/1142#discussion_r4755489561); +no code or tests changed, and the thread state was left alone. + --- ## C4: Tree keys repeat the full `_id` @@ -172,6 +189,12 @@ Missing-field cells still put the tooltip on a span (`:86-87`), but "This field **Recommendation:** **A** in this PR, after you confirm the contract change. Position-independent keys don't help at runtime today, because every new page starts collapsed (`useTreeRows.ts:73`). If the PR has to ship first, defer this with a tracked issue. +**WI-R1 done (2026-12-01), commit `67c5ef934`:** Tree keys now use the page index and typed +path segments, without repeating `_id`. The operator approved the contract change; advised +(`claude-opus-5.5`, ~90%) to remove Tree's unused identity argument and leave Table identity +unchanged. `mai-code-2` updated the existing contract tests, fixtures, and docs. No new tests; +7 Tree and 80 harness tests passed. [Reply posted](https://github.com/microsoft/vscode-documentdb/pull/1142#discussion_r4755543068). + --- ## C5: Add mode, a falsy `_id` reaches the upsert and can overwrite a document @@ -205,6 +228,12 @@ There is no test for an Add save whose `_id` matches an existing document. **Recommendation:** keep the PR change. Reply that the overwrite already exists for every `_id`, that this PR adds only the four falsy values, and that it fixes a worse duplicate bug. Open a follow-up issue for **A**, linked to the `upsertDocument` TODO. If the reviewer insists on a fix in this PR, A is the right one, not B. +**WI-R8 done (2026-12-01), no code commit:** The operator kept the #1142 fix and deferred +insert-only first saves to [#1153](https://github.com/microsoft/vscode-documentdb/issues/1153). +`mai-code-2-flash` filed it via the GitHub REST API after `gh issue create` failed, and +[posted the C5 reply](https://github.com/microsoft/vscode-documentdb/pull/1142#discussion_r4755576445). +No tests or product code changed. + --- ## C6: Tree refresh collapses branches and loses focus @@ -246,6 +275,11 @@ Even the worst case is under one 16 ms frame. Long `_id` keys (C4) make the Map **Recommendation:** **A**, which is cheap and safe. C is also defensible, given the measurements. +**WI-R3 done (2026-12-01), commit `e70794034`:** `mai-code-2` split index construction from +traversal as the operator approved. The Tree rebuilds the sorted index only when `nodes` changes; +expand/collapse reuses it and preserves visible row order. No new tests; 11 focused tests passed +with the existing assertions retained. [Reply posted](https://github.com/microsoft/vscode-documentdb/pull/1142#discussion_r4755618873). + --- ## C8: The last breadcrumb isn't marked as current @@ -265,6 +299,11 @@ Even the worst case is under one 16 ms frame. Long `_id` keys (C4) make the Map **Recommendation:** **A**. +**WI-R4 done (2026-12-01), commit `be840c6b6`:** `gpt-6-luna` marked the final crumb current +and removed its click handler so it no longer reports a no-op step-in. The operator approved +option A. Ancestor navigation is unchanged; no tests added, and 80 harness tests passed. +[Reply posted](https://github.com/microsoft/vscode-documentdb/pull/1142#discussion_r4755550580). + --- ## C9: The help says "Level Up", but the button's accessible name is "Up" @@ -284,6 +323,12 @@ Even the worst case is under one 16 ms frame. Long `_id` keys (C4) make the Map **Recommendation:** **A**. +**WI-R5 done (2026-12-01), commit `2caae4e56`:** `gpt-6-luna` implemented the operator-approved +Tooltip label, so the button's name matches the help without a separate `Up` label. Updated only +the existing navigation scenario selector, not its behavior assertions; 80 harness tests passed. +`npm run l10n` removed only the generated `Up` key. +[Reply posted](https://github.com/microsoft/vscode-documentdb/pull/1142#discussion_r4755640159). + --- ## C10: The test DNS stub leaks a UDP socket after a failed bind @@ -330,6 +375,13 @@ A second run showed that an unbound socket left open does **not** keep the proce **Recommendation:** **A**. Skip the regression test: it would need a seam added just for the test, and it would check Node internals, not product behavior. +**WI-R6 done (2026-12-01), commit `9722e1f20`:** `gpt-6-luna` made `close()` close the UDP +socket even after a bind failure. The operator approved option A and no new regression test. +Two existing parameterized tests now expect a close per failed attempt, retaining all retry, +error identity, and idempotence coverage; all 28 focused tests passed. Advised +(`claude-opus-5.5`, ~90%) that the cleanup preserves the Node socket lifecycle and TCP handling. +[Reply posted](https://github.com/microsoft/vscode-documentdb/pull/1142#discussion_r4755583278). + --- ## C11: Code and CodeWithScope share the same glyph @@ -351,6 +403,11 @@ A second run showed that an unbound socket left open does **not** keep the proce **Operator decision (2026-12-01):** **C**, won't fix (WI-R10). +**WI-R10 done (2026-12-01), no code commit:** The +[reply](https://github.com/microsoft/vscode-documentdb/pull/1142#discussion_r4755480841) +records the operator's option C: CodeWithScope is rare and deprecated, and is distinguishable by +its full value or the Tree view's Type column. No tests added; thread left unchanged. + --- ## C12: The type glyph at 40% opacity doesn't meet text contrast requirements @@ -382,6 +439,11 @@ The selected-row background lowers these values further. The full type name is a **Operator decision (2026-12-01):** won't fix in #1142. The glyph contrast is tracked in #382 and handled by the accessibility PR #1147 for release 1.2.0 (WI-R11). +**WI-R11 done (2026-12-01), no code commit:** The +[reply](https://github.com/microsoft/vscode-documentdb/pull/1142#discussion_r4755481100) +links #382 and #1147 (milestone 1.2.0), as the operator directed. No tests added; thread left +unchanged. + --- ## C13: The skill docs describe the deleted hook and the old selection shape @@ -403,3 +465,8 @@ handled by the accessibility PR #1147 for release 1.2.0 (WI-R11). | **B. Remove only the hook references** | Smallest change. | Leaves the pitfall contradiction and the old selection shape. | **Recommendation:** **A**. + +**WI-R7 done (2026-12-01), commit `8bc293a77`:** Removed both references to the deleted hook, +aligned the refs pitfall with the event-handler freshness guidance, and updated the selection +example to `selectedRowKeys`. The operator accepted option A; `gpt-6-luna` implemented the +docs-only changes. No tests added. [Reply posted](https://github.com/microsoft/vscode-documentdb/pull/1142#discussion_r4755513673). diff --git a/docs/user-manual/collection-view-querying.md b/docs/user-manual/collection-view-querying.md index f41988e1c..0bc7451e9 100644 --- a/docs/user-manual/collection-view-querying.md +++ b/docs/user-manual/collection-view-querying.md @@ -249,7 +249,9 @@ with the arrow keys or press **Space** to select that row. Mouse step-in is unch these actions. In **Tree View**, focus an expandable **Field** cell and press **Enter** to expand or collapse it. -The chevron button beside the field also toggles expansion. +The chevron button beside the field also toggles expansion. New results start collapsed. If a +refresh removes the nested cell you were on, focus returns to the same column of its root row, +or the first row if the root is no longer present. Focus on another control stays there. Table object cells preview their first two fields, with placeholders for nested objects and arrays. Tree containers show their direct field or element count; arrays with more than ten From 2e018004d0ed8ec0c201127deeb39ef14aab9f9f Mon Sep 17 00:00:00 2001 From: Tomasz Naumowicz Date: Tue, 1 Dec 2026 15:54:29 +0100 Subject: [PATCH 10/12] chore: format Copilot review fixes Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- src/utils/documentGrid/toTreeNodes.test.ts | 4 +--- .../components/resultsTab/DataViewPanelTree.tsx | 5 ++++- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/utils/documentGrid/toTreeNodes.test.ts b/src/utils/documentGrid/toTreeNodes.test.ts index 27ada55f9..3dd08779a 100644 --- a/src/utils/documentGrid/toTreeNodes.test.ts +++ b/src/utils/documentGrid/toTreeNodes.test.ts @@ -89,9 +89,7 @@ describe('toTreeNodes', () => { const document = { _id: 'stable', 'a.b': { '': null }, a: { b: false }, values: [{ x: 0 }] }; const tree = toTreeNodes([document]); expect(new Set(tree.map((node) => node.key)).size).toBe(tree.length); - expect(tree.find((node) => node.depth === 2 && node.field === '')?.key).toBe( - JSON.stringify([0, 'a.b', '']), - ); + expect(tree.find((node) => node.depth === 2 && node.field === '')?.key).toBe(JSON.stringify([0, 'a.b', ''])); expect(tree.find((node) => node.field === 'x')?.key).toBe(JSON.stringify([0, 'values', 0, 'x'])); tree.forEach((node, index) => { if (node.parentKey !== null) { diff --git a/src/webviews/documentdb/collectionView/components/resultsTab/DataViewPanelTree.tsx b/src/webviews/documentdb/collectionView/components/resultsTab/DataViewPanelTree.tsx index a36df53d1..0e40904e4 100644 --- a/src/webviews/documentdb/collectionView/components/resultsTab/DataViewPanelTree.tsx +++ b/src/webviews/documentdb/collectionView/components/resultsTab/DataViewPanelTree.tsx @@ -139,7 +139,10 @@ export const DataViewPanelTree = ({ nodes }: DataViewPanelTreeProps): React.JSX. } catch { // A key without a positional root falls back to the first visible row. } - const rowIdx = Math.max(0, rows.findIndex((row) => row.key === rootKey)); + const rowIdx = Math.max( + 0, + rows.findIndex((row) => row.key === rootKey), + ); gridRef.current?.setActivePosition({ rowIdx, idx: focusedCell.idx }, { shouldFocus: true }); if (rowIdx === focusedCell.rowIdx) { // RDG beta.64 does not refocus when the active coordinates are unchanged. From 1d31b5fcc379afd102ad349cfa1bbc4948cfdf37 Mon Sep 17 00:00:00 2001 From: Tomasz Naumowicz Date: Tue, 1 Dec 2026 16:06:46 +0100 Subject: [PATCH 11/12] test: type the Tree focus selector shim (WI-R2) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .../components/resultsTab/DataViewPanelTree.focus.test.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/webviews/documentdb/collectionView/components/resultsTab/DataViewPanelTree.focus.test.tsx b/src/webviews/documentdb/collectionView/components/resultsTab/DataViewPanelTree.focus.test.tsx index ee272e6c3..4d2218f9c 100644 --- a/src/webviews/documentdb/collectionView/components/resultsTab/DataViewPanelTree.focus.test.tsx +++ b/src/webviews/documentdb/collectionView/components/resultsTab/DataViewPanelTree.focus.test.tsx @@ -63,7 +63,9 @@ beforeEach((): void => { selector: string, ): Element | null { // jsdom's selector engine does not support RDG's nesting selector. - return querySelector.call(this, selector.replace(/^&/, ':scope')); + return Reflect.apply(querySelector, this, [ + selector.replace(/^&/, ':scope'), + ]); }); vi.spyOn(HTMLElement.prototype, 'clientWidth', 'get').mockReturnValue(800); vi.spyOn(HTMLElement.prototype, 'clientHeight', 'get').mockReturnValue(600); From 9ca58be8fdaf54186cc9eaf69659f9043acc4354 Mon Sep 17 00:00:00 2001 From: Tomasz Naumowicz Date: Tue, 1 Dec 2026 16:14:28 +0100 Subject: [PATCH 12/12] docs: record Copilot review verification Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .../iterations/08-copilot-pr-review-triage.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/docs/ai-and-plans/features/data-grid/iterations/08-copilot-pr-review-triage.md b/docs/ai-and-plans/features/data-grid/iterations/08-copilot-pr-review-triage.md index c02959d09..9e1abfdc7 100644 --- a/docs/ai-and-plans/features/data-grid/iterations/08-copilot-pr-review-triage.md +++ b/docs/ai-and-plans/features/data-grid/iterations/08-copilot-pr-review-triage.md @@ -470,3 +470,16 @@ unchanged. aligned the refs pitfall with the event-handler freshness guidance, and updated the selection example to `selectedRowKeys`. The operator accepted option A; `gpt-6-luna` implemented the docs-only changes. No tests added. [Reply posted](https://github.com/microsoft/vscode-documentdb/pull/1142#discussion_r4755513673). + +## Verification for the review-fix PR (#1152) + +- **Case 1:** `npm run build`, 61 focused Vitest tests, and 80 browser-harness tests passed. +- **Case 2:** `npm run l10n`, `npm run prettier-fix`, `npm run l10n:check`, `npm run lint`, + `npm run build`, `npm run typecheck:tests`, `npx vitest run`, and `npm run package` passed after + the rechecks below. Full Vitest: 431 files, 10,117 passed, 8 skipped. +- Formatting landed separately in `2e018004d`. The WI-R2 test-only lint correction in + `1d31b5fcc` did not change product behavior. A temporary PATH entry for the existing Git for + Windows OpenSSL resolved the OIDC harness setup failure. One unrelated Fluent UI import test + timed out on the first full rerun; it passed alone and on the next full run without changes. +- The real-grid interaction was tested in jsdom, not in an installed VS Code workbench or with a + screen reader.