diff --git a/docs/ai-and-plans/features/connection-lifecycle/README.md b/docs/ai-and-plans/features/connection-lifecycle/README.md index 3cb783d10..199aeeedf 100644 --- a/docs/ai-and-plans/features/connection-lifecycle/README.md +++ b/docs/ai-and-plans/features/connection-lifecycle/README.md @@ -18,33 +18,23 @@ code: # Connection lifecycle -**Status:** package P (A2, B2, C-balanced and D2; decisions 0026, 0027, 0029–0032) is implemented -in [draft #1149](https://github.com/microsoft/vscode-documentdb/pull/1149), stacked on the feature -branch. Integrated host checks pass; rendered/workbench and live verification remain incomplete. The -[iteration 3 section 6 evidence ledger](./iterations/03-complexity-reduction-analysis.md#6-packages-regenerated-2026-11-30) -records committed slices and remaining verification. **Issues:** - -- [#1102](https://github.com/microsoft/vscode-documentdb/issues/1102) -- [#1059](https://github.com/microsoft/vscode-documentdb/issues/1059) -- [#566](https://github.com/microsoft/vscode-documentdb/issues/566) -- [#990](https://github.com/microsoft/vscode-documentdb/issues/990) -- follow-ups after 1.2.0: [#1105](https://github.com/microsoft/vscode-documentdb/issues/1105) - (Kubernetes tunnels, network resilience), [#1106](https://github.com/microsoft/vscode-documentdb/issues/1106) - (out-of-date results), and [#1119](https://github.com/microsoft/vscode-documentdb/issues/1119) - (prompt handling of Microsoft account sign-out) - -**Branch:** `feature/connection-lifecycle`, with stacked sub-PRs from `dev/tnaum/*`. Implementation -does not wait for intermediate merges; the operator handles approvals and merges (decision 0006). - -**Review follow-up:** [decision 0033](./decisions.md#0033-approve-the-pr1149-review-dispositions-with-explicit-complexity-tradeoffs) -approves nine fixes and three no-code dispositions from the -[PR #1149 review](./iterations/03-pr1149-copilot-review.md). The follow-up fixes are implemented in -[draft #1154](https://github.com/microsoft/vscode-documentdb/pull/1154); workbench and live -verification remain incomplete. The accepted C01/C08 exceptions and selected C06/C10 behavior -are reflected in the intent below. - -> How database connections stay usable across Entra token expiry, idle drops and credential -> changes, and what open surfaces do when the user must act or explicitly ends the session. +Connections recover silently from Entra token expiry or an idle drop when the same account can +continue. An explicit Disconnect ends the session: retained tabs stay copyable but cannot run +database operations, even after reconnecting. + +**Landed on the feature branch, not yet on `main` (2026-12-02).** The open +[umbrella PR #1136](https://github.com/microsoft/vscode-documentdb/pull/1136) includes the +[recovery and retained-tab changes (#1149)](https://github.com/microsoft/vscode-documentdb/pull/1149), +their [review fixes (#1154)](https://github.com/microsoft/vscode-documentdb/pull/1154), and the +[simpler stale-action and ended-session handling (#1169)](https://github.com/microsoft/vscode-documentdb/pull/1169). +See the [decision log](./decisions.md), particularly 0031–0036, for what was chosen and why. +The [user guide](../../../user-manual/connecting-to-databases.md#disconnect-and-reconnect) describes what users see. + +**Verification still open.** [Automated checks passed for #1169](./iterations/04-pr1136-scope-and-test-review.md#case-2-follow-up-2026-12-02). +That does not establish real Entra expiry or sleep/wake recovery, dirty-tab copy after Disconnect, +or a Retry/sign-in overtaken by Disconnect in the workbench. Use the +[candidate verification runbook](./iterations/03-complexity-reduction-analysis.md#evidence-the-agent-collects-directly) +for the separate host, rendered, live-worker and telemetry checks. ## Problem @@ -58,6 +48,14 @@ Code. The original defects were: Evidence, telemetry and source pointers: [research-findings.md](./research-findings.md). +Tracking: [#1102](https://github.com/microsoft/vscode-documentdb/issues/1102), +[#1059](https://github.com/microsoft/vscode-documentdb/issues/1059), +[#566](https://github.com/microsoft/vscode-documentdb/issues/566) and +[#990](https://github.com/microsoft/vscode-documentdb/issues/990). Deferred: [Kubernetes tunnels +and network resilience](https://github.com/microsoft/vscode-documentdb/issues/1105), +[out-of-date results](https://github.com/microsoft/vscode-documentdb/issues/1106) and +[Microsoft account sign-out](https://github.com/microsoft/vscode-documentdb/issues/1119). + ## Code map | Area | Primary implementation | @@ -154,20 +152,12 @@ entries are unpublished drafts and do not represent a shipped release. ## Documents -| Document | Kind | -| -------------------------------------------------------------------------------------------------- | --------- | -| [research-findings.md](./research-findings.md) | research | -| [decisions.md](./decisions.md) | decisions | -| [iterations/01-implementation-plan.md](./iterations/01-implementation-plan.md) | plan | -| [iterations/01-dev-plan.md](./iterations/01-dev-plan.md) | plan | -| [iterations/02-ux-implementation-plan.md](./iterations/02-ux-implementation-plan.md) | plan | -| [iterations/02-pr1146-copilot-review.md](./iterations/02-pr1146-copilot-review.md) | review | -| [iterations/02-pr1136-copilot-review.md](./iterations/02-pr1136-copilot-review.md) | review | -| [iterations/03-complexity-reduction-analysis.md](./iterations/03-complexity-reduction-analysis.md) | analysis | -| [iterations/03-pr1149-copilot-review.md](./iterations/03-pr1149-copilot-review.md) | review | -| [iterations/04-pr1136-scope-and-test-review.md](./iterations/04-pr1136-scope-and-test-review.md) | analysis | -| [iterations/01-pr1136-final-review.md](./iterations/01-pr1136-final-review.md) | review | -| [iterations/01-pr1136-ux-review.md](./iterations/01-pr1136-ux-review.md) | ux-review | +- **Why the design looks this way:** [operator decisions](./decisions.md), [original defect evidence](./research-findings.md), [telemetry definitions and queries](./telemetry.md). +- **Original delivery:** the [implementation plan](./iterations/01-implementation-plan.md) gives the proposal and dependencies; the [dev ledger](./iterations/01-dev-plan.md) records deviations, commits, operator checks and limits. +- **Stage reviews:** [Entra renewal](./iterations/01-pr1-entra-renewal-review.md), [Azure Discovery](./iterations/01-pr2-azureauth-review.md), [client identity](./iterations/01-pr3-client-identity-review.md), [recovery](./iterations/01-pr4-connection-recovery-review.md), [bound views](./iterations/01-pr5-bound-surfaces-review.md), [worker relays](./iterations/01-pr6a-worker-token-relays-review.md), [telemetry and docs](./iterations/01-pr7-telemetry-and-docs-review.md). +- **What users saw:** [hands-on UX review](./iterations/01-pr1136-ux-review.md), [resulting changes](./iterations/02-ux-implementation-plan.md), [#1146 review dispositions](./iterations/02-pr1146-copilot-review.md). +- **Umbrella review:** [initial combined review](./iterations/01-pr1136-final-review.md) and [#1136 inline findings and outcomes](./iterations/02-pr1136-copilot-review.md). +- **What was simplified or deliberately kept:** [design alternatives and live runbook](./iterations/03-complexity-reduction-analysis.md), [#1149 dispositions](./iterations/03-pr1149-copilot-review.md), [scope and test cuts delivered in #1169](./iterations/04-pr1136-scope-and-test-review.md). ## Decisions index @@ -228,3 +218,4 @@ See [decisions.md](./decisions.md): | 2026-11-29 | Complexity analysis (iteration 3); decisions 0026, 0027 and 0029; 0028 proposed | | 2026-11-30 | A2 approved (0030); package P chosen (0031–0032); implementation partially committed | | 2026-12-01 | PR #1149 review dispositions approved (0033); follow-up implementation pending | +| 2026-12-02 | #1136 includes the #1154 review fixes and #1169 scope reductions (0036) | diff --git a/docs/ai-and-plans/features/connection-lifecycle/iterations/01-dev-plan.md b/docs/ai-and-plans/features/connection-lifecycle/iterations/01-dev-plan.md index ba40b481a..31eea0493 100644 --- a/docs/ai-and-plans/features/connection-lifecycle/iterations/01-dev-plan.md +++ b/docs/ai-and-plans/features/connection-lifecycle/iterations/01-dev-plan.md @@ -1,7 +1,7 @@ --- feature: connection-lifecycle kind: plan -status: active +status: historical created: 2026-11-19 code: - src/documentdb/auth/MicrosoftEntraIDAuthHandler.ts @@ -29,10 +29,11 @@ code: # Iteration 1, dev plan: how to execute the connection lifecycle work -> This is the execution guide for the approved [01-implementation-plan.md](./01-implementation-plan.md). -> That plan says **what** to build and in which PRs. This file says **how** for each work item: what to read -> first, ordered steps, the contracts that cross PRs, tests, the done criteria, and the points where the -> advisor must decide. Work-item numbers (WI-n), PR numbers and OT-n acceptance tests are the same as in +> This is the execution record for the approved [implementation plan](./01-implementation-plan.md). +> Read that plan for the original proposals and dependencies. Read the **Progress** blocks here for +> what actually landed, where it differed and what the operator verified. The +> [original execution recipes](https://github.com/microsoft/vscode-documentdb/blob/01590e0617e3dcf70cb237acab3fd880ca908162/docs/ai-and-plans/features/connection-lifecycle/iterations/01-dev-plan.md) +> remain available at the reviewed revision. Work-item numbers (WI-n), PR numbers and OT-n acceptance tests are the same as in > the approved plan. Decisions are in [../decisions.md](../decisions.md), evidence in > [../research-findings.md](../research-findings.md). Neither is repeated here. @@ -43,20 +44,9 @@ stable pointers. ### Authority and deviation -1. **Accepted decisions 0001–0008 bind you.** You cannot change them on your own. If the code shows one of - them is wrong or cannot be met, stop and raise it with the operator, giving evidence and alternatives. - The advisor cannot overrule an accepted decision. -2. **The approved plan's content binds you**, except where §3 (Tensions) names a conflict. There the advisor - decides at the named checkpoint. If that changes the intent of an accepted decision, the operator - confirms, as rule 1 requires. -3. **Everything in this dev plan is guidance.** That includes steps, file names, helper names and contract - field names. You may deviate when the advisor agrees. Record each deviation **inline, under the work - item's Progress block**, naming the alternatives you considered and why each was rejected - (knowledge-base rules, [docs/ai-and-plans/README.md](../../../README.md)). Never rewrite the plan text - to match what happened. -4. **The provisional answers in §1 are not decisions.** Implement them as written, keep them easy to change - (one constant, one setting, one branch of code), and list them in every PR description until the - operator confirms them. Once confirmed, append a decision entry to `decisions.md`. +Decisions 0001–0008 bound the original plan. Implementation details and the provisional answers +below were guidance, not approval to change intent. Conflicts went to the named checkpoint and, +for design changes, the operator; deviations and rejected alternatives are recorded against each WI. ### Progress recording @@ -67,21 +57,8 @@ and just as plainly, what was not. ### Operator tests: announce them clearly -Some checks need the operator: a real cluster, a long wait, a real account, or the packaged VSIX. When -the work reaches one, **stop** and post a message whose first line is: - -> **⏸ OPERATOR TEST NEEDED: OP-n, ** - -followed by: - -- **why** it is needed now, and what it blocks; -- **setup:** the build to install, the cluster and account, and the settings; -- **steps**, numbered; -- **what to send back:** output-channel lines, screenshots, pass or fail per step. Never include tokens; -- **an estimated duration**, including waits. - -Do not continue past the blocked step until the operator replies. Work that does not depend on the -result may continue, but say so in the message. Record the result in the Progress block of the WI. +These are operator checks, not unit tests. Each needed the candidate, setup, expected result, +sanitized evidence and elapsed time. Only work depending on the check had to wait. | OP | When | Test | | ---- | ------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | @@ -94,26 +71,9 @@ result may continue, but say so in the message. Record the result in the Progres ### Per-PR workflow -- **Branch:** create `dev/tnaum/` from the preceding PR's head and target that branch while - the preceding PR is open. If it is already merged, branch from and target - `feature/connection-lifecycle`. Do not wait for intermediate approvals or merges; the operator - handles those. The advisor checkpoints and explicit operator decisions and tests still apply. -- **Publish:** pushing the topic branch and opening its draft PR are pre-approved (decision 0006). - Do not pause for separate publication confirmation. Normal review and merge requirements remain. - Prefix the GitHub title with the plan number, for example `PR0:` or `PR1:`. -- **Commits:** one or more commits per WI, never one commit that mixes two WIs. Each commit ends with the - `Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>` trailer. -- **While working, and for draft PRs:** Case 1 only: `npm run build` plus `npx vitest run `. - If you edit `packages/*/src`, run `npm run build` in that package before the root tests; root tests - import the package's `dist`. -- **Ready for review:** Case 2 in full (copilot instructions). Run `npm run l10n` before `l10n:check` - whenever a `vscode.l10n.t()` string changed. -- **AI pre-review:** run the review (CONTRIBUTING §6) and commit it as - `iterations/01-pr--review.md`, for example `01-pr1-entra-renewal-review.md`. When this folder - reaches three or more iteration-1 documents, ask the operator before promoting it to an - `iterations/01-…/` folder. Moving the files breaks links in the issues. -- **PR description:** name the WIs, the issues (next section), the provisional answers (§1) the PR relies - on, the checkpoint verdicts it implements, and which verification case ran. +The [implementation plan's delivery section](./01-implementation-plan.md#delivery) owns the stack +and verification rules. Sub-PRs could open before their predecessors merged; operator gates and +approvals still applied. Each PR reported its WIs, issues, provisional answers and verification level. ### Issues: link them, and comment on partial fixes @@ -500,109 +460,6 @@ verdict exists, do not start the work it gates. The fingerprint table (formerly - An expired token that the server rejects is renewed silently. The extension relies on the server's answer, not on local expiry checks (decision 0010). -**Read first:** - -- `MicrosoftEntraIDAuthHandler.configureAuth`, and `MicrosoftEntraIDAuthHandler.test.ts`; -- `buildOidcClientConfiguration` in `oidcClientOptions.ts`; -- `documentdbTokenResource.ts`: `resolveInteractiveTokenResource` and the provider and env helpers; -- the JWT decoding in `playgroundWorker.ts` (the OIDC callback, around `tokenRequest`); -- `tokenExpiry.ts`; -- `entraErrors/entraTokenFailures.ts`; -- the error-translation skill. - -**Steps:** - -1. **Driver contract test (CP-0 evidence).** - - Add `src/documentdb/auth/driverOidcContract.test.ts`. It imports the driver's internal OIDC workflow - modules (use an ESLint disable comment, like the existing deep import) and drives them with a fake - `connection.command`. - - It asserts: - - (a) after the callback throws once, the next `fetchAccessToken` rethrows the same error (F-1); - - (b) `speculativeAuth` sends the cached token, whatever `expiresInSeconds` was (F-2); - - (c) code 18 calls the callback again and uses the new token; - - (d) a network error does not. - - Name the suite so it reads as a contract: `driver contract: mongodb OIDC workflow (7.2.0)`. If a - driver upgrade breaks it, the strategy has to be reviewed again. -2. **CP-0.** The strategy is **decided** (T-1, decision 0010): rely on the server. No proactive - rotation and no local expiry checks. An expired token is rejected with code 18, and the driver calls - our callback, which renews silently (step 5). - - Add **tracing** that makes this visible without logging tokens: each callback call with its - outcome (C-3), and the server error code or socket error that preceded it. - - Then **stop and hand OP-1a to the operator** (§0, operator tests). Today's callback returns the token - captured at connect, so OP-1a can only tell code 18 apart from a socket close; it **cannot** show - renewal. - - **A new socket on the same client** is what is under test. A new client would discard the token - cache. Add `maxIdleTimeMS=60000` to the test connection string, so the idle pool drops its sockets - and the next operation authenticates a fresh socket on the same `MongoClient`. - - The evidence is the trace line (server code or socket error, then whether the callback ran), not - "the query worked": a query on a socket that is already authenticated proves nothing. - - Act on the result: - - **code 18, then a second callback, then success:** nothing more to do; - - **socket closed or reset, with no callback:** the driver keeps its stale cached token, so retrying - on the same client cannot recover. Add a WI-5 classifier rule: on an Entra client, a closed - connection during authentication is `clientClosed`, so the next **foreground** operation creates a - new generation with a fresh token cache. No local expiry check (decision 0010). - - Record the result and the rule, if one was added, in Progress. - - **After step 5, hand OP-1b to the operator:** the same setup on the changed handler. Pass when the trace - shows the expiry signal, a callback with outcome `returned`, and a successful operation, with no - prompt. - -3. **Session helper.** - - Add `src/documentdb/auth/entraSession.ts`. It calls `vscode.authentication.getSession` with an - **explicit** provider ID, normalizes the scopes (same rules as `getSessionFromVSCode`: `.default` - suffix plus `VSCODE_TENANT:`), and takes the `account` and mode (`interactive` = `createIfNone`, - `silent`, `forceNew`) as parameters. - - Replace the deep import in `MicrosoftEntraIDAuthHandler.ts` with it. This takes the handler off the - azureauth internal path, so PR 1 and PR 2 do not collide. - - Read the provider ID through the existing seam in `documentdbTokenResource.ts`, so that PR 2 migrates - a single place. -4. **First acquisition.** Keep it as it is: interactive, reached only through the tree's first connect - (C-6). Then record C-1 from - `session.account` and the provider ID that was actually used, and return it on `AuthHandlerResponse`. -5. **The callback.** Replace the closure over `session` with: - - a silent lookup pinned to the provider, scopes, tenant and `account`; - - if the provider in use differs from the pinned one: `EntraSignInRequiredError('providerChanged')`; - - no session: `EntraSignInRequiredError('noSession')`; - - `session.account.id !== pinned.accountId`: `EntraIdentityMismatchError`; - - any other thrown error: `TokenCallbackError` (keep the cause); - - a result of `{ accessToken, expiresInSeconds }`, where `expiresInSeconds` comes from the JWT `exp`; - - a C-3 notification for every completed lookup, including misses and failures. - - Leave `buildOidcClientConfiguration` untouched; it still checks the destination policy around the call. - -6. **Shared JWT helper.** Move the JWT `exp` and `iat` decoding into `tokenExpiry.ts` as - `readJwtTimes(token)`, returning `{ iatSec?, expSec? }`. Use it in the handler and in - `playgroundWorker.ts`. An unknown `exp` stays unknown (`undefined`). The worker keeps its own fallback - TTL; WI-9 must not report that fallback as a measured value. -7. **Failure registry.** A silent miss and an identity mismatch are **not** recorded as token failures, - as the existing comment requires. A `TokenCallbackError` is recorded through - `recordEntraTokenFailure`, with its `classifyEntraError` rule. -8. **Explanation.** - - Register an `ErrorExplanationService` provider (id `entraSignInRequired`) that walks the - `cause` chain, and the server-selection `reason` if the driver wraps the error, looking for C-2 - names. - - It returns: - - "Your Microsoft sign-in for '{cluster}' expired. Sign in again to continue."; - - for a mismatch: "VS Code returned a different Microsoft account for '{cluster}'…". - - Text only, no UI (skill rules). - - The cluster name comes from the request's `clusterId`. Find out how existing providers resolve a - display name; if none do, use a generic "this connection" rather than adding a lookup. -9. **Telemetry trace.** Extend the existing `traceAuthFlow` usage to the callback, with bounded values - only. WI-9 adds the counted event; do not emit it here. - -**Tests** (extend `MicrosoftEntraIDAuthHandler.test.ts`): - -- a second callback asks the provider again, pinned, with `silent: true` and **never** `createIfNone`; -- the same token bytes while the token is still valid are accepted; -- no session gives `EntraSignInRequiredError`; -- a different account gives `EntraIdentityMismatchError`; -- a changed configured provider gives `providerChanged`, and `getSession` is never called with the new - provider; -- the destination policy is still enforced before and after; -- `expiresInSeconds` comes from the JWT, and an opaque token leads to an unknown value, not 0; -- the registry is not touched for silent misses; -- the explanation provider recognizes a C-2 error wrapped two levels deep. - **Done when:** - Case 1 is green; @@ -666,92 +523,6 @@ verdict exists, do not start the work it gates. The fingerprint table (formerly with an action. - A healthy warm worker never reads `CredentialCache`. -**Read first:** - -- `ShellSessionManager`: `initialize`, `buildInitMessage`, the token relay and the shutdown paths; -- `PlaygroundEvaluator`: `evaluate`, `buildInitMessage`, the token relay and the worker lifecycle; -- `playgroundWorker.ts`: the OIDC callback and the `tokenError` handling; -- `workerTypes.ts`; -- the sovereign-clouds `decisions.md` D12 and finding E4 - (`sovereign-clouds/iterations/02-copilot-feedback-and-edge-case-review.md`); -- `ShellSessionManager.test.ts` and `PlaygroundEvaluator.test.ts`. - -**Steps:** - -1. **Snapshot and surface binding.** - - Extend the D12 session snapshot with C-1: `providerId`, `accountId` and `tenantId`. Capture them on - the **first** token relay of a newly spawned worker. - - The first relay is silent and pinned when the host has a verified identity for the cluster - (`lastVerifiedIdentity`, WI-4). Only when the snapshot has no pinned account yet may it be - interactive, because opening a shell or running a playground is user-initiated. No separate - "initial acquisition pending" flag. - - Every later relay uses `entraSession.ts` in silent mode with the pinned account, and the same C-2 - errors as WI-1. - - **Where the fingerprint lives (F-23).** A shell stores its fingerprint string (C-4) on its terminal - session, which lives as long as the terminal. A playground stores it on the **document's** - `PlaygroundConnection` in `PlaygroundService` when the document is bound to a cluster, never on the - evaluator, which is shared per cluster and deleted on shutdown. Every Run compares the document's - fingerprint, whether or not a worker is warm. Neither joins the surface registry; teardown finds - shells through `getRegisteredShellTerminals` and playgrounds through `PlaygroundService` (WI-7). Before an automatic respawn - (`ShellSessionManager.evaluate`, `executePlaygroundCode.ts`), compare the fingerprint of the current - credentials with the stored one, and check the cluster latch (C-6): - - same fingerprint and not latched: respawn as today; - - a different fingerprint, or latched: do not respawn. Print the reason and the action. - - Only an explicit recovery (Sign in again, Reconnect) may respawn under a new fingerprint. -2. **IPC.** - - Extend `tokenError` with an optional bounded `reason`. Its values are `signInRequired`, - `identityMismatch`, `destinationRejected` and `refreshFailed`. Keep the existing allow-list pattern - of `errorName`. - - The worker rebuilds an error with the matching C-2 `name`. - - Add an optional bounded `authReason` to `initResult` and `evalError`, so that the reason survives both - **init** and a **warm evaluation**. - - **Update `WorkerSessionManager`'s error reconstruction** for init and eval (F-16). Today it builds a - plain `Error` and keeps only `EntraDestinationRejectedError`. Test the whole path: worker → manager - → surface. - - Never send token values over IPC except the existing `tokenResponse`. -3. **Host behavior when the reason arrives.** - - **Shell:** print one localized line, "Microsoft sign-in expired for this shell. Run 'Sign in again' to - continue.", plus a terminal link or a non-modal notification with **Sign in again**. Never a modal - (A1). - - **Playground:** show the same as the run's error output, with an action. - - **Sign in again for a worker:** under F-1 the worker's own driver workflow is broken. After a - successful interactive acquisition **for the pinned account**, restart the worker session. The shell - keeps its terminal and prints "Reconnected". The playground respawns on the next run. - - A different account is an identity change (0003): the shell prints "Signed in as a different account; - open a new shell to use it". Do not rebind. - - **Any other token failure (F-1).** A `refreshFailed` reason, or any other error thrown from the - worker's OIDC callback, whatever the auth method (Entra or managed identity), leaves the worker's - `MongoClient` broken while the worker process stays alive, so the automatic respawn (F-15) never - runs. Mark the worker session as broken when such a reason arrives. The next command, or the next - playground run, stops the worker and respawns it under the **same fingerprint**, using the respawn - rule in step 1. Print one line, without a modal. -4. **#1059 note.** - - Call `PlaygroundEvaluator.buildInitMessage` only when a worker is spawned. - - A warm run on the same cluster reuses the stored init. - - A run against a different cluster, or a dead worker, spawns as it does today. -5. **E4.** A late token response or error from a disposed or replaced worker must change neither state nor - diagnostics. Ignore messages from a worker that is no longer the session's current worker (compare the - worker object); no extra ID. - -**Tests:** - -- Extend the two existing suites: - - the second relay is silent and pinned; `createIfNone` is never used after the initial acquisition; - - a changed provider fails closed; - - a mismatched account fails closed; - - the reason reaches the host during init **and** during a warm `evaluate`; - - a warm evaluation does not read `CredentialCache` (spy); - - a late relay result from a replaced worker is ignored; - - after the cluster's credentials change to another user, the next shell command does **not** respawn - silently; it prints `credentialsChanged`. A password-only change does respawn; - - a latched (disconnected) shell or playground does not respawn on its next command; - - a playground document bound as identity A, left open while the cluster moves to B (and its evaluator is - shut down and recreated for another document), does not run as B; it prints `credentialsChanged` - until the user rebinds it; - - after a `refreshFailed` token error (Entra and managed identity), the next command respawns the - worker once under the same fingerprint, and the command after that runs on the new worker. -- Add a test of the worker message round trip for `reason` and `authReason`. - **Done when:** Case 1 is green, and the relay PR pre-review is committed. **Progress:** @@ -782,92 +553,6 @@ verdict exists, do not start the work it gates. The fingerprint table (formerly - The ARM challenge works. - Diagnostics reports "Azure sign-in needed" for ARM sign-in failures. -**Read first:** - -- issue #990: `gh issue view 990 --comments`. It is the checklist. -- `AzureSubscriptionProviderWithFilters.ts` and `subscriptionFiltering/*`; -- `azureClients.ts`; -- `classifyResolutionFailure` in `resolveTarget.ts`, and its tests; -- the azureauth import list in #990. - -**Steps:** - -1. **Version selection (CP-W3), under the A4 policy: as high as viable without breaking our workflows.** - - Findings on 2026-11-19: - - The **Azure Resources extension** (`vscode-azureresourcegroups` `main`, 0.13.x) uses azureauth - `^6.1.0-alpha.2`, azureutils `^4.3.0` and utils `^4.1.0`. - - azureutils `4.3.0`, `5.0.0` and `5.1.0` all require azureauth `^6.1.0-alpha.2`. - - Our azureutils `4.2.0` requires `^6.0.0-alpha.6`, which **does not** accept `6.1.0-alpha.x`. - - utils `4.1.1` and later, including `5.x`, require `@microsoft/vscode-azureresources-api` - **`^3.1.1`**. We are on `~2.5.0`; version 3 moved the package to CJS+ESM and finalized the auth - challenge API. We use it in about 30 files, mostly for `AzureSubscription` types, plus the Azure - Resources branch and workspace providers, `getAzureResourcesExtensionApi` and `unwrapArgs`. - - **utils 5.0.0's only breaking change** removes the experimentation (TAS) API, which we do not use. - The other public typings from 4.1.0 to 5.1.0 are additive (workflow telemetry, - `openReadOnlyFile`, `authentication` on subscription context). Whole-error masking in - `callWithTelemetryAndErrorHandling` is unchanged. - - azureutils `5.0.0` only bumps it to utils v5; `5.1.0` loosens the Azure client type generics. - - In our lockfile, only azureutils depends on the other azext packages, so the root manifest - controls all versions. - - The ladder (try from the top, stop at the first that passes): - - | Level | azureauth | azureutils | utils | azureresources-api | Note | - | --------------- | --------------- | ---------- | -------- | ------------------ | ---------------------------------------------------------- | - | **L2 (target)** | `6.1.0-alpha.2` | `~5.1.0` | `~5.1.0` | `~3.1.1` | Highest available; ahead of Azure Resources on utils | - | L1 | `6.1.0-alpha.2` | `~4.3.0` | `~4.3.0` | `~3.1.1` | Parity with Azure Resources | - | L0 | `6.0.0-alpha.8` | `~4.2.0` | `~4.1.0` | `~2.5.0` | Minimal; only if L1 breaks a workflow that cannot be fixed | - - - Before choosing, check the lockfile of the Azure Resources release that is published for the utils - and azureauth versions it actually resolved. - - For each level tried, record: - - `npm ls` for all four packages: exactly **one** copy each; - - the number of `npm run build` errors and what kind they are; - - the bundle scan from #990 for duplicate copies and the broken ESM init pattern; - - `flagging-fresh-dependencies` on the resulting lockfile. - - **"Not breaking our workflows" means all of these pass:** - - Azure Resources view: vCore and RU nodes, and the workspace resource provider; - - Discovery: vCore, RU and VMs, with subscription and tenant filters; - - sign-in, account changes, MFA and cloud switches; - - deep links (`/connect/azure`, with and without a tenant ID); - - every `AzureWizard` flow; - - the **packaged VSIX** (`npm run package`) loads and activates, and the checks above pass on it, - not only on a dev build; - - the masking test in the telemetry-masking memory: a property containing "error" is still redacted. - - Choose with the advisor. If L2 needs more than mechanical changes in the `azureresources-api` 3 - consumers, step down to L1 and record why. - -2. **Migrate the APIs** at every call site that #990 lists: - - `getSubscriptions` → `getAvailableSubscriptions`; - - accounts and tenants; - - `signIn`; - - `onRefreshSuggested`; - - the provider class paths; - - the type-only imports. - - Keep the subscription-filter override effective, and keep the tenant filter as **one** mechanism - (#990 asks you to choose; recommended: keep the extension's `globalState` tenant filter as it is). - -3. **Shared seam.** Migrate `documentdbTokenResource.ts` (`getConfiguredAuthProviderId`, - `getConfiguredAzureEnv`). That is the single seam WI-1 reads. If PR 1 merged first, re-run the WI-1 - tests. -4. **Stored subscriptions.** Confirm that v6 `credential.getToken` and `authentication.getSession` acquire - a token on **every** call. - - Add a unit test: a stored `AzureSubscription` whose first session "expires" still lists clusters on - the second call. Use a mocked session sequence, and go through `createSubscriptionContext` the way - `azureClients.ts` does. -5. **Diagnostics.** - - In `classifyResolutionFailure`, classify these as `signInRequired`: - - the package's `isNotSignedInError` guard; - - a failed challenge; - - `interaction_required` or an AADSTS sign-in error, matched by name or code, never by free text where - a typed signal exists. - - The report stays bounded: error name and status only. - - Replace the test that manufactures `name: 'NotSignedInError'` with the **real** v6 exception shape - (`name: 'Error'`, no status) recognized by the guard. - - Do not assume ARM never prompts: a challenge can ask for step-up. -6. **l10n.** Refresh `l10n/@microsoft/vscode-azext-azureauth/bundle.l10n.json` as #990 describes, then - run `npm run l10n` and `npm run l10n:check`. - **Done when:** - Case 1 is green; @@ -938,103 +623,6 @@ shim (0005). - A closed topology is replaced, never reconnected with old options. - `getClient` never prompts (C-6). -**Read first:** - -- `ClustersClient`: `getClient`, `initClient`, `initializeClient`, `connect` and `deleteClient`; -- `ClustersClient.test.ts`; -- `connectionAuthIdentity.ts`; -- the tree-cluster-architecture skill (dual ID); -- the Kubernetes and Atlas reachability providers (how a tunnel rewrites the host). - -**Steps:** - -1. **Fingerprint** (`src/documentdb/connectionFingerprint.ts`, pure). - - It hashes two inputs (SHA-256, hex, truncated) into an opaque string: - - the **stored connection string without its password**, as it was before reachability rewrote the - host to `localhost`. It carries the hosts, the database path and any `authSource`, so F-17 needs no - special handling; - - the **principal**: the native user name; Entra `providerId` + `accountId` + `tenantId` (C-1); the - managed identity client ID, or `system-assigned`; or `none`. - - **No normalization.** Any edit to the connection string counts as an identity change. That fails - closed: the user sees "credentials changed" once and reconnects. - - The Entra `providerId` is part of it, so a provider or cloud change is an identity change too. - - **Known limitation:** if an admin replaces a resource's system-assigned identity, the principal - changes but the fingerprint does not. That is not the user-driven identity switch that 0003 guards - against; document it. - - Table tests, reviewed as part of the PR: - - a password-only change keeps the fingerprint, including an RU key rotation; - - another user changes it; - - an edited connection string changes it; - - two managed identity client IDs differ; - - stable fingerprints across Kubernetes local-port changes are deferred to #1105 - (operator amendment to decision 0009); automatic replacement still rejects a mismatch. -2. **Generation.** - - Keep a static `Map` that only ever increases and is never cleared. - - Each `ClustersClient` instance records `generation`, `fingerprint`, `createdAt` and its credentials - snapshot. - - Expose a read-only `binding` (C-4) and `ClustersClient.getBinding(clusterId)`. -3. **One startup at a time (single flight).** - - A `_pendingStartups` map keyed by `clusterId` holds the startup promise. Every caller awaits it. - - A caller's own `abortSignal` rejects only **that caller's** wait. It never aborts the startup, which - has its own timeout. - - The startup captures the C-6 epoch and publishes only if it is unchanged. Otherwise it closes its own - `MongoClient`. Its waiters then get the latch's `ConnectionUnavailableError` if the cluster is - latched, or retry once with the current credentials if it is not. - - `deleteClient` calls `invalidate` **before** its first `await`. -4. **`getClient` rules (C-6).** - - `initializeClient` stops hardcoding `{ interactive: true }`; `getClient` is always silent. Its options - are `{ trigger, abortSignal, background? }`. - - The interactive first connect moves to `ClustersClient.connectInteractive(clusterId)`, called only by - the tree items' `authenticateAndConnect` and by Sign in again. No per-call-site audit is needed: every - other caller acts on a cluster that the tree has already connected. - - Add a per-cluster `lastVerifiedIdentity` record (C-1 for Entra; the principal for other methods), - keyed by `clusterId` like `ClustersClient._clients`. It **survives eviction and Disconnect**, and only - Remove Connection clears it (WI-7, decision 0011). A silent reconnect is pinned to it. - - Add the latch check: a latched cluster throws `ConnectionUnavailableError(reason)` for every caller. - WI-7 sets the latch. - - Missing credentials throw `ConnectionUnavailableError('credentialsMissing')` instead of today's plain - `Error`, whose message shows the raw `clusterId` (F-20). - - Pass `background: true` from the dashboard poll, tree count badges and `CollectionNameCache`. -5. **Cached reuse.** - - Remove the abort handler that closes the shared client (the cached branch of `getClient`). - - A cancelled waiter just rejects with `UserCancelledError`. -6. **Closed topology.** - - Track closure with the public SDAM event `topologyClosed` on the `MongoClient`, plus our own `close()` - calls. - - A foreground `getClient` on a closed client publishes a **new generation**, using the **current** - `CredentialCache` and requiring the **same fingerprint**. A background caller fails instead. - - If the fingerprint differs, do not publish; throw `ConnectionUnavailableError('identityChanged')`. - - Today's `client._mongoClient.connect()` call on the cached path goes away. -7. **Telemetry helper.** - - Add `addEstablishedConnectionContext(context, clusterId | client)`. It sets `authMethod`, - `connectionCorrelationId`, and the measurements `connectionAgeMs` and `clientGeneration`. - - No property name may contain "error" (masking). - - WI-5 and WI-6 call it; add the helper and its tests only here. -8. **Development test hook** (optional, recommended). - - Add `vscode-documentdb.debug.connection.simulateExpiry`, following the survey debug commands: - - declared in `package.json`; - - registered only in development mode; - - listed in `LAZY_COMMANDS` with its reason. - - It (a) makes the next N Entra callbacks for a selected cluster behave like a silent miss, and (b) - force-closes the pool to simulate an idle drop. - - Use a dashed context key if one is needed. - -**Tests** (`ClustersClient.test.ts`, plus the new fingerprint test): - -- two concurrent cold `getClient` calls create one `MongoClient`; -- cancelling one of two waiters leaves the other connected; cancelling both does not abort the startup; -- a startup that finishes after `deleteClient` does not publish, and closes its client; -- a cancelled cached reuse does not close the shared client; -- `topologyClosed` followed by a foreground `getClient` gives a new generation with the same fingerprint; - a background `getClient` does not replace it; -- a changed principal followed by `getClient` gives `ConnectionUnavailableError('identityChanged')`; -- `getClient` never prompts, even with no client and with credentials cached; only `connectInteractive` - may, and only when the cluster has no `lastVerifiedIdentity`; -- a latched cluster rejects every caller, including background ones; -- missing credentials give `credentialsMissing`, with no `clusterId` in the message; -- generation numbers only ever increase across delete and reconnect; -- the telemetry helper sets the bounded properties and no forbidden names. - **Done when:** - Case 1 is green; @@ -1159,127 +747,6 @@ shim (0005). - **Sign in again** exists and prompts once per click. - A token callback failure never leaves a broken client cached, for any auth method. -**Read first:** - -- `ClusterItemBase.getChildren` and `createErrorRecoveryChildren`; -- `retryAuthentication.ts` and its test; -- the RU items: `MongoRUResourceItem.ts`, `RUCoreResourceItem.ts`, `ruClusterHelpers.ts`; -- the tree-cluster-architecture skill, "Failure Presentation: Actions Only"; -- the contract-test fixtures from WI-1. - -**Steps:** - -1. **Classifier** (`src/documentdb/connectionFailures.ts`, pure). Draft the table, then hold CP-2. - - It walks `cause`, plus `MongoServerSelectionError.reason.servers[*].error` where present. - - Carry-forward from [PR1 review R5](https://github.com/microsoft/vscode-documentdb/pull/1108#discussion_r4640902166): - recheck whether the installed driver can retain callback failures in per-server errors. If it - can, use the same bounded traversal for `EntraErrorExplainer`, test mixed-server failures, and - render only the rule-based explanation, not raw cause text. Recheck on driver upgrades. - - Initial table: - - | Signal | Auth | Kind | Generation | Offered action | - | ----------------------------------------------------------------------------- | ---------- | ---------------------------- | -------------------------------------------- | ----------------------------------------------- | - | `EntraSignInRequiredError` | Entra | `signInRequired` | replace on recovery (F-1) | Sign in again | - | `EntraIdentityMismatchError`, `ConnectionUnavailableError('identityChanged')` | any | `identityChanged` | evict; surfaces unavailable | Reconnect (rebind) | - | `TokenCallbackError` (step 2) | Entra, MI | `transient`, workflow broken | replace on the next **foreground** operation | Retry | - | `ConnectionUnavailableError('credentialsMissing')` (F-20) | any | `credentialsMissing` | none to keep | Update credentials | - | code 18 | Native, RU | `credentialsRejected` | evict; no automatic retry | Update credentials (RU: Retry re-reads the key) | - | final code 18 | Entra | `credentialsRejected` | evict; no automatic retry | Sign in again with a verified Entra identity | - | `MongoNotConnectedError`, `MongoTopologyClosedError` | any | `clientClosed` | new generation on the next foreground call | none | - | network errors, timeouts, server selection with no auth cause | any | `transient` | keep | Retry | - | anything else | any | `other` | keep | existing behavior | - - - **No regression for tunneled connections:** connection refused against a Kubernetes port-forward - port is `transient`. The client is **kept**, never evicted, so the tree's existing tunnel restore - (`beforeCachedClientConnect`) still recovers it. Tunnel recovery itself is #1105. - -2. **Callback failures for every auth method (F-1).** - - F-1 applies to **every** throw from the OIDC callback. The managed identity callback - (`ManagedIdentityAuthHandler.configureAuth`) rethrows token-service (IMDS) failures and throttling as - they are, so today they fall to `other → keep`, and the broken client stays cached until VS Code - restarts. - - Both handlers wrap such errors in `TokenCallbackError` (C-2). Destination rejection keeps its current - handling. - - The classifier treats it as `transient`, workflow broken: `reportFailure` marks the client, and the - next **foreground** `getClient` replaces it with a new generation and the same fingerprint. -3. **Report failures.** - - Add `ClustersClient.reportFailure(binding, error)`: a function, not a service. It classifies the - error and ignores it when `binding.generation` is stale. It evicts or marks the client according to - the table, and returns the kind so the caller can choose its UI. - - It keeps no connection state and fires no events (C-5). - - **Every operation reports its own failure.** A client can resolve and then fail authentication - **during** a read, save or ping. Add one thin function, `runWithClient(binding, op, { background? })`: - it resolves the client (WI-6), runs `op`, and on a throw calls `reportFailure`. For a terminal kind - (`signInRequired`, `credentialsRejected`, `credentialsMissing`, `identityChanged`) it returns the - structured unavailable result (C-5); otherwise it rethrows. Every WI-6 router operation and WI-8 - ping goes through it. It keeps no state (decision 0013). -4. **Tree.** - - Route both catch paths in `getChildren` (cached-client reuse and `listDatabases`) through - `reportFailure`. Keep the modal-plus-actions presentation. - - Change `createErrorRecoveryChildren` to: - - **Retry sign-in** when the kind is `signInRequired` or `credentialsRejected` and the - Entra identity and settings are available, or **Update credentials** (the provider-owned - action that exists today); - - then Diagnose; - - then Open shell; - - then **Retry last**, except when **Retry sign-in** is offered in its place. - - Check that order against the skill text, and update the skill in WI-10 if it differs. - - Call `addEstablishedConnectionContext` on the failure events of `connect`, `getchildren` and the tree. - - **Keep credentials on recoverable failures (F-20).** In every provider item's `authenticateAndConnect` - failure path, still call `deleteClient`, but call `CredentialCache.deleteCredentials` only when the - kind is `credentialsRejected`, or `other` as today. For `credentialsRejected` with a verified - Entra identity, retain the in-memory settings for explicit **Sign in again** (decision 0014). - For `transient`, `clientClosed` and - `signInRequired`, keep the entry: a network outage during a tree expand must not leave open surfaces - with nothing to reconnect from, nor make the user retype a discovery password. Put the decision in - one shared helper, not in ten copies. -5. **Retry.** - - `retryAuthentication` evicts the client (`deleteClient` without clearing credentials) when the last - kind was `signInRequired`, `credentialsRejected` or `clientClosed`, and then refreshes. - - It captures the C-6 epoch **before** its first `await`. If the epoch changed in the meantime (a - Disconnect, or another recovery replaced the client), it does nothing destructive: no eviction, and - no latch cleared. - - The `CredentialCache` entry is kept. - - **RU key exception:** on Retry after `credentialsRejected` for an RU Discovery or Azure Resources - item: - - drop the cached key and re-read it from ARM once (`extractCredentialsFromRUAccount`); - - an ARM sign-in failure there is reported as "Azure sign-in needed" (WI-3 classifier), not as a - database rejection; - - never open a password wizard. -6. **Sign in again** command (`vscode-documentdb.command.signInAgain`, args: a tree node or `{ clusterId }`). - - Read the pinned C-1 from the cluster's `lastVerifiedIdentity` record (WI-4). Capture the C-6 epoch - **before** prompting. - - Call `entraSession.ts` with `forceNewSession` for that account and tenant, every time. The user - clicked, so one prompt is expected, and it also covers a session that the silent lookup still - returns but the server rejects. - - **After the prompt, check the epoch.** If it changed while the user was signing in (for example, a - Disconnect), do not evict, do not reconnect and do not clear the latch. Report "The connection was - closed while you were signing in." - - Same account: evict and start a new generation. - - Different account: the identity changed. Surfaces bound to the old fingerprint become unavailable - with `identityChanged` (C-5), and the tree continues with the new identity. - - A dismissal is a `UserCancelledError`. Nothing re-prompts, because `getClient` never prompts (C-6). - - There is no `onDidChangeSessions` listener (decision 0012). A signed-out account is found by the next - operation's silent lookup, which fails with `signInRequired`. - -**Tests:** - -- classifier table tests on real error shapes; -- a managed identity callback that throws once: the next foreground operation works on a new - generation, and a background tick does not replace the client; -- Retry after `clientClosed` creates a new generation; after `credentialsRejected` it keeps the - credentials and does not loop; -- the RU old/new key pair; an ARM sign-in failure compared with a database rejection; -- Sign in again with the same account and with a different account, always with `forceNewSession`; -- no re-prompt after a dismissal; -- a stale-generation result is ignored; -- an old Retry that resolves after the client was replaced does not evict the new client; -- Sign in again that completes after a Disconnect does not reconnect or clear the latch; -- with the tree untouched, an OIDC callback failure during a Document View read offers the recovery - action (through `runWithClient`), and the next foreground read gets a new generation; -- a tree expand that fails with a network error keeps the `CredentialCache` entry, and an open surface - then reconnects silently once the network is back; a code 18 failure still evicts it. - **Done when:** - Case 1 is green; @@ -1384,134 +851,17 @@ webview as a structured unavailable result, not a generic query error. - They never apply stale results. - They never run under another identity. -**Read first:** - -- the webview-trpc-messaging and react-webview-architecture skills; -- `collectionViewRouter.ts`, `indexesTab/indexViewRouter.ts`, `queryInsights/queryInsightsRouter.ts` - and `queryInsightsEventsRouter.ts`; -- `QueryInsightsAIService.ts` and `indexAdvisorCommands.ts`; -- `documentsViewRouter.ts` and `documentView.tsx` (the `isDirty` state); -- `clusterDashboardRouter.ts` and `ClusterDashboard.tsx`; -- `collectionViewContext.ts`; -- `openAppWebview.ts`; -- `build/verification/browser/scenarios.ts` and `fixtures.ts`. - -PR 5 is one PR. Split it into host and webviews only if the diff becomes too large to review well, as the -approved plan allows; the webview half then stacks on the host half without waiting for it to merge. - ### Host -1. **Surface registry** (`src/documentdb/connectionSurfaces.ts`). - - A plain list per `clusterId`: `register({ clusterId, kind, disable(reason), dispose, isDirty? })` - returns a disposable. - - Collection View, Document View and the Dashboard register when they open and unregister on - `onDisposed`. - - Only teardown reads it (WI-7). Shells and the playground do not register (WI-2). -2. **Binding resolution.** - - `resolveBoundClient(binding, { background? })` has two outcomes: - - **the same fingerprint:** return the cluster's current client, whatever its generation. Replacing a - client for the same identity is transparent: no re-run and no notice (decision 0010). If there is - no client and the cluster is not latched, `getClient` reconnects silently, pinned to - `lastVerifiedIdentity`; - - **a different fingerprint, or a latched cluster:** throw `ConnectionUnavailableError(reason)`. - - A surface **never** prompts (C-6). - - Router procedures run their operations through `runWithClient` (WI-5 step 3), so failures **during** - the operation are classified too, and return a structured `{ unavailable: { reason, text, action } }` - result instead of an error (F-12). - - **No regression for tunneled connections** (Kubernetes `ClusterIP` through port-forward). Creating a - new generation from this path may not do less than today's tree path, and it does not re-create - tunnels. A tab whose tunnel died behaves as it does today: it fails transiently until a tree expand - restores the tunnel. Re-creating the tunnel outside the tree is #1105. -3. **`ClusterSession`.** - - It stops holding a `ClustersClient`, and stores the binding instead. - - `getClient()` becomes an `async` resolve. - - Update its callers: - - the Collection View router; - - the Query Insights routers; - - `QueryInsightsAIService`; - - `indexAdvisorCommands`. -4. **Routers without a session.** - - Document View, the index router and the Dashboard capture the binding when the panel opens (in the - controller's config and tRPC context), and resolve it for every operation. - - Re-run the grep from the approved plan, and list every converted call site in Progress. -5. **Writes.** - - Save document, inserts and deletes, and index create, drop, hide and unhide. - - The extension **never resubmits** a write; that is OT-4's "not replayed". A failed write is reported - as it is today, and never with text that claims the write was not applied: when the reply was lost, - the server may have applied it (F-22). The driver's own retryable writes (`retryWrites`) stay as they are: the server - deduplicates them by design, and RU connection strings disable them. - - Test that one application-level submission results in exactly one call to the driver. -6. **Stale results.** - - Every request records the C-6 **epoch** when it starts. - - **Before any host-side mutation**, check once that the epoch is unchanged, that the binding still - resolves to the same fingerprint, and that the cluster is not latched. Otherwise drop the result. - Disconnect, Reconnect and every eviction bump the epoch, so a reply that started before a Disconnect - is dropped even after a Reconnect as the same user. That covers `ClusterSession`'s - `_currentRawDocuments`, its query caches, the Query Insights caches and `SchemaStore` updates. A stale - result must not change host state at all. -7. Every router error path uses `addEstablishedConnectionContext` (WI-4). +Capture a binding rather than a physical client; re-resolve for the same identity and reject +stale replies before mutating caches or issuing a write. Import/export from a view carries that +origin to the transfer's first operation; a tree command uses the selected current connection. ### Webviews -1. **Shared UI.** - - A feature-local `DisconnectedOverlay` uses a controlled Fluent `Dialog` to dim the webview - and show the host-provided reason in the center. Show **Close view** and at most one supported - repair action (decision 0016). Focus stays in the dialog; Escape and backdrop clicks do not - dismiss it or close the view. - - It shows when a procedure returns `unavailable`, or when the host's `disable(reason)` sends its one - message to the panel over the existing webview channel. - - Put it in the shared webview components folder, and run the detecting-accessibility-issues skill on - it. -2. **Disabling.** - - While the overlay shows, every action that talks to the server is disabled: run query, paging, - refresh, save, delete, insert, index actions, Query Insights stages and AI calls. - - The underlying view is inert. Editors stay mounted and retain their contents and dirty state. - - A response that arrives while the overlay shows is ignored. - - **A reply never overwrites a newer edit.** The Document View applies a save or load reply to the editor - only if the editor content has not changed since the request was sent; otherwise it keeps the edit and - stays dirty. Today's save handler (`documentView.tsx`) replaces the content and clears `isDirty` - unconditionally. The Collection View applies a page only for the latest query request it sent. -3. **What each view keeps.** - - **Collection View:** query text, filter, sort, projection, page number and size, the selected tab, - and the Query Insights results as they were. - - **Document View:** the dirty editor content and `isDirty`. - - **Dashboard:** the last data (WI-8 stops the polling). -4. **Actions.** - - **Retry:** resolve only the original fingerprint, silently and without clearing a latch. - After a same-identity repair in the tree, recovery removes the overlay without replaying the - failed operation. The live region announces "Reconnected"; there is no out-of-date notice - (decision 0010; see #1106). Sign-in and credential changes stay in the tree. - - **Close view:** the only action after an identity change or removal. Reopen from the tree - to use a different identity. A dirty Document View warns that closing discards unsaved - changes; do not open a second prompt (decision 0017). -5. **L2-dev scenarios** (`scenarios.ts` and `fixtures.ts`): - - `collectionView/disconnected-signInRequired`: query text kept, Run disabled, no host calls when - Run is clicked; - - `documentView/disconnected-dirty`: edit kept, Save disabled; - - `clusterDashboard/disconnected`; - - a scenario that injects a disconnect after typing and then delivers a page response: the applied - results are not overwritten; - - `documentView/stale-save-after-reconnect`: send Save, Disconnect, Reconnect, edit again, then deliver - the old save reply: the new edit stays and the view stays dirty. - - Run them with the browser scenario config. Screenshots are artifacts, not baselines. - -**Transfers:** do not change how copy, paste or export work (approved plan). One addition: when Collection -View starts an import or export, it passes its binding's fingerprint in the command arguments (F-23). The -command checks it once, where it takes the WI-7 lease and before its first `getClient`. A mismatch stops -with `credentialsChanged` and nothing is written. Commands started from the tree carry no fingerprint and -behave as today. - -**Tests:** - -- router tests for both resolution outcomes on each converted router; -- `ClusterSession` no longer stores a client (a type-level or structural test); -- a stale result is dropped before any host-side mutation, including a reply that started before a - Disconnect and arrives after a Reconnect as the same user; -- the webview ignores a response that arrives while the overlay shows; -- one submission for a write whose reply is lost; -- an import started from Collection View as identity A, with its file picker left open while the cluster - moves to B, writes nothing until the user starts it again; -- the scenarios above. +Keep the editor mounted. The original plan proposed a disabled overlay with repair actions; +an old save or page reply must never replace a newer draft or query. The Progress block below +records the operator's subsequent choices; the [feature README](../README.md#intent) describes today's policy. **Done when:** @@ -1600,145 +950,6 @@ behave as today. This is the right level for an interactive tool; do not build per-operation admission control. -**Read first:** - -- `removeConnection.ts`; -- `resourceUsageHelper.ts` and `taskService.ts` (`getConflictingTasks`); -- `CopyPasteCollectionTask.ts` and `CopyIndexesTask.ts` (`getUsedResources`); -- `exportDocuments.ts` and `importDocuments.ts`; -- `deleteFolder/` (`ExecuteStep.ts`, `VerifyNoConflictsStep.ts`); -- `storageService.ts` `push` (F-21); -- `updateCredentials.ts`, including the D12 modal; -- `updateConnectionString.ts`; -- `CredentialCache.ts`, `entraTokenFailures.ts` and `SchemaStore.clearCluster`; -- the WI-6 registry; -- `switchAtlasViewMode.ts` (the `globalState` pattern). - -**CP-4 first:** the teardown order, T-2 and the export and import lease. - -**Steps:** - -1. **Export and import lease (A5).** - - Add `TaskService.acquireResourceLease(resource, label)`, which returns a disposable. - `getConflictingTasks` includes active leases. - - `exportDocuments.ts` holds the lease for the whole export, and `importDocuments.ts` for the whole - import (from the first `getClient` to the last flushed batch), on the target collection. - - Copy/paste and copy-indexes are tasks already and need no lease (F-9). - - `acquireResourceLease`, and starting a task, are refused while the cluster is latched (C-6), with the - latch's reason. The latch is what keeps new work out during a credential save (step 5). - - Test that export and import each conflict with Disconnect of their cluster and with Delete - Collection of their collection, and that an unrelated cluster does not. -2. **Teardown** (`src/documentdb/connectionTeardown.ts`): plain functions, with no reservation. The latch - is the only thing that can be undone, and only Update Credentials ever undoes it (step 5). Disconnect - and Remove call `confirmTeardown` and `commitTeardown` back to back. - - **`confirmTeardown(clusterId, intent)`**, which may prompt and may be cancelled. It changes nothing: - 1. **Conflicts:** task and lease conflicts through `checkCanProceedAndInformUser`. On a conflict, - stop; the conflicting task is named. - 2. **Choice:** Close all or Keep open (A2), only when surfaces are registered and the setting is - `ask`. With the setting at `closeAll` or `keepOpenDisabled`, use that value without a modal. - 3. **Dirty check** (only for `close`): if any registered surface reports `isDirty`, ask for - confirmation. Cancelling leaves every panel, draft and connection intact, also when Remove started - the teardown. - - **`latchForTeardown(clusterId, reason)`**, synchronous: recheck conflicts with `getConflictingTasks`, - because a copy, export or import may have started while a prompt was open; on a conflict return - `false` and change nothing. Otherwise set the latch (C-6), which already increases the epoch, - with no `await` in between, and return `true`. From here on no new task, lease or client can start. - - **`commitTeardown(clusterId, { reason, choice, dropCredentials })`**, which has no prompts: - 1. Call `latchForTeardown` unless the caller already did (step 5). On a conflict, stop and inform the - user; nothing has changed. - 2. **Surfaces:** for Keep open, call each registered surface's `disable(reason)`; for Close all, - dispose them. - 3. **Shells** (found through `getRegisteredShellTerminals`): print "Disconnected", then stop the - worker. **Playground:** stop the worker. The latch keeps both from respawning (F-15). - 4. Close the client (`deleteClient`). Clear the Entra failure registry and `SchemaStore.clearCluster`. - Clear the `CredentialCache` entry and `lastVerifiedIdentity` **only** when `dropCredentials` is - set (Remove). Disconnect keeps both (A3, decision 0011), so tree Reconnect and then tab Retry - can reuse the same identity. - 5. Refresh the tree (T-2). - - **Never touched:** VS Code auth sessions, the managed identity cache, the ARM cache. - - **Keys:** every store keeps its current `clusterId` matching. Provider-specific equality is out of - scope (decision 0009, #1105). Do not add case folding or unfolding in this iteration. - - **Kubernetes tunnels:** the teardown does not stop port-forward tunnels, and does not change how - removing a kubeconfig source works (#1105). -3. **Disconnect command** (`vscode-documentdb.command.disconnect`). - - Add a `connected` tag to the cluster item's `contextValue` while a client exists, and refresh it when - the item refreshes. Use `viewItem` regex menus in the Connections, Azure Resources and Discovery - views. - - **The choice (A2):** - - Use a modal warning: `showWarningMessage` with `{ modal: true, detail }` and the two buttons Close - all and Keep open (disabled). The built-in Cancel cancels the whole operation. - - The modal cannot pre-select a button, and nothing is remembered. - - Add a setting, proposed as `documentDB.connections.openTabsOnDisconnect`, with the enum `ask` - (default), `closeAll` and `keepOpenDisabled`. `documentDB.shell.multiLinePasteBehavior` is the - precedent for an enum with an `ask` default and `enumDescriptions`. - - Follow [settings/README.md](../../settings/README.md) for the group, `order` and the ID naming - rules. If an existing group fits better than `connections`, use it and record the final ID in - Progress. - - The same choice applies to Remove Connection. Saved connection edits keep old views open - and locked without asking for a tab choice (decision 0018). - - The setting never skips the unsaved-edits confirmation: when Close all is chosen and an editor is - dirty, that confirmation still appears. - - Skip the modal when no surfaces are registered. - - Add a disconnected cluster node child action, "Reconnect" (T-2). Check the `userDisconnected` - latch before reusing cached credentials when building the children. The action clears only - that latch and refreshes the node without changing its ID; normal expansion connects. -4. **Remove Connection and folder deletion.** - - Remove Connection: teardown with reason `connectionRemoved` and `dropCredentials: true`, then delete - the stored connection and clear the schema, as today. Keep the existing confirmation. - - **Deleting a folder** (F-23) runs the same teardown for **every connected descendant**, with **one** - combined `confirmTeardown` for all of them (conflicts, choice, dirty check), not one modal per - connection. It runs before `deleteFolder/ExecuteStep.ts` deletes anything. Cancelling leaves the - folder, its connections, panels, drafts and shells intact. Descendants without a client or open - surface still get their `CredentialCache` entry and schema cleared, as Remove does. -5. **Update Credentials and Update Connection String.** - - Follow decision 0018: do not classify edits into same- and different-fingerprint recovery - flows or ask whether to close tabs. Check for task conflicts, fence new operations while - persisting the edit, and make the save result explicit (F-19). - - **Storage decides, not the success flag** (F-21). Compare the relevant before/after stored - connection settings in memory, including credentials; never log or persist the comparison. - If storage is unchanged, release the save fence without retiring the old views. Preserve - existing failure reporting for a failed save. - - If storage changed, retire the old bindings, invalidate the old client and cached settings, - and push `credentialsChanged` to the affected views. They keep their contents but cannot - Retry; new views use the saved settings. If the save reported a failure, warn that the - change may be incomplete. Fence concurrent startup so it cannot publish the old credentials. - - Keep the existing identity checks for other sources of change. Silent token renewal, a - same-account sign-in and reconnect with unchanged settings do not retire old bindings. - - Add a **Disconnect** button to the D12 modal for open shells. -6. **Telemetry.** - - One `connection.disconnect` event with `source` (`command`, `remove`, `credentialsChanged`), - `surfacesChoice`, and counts of surfaces, shells and the playground, plus `blockedByTask`. - - No identifiers. - -**Tests:** - -- teardown for each surface type; -- blocked for a copy source, a copy destination, an export source and an import target; an unrelated - cluster is not blocked; Disconnect succeeds once the task is done or stopped; -- a token response that arrives after Disconnect is ignored; -- Reconnect uses the current credentials and cloud settings; -- after Disconnect, tree Reconnect followed by tab Retry succeeds without the tree reloading - credentials and without a prompt (native, Entra and discovery with a typed password); after Remove, - the `CredentialCache` entry and `lastVerifiedIdentity` are gone; -- Remove reuses the same teardown; -- cancelling the dirty prompt changes nothing; -- a copy, export or import that starts while the Disconnect prompt is open stops the commit, and nothing - changes; -- a shell or playground left open after Disconnect does not respawn on its next command; -- Disconnect while a query or save is in flight: whatever the operation's outcome, it is reported, its - reply changes no state, and nothing new is submitted under the old binding; -- an import attempted while Update Credentials is saving is refused with the latch's reason, and nothing - is half-applied; -- a save that fails before any write keeps the old binding and clears the latch; -- a cancelled or identical edit keeps old views usable; a saved password-only edit permanently - locks existing views with their contents kept and no tab-choice prompt; -- a save whose metadata write fails after the secret write ends in teardown under `credentialsChanged`, - never in a split state (old client, new stored secrets); -- deleting a folder with a connected child that has a dirty Document View and a live shell: cancelling - leaves everything intact; confirming leaves no usable client, cached credentials, shell or tab for the - child; -- a concurrent connect during Update Credentials does not publish the old credentials. - **Done when:** Case 1 is green, and the OT-7 flows can be reproduced on a dev build. **Progress:** @@ -1790,31 +1001,6 @@ behave as today. **Outcome:** the poll stops when the cluster is unavailable, shows the overlay, and resumes with exactly one loop. -**Steps:** - -1. `measureRtt` runs through `runWithClient` with `background: true`, so it never replaces a client - (T-4). It returns a structured result, `{ ok, rttMs } | { unavailable }`, instead of throwing. - - **Classify before the sampler stringifies (F-24).** `sampleClusterHealth` keeps the error object - of a failed command long enough to classify it. A terminal kind (auth, closed client) is rethrown so - that `runWithClient` returns `unavailable`. An unsupported command, such as `serverStatus` on some - servers, stays an ordinary partial sample with its entry in `errors`. -2. The webview poll effect stops on `unavailable` or a `disable` message, even when the dialog is - dismissed to copy contents. It starts again only after Retry succeeds. React's effect cleanup - keeps it to one loop; no extra loop token. -3. A ping that resolves while the overlay shows is ignored (the WI-6 webview rule), so it cannot clear the - overlay. -4. Visibility pause and backoff are the rest of #1091. Do them here only if they are trivial; otherwise - leave them to #1091. - -**Tests** (fake timers): - -- no client lookups on ticks or on reveal after Disconnect; -- a late success does not clear the overlay; -- reconnecting starts exactly one loop; -- `signInRequired` and `credentialsRejected` stop the loop after one tick, including when they happen - **inside** the sampler's ping with the tree untouched; -- an unsupported `serverStatus` still yields a partial sample and keeps polling. - **Progress:** - The Dashboard polls with a background-only binding. Auth and closed-client errors from diff --git a/docs/ai-and-plans/features/connection-lifecycle/iterations/01-implementation-plan.md b/docs/ai-and-plans/features/connection-lifecycle/iterations/01-implementation-plan.md index a9feb8ed4..7a51a362f 100644 --- a/docs/ai-and-plans/features/connection-lifecycle/iterations/01-implementation-plan.md +++ b/docs/ai-and-plans/features/connection-lifecycle/iterations/01-implementation-plan.md @@ -1,7 +1,7 @@ --- feature: connection-lifecycle kind: plan -status: active +status: historical created: 2026-11-19 code: - src/documentdb/auth/MicrosoftEntraIDAuthHandler.ts @@ -42,9 +42,9 @@ work. **It deliberately does not specify interfaces**: a dedicated agent designs following the decisions. Progress is recorded **inline, against each work item**, when that item is committed. -**Execution detail:** [01-dev-plan.md](./01-dev-plan.md) expands each work item into steps, cross-PR -contracts, advisor checkpoints and provisional answers to the open questions. Progress is recorded inline -there. +This is the original proposal, not current product policy. The [dev ledger](./01-dev-plan.md) records +the cross-PR contracts, checkpoints, deviations and actual verification against each WI. See the +[feature README](../README.md) for what landed. ## Goal @@ -95,36 +95,12 @@ WI-4 ─┴─> WI-5 ─> WI-6 ─> WI-7 ─> WI-8 (lifecycle core, then Disco - **One** final PR, `feature/connection-lifecycle` → `main`, ships everything in a single release. - Use ordinary PRs targeting the preceding branch, not GitHub's stack feature. -**How the repository enforces this** (checked 2026-11-19): - -- `main.yml` runs on `pull_request` to `feature/**`. -- The `feature/**` ruleset: - - every change goes through a PR with one code-owner approval; - - the last push needs approval, and a new push dismisses stale approvals; - - required checks are `license/cla` and `Merge gate`; - - **force pushes and deletion are blocked**. -- Repository merge settings: **merge commits only** (squash and rebase are disabled), and head - branches are deleted on merge. - ### Rules for stacking sub-PRs -1. **Do not wait for approvals or an intermediate merge to start or open the next PR.** Branch from - the preceding PR's head and target that branch while its PR is open. If it has already merged, - branch from and target `feature/connection-lifecycle` instead. -2. **Keep implementation gates.** The stack order does not remove any advisor checkpoint or - operator decision or test. Stop at those as specified. Run the existing verification locally - even when CI does not run on a PR targeting an intermediate branch. -3. **Group work items into one PR** when they are strongly coupled and reviewable together. Keep - commits per work item inside the PR, so the inline progress notes can name them. -4. **Integrate bottom-up.** Do not merge a sub-PR into the preceding topic branch. After the - predecessor merges, verify the next PR targets `feature/connection-lifecycle` before merging it. - To pick up later changes from the base, use `git merge `. Never rebase or force-push after a - human review (CONTRIBUTING §1.6). -5. **Sync `main` into the feature branch** through a PR, because force pushes are blocked: - - weekly, and once more right before the final PR; - - as a pure merge, with no feature work in it; - - on `l10n/bundle.l10n.json` and `package-lock.json` conflicts, take either side and - regenerate (`npm run l10n`, `npm install`). Never hand-merge them. +Branch from the preceding head while it is open; integrate bottom-up into the feature branch. +Reviews and operator tests still apply on intermediate bases even without CI. Sync `main` +weekly and before the final PR by merge, not a post-review rebase or force-push. Regenerate +localization and the lockfile rather than hand-merging them. ### PR split @@ -155,16 +131,9 @@ WI-4 ─┴─> WI-5 ─> WI-6 ─> WI-7 ─> WI-8 (lifecycle core, then Disco ### Verification per PR -- **Sub-PRs (draft or in progress):** Case 1, as in the copilot instructions: `npm run build`, - plus `npx vitest run `. -- **Sub-PRs marked ready for review:** Case 2 in full. That includes `l10n:check`, `lint`, - `typecheck:tests`, the full Vitest suite and `package`. The AI pre-review is committed under - `iterations/` as `01--review.md`, following the knowledge-base naming rules. -- **Final PR F** has three gates: - - Case 2; - - the CONTRIBUTING §1.4 checklist: packaged-VSIX validation means the operator acceptance tests - below; telemetry is WI-9; docs are WI-10; - - a ~1-week watch after the merge. +Case 1 for work in progress, full Case 2 and a committed AI pre-review for handoff +([contributor workflow](../../../../../CONTRIBUTING.md)). The final PR also required packaged +operator tests, telemetry and documentation review, and about one week of post-merge observation. --- diff --git a/docs/ai-and-plans/features/connection-lifecycle/iterations/01-pr1-entra-renewal-review.md b/docs/ai-and-plans/features/connection-lifecycle/iterations/01-pr1-entra-renewal-review.md index 97b73fe7f..c504800b2 100644 --- a/docs/ai-and-plans/features/connection-lifecycle/iterations/01-pr1-entra-renewal-review.md +++ b/docs/ai-and-plans/features/connection-lifecycle/iterations/01-pr1-entra-renewal-review.md @@ -1,7 +1,7 @@ --- feature: connection-lifecycle kind: review -status: active +status: historical created: 2026-11-20 --- diff --git a/docs/ai-and-plans/features/connection-lifecycle/iterations/01-pr1136-final-review.md b/docs/ai-and-plans/features/connection-lifecycle/iterations/01-pr1136-final-review.md index c412c281f..56d9cbaa9 100644 --- a/docs/ai-and-plans/features/connection-lifecycle/iterations/01-pr1136-final-review.md +++ b/docs/ai-and-plans/features/connection-lifecycle/iterations/01-pr1136-final-review.md @@ -1,5 +1,15 @@ +--- +feature: connection-lifecycle +kind: review +status: historical +prs: [1136] +--- + # Final review: Connection lifecycle (combined PR) +This is the November review, not the current release status. The [feature README](../README.md) +and [scope review](./04-pr1136-scope-and-test-review.md) cover subsequent changes. + [PR #1136](https://github.com/microsoft/vscode-documentdb/pull/1136) · `feature/connection-lifecycle` → `main` · reviewed head `559c2f827` (draft) @@ -83,26 +93,10 @@ the feature branch. Avoiding over-engineering remains a constraint for every ite ## Follow-up work plan -The operator accepted the dispositions above. The planning advisor (`claude-opus-5.5`) -checked these items against the current code and the installed MongoDB driver, tRPC and Azure -authentication libraries. No change in scope is implied by the plan. All test and build -executions go to `mai-code-2-flash`; use Case 1 (`npm run build` and focused Vitest) in coherent -batches, and defer the full Case 2 suite until all work items are complete. - -| Item | Scope and dependencies | Acceptance and verification | Recommended → assigned model | -| -------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------- | -| WI-01 (F1) | `ClustersClient.connect()` and its tests; first in the shared client/auth sequence. | A rejected Entra or managed-identity callback rethrows unchanged and marks a bound client without evicting it or downgrading an existing state. A direct `getClient` gets a new generation. Retain all renewal telemetry assertions in a driver-realistic order. Run `ClustersClient` and connection failure tests. | `gpt-6.1-sol` → same; auth and generation lifecycle. | -| WI-02 (F4) | Classifier and host/worker renewal timeout instrumentation; after WI-01 (shared tests). | Match only the installed driver's callback timeout; record bounded `timedOut` without introducing a timer or double-counting. Test wrapped and unrelated errors, host abort/late settlement, and worker timeout/cancellation. | `gpt-6.1-sol` → same; host/worker abort timing. | -| WI-03 (F3) | DocumentDB tRPC telemetry adapter and its tests; independent. | Add only a bounded `unavailableReason` to validated responses. Leave SDK outcome, error and cancellation handling intact. Test typed unavailable, ordinary success, and invalid reason. | `mai-code-2` → same; self-contained middleware edit. | -| WI-04 (F5, tenant catches in F6) | Azure subscription provider, subscription picker, and three Azure discovery roots; independent. | Keep partial results and existing sanitized output warnings. Record skipped account/tenant totals and show one non-blocking hint with **Show Output** per partial listing. Meter the four tenant-lookup catches. Test partial/full listings and verify the warning in a workbench with a failing tenant. | `mai-code-2` → same; contained provider behavior. | -| WI-05 (rest of F6) | Only the named silent catches; after WI-02 (client and Entra overlap). | Preserve return values, control flow and UI; meter actual swallowed observer/telemetry errors, not rethrows. Run focused tree and client/auth tests in the next Case 1 batch. | `gpt-6-luna` → same; mechanical edits. | -| WI-06 (O1) | Extract a small recovery hook from the three lifecycle webviews, retaining per-view policy. Schedule in the final implementation batch. | Preserve stale-reply and disposal guards, Retry/Close behavior, draft data and announcements. Run focused hook, Document View and overlay tests. In a workbench exercise Disconnect/Keep open, dismiss/reappear, Reconnect/Retry, Close, the Dashboard auto-retry, and the dirty Document View prompt. | `gpt-6.1-sol` → same; cross-view lifecycle and race-sensitive state. | -| WI-07 (F7) | Shared Retry hook after WI-06, plus Document View Save. | An explanation RPC rejection does not prevent the existing fallback notification; preserve raw cause and existing telemetry. Test Retry and Save fallbacks. Other explanation chains are outside the accepted fix. | `gpt-6-luna` → same; two local fallbacks. | -| WI-08 (F8) | Collection View query path only; after WI-02 and sequential with WI-06 if a view file is shared. | Show truthful retry guidance only when marked for replacement; retain original explanation and error evidence, no overlay or `runWithClient` changes. Test replacement/non-replacement paths and the next query in a workbench. | `mai-code-2` → same; one targeted query path. | -| WI-09 (O2) | Retry command and node capability; final implementation batch. | A before/after characterization matrix preserves which nodes can clear rejection, ARM key-read precedence, and silent returns. Run command/tree tests and verify Quick Start, Azure discovery and stored connection recovery in a workbench. | `mai-code-2` → same; small policy move with explicit behavior parity. | -| WI-10 (F2) | OP-6 row and PR F step 3 in the development plan. | First write after at least two hours idle, continuous use through expiry, and sleep/wake plus Shell and Playground; operator validation pending. No replay, no pre-write probe, and no Save wording change unless the first-write scenario fails. | `gpt-6-luna` recommended; docs-only leader record. | -| WI-11 (affected documentation) | Decision 0020 and lifecycle telemetry/feature documentation; after the final WI-02–04 fields. | Record the operator's bounded F3 amendment without adding rationale; cross-release comparison stays deferred. Document renewal timeout and partial-listing data; add the new property to CP-5 verification. Check affected user documentation for drift. | `gpt-6-luna` recommended; docs-only leader record. | -| WI-12 (F9, O3) | Inline disposition only; independent. | Retain the pinned prerelease; re-run ARM renewal when upgrading to GA. No lifecycle registry extraction or external tracking issue in this PR. | Leader record; no coding model. | +The numbered findings below are the work ledger: F1/F4 shared the client and auth tests; +F3 and the Azure partial-listing fix could land independently. O1's recovery hook preceded +F7's error fallback. F9 and O3 required no code. For the original WI-01–WI-12 assignment and +acceptance matrix see the [review at the pinned revision](https://github.com/microsoft/vscode-documentdb/blob/01590e0617e3dcf70cb237acab3fd880ca908162/docs/ai-and-plans/features/connection-lifecycle/iterations/01-pr1136-final-review.md#follow-up-work-plan). OP-6, CP-5 ingestion and workbench results are recorded separately from the implementation items. A Save wording follow-up is conditional on an observed OP-6 failure, not a queued diff --git a/docs/ai-and-plans/features/connection-lifecycle/iterations/01-pr1136-ux-review.md b/docs/ai-and-plans/features/connection-lifecycle/iterations/01-pr1136-ux-review.md index be8e49233..5fc8cda8d 100644 --- a/docs/ai-and-plans/features/connection-lifecycle/iterations/01-pr1136-ux-review.md +++ b/docs/ai-and-plans/features/connection-lifecycle/iterations/01-pr1136-ux-review.md @@ -8,11 +8,10 @@ created: 2026-11-27 # Connection lifecycle — UX Review Pack -> **Who this is for:** the operator doing the hands-on connection-lifecycle review and -> anyone triaging its findings. -> **What this is:** a code-verified pre-assessment of the DocumentDB extension for Visual -> Studio Code, followed by a running ledger of runtime observations. Suspected priorities -> are ordered P0 → P3; recommendations are suggestions, not decisions. +> **Historical review, 2026-11-27.** The F-items distinguish what the operator saw from +> what the source suggested. “Open” and quoted UI text refer to this pass, not today's +> extension. The [next iteration](./02-ux-implementation-plan.md) records what was +> authorized, implemented, deferred and tested. - **Feature area:** connection-tree recovery; Disconnect / Reconnect; saved credential and destination edits; Collection, Document and Dashboard views; Interactive Shell; @@ -30,36 +29,22 @@ created: 2026-11-27 remain follow-ups #1105, #1119 and #1106, respectively. - **Review date:** 2026-11-27. -**For a wording-and-message review, start with -[Appendix C: the scenario walkthrough](#appendix-c--message-walkthrough-what-the-user-sees-and-when).** -It follows a person from first connection through failure, repair, retained work and -removal, quoting the actual messages rather than only naming their surfaces. +For sample messages and review questions, see [Appendix C](#appendix-c--message-walkthrough-what-the-user-sees-and-when). +The [unabridged review pack](https://github.com/microsoft/vscode-documentdb/blob/01590e0617e3dcf70cb237acab3fd880ca908162/docs/ai-and-plans/features/connection-lifecycle/iterations/01-pr1136-ux-review.md) +preserves the full diagrams, message templates and source citations. Relative source +links name the files; their line numbers refer to `402b8e052`. For current intent, use the overview and manual: +explicit Disconnect now leaves retained views read-only even after Reconnect. ## How this review was run -**Preparation followed by the operator's first hands-on feedback on 2026-11-27.** -The assistant read the manifest, command handlers, tree recovery paths, retained-view -components and controllers, worker recovery and Azure account flows. The original six -Flags were code-derived seeds. Their bodies now distinguish the operator's observations, -accepted changes, remaining suggestions and version-uncertain reproduction requests. -No product fixes have been implemented in this review. - -Appendix C continues to quote **current source wording**, not pretend approved wording -has shipped. Decisions below and notes beside the relevant scenarios identify the -requested replacements. Operator transcripts omit the supplied server hostname; -that identifier is unnecessary to understand the observed behavior. - -During the live pass, the person drives the extension and dictates observations; the -assistant verifies each observation against the source and updates this ledger and the -todo list. Each item has **Observation / Finding / Suggestion / Status**. Significant -choices require the operator's decision and reason before implementation. Design -trade-offs belong in [Open ideas](#open-ideas--options-pros--cons). - -This is **Case 1**, not a ready-for-review handoff. Full Case 2 checks, including -`prettier-fix`, are deferred while #1136 remains a draft. This pack does not satisfy -the packaged-VSIX or telemetry operator gates, or substitute for the AI code review. -Preparation validation: `npm run build` passed and local reference targets resolved. -No runtime tests ran because this preparation changes documentation only. +The assistant traced the manifest, commands, tree, views, workers and Azure flows to seed +F1–F6. The operator then drove the extension and dictated observations, checked here +against source; transcripts omit the test hostname. Only an explicit operator decision +settled a recommendation. + +**Case 1 preparation:** `npm run build` passed and local references resolved. No runtime +tests ran for the docs change. Case 2 (including `prettier-fix`) was deferred on the draft; +this was neither an AI code review nor a packaged-VSIX or telemetry gate. ## Legend @@ -93,95 +78,15 @@ No runtime tests ran because this preparation changes documentation only. | 💡 **Suggestion** | A design/wording recommendation to react to | | 🔍 **Answered** | A "how does this work?" question answered from the code | -> **For the operator:** no recommendation below is an approved change. Hands-on -> confirmation can change the priority or close an item with a reason. +Recommendations without an explicit decision remained open. --- ## User interaction map -Explicit terminal nodes distinguish a completed action from a modal, retained state, -notification, or silent cancellation. F1–F6 refer to the priority index. - -```mermaid -flowchart TD - subgraph Tree["Tree connection and recovery"] - T["Expand cluster / open Dashboard"] --> TC{"Connect outcome"} - TC -- success --> TS(["Databases or Create Database; Dashboard may auto-open"]) - TC -- failure --> TF["Modal explanation; recovery-action children"] - TC -- cancelled --> TX(["No connection; recovery rows may remain"]) - TF --> TR["Update string / credentials, Retry sign-in, Diagnose, Open shell, Retry"] - TR -- Diagnose --> TD(["Diagnostics panel"]) - TR -- "Open shell" --> SC{"Cached credentials?"} - SC -- yes --> SO(["Terminal opens; worker connects or explains failure"]) - SC -- no --> SN(["F1: notification; no terminal"]) - TR -- Retry --> TC - TR -- "state changed before click" --> TN(["F5: silent guard; no acknowledgement"]) - TS --> DB["Expand database / indexes"] - DB -- failure --> DE(["F3: notification rather than cluster modal"]) - end - subgraph Tabs["Identity-bound views"] - V["Run query / page / save / index / insights / Dashboard action"] --> VO{"Operation outcome"} - VO -- success --> VS(["Result applied to the same bound view"]) - VO -- "typed unavailable" --> U["Reason dialog over retained content"] - VO -- "other failure" --> VE(["Existing operation error feedback"]) - U -- X --> COPY(["Copyable content; database operations still blocked"]) - COPY -- "database action" --> U - U -- Retry --> RC{"Binding and connection check"} - RC -- "same identity available" --> ROK(["Reconnected announcement; no operation replay"]) - RC -- unavailable --> U - RC -- "unclassified exception" --> RE(["F4: host notification; dialog remains"]) - U -- "Close view" --> CQ{"Confirm close; warn if dirty"} - CQ -- confirm --> CLOSED(["View disposed"]) - CQ -- cancel --> U - end - subgraph Teardown["Disconnect, removal and saved edits"] - D["Disconnect / Delete Connection / Delete Folder"] --> G{"Active transfer?"} - G -- yes --> BLOCK(["Modal lists tasks; task and connection keep running"]) - G -- no --> CONF["Removal confirmation if deleting; tab-choice setting"] - CONF -- "ask, with views" --> CH{"Close all / Keep open disabled / Cancel"} - CONF -- "configured default or no views" --> COMMIT["Commit teardown"] - CH -- cancel --> DC(["No change"]) - CH -- close --> DIRTY{"Dirty Document View?"} - DIRTY -- yes --> DISC{"Discard changes?"} - DISC -- cancel --> DC - DISC -- confirm --> COMMIT - DIRTY -- no --> COMMIT - CH -- keep --> COMMIT - COMMIT --> DONE(["Views closed or disabled; workers stopped; files and scrollback retained"]) - DONE -- Disconnect --> RECONNECT["Single Reconnect row"] - RECONNECT --> TC - RECONNECT --> WORK(["Next Shell / Playground run can reuse unchanged identity"]) - DONE -- "Run before Reconnect" --> WF(["F2: worker warning requests new shell or re-pick"]) - DONE -- Remove --> REMOVED(["Saved connection removed; retained views close-only"]) - E["Update Credentials / Connection String wizard"] --> EC{"Saved settings changed?"} - EC -- "cancel / unchanged" --> EN(["No permanent view retirement"]) - EC -- yes --> EO(["Old webviews permanently disabled; reopen from tree"]) - EO --> ES(["Shell consent dialog: Disconnect worker or keep old settings"]) - end - subgraph Auth["Renewal and explicit sign-in"] - A["Database / worker token callback"] --> AC{"Silent renewal"} - AC -- success --> AS(["Operation continues; no sign-in prompt"]) - AC -- "user interaction required" --> NEED["Tree Retry sign-in / worker Sign in again"] - NEED --> AP{"User completes sign-in"} - AP -- "tree success" --> AT(["Tree refreshed; retained views still check binding"]) - AP -- "Shell success" --> AH(["Sign-in restored; run command again"]) - AP -- "Playground success" --> AG(["F6: evaluator stopped; no completion or rerun cue"]) - AP -- "cancel / stale action" --> AX(["No replay; stale action can be silent F5"]) - AP -- "failure / forbidden identity" --> AE(["Tree modal or worker warning; no recovery"]) - end - subgraph Azure["Azure Discovery and tenant selection"] - AZ["Expand / Refresh Azure provider"] --> AZR{"Subscription listing"} - AZR -- complete --> AZOK(["Subscription/resource tree"]) - AZR -- partial --> AZPART(["Successful results plus warning with Show Output"]) - AZR -- empty --> AZEMPTY["No subscriptions modal"] - AZEMPTY -- "Manage Accounts / Adjust Filters" --> AZP(["Account or filter wizard; Retry row remains"]) - AZEMPTY -- cancel --> AZEND(["Retry row"]) - TEN["Entra tenant picker"] --> TENR{"Lookup"} - TENR -- tenants --> TENOK(["Choose tenant; continue wizard"]) - TENR -- "empty / error / timeout" --> TENALT(["Retry loading tenants / manual ID / Manage Azure Accounts"]) - end -``` +Use I1–I13 for tree entry, repair and teardown; I14–I19 for retained views and +transfer guards; I20–I25 for workers, Azure and diagnostics. The inventory identifies +where each action ended. ### Interaction inventory @@ -201,7 +106,7 @@ and [command registration](../../../../../src/documentdb/ClustersExtension.ts#L1 | I7 | Click Diagnose connection… or invoke Diagnose from the palette | [diagnose command](../../../../../src/commands/diagnoseConnection/diagnoseConnection.ts#L27) | Read-only diagnostics panel; palette first picks a stored cluster | | I8 | Click Open shell in failure rows / cluster context menu | [shell command](../../../../../src/commands/openInteractiveShell/openInteractiveShell.ts#L45) | Terminal and connection banner, or missing-credentials notification with no terminal, F1 | | I9 | Click Update connection string… / Update credentials… | [destination edit](../../../../../src/commands/updateConnectionString/updateConnectionString.ts#L77), [credential edit](../../../../../src/commands/updateCredentials/updateCredentials.ts#L147) | Wizard; save feedback; changed settings retire webviews; error-node credential wizard asks whether to reconnect | -| I10 | Respond to old-Shell-settings notice after an edit | [Shell choice](../../../../../src/commands/saveConnectionEdit.ts#L136) | Modal; Disconnect stops workers; dismissal keeps running workers on previous settings | +| I10 | Respond to old-Shell-settings notice after an edit | [Shell choice at review](https://github.com/microsoft/vscode-documentdb/blob/402b8e05251a5e2e688ac5d4a8eba8e8ce520139/src/commands/saveConnectionEdit.ts#L136) | Modal; Disconnect stops workers; dismissal keeps running workers on previous settings | | I11 | Right-click connected cluster → Disconnect | [Disconnect](../../../../../src/commands/disconnect/disconnect.ts#L18), [tab choice](../../../../../src/documentdb/connectionTeardown.ts#L55) | Hidden from palette; connected-only menu; task block, tab choice, dirty warning, or teardown | | I12 | Click Reconnect under a disconnected cluster | [Reconnect](../../../../../src/commands/disconnect/disconnect.ts#L32) | Unlatch and tree refresh; connection result follows expansion; stale guard is silent | | I13 | Delete one/multiple saved connections or a folder | [connection removal](../../../../../src/commands/removeConnection/removeConnection.ts#L23), [folder removal](../../../../../src/commands/connections-view/deleteFolder/ExecuteStep.ts#L22) | Shared destructive confirmation + teardown; refresh; configured summary; failures surfaced | @@ -220,48 +125,30 @@ and [command registration](../../../../../src/documentdb/ClustersExtension.ts#L1 ### Failure and feedback surface matrix -These are the lifecycle-relevant foreground failure branches, not every unrelated -database-operation error. Silent background count/metadata failures and obsolete replies -are intentionally not treated as user-action failures. - -| Event | Current feedback / termination | Source | Assessment | -| --------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | -| First cluster startup failure | Output detail + translated modal; recovery rows | [first-connect helper](../../../../../src/documentdb/showClusterConnectFailure.ts#L36), [stored startup](../../../../../src/tree/connections-view/DocumentDBClusterItem.ts#L273) | Expected baseline | -| Cached connect / listDatabases failure | Modal with explanation and detail; action-only children | [expansion failure](../../../../../src/tree/documentdb/ClusterItemBase.ts#L443) | Expected baseline | -| Explained database/index child-expansion failure | Non-modal error with cause appended | [provider catch](../../../../../src/tree/BaseExtendedTreeDataProvider.ts#L606) | F3: sibling tree divergence | -| Open shell after cache eviction | Non-modal “Not signed in”; no terminal | [credential guard](../../../../../src/commands/openInteractiveShell/openInteractiveShell.ts#L63) | F1: offered recovery can dead-end | -| Azure replacement-key read failure | Modal “Azure sign-in needed” or key-read failure | [key read](../../../../../src/commands/retryAuthentication/retryAuthentication.ts#L107) | Targeted recovery | -| Tree sign-in fails / cloud provider changed / connection closed mid-sign-in | Translated or dedicated modal | [sign-in flow](../../../../../src/commands/signInAgain/signInAgain.ts#L114) | Explicit action reports failure | -| Bound-view unavailable reason | In-view modal over retained content; Retry and/or Close view | [reason map](../../../../../src/webviews/_integration/describeUnavailableConnection.ts#L11) | Accepted design, not a passive tree row | -| Bound-view Retry throws an unclassified error | Host non-modal error; previous dialog remains | [recovery catch](../../../../../src/webviews/documentdb/useBoundViewRecovery.ts#L125) | F4: feedback split | -| Close-view confirmation RPC fails | In-dialog alert; view remains open | [close confirmation](../../../../../src/webviews/components/DisconnectedOverlay.tsx#L48) | Explicit failure with retry path | -| Worker sign-in expires | Shell bounded output or Playground result; non-modal Sign in again when safe | [Shell](../../../../../src/documentdb/shell/DocumentDBShellPty.ts#L907), [Playground](../../../../../src/commands/playground/executePlaygroundCode.ts#L313) | Deliberate worker surface; not automatically a modal inconsistency | -| Worker sign-in action fails | Bounded non-modal warning; original operation not replayed | [Shell action](../../../../../src/documentdb/shell/DocumentDBShellPty.ts#L979), [Playground action](../../../../../src/commands/playground/executePlaygroundCode.ts#L402) | Confirm actionable next-step wording | -| Run while user-disconnected / identity changed | Shell error output; Playground warning before run or result after failure | [Shell reason](../../../../../src/documentdb/shell/DocumentDBShellPty.ts#L895), [Playground latch](../../../../../src/commands/playground/executePlaygroundCode.ts#L127) | F2: unnecessary new-shell/re-pick guidance for unchanged settings | -| Save fails / persisted state uncertain | Save-error notification; possible incomplete-update warning; old views remain safely disabled | [save reconciliation](../../../../../src/commands/saveConnectionEdit.ts#L76), [credential save](../../../../../src/commands/updateCredentials/ExecuteStep.ts#L106) | Do not confuse “saved” with “usable” | -| Removal partly/all fails | Output details; partial-success summary respects summary setting; all-failed error is non-modal | [removal feedback](../../../../../src/commands/removeConnection/removeConnection.ts#L117) | Existing summary policy; confirm restored Reconnect state on storage failure | -| Transfer blocks disconnect/remove/edit | Modal lists conflicting tasks; nothing stopped | [task guard](../../../../../src/services/taskService/resourceUsageHelper.ts#L19) | Safety check | -| Azure partial listing | Successful subscriptions plus one warning with Show Output per listing | [partial listing](../../../../../src/plugins/api-shared/azure/AzureSubscriptionProviderWithFilters.ts#L107) | Accepted partial-result policy | -| Azure empty listing | Informational modal with Manage Accounts / Adjust Filters; Retry child | [empty-state helper](../../../../../src/plugins/api-shared/azure/askToConfigureCredentials.ts#L26) | Actionable first-run state | -| Tenant lookup empty / error / timeout | Picker Retry row with reason, plus manual ID and account management | [tenant alternatives](../../../../../src/commands/newConnection/PromptTenantStep.ts#L76) | No wizard dead end | -| User cancellation | No error; no automatic operation replay | [connect cancellation](../../../../../src/tree/documentdb/ClusterItemBase.ts#L173) | Expected | -| Stale action becomes invalid before click | Some handlers return silently | [Reconnect](../../../../../src/commands/disconnect/disconnect.ts#L32), [Retry](../../../../../src/commands/retryAuthentication/retryAuthentication.ts#L85) | F5: distinguish safety guard from missing feedback | +The same failure could look different depending on who initiated the action: + +- **Tree:** first connect and cached acquisition/listing failures showed a translated + modal with separate detail and action-only children. Explained database/index failures + used a notification (F3). Tree sign-in and Azure key-read failures had dedicated modals. +- **Retained view:** a typed reason stayed over the content. An unexpected Retry error + went to a host notification (F4); a failed close confirmation stayed in the dialog. +- **Worker:** bounded terminal/result text, with a sign-in warning only when safe. Distinguish + F1's terminal startup failure from no terminal after cache eviction, and F5's explicit + stale click from intentionally silent cancellation, background counts and obsolete replies. +- **Persistence:** saving credentials did not guarantee usability (C7). Partial removal used + the summary setting; all-failed removal notified regardless. Check that a storage failure + restores the Reconnect state (C10). A task-blocking modal did not stop the task. +- **Discovery:** partial listings warned and offered Show Output; empty listings offered + account/filter repair. Tenant lookup failures kept Retry, manual ID and account management (C11). --- ## The story in one paragraph -The extension aims to recover silently when the connection identity has not changed, -and to preserve work rather than replay interrupted operations or silently change -permissions. Explicit Disconnect offers a tab choice and a single tree Reconnect; -changed saved settings permanently retire old webviews, while workers have separately -documented restart rules. The live pass confirms that Shell and Playground can recover after tree Reconnect -without a new terminal or connection pick, despite their wording. The operator wants -unauthenticated Shell access from failure rows, modal errors for tree-originated actions, -simpler retained-view labels and readable, consistent debugging output. A missing -Disconnect menu item after credential repair still needs current-version reproduction; -Retry/stale-action feedback choices remain open. The lack of a dedicated Playground -sign-in completion message is accepted as-is. +The operator could reuse the same Shell and Playground after tree Reconnect, despite +instructions to start over. In contrast, Open shell on an invalid saved password +retried that password. The review separated misleading guidance from safety guards +that should stay: never replay an operation or silently switch identity. --- @@ -371,7 +258,7 @@ and [F8](#f8-disconnected-is-written-beside-the-active-shell-prompt). the [next Shell evaluation restarts its worker](../../../../../src/documentdb/shell/ShellSessionManager.ts#L340). [Playground checks the original fingerprint when spawning](../../../../../src/documentdb/playground/PlaygroundEvaluator.ts#L276) and can use the retained binding. -- The [manual explicitly describes reuse without a new terminal or pick](../../../../user-manual/connecting-to-databases.md#disconnect-and-reconnect). +- The [manual at the reviewed revision described reuse without a new terminal or pick](https://github.com/microsoft/vscode-documentdb/blob/402b8e05251a5e2e688ac5d4a8eba8e8ce520139/docs/user-manual/connecting-to-databases.md#disconnect-and-reconnect). Source behavior supports that intent; the error wording is the mismatch. Identity or destination changes still require the stricter guidance. @@ -555,7 +442,7 @@ preserve input intentionally rather than blindly adding a newline in every outpu **Priority:** P2 · **Status:** 🟠 Open -**Observation / comment:** C0's host-modal option “Keep open (disabled)” is too complex; +**Observation / comment:** the host-modal option “Keep open (disabled)” (C0/C5) is too complex; the operator knows the state is disabled but finds the label unclear. **Finding:** [the teardown modal currently uses Keep open (disabled)](../../../../../src/documentdb/connectionTeardown.ts#L78). @@ -667,33 +554,15 @@ not relabeled as a fix from this pass. ### Preparation — before Iteration 1 -| # | Item | Decision (why) | Outcome | -| ----- | ------------------------------------------------------------- | ------------------------------ | ------------------------------ | -| F1–F3 | Recovery availability, worker guidance, sibling tree feedback | None; code-verified seeds only | 🟠 Open → hands-on Iteration 1 | -| F4–F6 | Retry feedback, stale clicks, Playground sign-in completion | None; code-verified seeds only | 🟠 Open → hands-on Iteration 1 | +F1–F6 began as source-derived questions, not six live reproductions. ### Iteration 1 — operator feedback recorded, implementation pending -| # | Operator outcome / reason | Current outcome | -| -------------------------- | ------------------------------------------------------------------------------- | --------------------------------------------------------------------------------- | -| F1 | Prefers anonymous Shell on error rows; invalid saved auth otherwise fails again | 🟠 Open; final label/implementation not decided | -| F2 | In-place worker recovery works; re-pick wording is unclear | 🟠 Open; rerun guidance approved | -| F3 / O1 | Modal errors for tree actions are the UX guideline | 🟠 Open; scoped policy approved | -| F4 / O2 | Wants guidance with pros/cons | 🟠 Open; recommendation recorded, no choice yet | -| F5 / O3 | Wants guidance with pros/cons | 🟠 Open; recommendation recorded, no choice yet | -| F6 | Acceptable as-is | 🚫 Closed; no code change | -| F7 | Possibly tested an older version | 🟡 Open (soft); current-build reproduction required | -| F8 | Disconnected must not look like entered input | 🟠 Open; separate output line approved | -| F9 | Disabled suffix is unclear/complex | 🟠 Open; Keep open approved | -| F10 | Wants the saved, correctly formatted password made explicit | 🟠 Open; proposed copy recorded | -| F11 | Access is broader than copying | 🟠 Open; accessible name approved | -| F12 | Debugging is also for humans; prioritize readability | 🟠 Open; shared multiline records recommended | -| Dashboard diagnostics link | Future work rather than widening this PR | 🔗 Tracked in [#1141](https://github.com/microsoft/vscode-documentdb/issues/1141) | -| Q1 | Asks how to increase Shell buffer capacity | 🔍 Answered; VS Code scrollback setting | - -No product changes were requested for execution in this recording pass. Open items stay -in the ledger and carry to the next fix iteration; code, tests, localization and shipped -documentation have not been changed to pretend these choices are already implemented. +The [priority index](#priority-index) records the disposition at the end of the pass; +the F-items give the evidence and reasons where supplied. F1, F4 and F5 still needed design choices, +F7 needed a build-specific reproduction, and F6 was accepted as-is. Q1 was answered; +the Dashboard diagnostics request went to #1141. No product changes were requested +for execution in this pass. --- @@ -822,38 +691,18 @@ It is not an active implementation item in #1136. ### Retained-view state and action availability -```mermaid -flowchart LR - READY["Bound and usable"] -- "typed failure / explicit disable" --> UNAVAILABLE["Reason modal; content mounted"] - UNAVAILABLE -- X --> DISMISSED["Dialog hidden; blocking ref still set"] - DISMISSED -- "server action" --> UNAVAILABLE - DISMISSED -- "copy / inspect" --> COPYABLE(["Local content available"]) - UNAVAILABLE -- Retry --> CHECK{"Retired binding or latch?"} - CHECK -- yes --> UNAVAILABLE - CHECK -- no --> RESOLVE{"Same identity resolves?"} - RESOLVE -- yes --> RESTORED(["Usable; Reconnected announced; no operation replay"]) - RESOLVE -- "typed unavailable" --> UNAVAILABLE - RESOLVE -- exception --> TOAST(["Host error; existing dialog retained F4"]) - READY -- "saved edit / identity changed / remove" --> RETIRED["Close-only reason; contents retained"] - RETIRED -- X --> INSPECT(["Inspect/copy; never adopt new identity"]) - RETIRED -- "Close view" --> CONFIRM{"Close confirmed?"} - UNAVAILABLE -- "Close view" --> CONFIRM - CONFIRM -- yes --> END(["Disposed"]) - CONFIRM -- no --> KEPT(["View retained"]) -``` - -The [reason map](../../../../../src/webviews/_integration/describeUnavailableConnection.ts#L11) -offers Retry for sign-in required, credential rejection/missing/updating, user Disconnect -and unreachable. Changed identity/settings and removal are close-only. Dismissing the -dialog clears only render state, not the +At the reviewed revision, the [reason map](../../../../../src/webviews/_integration/describeUnavailableConnection.ts#L11) +offered Retry for sign-in required, credential rejection/missing/updating, user Disconnect +and unreachable. Changed identity/settings and removal were close-only. Dismissing the +dialog cleared only render state, not the [blocking ref](../../../../../src/webviews/documentdb/useBoundViewRecovery.ts#L67). [Host recovery](../../../../../src/webviews/documentdb/boundViewOperations.ts#L19) -resolves the original binding and does not rerun the interrupted operation. +resolved the original binding without rerunning the interrupted operation. **Intentional asymmetries to confirm, not automatically flag:** -- Saved edits retire webviews even for password-only changes; workers follow different - restart rules. See decisions 0018 and the manual. +- Saved edits retired webviews even for password-only changes; workers had different + restart rules (decision 0018). - Reconnect can auto-retry an existing same-identity Dashboard when auto-open brings it forward; other retained views still require Retry. See [Dashboard reveal](../../../../../src/webviews/documentdb/clusterDashboard/clusterDashboardController.ts#L410). @@ -903,127 +752,41 @@ or packaged extension behavior. Follow the [L2-dev runner recipe](../../../../../build/verification/README.md#l2-dev-source-scenarios); do not treat fixture success as the hands-on review. -After merge, add a reconciliation note pointing to the current manual and final -pre-merge review so this snapshot is not mistaken for current behavior. - ## Appendix C — message walkthrough: what the user sees, and when -This is the **source-based script for the hands-on review**; runtime observations and -decisions from Iteration 1 are recorded in the F-items above, not retroactively substituted -for the current source wording here. -The source snapshot is unchanged from the preparation above. Quoted wording is the -English source wording; `Orders`, `inventory` and `reviews` are fictional display -names used to instantiate templates. `{error}`, `{host}` and similar placeholders -mean variable content, not literal words the user sees. Driver error text, timestamps, -account labels and authentication-provider/browser prompts vary; examples of these -are explicitly identified rather than presented as guaranteed screenshots. - -Repeated families are grouped, but each group includes concrete examples. The inventory -covers the PR's lifecycle journeys and representative adjacent feedback encountered -along them, not every pre-existing database, index or diagnostics message in the extension. -Links identify the renderer or caller that selects each message. +This was a **source-based script**, not a list of tests that passed. `Orders`, +`inventory` and `reviews` instantiate templates; `{error}`, `{host}`, account labels, +provider UI and timings vary. F-items above hold the actual observations and decisions. +For the full wording and renderer inventory from this review, see the [original message walkthrough](https://github.com/microsoft/vscode-documentdb/blob/01590e0617e3dcf70cb237acab3fd880ca908162/docs/ai-and-plans/features/connection-lifecycle/iterations/01-pr1136-ux-review.md#appendix-c--message-walkthrough-what-the-user-sees-and-when). ### C0. Know which surface you are reviewing -| Surface | What the person experiences | Example in this walkthrough | -| ------------------------------------------- | ------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------ | -| Notification | VS Code information/warning/error message; does not block the whole window | “Could not sign in again. Open a new shell from the tree.” | -| Progress notification | Cancellable progress, possibly delayed; not a success or error toast | `Connecting to "Orders"…` | -| Host modal | A VS Code dialog with a heading, optional detail and buttons; interrupts the window | “Disconnect?” / “Close all” / “Keep open (disabled)” | -| Tree recovery action | Clickable child under a failed/disconnected node; not a paragraph explaining the failure | “Retry sign-in”, “Diagnose connection…”, “Reconnect” | -| In-view overlay/dialog | Modal **inside** a Collection, Document or Dashboard webview; existing contents stay mounted behind it | “Connection changed” with “Close view” | -| Persistent inline message | MessageBar or panel error that stays in the view, rather than a transient notification | “Failed to read cluster information: {error}” with “Retry” | -| Picker/input validation | Quick Pick title, row, detail or input validation inside an ongoing wizard | “Retry loading tenants” / “Loading tenants timed out after 5 seconds.” | -| Terminal output | Shell scrollback, connection banner, prompt and spinner; separate from host notifications | “Sign-in restored. Run your command again.” | -| Playground result document | Read-only execution output next to the source file; survives a dismissed notification | “Error executing query” plus a bounded recovery message | -| Badge, CodeLens, tooltip or accessible name | Smaller state and action cues; some are read aloud rather than shown as prose | “Disconnected”, “Running…”, “Dismiss dialog to copy view contents” | -| Screen-reader announcement | Live-region message; **not** necessarily visible text or a toast | “Reconnected”, “Lost connection to the cluster.” | -| Output channel only | Detail is available if the person opens Output; not an acknowledgement on its own | “Skipped an Azure tenant because its subscriptions could not be listed.” | -| Deliberate silence | No new message on successful silent renewal, cancellation or obsolete replies | A successful operation simply continues after token renewal | - -“Error nodes” in the lifecycle tree are the action rows above, sometimes internally -tagged `error`. They are **not** passive error-summary rows. Read the failure modal -first, then review whether the surviving action labels are enough to guide recovery. - -**Iteration 1 wording decision:** the host-modal choice quoted above is still the current -**“Keep open (disabled)”**; the approved replacement is **“Keep open”** ([F9](#f9-shorten-the-retained-tab-choice)). -The retained-view behavior stays unavailable for database operations. +A host modal interrupted the window; a notification did not. Tree error children were +**actions**, not paragraphs repeating the modal. An overlay blocked one mounted webview; +a MessageBar stayed inline. Pickers and progress belonged to the action in flight. +Shell scrollback, Playground results and Output could outlast a notification. Badges, +CodeLens and tooltips conveyed state; accessible names and live announcements were not +toasts. Silent renewal, cancellation and obsolete replies could have no message at all. ### C1. “I expand Orders and connect for the first time” -Start with a saved scratch connection. Expand it, then repeat with a connection slow -enough to expose progress. Finally repeat with an empty server. - -1. **While connecting:** after the operation has lasted about **2 seconds**, a - cancellable progress notification can appear: - - > Connecting to "Orders"… - - A fast connection shows no such notification. Cancelling it does not produce an - error dialog just to report the cancellation. - Sources: [tree progress](../../../../../src/tree/documentdb/ClusterItemBase.ts#L263) - and [delay helper](../../../../../src/utils/withProgress.ts#L8). +Expand a fast, a slow and an empty scratch connection. Only the slow path might show +cancellable `Connecting to "Orders"…` (about 2 s); cancellation had no error dialog. +Success meant databases or “Create Database…” (within an empty database, “Create +Collection…”), not a toast. The optional Dashboard badge reflected periodic pings, +not the last command. Loading, reuse and failure details went to Output. -2. **When it succeeds:** the tree shows databases. If none exist, the child is - **“Create Database…”**, not “No databases found”. Inside an empty database the - equivalent action is **“Create Collection…”**. Those entries start creation - wizards, rather than merely explaining the empty state. -3. **A Dashboard may open automatically:** its status badge reads **“Connecting…”**, - **“Connected”** or **“Disconnected”**, based on ping samples. Its tooltip says: - - > Connection status based on periodic ping commands to this cluster. - - The initial successful connection does not have a dedicated lifecycle “Connected - successfully” toast. Tree contents, the optional Dashboard and its badge are the - visible completion. - -4. **If the person checks Output:** examples include - `Loading cluster details for "Orders"`, `Reusing active connection for "Orders".` - and `Could not connect to "Orders".` These are Output messages, not three separate - pop-ups. - -Sources: [tree success/empty state](../../../../../src/tree/documentdb/ClusterItemBase.ts#L626), -[database empty state](../../../../../src/tree/documentdb/DatabaseItem.ts#L97), -[Dashboard badge](../../../../../src/webviews/documentdb/clusterDashboard/components/DashboardHeader.tsx#L271). - -**Review checkpoint:** did the operation feel complete without a toast? Was the -automatic Dashboard opening expected? Was cancellation quiet without leaving the -person unsure what the remaining recovery rows mean? +**Check:** did completion and automatic Dashboard opening make sense? After cancel, +could the person explain any remaining rows? See I1–I3. ### C2. “The server rejects my connection; now what do I read?” -Use an intentionally incorrect password on a scratch connection. Read the modal before -dismissing it, then inspect the tree and try its recovery actions. - -**First failure, no provider-specific explanation:** the host error modal uses: - -> **Failed to connect to "Orders"** -> -> Revisit connection details and try again. -> -> Error: {driver message} - -The heading has no period in this template. `{driver message}` is the actual variable -error, not a normalized friendly summary. On a cached-connection failure the fallback -heading is also `Failed to connect to "Orders"`; if connection acquisition succeeded -but database enumeration failed, it is `Failed to load databases for "Orders"`. -That cached/expansion path normally places the raw error directly in the detail, -without the first-connect “Revisit connection details…” preface. - -**An explanation can replace the heading.** For example, a failed connection to a -managed local instance can say: - -> DocumentDB Local does not appear to be running. Start it from the Connections view, then try again. - -If that container was removed, another heading is: - -> We cannot find the DocumentDB Local container. It was very likely removed outside VS Code. You can create it again from the Connections view. - -These are existing infrastructure explanations reused by the lifecycle, not new -automatic repair steps. In the first-connect modal the raw failure remains in detail. -Sources: [modal composition](../../../../../src/documentdb/showClusterConnectFailure.ts#L81), -[cached expansion](../../../../../src/tree/documentdb/ClusterItemBase.ts#L503), -[local explanations](../../../../../src/services/localQuickStart/QuickStartErrorExplainer.ts#L38). +Fail a scratch connection with an incorrect password. The first fallback modal said +**Failed to connect to "Orders"**, then “Revisit connection details and try again.” and +`Error: {driver message}`. Cached failures put the raw error in detail without that +preface; enumeration had its own “Failed to load databases” heading. A provider could +replace the heading (e.g. start a stopped DocumentDB Local instance versus recreate a +missing container); this was advice, not automatic repair. **After dismissing the modal, review the action rows.** Examples: @@ -1034,60 +797,20 @@ Sources: [modal composition](../../../../../src/documentdb/showClusterConnectFai | Ordinary retryable failure | Provider repair rows when applicable, then “Diagnose connection…”, “Open shell”, “Retry” | No passive row containing the full driver error | | Explicit user Disconnect | “Reconnect” | Not the failed-authentication repair block | -Sources: [base recovery rows](../../../../../src/tree/documentdb/ClusterItemBase.ts#L402), -[stored repair rows](../../../../../src/tree/connections-view/ConnectionsBranchDataProvider.ts#L124), -[canonical Retry](../../../../../src/tree/api/retryNode.ts#L45). - -For an already-unavailable acquisition, the expansion modal can use a bounded detail -instead of the raw rejection: - -| Condition | Detail text | -| ----------------------------------- | ------------------------------------------------------------------------------- | -| Sign-in required | “Sign in again to continue using this connection.” | -| Verified Entra credentials rejected | “The database rejected the credentials. Choose Retry sign-in to continue.” | -| Azure replacement-key path | “The database rejected the key. Choose Retry to read the key from Azure again.” | -| Stored credentials need editing | “The database rejected the credentials. Choose Update credentials to continue.” | -| Other reloadable credentials | “The database rejected the credentials. Choose Retry to reload them.” | +The detail distinguished sign-in required, verified Entra rejection (Retry sign-in), +Azure replacement key (Retry reads from Azure), stored credentials (Update credentials) +and reloadable credentials (Retry). F1 records what happened with invalid credentials +versus the source-only “Not signed in” branch after cache eviction. -Source: [credential rejection wording](../../../../../src/tree/documentdb/ClusterItemBase.ts#L374). -These details are conditional branches, not five messages shown in succession. - -**Now click Open shell.** If the failed startup already evicted cached credentials, -a non-modal error says **“Not signed in to Orders. Please authenticate first.”** -and no terminal opens ([Shell entry guard](../../../../../src/commands/openInteractiveShell/openInteractiveShell.ts#L63)). -This is F1: compare what the action promises with what it actually lets the person do. - -**Optional password-encoding branch:** if a Native password appears URL-encoded, the -failure modal adds this detail and a **“Try with decoded password”** button: - -> 💡 Your password appears to contain URL-encoded characters (e.g. %40 instead of @). This often happens when copying a password from a connection string URL. Would you like to retry with the decoded version? - -Only accepting the button attempts the decoded value. If that works, a non-modal -information message asks: - -> Connected to "Orders" using the decoded password. Would you like to update your saved credentials? - -The action is **“Update saved password”**. -Sources: [decoding offer](../../../../../src/documentdb/auth/urlEncodedPassword.ts#L101), -[successful retry](../../../../../src/tree/connections-view/DocumentDBClusterItem.ts#L350). - -**Iteration 1 comment:** make this explicit about storing the correctly formatted -password. [F10](#f10-explain-what-the-decoded-password-save-will-store) proposes: -**“Connected to "Orders" using the decoded password. Would you like to update your saved credentials with the correctly formatted password?”** -The source sentence above remains unchanged until implementation. - -**Review checkpoint:** read the modal, dismiss it, and explain the next step using only -the remaining rows. Compare a cluster failure with a database/Indexes expansion failure: -the latter's explained failure is a **notification**, formatted as -`{explanation} ({cause})`, not the same modal (F3; -[provider catch](../../../../../src/tree/BaseExtendedTreeDataProvider.ts#L606)). +**Encoded password:** “Try with decoded password” retried only by consent; success +then offered a _separate_ “Update saved password” action. F10 quotes the old and +proposed save prompts. After dismissing the modal, could the person choose the right +row unaided? Compare a database/Indexes failure's `{explanation} ({cause})` notification (F3). ### C3. “My Microsoft sign-in expires while I am working” -First distinguish the two stories: **silent renewal succeeds**, so no authentication -message appears and the operation continues; or **interactive recovery is needed**, so -the person gets a surface-specific message. Authentication/browser consent UI comes -from VS Code's configured provider; its precise wording is not owned by this extension. +Successful silent renewal continued the operation. Only interactive recovery produced +the extension messages below; VS Code's provider owned browser/consent wording. | Where the failure is encountered | Exact extension wording | Where / next action | | ---------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- | @@ -1102,29 +825,13 @@ Sources: [typed Entra explanation](../../../../../src/documentdb/auth/entraError [Playground auth feedback](../../../../../src/commands/playground/executePlaygroundCode.ts#L313), [provider invocation](../../../../../src/documentdb/auth/entraSession.ts#L30). -**Accept sign-in once, then stop and look for the ending:** - -- **Tree:** successful recovery refreshes the tree; no dedicated “Sign-in restored” - notification is issued by this command. Retained tabs still check their bindings. -- **Shell:** terminal output explicitly says - **“Sign-in restored. Run your command again.”** -- **Playground:** successful recovery stops the old evaluator but supplies no - equivalent completion/rerun message; the failed result is still there (F6). -- **Cancel:** the interrupted command is not replayed. A stale warning action may - produce no additional feedback if its original connection has changed (F5). - -If interactive recovery fails, the tree fallback heading is **“Could not sign in again.”** -unless an explanation replaces it. Shell warns -**“Could not sign in again. Open a new shell from the tree.”**; -Playground warns -**“Could not sign in again. Re-pick the playground connection from the tree.”** -Sources: [tree action](../../../../../src/commands/signInAgain/signInAgain.ts#L181), -[Shell completion/failure](../../../../../src/documentdb/shell/DocumentDBShellPty.ts#L959), -[Playground completion/failure](../../../../../src/commands/playground/executePlaygroundCode.ts#L393). - -**Other bounded worker-authentication branches** use the following messages. These are -alternatives selected by the failure reason, not extra generic driver errors appended -to every failure: +On success the tree refreshed without a toast; tabs still checked bindings. For Shell's +explicit rerun cue versus Playground's unchanged failed result, see F6. Cancellation +never replayed the operation; an old warning choice could end silently (F5). Failed +interactive sign-in used the tree's “Could not sign in again.” modal (or translated +heading), or a worker warning to open a new Shell / re-pick the Playground connection. + +**Other worker-authentication branches:** | Reason | Shell terminal message | Playground result message | | ---------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------- | @@ -1142,18 +849,10 @@ Two **tree sign-in modal exceptions** are worth a separate read: Source: [sign-in race and provider checks](../../../../../src/commands/signInAgain/signInAgain.ts#L114). -For an untrusted destination on the host's connect path, the modal instead says: - -> **Microsoft Entra ID isn't allowed for this server.** -> -> Microsoft Entra ID is available only for Azure DocumentDB -> or servers allowed by the trusted-server setting. -> -> Server: {host} - -It offers **“Learn More”**; multiple hosts use **“Server: {host} and {count} more”**. -If the link cannot open, the follow-up warning is **“We couldn't open this link.”** -([destination modal](../../../../../src/documentdb/showClusterConnectFailure.ts#L40)). +For an untrusted destination the host modal explained that Microsoft Entra ID was +limited to Azure DocumentDB or trusted servers. It included `Server: {host}` (plus a +count for multiple hosts) and offered “Learn More”. Link failure warned “We couldn't +open this link.” **Review checkpoint:** can the person tell whether to use the tree, the warning's Sign in again button, or the tab's Retry? Does each successful route visibly end? @@ -1161,33 +860,14 @@ Do not deliberately change shared accounts or cloud configuration for this test. ### C4. “The server or network stops answering” -On an operator-owned scratch server, compare the **same cause** across a tree expand, -a view operation and a worker command. Do not expect every network error to become a -“Connection lost” overlay: classification and call site decide whether it is an -unavailable state or an ordinary operation error. - -- **Tree:** the modal from C2, with a translated heading when applicable. -- **Retained view:** a mapped unavailable reason can show - **“Connection lost”** / **“Check the network or server, then click Retry.”** - Other failures keep the existing operation-specific error handling. -- **Shell initial connection, ordinary error:** terminal text starts - **“Failed to connect: {error}”**, can add an infrastructure explanation, and ends - **“Run a command to try connecting again, or close this terminal.”** - A non-modal error also says `Failed to connect to "Orders": {error}`, or uses the - explanation instead. Typed worker/lifecycle failures take their bounded paths in C3/C8 - rather than necessarily displaying this generic notification too. -- **Playground ordinary execution failure:** the result document retains the error; - a non-modal error uses the explanation or - **“Query playground execution failed: {error}”**. -- **Kubernetes explanation example, missing tunnel:** the shared text template is - **“We cannot find an active port-forward tunnel to {target}, so localhost:{port} very likely does not reach the cluster right now. Collapse and expand the connection again to re-establish the tunnel.”** - `{target}` expands like `"reviews" in namespace "dev"`; the port varies. This is - diagnostic wording, not a promise of broader tunnel recovery in this PR. - -Sources: [Shell ordinary startup failure](../../../../../src/documentdb/shell/DocumentDBShellPty.ts#L634), -[Playground ordinary failure](../../../../../src/commands/playground/executePlaygroundCode.ts#L286), -[tunnel explanation](../../../../../src/plugins/service-kubernetes/KubernetesErrorExplainer.ts#L89), -[typed view operation boundary](../../../../../src/documentdb/runWithClient.ts#L25). +Compare the same scratch-server failure across surfaces. The tree used C2's modal. +Only a _mapped_ unavailable view showed “Connection lost” / “Check the network or +server, then click Retry.” Ordinary operations kept their own errors. Ordinary Shell +startup wrote the error, possible infrastructure explanation and retry-or-close cue +(F1); a notification also explained the failure. Playground retained an error result +plus the explanation or `Query playground execution failed: {error}`. A missing +Kubernetes tunnel suggested collapsing and expanding to re-establish the port-forward, +not general network recovery. Typed worker failures followed C3/C8 instead. **The Dashboard has additional, non-overlay ways to say something is wrong:** @@ -1213,44 +893,20 @@ from failed pings be distinguished from an explicit user Disconnect? ### C5. “I choose Disconnect, but I need to keep my work” -Open the three view types, edit a scratch document without saving, and keep a Shell -and Playground open. Right-click the connected cluster and choose **“Disconnect”**. - -1. **If a transfer is active, stop here:** C10's task-blocking modal appears first. - The tab-choice modal is not shown and the task is not stopped. -2. **With open registered views and `openTabsOnDisconnect=ask`:** a warning modal: - - > **Disconnect?** - > - > What should happen to the open tabs for this connection? - - Choices: **“Close all”**, **“Keep open (disabled)”**, or VS Code's dismissal/cancel. - With a configured `closeAll` or `keepOpenDisabled` default, this question is skipped. - With no registered views, there is no tab-choice question even if workers exist. - -3. **Choose Close all while a Document View is dirty:** a second warning modal: - - > **Discard unsaved document changes?** - > - > Closing these tabs will discard their unsaved changes. - - Explicit action: **“Discard changes”**. Cancelling leaves the teardown uncommitted. - The configured tab default does **not** bypass this warning. - -4. **Choose Keep open (disabled) instead:** each retained webview gets C6's - **“Disconnected”** dialog. The tree's child becomes **“Reconnect”**. - Shell prints **“Disconnected”** and keeps its terminal; the Playground file remains - open. Their workers stop regardless of the webview tab choice. -5. **Observe completion:** there is no separate “Disconnected successfully” toast. - The action row, retained dialogs and Shell line are the completion cues. -6. **Reconnect in the tree:** it resumes the tree connection flow from C1. Other - retained views require Retry; auto-opening the existing same-identity Dashboard - can retry that Dashboard automatically. No interrupted query or write is replayed. - -Sources: [tab/discard questions](../../../../../src/documentdb/connectionTeardown.ts#L55), -[surface/worker teardown](../../../../../src/documentdb/connectionTeardown.ts#L147), -[Reconnect](../../../../../src/commands/disconnect/disconnect.ts#L32), -[Dashboard reveal retry](../../../../../src/webviews/documentdb/clusterDashboard/clusterDashboardController.ts#L410). +With Collection, dirty Document, Dashboard, Shell and Playground open, disconnect the +cluster. Record which steps appeared, in order: + +1. An active transfer blocked teardown before any tab question (C10). +2. With registered views and `openTabsOnDisconnect=ask`, “Disconnect?” offered “Close all” + or “Keep open (disabled)” (old wording; F9). Dismissal cancelled. `closeAll`, + `keepOpenDisabled`, or no registered views skipped the question, even with workers. +3. Closing a dirty Document still required “Discard unsaved document changes?” → + “Discard changes”, regardless of the default. Cancellation left teardown uncommitted. +4. Keeping views showed C6's dialog; Reconnect appeared in the tree. Workers stopped; + the terminal printed “Disconnected” and the Playground file stayed open. No success toast. +5. At this revision, tree Reconnect restarted acquisition, not the interrupted query/write. + Other retained views needed Retry; [revealing an auto-opened same-identity Dashboard](../../../../../src/webviews/documentdb/clusterDashboard/clusterDashboardController.ts#L410) + could retry that Dashboard. **Review checkpoint:** does “open tabs” sound like it includes the Shell terminal or Playground file, even though neither closes? Is the two-modal Close all → Discard @@ -1258,9 +914,8 @@ sequence understandable? Capture what the person thinks Reconnect will resume. ### C6. “There is a dialog over my old results or unsaved document” -This is the shared **in-view** modal for Collection View, Document View and Dashboard. -It is not a host notification. It shades/blocks the mounted contents while open. -Here is the complete reason-to-copy inventory, including repeated titles: +These mapped reasons applied inside Collection, Document and Dashboard views, not to +every low-level error. “Close view” alone meant the binding could not recover. | Trigger / reason | Title | Detail | Footer buttons | | ------------------------------- | ------------------------------- | ---------------------------------------------------------------------------------------------- | ----------------- | @@ -1275,40 +930,18 @@ Here is the complete reason-to-copy inventory, including repeated titles: | Bound connection is unreachable | “Connection lost” | “Check the network or server, then click Retry.” | Retry; Close view | Source: [all mapped titles/details](../../../../../src/webviews/_integration/describeUnavailableConnection.ts#L11). -These are available mappings, not a promise that each reason can be reproduced by -every surface or that every low-level error is mapped. - -**Now walk all three actions:** - -- **X:** its accessible label is **“Dismiss dialog to copy view contents”**. Dismissing - is not reconnecting. The contents become accessible for copying; attempting another - database operation reveals the reason again. Confirm this distinction without - assuming a visible disabled toolbar persists after dismissal. - **Iteration 1 approved replacement:** **“Dismiss dialog to access view contents”**, - because access/inspection is broader than copying ([F11](#f11-x-should-describe-access-to-retained-contents)). -- **Retry:** while pending, Retry, Close view and the X are disabled/focusable. - Their labels do not change to “Retrying…” and this component adds no recovery spinner. - On success the overlay disappears and a live region announces **“Reconnected”**; - this is not a success toast and does not mean the old operation ran again. - A typed failure updates/retains the dialog. An unclassified exception keeps the old - dialog and raises the non-modal **“Unable to recover the connection”** or an - infrastructure explanation, followed by the cause in parentheses (F4). -- **Close view:** this first asks a **host confirmation**, even for a clean view: - - > **Close this view?** - > - > Dismiss the connection dialog instead if you need to copy anything from the view. - - Explicit action: **“Close view”**. For a dirty Document View the detail instead is - **“Closing this view discards unsaved changes.”** The same dirty warning also appears - as a paragraph inside the overlay before closing. If the confirmation request itself - fails, an inline alert in the overlay reads - **“Unable to confirm closing the view. Try again.”** - -Sources: [overlay controls and confirmations](../../../../../src/webviews/components/DisconnectedOverlay.tsx#L37), -[Retry outcomes](../../../../../src/webviews/documentdb/useBoundViewRecovery.ts#L100), -[recovery success text](../../../../../src/webviews/documentdb/boundViewOperations.ts#L39), -[host confirmation contract](../../../../../src/webviews/_integration/appRouter.ts#L266). + +The three actions had different consequences: + +- **X** exposed retained contents without reconnecting. Another server action brought + the reason back. F11 records the old accessible name and its approved replacement. +- **Retry** left controls disabled but focusable while pending, with no changed label or + spinner. Success announced “Reconnected” without replay. Typed failure updated the + reason; unexpected exceptions left it in place and notified the host (F4). +- **Close view** [asked “Close this view?”](../../../../../src/webviews/_integration/appRouter.ts#L266) even when clean, suggesting dismissal instead + if the person needed to copy. Dirty views warned both inline and in the confirmation: + “Closing this view discards unsaved changes.” A failed confirmation request showed + “Unable to confirm closing the view. Try again.” inside the overlay. **Review checkpoint:** can the person copy without accidentally closing or reconnecting? Can they hear the title/detail, reach X by keyboard, and distinguish “Retry the binding” @@ -1317,36 +950,16 @@ trigger-click dismissal, not every close request. ### C7. “I save changed credentials or a new connection string” -Start an edit with dirty/open views and an existing Shell. Repeat with cancel, -unchanged values, a password-only edit, and changed destination/identity. - -1. The credential wizard asks **“Select an authentication method”**. From an error - state it also asks **“Would you like to reconnect with the updated credentials?”**: - **“Yes”** / **“Reconnect now with the updated credentials”** versus - **“No”** / **“Save credentials without reconnecting”**. - These are picker rows, not a post-save notification. -2. A successful save can show an information **operation summary**: - **“Credentials updated successfully.”** or **“Connection updated successfully.”** - The summary respects `showOperationSummaries`; hiding summaries does not suppress - every warning or modal in this journey. -3. When saved settings actually changed, old webviews receive **“Connection changed”** - from C6, including password-only changes. There is **no** Disconnect-style - Close all / Keep open question for this edit path. -4. If Shell terminals exist, a separate information **modal** says: - - > Open shells are still using the previous connection settings. - - Its explicit action is **“Disconnect”**. Dismissing it leaves those workers running - on their previous settings. Accepting it prints **“Disconnected”** in the terminals. - -5. An unchanged/cancelled edit does not permanently retire existing views. Distinguish - transient “Connection update in progress” from permanent “Connection changed”. - -Sources: [authentication picker](../../../../../src/commands/updateCredentials/PromptAuthMethodStep.ts#L57), -[reconnect picker](../../../../../src/commands/updateCredentials/PromptReconnectStepForErrorNodes.ts#L22), -[credential save](../../../../../src/commands/updateCredentials/ExecuteStep.ts#L106), -[string save](../../../../../src/commands/updateConnectionString/ExecuteStep.ts#L94), -[edit reconciliation and Shell notice](../../../../../src/commands/saveConnectionEdit.ts#L76). +Try cancel, unchanged values, password-only change and changed destination/identity +with dirty views and a Shell open. After “Select an authentication method”, error-node +credential repair asked whether to reconnect now or save without reconnecting (F7). +`showOperationSummaries` controlled the successful credential/string update message, +not all warnings. Cancel/unchanged settings did not permanently retire views; compare +“Connection update in progress” with “Connection changed” after an actual save. + +Even a password-only change retired old views without a tab-choice question. A separate +Shell modal said “Open shells are still using the previous connection settings.” +Disconnect stopped the workers and printed the status; dismissal kept the old settings. **Failure and special-case copy to read on this journey:** @@ -1366,22 +979,9 @@ success and permission/identity continuity are three separate facts. ### C8. “I keep my Shell open and try the next command” -Before any failures, review the Shell's ordinary state cues. Its initial terminal spinner -says **“Connecting and authenticating...”**. A successful banner includes, for example: - -```text -Connected to: Orders ({host}) -Identity: {identity} | Authentication: Username and Password (SCRAM) | Database: inventory -Type "help" for available commands. -``` - -Line wrapping varies with terminal width; absent identity omits that field. Other -authentication labels are **“Microsoft Entra ID (Account)”**, -**“Microsoft Entra ID (Managed Identity)”**, and **“No Authentication”**. -Worker restart can change the spinner label to **“Reconnecting...”**. -Source: [Shell banner/spinner](../../../../../src/documentdb/shell/DocumentDBShellPty.ts#L549). - -**Then disconnect and type before reconnecting.** The bounded terminal messages are: +A new Shell showed “Connecting and authenticating...”, then host, authentication method, +optional identity, database and help cue (F1). Labels distinguished SCRAM, Entra Account, +Entra Managed Identity and No Authentication. A worker restart could show “Reconnecting...”. | State when the command is attempted | Shell terminal wording | | ----------------------------------- | --------------------------------------------------------------------------------- | @@ -1405,62 +1005,20 @@ worker restart distinguishable in scrollback? ### C9. “I run the Playground before and after a connection problem” -1. **Before a connection exists**, the top CodeLens reads **“Connect”**; its tooltip is - **“Connect this playground to a database”**. Run All on an unbound file also starts - the picker: **“Select a database to connect this playground to”**. - Cancelling does not execute the code. -2. **Once bound**, the CodeLens shows a display string such as `Orders / inventory` - and its tooltip says **“Connected to Orders / inventory”**. This describes the - retained binding, not a live health probe. -3. **Click that connection display:** an information modal reads: - - > **This playground is connected to Orders / inventory.** - > - > Disconnect and connect this playground to a different database? - - Action: **“Connect to a different database…”**. Cancelling the following picker - preserves the original binding. - -4. **Run:** a cancellable **“Query Playground”** progress notification reports - **“Initializing…”**, **“Authenticating…”**, **“Running query…”** as the evaluator - reaches those phases. The CodeLens changes from **“Run All”** / **“Run”** to - **“Running…”**; its busy tooltip says - **“The worker for this cluster is busy executing a playground”**. - Another run on that cluster can produce the information notification - **“A playground is already running on this cluster. Wait for it to finish.”** -5. **If failure happens during execution**, a read-only result document shows this - shape (timestamp, query preview and duration vary): - - ```text - // Orders / inventory - // {timestamp} - // - // ▶ {query preview} - // ❌ Error executing query - // Executed in {duration}ms - // ───────────────────────── - - Microsoft sign-in expired for this playground. Sign in again to continue. - ``` - - That example uses C3's explicit sign-in path; its warning also offers - **“Sign in again”**. Other bounded result messages include: - **“This playground is bound to the previous connection. Re-pick its connection from the tree.”** - and **“This connection is unavailable. Reconnect from the tree, then re-pick it here.”** - -6. **If it is already latched as unavailable before the run starts**, the bounded - message is a **warning notification**, and that early exit does not create the - execution-error result document. This matters when comparing seemingly identical - failures: the previous result can remain on screen. -7. **Recover and look again before rerunning:** sign-in does not replace the error - result or rerun the source. Same-settings reconnect can use the retained Playground - without a new pick; its generic message still requests a re-pick (F2/F6). - -Sources: [CodeLens](../../../../../src/documentdb/playground/PlaygroundCodeLensProvider.ts#L85), -[display-name meaning](../../../../../src/documentdb/playground/PlaygroundService.ts#L339), -[connection modal/picker](../../../../../src/commands/playground/connectDatabase.ts#L35), -[preflight and execution progress](../../../../../src/commands/playground/executePlaygroundCode.ts#L106), -[phase text](../../../../../src/documentdb/playground/PlaygroundEvaluator.ts#L265), +1. Unbound: “Connect” or Run All started the database picker; cancel ran nothing. + Bound: `Orders / inventory` named the binding, not a live health probe. Clicking it + offered “Connect to a different database…”; cancelling the picker preserved the binding. +2. Run: cancellable “Query Playground” progress went through “Initializing…”, + “Authenticating…”, “Running query…”. CodeLens switched to “Running…”; a second run + on the same cluster said to wait for the busy worker. +3. Failure **during** execution produced a read-only “Error executing query” result with + the binding, timestamp, query preview, duration and bounded reason. Expired sign-in + could also offer a “Sign in again” warning (C3). A changed binding directed the person + to re-pick; F2 quotes the confusing same-connection warning. +4. Failure **before** execution due to a latch only warned; the previous result could + still be on screen. Sign-in did not replace it or rerun code (F6). + +Sources: [phase text](../../../../../src/documentdb/playground/PlaygroundEvaluator.ts#L265), [result formatting](../../../../../src/documentdb/playground/resultFormatter.ts#L87). **Review checkpoint:** read the connection CodeLens, old result and current warning @@ -1469,55 +1027,19 @@ Can a person tell whether the latest click executed any code? ### C10. “I disconnect or remove while work is running, then remove for real” -Start a scratch transfer and try Disconnect, a saved edit, or removal. The task guard -shows a **host error modal**, for example: +Try Disconnect, update and remove during a scratch transfer. The host modal named the +blocked operation (“Cannot disconnect this connection”, for example), listed task names +and types against the **cluster ID**, and asked the person to stop them. It did not +stop the tasks. After the transfer finishes: -```text -Cannot disconnect this connection - -The following tasks are currently using connection "{clusterId}": - • {taskName} ({taskType}) - -Please stop these tasks first before proceeding. -``` - -The connection-level resource description currently uses the **cluster ID**, not -necessarily the friendly `Orders` label. The title varies to -**“Cannot remove this connection”** or **“Cannot update this connection”** for those -operations. The modal tells the person to stop tasks; it does not itself stop them. -Source: [task guard](../../../../../src/services/taskService/resourceUsageHelper.ts#L19). - -After the transfer finishes, remove a saved connection: - -1. **Destructive confirmation first:** title **“Are you sure?”**, message - `Delete "Orders"?` followed by **“This cannot be undone.”** For multiple selections, - the message is, for example, **“Delete 2 connections?”**. -2. **The confirmation-style setting changes the surface.** The default word input adds: - **“Please enter the word "delete" to confirm the operation.”** and - **“Note: This confirmation type can be configured in the extension settings.”** - Challenge mode uses a warning modal with **“Pick "{number}" to confirm and continue.”** - and three numeric buttons. Button mode uses a warning modal with a **Yes** action. - Incorrect word input repeats the word instruction as validation. -3. **Then the retained-tab choice can appear:** same detail/buttons as Disconnect, - but the heading is **“Remove the connection?”**. A Close all choice can still lead - to the separate unsaved-document discard modal. These are sequential questions, - not alternative wording for the destructive confirmation. -4. **Success:** information summary **“The selected connection has been removed.”** - or, for example, **“All 2 connections have been removed.”** Retained views show - **“Connection removed”** / **“This connection is no longer in the tree. Close this view.”** - They do not offer Retry. -5. **Partial failure:** a summary can say - **“Removed 1 of 2 connections. 1 failed.”**; per-connection detail is in Output as - `Failed to remove connection "Orders": {error}`. -6. **All failed:** an error notification says - **“Failed to remove the selected connection. See the output channel for details.”** - or `Failed to remove all 2 connections. See the output channel for details.` - Success/partial summaries respect `showOperationSummaries`; this all-failed error - does not go through that summary switch. - -Sources: [removal sequence and feedback](../../../../../src/commands/removeConnection/removeConnection.ts#L57), -[confirmation styles](../../../../../src/utils/dialogs/getConfirmation.ts#L55), -[summary switch](../../../../../src/utils/dialogs/showConfirmation.ts#L9). +1. Delete one or several connections: “Are you sure?” named the target/count and warned + “This cannot be undone.” Default word input required `delete` (validation repeated + the instruction). Challenge mode offered three numbers; button mode offered Yes. +2. The separate “Remove the connection?” tab choice and dirty-discard confirmation + followed as applicable (C5). Retained views became “Connection removed”, without Retry. +3. Success and partial-success counts respected `showOperationSummaries`; partial failure + also logged each failed connection and cause. All-failed notified regardless of that + setting and directed the person to Output. **Folder variant:** the confirmation message can be `Delete folder "reviews"?`, then `This will also delete 2 connections.`, then @@ -1525,7 +1047,7 @@ Sources: [removal sequence and feedback](../../../../../src/commands/removeConne teardown/tab choice. On success the summary is **“The selected folder has been removed.”** Sources: [folder confirmation](../../../../../src/commands/connections-view/deleteFolder/ConfirmDeleteStep.ts#L18), -[folder summary](../../../../../src/commands/connections-view/deleteFolder/deleteFolder.ts#L63). +[folder summary at review](https://github.com/microsoft/vscode-documentdb/blob/402b8e05251a5e2e688ac5d4a8eba8e8ce520139/src/commands/connections-view/deleteFolder/deleteFolder.ts#L60). **Review checkpoint:** count the prompts a person actually encounters. Is each asking a different understandable question? Are partial failures visible with summaries disabled? @@ -1533,74 +1055,27 @@ Do not interpret “delete connection” as deleting the database service itself ### C11. “Azure Discovery is empty or only some subscriptions appear” -Expand/refresh the Azure provider without changing shared account state just to force -a test. Separate “nothing returned”, “partial results” and “tenant-picker lookup failed”. - -**Nothing returned:** an information **modal** says: - -> **No Azure Subscriptions Found** -> -> To connect to Azure resources, you need to sign in to Azure accounts. -> -> If you are already signed in, your subscription or tenant filters may be hiding results. - -Actions: **“Manage Accounts”**, **“Adjust Filters”**; dismissal leaves a **“Retry”** row. -The filtering wizard can suppress Adjust Filters to avoid a loop, in which case only -the sign-in paragraph is used. -Sources: [empty-state modal](../../../../../src/plugins/api-shared/azure/askToConfigureCredentials.ts#L26), -[provider continuation](../../../../../src/plugins/service-azure-mongo-vcore/discovery-tree/AzureServiceRootItem.ts#L51). - -**Some account/tenant listings fail:** successful subscriptions remain visible and a -non-modal warning says: - -> Some Azure accounts or tenants could not be listed, so some subscriptions may be missing. - -Action: **“Show Output”**. There the corresponding sanitized warnings are -**“Skipped an Azure account because its tenants could not be listed.”** and -**“Skipped an Azure tenant because its subscriptions could not be listed.”** -These intentionally do not name which account/tenant. -Source: [partial listing](../../../../../src/plugins/api-shared/azure/AzureSubscriptionProviderWithFilters.ts#L107). - -**Manage Accounts:** the picker placeholder is **“Azure accounts used for service discovery”**, -with loading text **“Loading Azure Accounts Used for Service Discovery…”**. -With no accounts it offers **“Sign in to Azure to continue…”**, detail -**“Not signed in to Azure”**, and **“Exit”**. With accounts, examples include -**“1 tenant available (0 signed in)”** and **“Sign in with a different account…”**. -Inside an account, tenant rows say **“Signed in”** or **“Select to sign in”** -(with codicons). An empty tenant list has **“No tenants available for this account”** -as a separator and actionable **“Back to account selection”** / **“Exit”**. -Successful explicit tenant authentication notifies, for example, -**“Successfully signed in to {tenantName}”**. -Sources: [account picker](../../../../../src/plugins/api-shared/azure/credentialsManagement/SelectAccountStep.ts#L49), -[tenant picker](../../../../../src/plugins/api-shared/azure/credentialsManagement/AccountTenantsStep.ts#L41). - -**New/edit Entra connection tenant selection:** a different picker says -**“Select a tenant for Microsoft Entra ID authentication”**, initially -**“Loading Tenants…”**. Both keep **“Manually enter a custom tenant ID”** available, -but their account-management rows currently use different wording: new connections -show **“Manage Azure Accounts…”**, detail -**“Sign in to additional accounts or authenticate with other tenants to see more options.”**; -credential edits show **“Sign in to other Azure accounts to access more tenants”**. -When no tenants load, an actionable -**“Retry loading tenants”** row carries one of: - -- **“Loading tenants timed out after 5 seconds.”** initially, or - **“Loading tenants timed out after 30 seconds.”** after explicit retry. -- **“Unable to load tenants. See the DocumentDB output for details.”** -- **“No tenants were returned for the available Azure accounts.”** - -Manual input asks **“Enter the tenant ID (GUID)”**. Empty input validates as -**“Tenant ID cannot be empty”**; invalid format says -**“Please enter a valid tenant ID in GUID format (e.g., 12345678-1234-1234-1234-123456789012 or 12345678123412341234123456789012)”**. -Sources: [new-connection tenant step](../../../../../src/commands/newConnection/PromptTenantStep.ts#L32), -[edit tenant step](../../../../../src/commands/updateCredentials/PromptTenantStep.ts). - -**Separate Azure RU key-recovery branch:** clicking Retry after a rejected key can -produce either **“Azure sign-in needed”** / **“Sign in to Azure and try Retry again.”** -or **“Could not read the database key from Azure.”** / -**“Check access to the Azure resource and try again.”**, both host error modals -([key read](../../../../../src/commands/retryAuthentication/retryAuthentication.ts#L107)). -This is Azure resource access, not necessarily expired database sign-in from C3. +Compare an empty listing, partial results and failed tenant lookup without changing shared accounts: + +- **Empty listing:** “No Azure Subscriptions Found” explained sign-in and possibly hidden + results. Manage Accounts / Adjust Filters offered exits; dismissal left Retry. The + filter wizard omitted its own filter action and paragraph to avoid a loop. +- **Partial listing:** successful subscriptions stayed visible. One warning per listing + offered Show Output; sanitized detail distinguished a skipped account's tenants from + a skipped tenant's subscriptions, naming neither. +- **Manage Accounts:** the loading picker offered sign-in or Exit when empty; otherwise + tenant/signed-in counts and a different-account option. Tenant rows distinguished + “Signed in” from “Select to sign in”; an empty list offered Back or Exit. Explicit + tenant sign-in could notify “Successfully signed in to {tenantName}”. +- **New/edit Entra tenant pickers:** both kept manual GUID entry and account management; + the new flow said “Manage Azure Accounts…” and edit said “Sign in to other Azure + accounts to access more tenants”. Retry distinguished timeout (5 s, then 30 s on + explicit retry), load failure with Output detail, and no tenants returned. Manual + input rejected empty or non-GUID text; hyphenated and compact GUIDs were valid. + +**Azure RU key recovery** was separate from database sign-in: the [replacement-key read](../../../../../src/commands/retryAuthentication/retryAuthentication.ts#L107) +could show “Azure sign-in needed” / “Sign in to Azure and try Retry again.” or +“Could not read the database key from Azure.” / “Check access to the Azure resource and try again.” **Review checkpoint:** can the person tell missing resources from hidden filters, failed discovery and expired database authentication? Does Show Output provide enough @@ -1608,33 +1083,15 @@ detail to act without disclosing account identities in the warning itself? ### C12. “I choose Diagnose, copy a report, or rely on assistive feedback” -These are adjacent surfaces the person can reach while following the recovery story. - -- **Diagnose opens a separate panel**, headed **“Connection Diagnostics”**, subtitle - **“Check a connection step by step and review the results.”** During a run, status - can say **“Checking the connection…”**, **“Diagnosis cancelled”** or - **“Diagnosis did not finish”**. The principal run controls are **“Cancel”** and - **“Re-run”**; completed reports offer **“Show report”** and **“Share report”**. -- **Opening an already-open completed diagnostics panel** can produce an inline - information bar: **“Connection Diagnostics is already open for this connection. Run the diagnosis again?”** - with **“Re-run”** and a dismiss action. This is not a connection-error modal. -- **Report sharing with identifiers included** asks a host warning confirmation: - **“This report includes host and identity details.”**, detail - **“Host names, addresses and the username are not hidden. To hide them, cancel, select Hide identifiers in the report, and then share again.”**, - action **“Copy report”** or **“Save report”**. - The panel itself says **“Review the report before sharing.”** and, depending on the - selection, **“The report will replace host and identity details with placeholders.”** - or **“The report will include host and identity details.”** -- **Report-action failure** stays as an inline error, for example - **“Could not copy the report: {error}”**; successful copying announces - **“Report copied”** through a live region. - -Source: [diagnostics UI and sharing](../../../../../src/webviews/documentdb/connectionDiagnostics/ConnectionDiagnostics.tsx#L420). -Detailed check/result wording belongs to the diagnostics feature, not a second full -diagnostics review in this PR. - -**Messages a sighted reviewer may not notice:** successful retained-view Retry -announces **“Reconnected”**. Dashboard transitions announce +- **Diagnose:** Connection Diagnostics showed checking, cancelled or incomplete status, + Cancel/Re-run and, on completion, Show report / Share report. Opening an already-open + completed panel offered Re-run or dismissal inline, not an error modal. +- **Share:** the panel said to review the report and whether placeholders would hide + identifiers. With identifiers included, a host warning named host names, addresses + and username; cancel and select Hide identifiers, or explicitly Copy report / Save + report. Copy failure was inline; “Report copied” was a live announcement. + +Successful retained-view Retry announced **“Reconnected”**. Dashboard transitions announce **“Connected to the cluster.”** / **“Lost connection to the cluster.”**; manual storage refresh can announce **“Refreshing storage statistics…”**, then, for example, **“Storage statistics refreshed. 2 databases.”** These are live-region messages, @@ -1663,8 +1120,3 @@ For each scenario, dictate a short sequence using this review card: | How did I know it finished? | View enabled, result changed, live announcement, tree refreshed, or no visible completion | | What was preserved or lost? | Draft, result, query text, scrollback, worker variables; whether anything unexpectedly replayed | | Is this observed or only inferred? | Runtime evidence versus a source-only branch; link an existing F-item where applicable | - -This appendix preserves the message inventory from the source snapshot. Iteration 1 -decisions and observations are explicit in the ledger above; unresolved suggestions -remain open, F6 is closed as accepted, and none of the requested fixes has shipped merely -because it was recorded here. diff --git a/docs/ai-and-plans/features/connection-lifecycle/iterations/01-pr2-azureauth-review.md b/docs/ai-and-plans/features/connection-lifecycle/iterations/01-pr2-azureauth-review.md index d5e6d098f..55395be11 100644 --- a/docs/ai-and-plans/features/connection-lifecycle/iterations/01-pr2-azureauth-review.md +++ b/docs/ai-and-plans/features/connection-lifecycle/iterations/01-pr2-azureauth-review.md @@ -1,7 +1,7 @@ --- feature: connection-lifecycle kind: review -status: active +status: historical created: 2026-11-20 --- diff --git a/docs/ai-and-plans/features/connection-lifecycle/iterations/01-pr3-client-identity-review.md b/docs/ai-and-plans/features/connection-lifecycle/iterations/01-pr3-client-identity-review.md index f7201b1e3..1792eab9e 100644 --- a/docs/ai-and-plans/features/connection-lifecycle/iterations/01-pr3-client-identity-review.md +++ b/docs/ai-and-plans/features/connection-lifecycle/iterations/01-pr3-client-identity-review.md @@ -1,7 +1,7 @@ --- feature: connection-lifecycle kind: review -status: active +status: historical created: 2026-11-23 --- diff --git a/docs/ai-and-plans/features/connection-lifecycle/iterations/01-pr4-connection-recovery-review.md b/docs/ai-and-plans/features/connection-lifecycle/iterations/01-pr4-connection-recovery-review.md index f4ba08728..d10a368fe 100644 --- a/docs/ai-and-plans/features/connection-lifecycle/iterations/01-pr4-connection-recovery-review.md +++ b/docs/ai-and-plans/features/connection-lifecycle/iterations/01-pr4-connection-recovery-review.md @@ -1,7 +1,7 @@ --- feature: connection-lifecycle kind: review -status: active +status: historical created: 2026-11-23 --- diff --git a/docs/ai-and-plans/features/connection-lifecycle/iterations/01-pr5-bound-surfaces-review.md b/docs/ai-and-plans/features/connection-lifecycle/iterations/01-pr5-bound-surfaces-review.md index 2006573f4..0401d3f03 100644 --- a/docs/ai-and-plans/features/connection-lifecycle/iterations/01-pr5-bound-surfaces-review.md +++ b/docs/ai-and-plans/features/connection-lifecycle/iterations/01-pr5-bound-surfaces-review.md @@ -1,7 +1,7 @@ --- feature: connection-lifecycle kind: review -status: active +status: historical created: 2026-11-24 --- diff --git a/docs/ai-and-plans/features/connection-lifecycle/iterations/01-pr6a-worker-token-relays-review.md b/docs/ai-and-plans/features/connection-lifecycle/iterations/01-pr6a-worker-token-relays-review.md index 4c3abab86..7741d5aaf 100644 --- a/docs/ai-and-plans/features/connection-lifecycle/iterations/01-pr6a-worker-token-relays-review.md +++ b/docs/ai-and-plans/features/connection-lifecycle/iterations/01-pr6a-worker-token-relays-review.md @@ -1,3 +1,10 @@ +--- +feature: connection-lifecycle +kind: review +status: historical +prs: [1133] +--- + # PR6a pre-review: Shell and Playground token relays [PR #1133](https://github.com/microsoft/vscode-documentdb/pull/1133) · WI-2 · reviewed head `8c2ca3fdc` diff --git a/docs/ai-and-plans/features/connection-lifecycle/iterations/01-pr7-telemetry-and-docs-review.md b/docs/ai-and-plans/features/connection-lifecycle/iterations/01-pr7-telemetry-and-docs-review.md index 0138ae079..adc75d53f 100644 --- a/docs/ai-and-plans/features/connection-lifecycle/iterations/01-pr7-telemetry-and-docs-review.md +++ b/docs/ai-and-plans/features/connection-lifecycle/iterations/01-pr7-telemetry-and-docs-review.md @@ -1,3 +1,10 @@ +--- +feature: connection-lifecycle +kind: review +status: historical +prs: [1135] +--- + # PR7 pre-review: Connection recovery telemetry and docs [PR #1135](https://github.com/microsoft/vscode-documentdb/pull/1135) · WI-9 and WI-10 · reviewed head `668ead86a` diff --git a/docs/ai-and-plans/features/connection-lifecycle/iterations/02-pr1136-copilot-review.md b/docs/ai-and-plans/features/connection-lifecycle/iterations/02-pr1136-copilot-review.md index 84ad39099..46163bb6d 100644 --- a/docs/ai-and-plans/features/connection-lifecycle/iterations/02-pr1136-copilot-review.md +++ b/docs/ai-and-plans/features/connection-lifecycle/iterations/02-pr1136-copilot-review.md @@ -1,7 +1,7 @@ --- feature: connection-lifecycle kind: review -status: active +status: historical prs: [1136] created: 2026-11-29 verified: 2026-11-29 diff --git a/docs/ai-and-plans/features/connection-lifecycle/iterations/02-pr1146-copilot-review.md b/docs/ai-and-plans/features/connection-lifecycle/iterations/02-pr1146-copilot-review.md index cee58db4a..366eac936 100644 --- a/docs/ai-and-plans/features/connection-lifecycle/iterations/02-pr1146-copilot-review.md +++ b/docs/ai-and-plans/features/connection-lifecycle/iterations/02-pr1146-copilot-review.md @@ -1,7 +1,7 @@ --- feature: connection-lifecycle kind: review -status: active +status: historical prs: [1146] created: 2026-11-27 verified: 2026-11-27 @@ -11,877 +11,273 @@ verified: 2026-11-27 ## Scope and review policy -Reviewed [the refinement PR](https://github.com/microsoft/vscode-documentdb/pull/1146) at -`dec9ac64cbdb18f295fb0f05a7ebe12955703c47`, against `feature/connection-lifecycle`. -The [Copilot review](https://github.com/microsoft/vscode-documentdb/pull/1146#pullrequestreview-6090776593) -contains 12 inline comments; all 12 were unresolved and current when retrieved. -The PR is now non-draft; that is an externally changed status, not a readiness decision made here. +On 2026-11-27, the lead validated [Copilot's 12 comments](https://github.com/microsoft/vscode-documentdb/pull/1146#pullrequestreview-6090776593) +on [PR #1146](https://github.com/microsoft/vscode-documentdb/pull/1146) at `dec9ac64cbdb18f295fb0f05a7ebe12955703c47` +against `feature/connection-lifecycle`. All threads were current and unresolved. The PR had become +non-draft independently of this review. This ledger records the decisions and checks at the time, +not the current behavior or release status. The [unabridged ledger at `01590e0`](https://github.com/microsoft/vscode-documentdb/blob/01590e0617e3dcf70cb237acab3fd880ca908162/docs/ai-and-plans/features/connection-lifecycle/iterations/02-pr1146-copilot-review.md) +has the complete options, commands and host usage tables. -The leader verified the claims against source and focused behavioral probes, then consulted -**Claude Opus 5.5** as the read-only advisor. The operator selected the actions recorded below on -2026-11-27. The initial validation pass made no production changes, commits, pushes, GitHub replies, -or thread resolutions. The lead implementation run is recorded separately below. - -The operator's priorities for this review: - -- Standard workflows should work without elaborate machinery for implausible races. -- Edge cases must not permit data loss, wrong-target execution, or automatic replay. -- A **won't fix** recommendation is legitimate when safety is preserved and the benefit is small. -- Separate a real behavior defect from an overstated severity or unnecessarily broad solution. - -Severity: **High** breaks a central supported workflow; **Medium** materially disrupts routine -actions or has a concrete wrong-target/input/write-outcome risk; **Low** is bounded feedback or -ergonomic degradation. Severity and disposition are separate: a low-frequency wrong-target defect -still warrants a fix. None of these findings proves that database data was actually lost. +The operator prioritized ordinary workflows without machinery for implausible races, but not at +the cost of data loss, wrong-target execution or automatic replay. All 12 findings were confirmed; +the severity pairs below are **Copilot → assessment**, not a vote on whether to fix. No database +loss was observed. ## Operator-selected disposition -The operator directed **"c10, ignore/wont fix."** and selected the recommended actions for every -other item. This selects nine fixes and three won't-fix/defer outcomes (C05, C10, C12). -No additional rationale was supplied; the review's option analysis is preserved below rather -than attributing new reasoning to the operator. Selection is not implementation. - -| Item | Copilot severity | Validity | Assessed severity | Selected action | -| ---------------------------------------------------------------------- | ---------------- | ------------------------------------- | --------------------------------- | ---------------------------------------------------------- | -| [C01](#c01-diagnostic-worker-startup-rejects-authentication-holds) | High | Confirmed | High | Fix: explicit diagnostic startup capability | -| [C02](#c02-vm-diagnostic-shell-can-use-the-wrong-port) | High | Confirmed | Medium | Fix: retain attempted endpoint; fail closed when unknown | -| [C03](#c03-stale-diagnostic-shell-click-has-generic-feedback) | Medium | Confirmed, stale-node claim qualified | Low | Fix: supported-view refresh and typed stale feedback | -| [C04](#c04-old-playground-sign-in-can-warn-a-new-connection) | Medium | Confirmed | Low | Fix: two connection-ownership checks | -| [C05](#c05-completed-edit-can-silently-supersede-tree-sign-in) | Medium | Confirmed | Low | Won't fix / defer richer change attribution | -| [C06](#c06-genuine-sign-in-dismissal-can-show-a-stale-modal) | Medium | Confirmed | Low | Fix: distinguish genuine dismissal from stale cancellation | -| [C07](#c07-disconnect-restores-text-but-not-the-cursor) | Medium | Confirmed | Low | Fix with C09: restore text and cursor | -| [C08](#c08-anonymous-startup-failure-also-notifies-the-host) | Medium | Confirmed | Low | Fix: anonymous-only notification guard | -| [C09](#c09-late-shell-sign-in-output-corrupts-the-visible-prompt) | Medium | Confirmed | Medium | Fix: bounded asynchronous output handling | -| [C10](#c10-anonymous-command-result-is-discarded-on-host-client-churn) | Medium | Confirmed; guard is intentional | Medium for write-outcome feedback | Won't fix: operator override; no guard or message changes | -| [C11](#c11-index-failures-can-show-two-tree-modals) | Medium | Confirmed | Medium | Fix: explicit feedback ownership, not suppressDisplay | -| [C12](#c12-host-side-stale-retry-cancellation-becomes-an-alert) | Medium | Confirmed | Low | Won't fix / defer typed cancellation outcome | - -Suggested implementation order for this run: C01, C02, C11; then the shared C07/C09 input work; -then cheap C04/C08/C06/C03 feedback refinements. C05 and C12 need no new architecture this round. -C10 is excluded from implementation. The operator withdrew the initial C01/C02 deferral. -All nine accepted fixes are in scope for this run; all remain unimplemented at intake. +The operator selected the recommendation for every item except C10: **"c10, ignore/wont fix."** +Nine fixes were accepted; C05, C10 and C12 were no-code decisions. The technical reasons below +are the review's unless attributed to the operator; no additional operator rationale was supplied. ### Lead run intake (2026-11-27, 17:17 UTC) -The operator requested committing this plan and implementing it as a lead with an advisor, -initially with **"we skip work items 1 and 2 for now."** Before coding, the operator corrected -this as a different-project instruction: **"here we don't skip 1 and 2"**, then confirmed -**"we work on all decided/accepted work items."** C01 and C02 are included; the initial -deferral is superseded. C05, C10 and C12 retain their selected won't-fix/defer outcomes. - -The operator confirmed the model assignments: **claude-opus-5.5** advisor; -**mai-code-2** for smaller coding items, **gpt-6.1-sol** for lifecycle/concurrency work; -**mai-code-2-flash** for checks. The advisor supplies the implementation mapping and technical -decisions within the accepted scope before coding. - -Endpoint: local implementation and separate item commits, with Case 1 build and focused tests. -No push, PR-status change, or thread resolution is authorized by this run. Full Case 2 is not -part of this ongoing-work endpoint. - -The operator authorized a summary **in each item's Copilot review thread**, explaining what -changed and why, with a commit reference when available: **"always in the thread, no one -multi-comment."** Do not post an omnibus PR comment. Any local-only commit reference must be -identified as not yet pushed rather than linked as though available on GitHub. +The operator withdrew **"we skip work items 1 and 2 for now."** as a different-project instruction: +**"here we don't skip 1 and 2"**, then **"we work on all decided/accepted work items."** The initial +endpoint was a committed plan, separate local fixes and Case 1 checks, with replies **"always in +the thread, no one multi-comment."** Push, Case 2, PR-state changes and thread resolution were not +part of that authorization; the later pre-push snapshot records the expanded endpoint. ### Advisor implementation mapping -**Advised (claude-opus-5.5, 2026-11-27):** all nine selected fixes fit the existing code. -No new user-facing strings or changed authentication identity rules are planned. Each item gets -its own code commit; C07 precedes C09, and C01 precedes C03. Items sharing the PTY run sequentially. -Tests use the root Vitest configuration with `--maxWorkers=2`. - -| Item | Advisor-recommended / assigned model | Owned implementation and test scope | Confidence | -| ---- | ------------------------------------ | ------------------------------------------------------------------------------------------------------------ | ---------------------------------- | -| C01 | gpt-6.1-sol | ConnectionUnavailableError; WorkerSessionManager; ShellSessionManager; openInteractiveShell; dependent tests | 85% | -| C02 | gpt-6.1-sol | AzureVMResourceItem and its focused new test | 80% | -| C03 | mai-code-2 | openInteractiveShell and its test, after C01 | 85% | -| C04 | mai-code-2 | executePlaygroundCode and its test | 95% | -| C06 | gpt-6.1-sol | signInAgain and its test; final cross-surface checks after other edits | 80% | -| C07 | mai-code-2 | ShellInputHandler and DocumentDBShellPty with their tests, after C08 | 90% | -| C08 | mai-code-2 | DocumentDBShellPty and its test | 95% | -| C09 | gpt-6.1-sol | DocumentDBShellPty and tests, using C07's input restore method | 90% after render-origin refinement | -| C11 | mai-code-2 | commandErrorHandling; three index callbacks; wrapper and focused index tests | 90% | - -Approved implementation interfaces supplied by the advisor: - -- C01: `isDiagnosticAuthenticationHold(reason: ConnectionUnavailableReason | undefined): boolean`, - with an explicit host-only `allowDiagnosticAuthenticationHold = false` startup parameter passed - through worker startup. Shell passes it only for the separate diagnostic path; no wire-message flag. -- C07: `ShellInputHandler.restoreLine(text: string, cursor: number): void`, clamping the cursor - and using the existing renderer without clearing multiline/history state or firing buffer callbacks. -- C09: private PTY `writeAsyncFeedback(line: string): void`, with queued feedback during evaluation - or disabled input, flushed at the next safe prompt. Disconnect clears obsolete queued feedback. -- C11: `markCommandErrorPresented(context: IActionContext, error: unknown): void`, with exact - invocation/error ownership. Skip only additional tree UI, preserving webview behavior, explanation - telemetry and presentation for a different cleanup error. - -The leader accepts this mapping within the already approved solutions; material deviations still -return to the advisor/operator. Existing exact-output tests may change only where the accepted -cursor restoration changes their actual behavior, not merely to make a failing test pass. -Live checks remain pending: C09 installed-terminal redraw and C02 provider node lifetime/refresh. +The operator confirmed `claude-opus-5.5` for advice, `gpt-6.1-sol` for C01/C02/C06/C09, +`mai-code-2` for C03/C04/C07/C08/C11 and `mai-code-2-flash` for checks. Actual assignments +matched, without substitutions. C01 preceded C03; the PTY work ran sequentially, with one coder +for C08 then C07 (separate commits), and C07's restore primitive available for C09. ## C01. Diagnostic worker startup rejects authentication holds -**Comment:** [Copilot C01](https://github.com/microsoft/vscode-documentdb/pull/1146#discussion_r4721515405). - -**Evidence and impact.** The command and -[Shell latch filter](https://github.com/microsoft/vscode-documentdb/blob/dec9ac64cbdb18f295fb0f05a7ebe12955703c47/src/documentdb/shell/ShellSessionManager.ts#L462) -allow diagnostic startup through three authentication holds. However, -[WorkerSessionManager's startup assertion](https://github.com/microsoft/vscode-documentdb/blob/dec9ac64cbdb18f295fb0f05a7ebe12955703c47/src/documentdb/playground/WorkerSessionManager.ts#L351) -rejects every latch. Its repeated checks include the boundary before worker construction. -A real ShellSessionManager calling the real WorkerSessionManager rejected all three probe cases -before spawning, while leaving the latch intact. - -The existing Shell tests mock WorkerSessionManager, so their passing bypass tests do not verify -this integration. `credentialsRejected` is a concrete production path; the other two cases also -test the intended capability boundary. This fails safely, but defeats the recovery action precisely -when rejected authentication made it useful. **High; fix.** - -**Options.** - -- **Recommended:** pass a host-only diagnostic capability into worker startup and share the narrow - authentication-hold predicate. **Pros:** fixes the actual boundary; preserves shared state; - ordinary Shell/Playground checks stay strict. **Cons:** one startup API change and dependent tests. -- Infer the bypass from `authMechanism === 'NoAuth'`. **Pros:** fewer parameters. - **Cons:** also affects ordinary saved NoAuth sessions; rejected. -- Won't fix. **Pros:** no changes. **Cons:** leaves the accepted diagnostic workflow broken; not recommended. - -**Acceptance:** real Shell-to-worker startup under each allowed hold; ordinary NoAuth remains -blocked; Disconnect, removal, updates, aborts and superseding epochs remain blocked. No credentials, -token relay, shared-client mutation, or automatic authenticated fallback. - -**Author decision (2026-11-27):** selected the recommended explicit diagnostic startup capability -and shared narrow authentication-hold predicate. - -**Deferred by operator (2026-11-27):** skip C01 for this lead run. The accepted fix remains pending. - -**Deferral withdrawn by operator (2026-11-27):** the skip instruction was for a different -project. C01's accepted fix is included in this lead run. +[Discussion](https://github.com/microsoft/vscode-documentdb/pull/1146#discussion_r4721515405) · High → High. +The [Shell filter](https://github.com/microsoft/vscode-documentdb/blob/dec9ac64cbdb18f295fb0f05a7ebe12955703c47/src/documentdb/shell/ShellSessionManager.ts#L462) +allowed three authentication holds, but the [worker startup assertion](https://github.com/microsoft/vscode-documentdb/blob/dec9ac64cbdb18f295fb0f05a7ebe12955703c47/src/documentdb/playground/WorkerSessionManager.ts#L351) +rejected all three before spawn. Shell tests mocked that boundary; a real Shell-to-worker probe +showed recovery failed safely even for `credentialsRejected`. -**Done (2026-11-27), commit `476e65176` (local, not pushed):** gpt-6.1-sol passed the explicit -diagnostic capability through worker startup and shared the exact three-hold predicate across -the command, Shell and Worker. Ordinary NoAuth, all other holds, abort and epoch fences stay strict; -no credentials, relay, wire flag or hold clearing. Added 21 focused cases; four targeted files: -224 passed. The extra startup argument assertion preserves the existing isolation assertions. -Advised (claude-opus-5.5): approved at 90% confidence after checking startup and worker ownership. -Final batch build remains pending. [Thread reply](https://github.com/microsoft/vscode-documentdb/pull/1146#discussion_r4722230665). +**Selected and implemented:** pass an explicit, host-only diagnostic capability through startup +and share the narrow three-hold predicate. Inferring permission from `NoAuth` would exempt saved +anonymous sessions too. Ordinary Shell/Playground, other holds, abort and epoch checks stayed +strict; no credentials, relay, wire flag or hold clearing. [Fix `476e65176`](https://github.com/microsoft/vscode-documentdb/commit/476e6517689381399f1809dd676782c4e3def625) +added 21 cases; 224 tests passed across four files. [Reply](https://github.com/microsoft/vscode-documentdb/pull/1146#discussion_r4722230665). ## C02. VM diagnostic Shell can use the wrong port -**Comment:** [Copilot C02](https://github.com/microsoft/vscode-documentdb/pull/1146#discussion_r4721515477). - -**Evidence and impact.** -[VM discovery](https://github.com/microsoft/vscode-documentdb/blob/dec9ac64cbdb18f295fb0f05a7ebe12955703c47/src/plugins/service-azure-vm/discovery-tree/AzureSubscriptionItem.ts#L105) -seeds `host:27017`. -[The VM credentials path](https://github.com/microsoft/vscode-documentdb/blob/dec9ac64cbdb18f295fb0f05a7ebe12955703c47/src/plugins/service-azure-vm/discovery-tree/vm/AzureVMResourceItem.ts#L123) -asks for a port and builds a different URI without updating that model. -The inherited diagnostic endpoint still returns the model URI. Credential-cache recovery is both -unreliable after failure and forbidden on this anonymous path. - -Default-port users are unaffected. Custom-port users usually get a misleading refusal; if another -anonymous-capable server listens at 27017, arbitrary Shell commands can target it instead. -The banner exposes the port, but that is not an adequate correctness guard. **Medium; fix required.** -There is no evidence that a destructive command was actually executed against another server. - -**Options.** - -- **Recommended:** retain the credential-free endpoint actually attempted on that VM node and - override its endpoint reader. Record it on the connection-attempt path, not from a diagnostics-only - port prompt. **Pros:** preserves the feature and correct port, with small node-local state. - **Cons:** a recreated node has no trustworthy attempted endpoint and must report unavailable. - Re-reading must observe a later attempt with a different port rather than returning a frozen URI. -- Always return unavailable for VM diagnostic endpoints. **Pros:** smallest fail-closed fix; - eliminates wrong-target risk. **Cons:** loses the diagnostic Shell even for default-port VMs. -- Prompt or fetch credentials during endpoint re-read. **Pros:** can recover the port. - **Cons:** violates the approved no-authentication/no-ARM path and can repeatedly prompt; rejected. - -**Acceptance:** failed attempts on default and custom ports, cache eviction, another attempt on a -different port, and node recreation. Unknown endpoint must never silently fall back to 27017. - -**Author decision (2026-11-27):** selected retaining the credential-free attempted VM endpoint -with an overridden reader that fails closed when the endpoint is unknown. - -**Deferred by operator (2026-11-27):** skip C02 for this lead run. The accepted fix remains pending. - -**Deferral withdrawn by operator (2026-11-27):** the skip instruction was for a different -project. C02's accepted fix is included in this lead run. - -**Done (2026-11-27), commit `e3bd77b21` (local, not pushed):** gpt-6.1-sol retains the sanitized -actually attempted VM endpoint, including its selected port. Unknown/recreated nodes fail closed; -later attempts update the reader; cache eviction and diagnostics-only reads do not redirect it. -Added eight focused cases; three targeted files: 69 passed. Advised (claude-opus-5.5): final revision -approved with high confidence. The leader rejected the first revision's silent sanitizer catch; -the advisor confirmed that the already-parsed input can use normal outer failure handling. -The revised new test verifies cleared endpoint, no client startup and bounded failure presentation -instead of silent diagnostic failure. No pre-existing or TDD test was weakened. -Real VM/provider node-lifetime checks and final batch build remain pending. -[Thread reply](https://github.com/microsoft/vscode-documentdb/pull/1146#discussion_r4722266137). +[Discussion](https://github.com/microsoft/vscode-documentdb/pull/1146#discussion_r4721515477) · High → Medium. +[Discovery](https://github.com/microsoft/vscode-documentdb/blob/dec9ac64cbdb18f295fb0f05a7ebe12955703c47/src/plugins/service-azure-vm/discovery-tree/AzureSubscriptionItem.ts#L105) +seeded port 27017; the [credentials path](https://github.com/microsoft/vscode-documentdb/blob/dec9ac64cbdb18f295fb0f05a7ebe12955703c47/src/plugins/service-azure-vm/discovery-tree/vm/AzureVMResourceItem.ts#L123) +used the user's port without updating the model. The inherited reader could thus target another +server after a custom-port failure. A visible banner was not a guard; no destructive command was observed. -## C03. Stale diagnostic Shell click has generic feedback - -**Comment:** [Copilot C03](https://github.com/microsoft/vscode-documentdb/pull/1146#discussion_r4721515571). - -**Evidence and impact.** -[The command](https://github.com/microsoft/vscode-documentdb/blob/dec9ac64cbdb18f295fb0f05a7ebe12955703c47/src/commands/openInteractiveShell/openInteractiveShell.ts#L105) -correctly blocks lifecycle holds, but its catch shows a generic modal without the supported-node -refresh used by other recovery commands. A bare epoch mismatch also maps to `credentialsChanged`. -Removal or update may already refresh the provider, so "leaves the old node visible" is not universal. -No unsafe connection starts. **Low.** - -**Options.** +**Selected and implemented:** remember the credential-free endpoint actually attempted on that VM +node. The reader reflects later attempts, survives credential-cache eviction and fails closed on +unknown/recreated nodes. No diagnostic port prompt, credential fetch, ARM lookup or default fallback. +The lead rejected a silent sanitizer catch even after initial advisor approval. The accepted +revision used outer failure handling; its new test required a cleared endpoint, no client startup +and bounded feedback. [Fix `e3bd77b21`](https://github.com/microsoft/vscode-documentdb/commit/e3bd77b21759f7ca65e8fd9e5c770718e0f9a9d1): +eight cases added, 69 tests passed across three files. [Reply](https://github.com/microsoft/vscode-documentdb/pull/1146#discussion_r4722266137). -- **Recommended cheap fix:** reuse supported-view refresh routing and existing removed/changed - wording only when the current typed latch proves that cause. **Pros:** consistent actionable UX. - **Cons:** a few routing guards; unsupported Workspace branches must remain unchanged. -- Won't fix. **Pros:** safe existing behavior and narrow stale-click window. - **Cons:** less useful explanation and possibly stale recovery rows. - -Do not infer an actual settings change from an epoch mismatch alone, or create a new provenance -tracker just for this command. **Acceptance:** removed/changed supported nodes, unsupported nodes, -cancelled work, and epoch-only supersession without a false "connection changed" claim. - -**Author decision (2026-11-27):** selected the recommended supported-view refresh and typed -removed/changed feedback, without speculative epoch attribution. +## C03. Stale diagnostic Shell click has generic feedback -**Done (2026-11-27), commit `c952e9624` (local, not pushed):** mai-code-2 refreshes supported -nodes and selects existing actionable copy only from the current removed/changed latch. -Unknown, epoch-only and unsupported-view failures retain generic feedback; cancellation stays quiet -and the original error is preserved. Added five focused cases; 34 passed. -Advised (claude-opus-5.5): approved at 85% confidence after checking routing and reason attribution. -Final batch build remains pending. [Thread reply](https://github.com/microsoft/vscode-documentdb/pull/1146#discussion_r4722266186). +[Discussion](https://github.com/microsoft/vscode-documentdb/pull/1146#discussion_r4721515571) · Medium → Low. +The [command](https://github.com/microsoft/vscode-documentdb/blob/dec9ac64cbdb18f295fb0f05a7ebe12955703c47/src/commands/openInteractiveShell/openInteractiveShell.ts#L105) +blocked startup but gave a generic modal. The stale-node claim was qualified: removal/update +could already refresh the provider. **Selected and implemented:** refresh supported views and use +removed/changed wording only when the current typed latch proves the cause. Epoch mismatch alone +is not proof of an edit. Unknown causes and unsupported views kept generic feedback; cancellation +stayed quiet and the original error survived. [Fix `c952e9624`](https://github.com/microsoft/vscode-documentdb/commit/c952e9624c8394205056b297751df4300ffb7a6e): +five cases added, 34 passed. [Reply](https://github.com/microsoft/vscode-documentdb/pull/1146#discussion_r4722266186). ## C04. Old Playground sign-in can warn a new connection -**Comment:** [Copilot C04](https://github.com/microsoft/vscode-documentdb/pull/1146#discussion_r4721515627). - -**Evidence and impact.** -[Both stale-feedback branches](https://github.com/microsoft/vscode-documentdb/blob/dec9ac64cbdb18f295fb0f05a7ebe12955703c47/src/commands/playground/executePlaygroundCode.ts#L414) -check that the document is open but omit its current connection ownership. -Probes re-picked A to healthy B and then removed A, before the click and during sign-in: -both produced A's removal warning against the document now using B. The newer evaluator was -not disposed and no operation was replayed. Existing "re-picked healthy" tests omit A's removal -latch, which is why they miss this combination. **Low; cheap fix.** - -**Options.** - -- **Recommended:** require `service.getConnection(documentUri) === connection` in both feedback - branches. **Pros:** two local checks; preserves legitimate removal feedback for the same document. - **Cons:** requires focused race tests. -- Reuse the whole `stillOwnsAction()` predicate. **Pros:** existing helper. - **Cons:** suppresses legitimate feedback when removal has disposed the old evaluator; rejected. -- Won't fix. **Pros:** state remains safe. **Cons:** a straightforward ownership defect remains. - -**Author decision (2026-11-27):** selected the two document-connection ownership checks in the -stale-feedback branches, not the full evaluator-ownership predicate. - -**Done (2026-11-27), commit `1fdcfd43d` (local, not pushed):** mai-code-2 added both ownership -guards and four stale-feedback race cases. Same-document feedback and evaluator state are preserved; -no reset or replay. Advised (claude-opus-5.5): approved at 90% confidence after verifying the stored -connection object identity and both async branches. Focused Playground suite: 38 passed. -Final batch build remains pending. [Thread reply](https://github.com/microsoft/vscode-documentdb/pull/1146#discussion_r4722213773). +[Discussion](https://github.com/microsoft/vscode-documentdb/pull/1146#discussion_r4721515627) · Medium → Low. +After a document switched from A to B and A was removed, [both stale-feedback branches](https://github.com/microsoft/vscode-documentdb/blob/dec9ac64cbdb18f295fb0f05a7ebe12955703c47/src/commands/playground/executePlaygroundCode.ts#L414) +could warn about A against B (before the click or during sign-in). **Selected and implemented:** +check the document's current connection in both branches, not full evaluator ownership: +removal can dispose the evaluator while feedback for the same connection is still legitimate. +No evaluator reset or replay. [Fix `1fdcfd43d`](https://github.com/microsoft/vscode-documentdb/commit/1fdcfd43d8c1421fd3749846c7555e151877b37d): +four race cases added, 38 passed. [Reply](https://github.com/microsoft/vscode-documentdb/pull/1146#discussion_r4722213773). ## C05. Completed edit can silently supersede tree sign-in -**Comment:** [Copilot C05](https://github.com/microsoft/vscode-documentdb/pull/1146#discussion_r4721515692). - -**Evidence and impact.** -[The save helper](https://github.com/microsoft/vscode-documentdb/blob/dec9ac64cbdb18f295fb0f05a7ebe12955703c47/src/commands/saveConnectionEdit.ts#L120) -can clear the update latch after the changed settings persist. -[The sign-in currentness check](https://github.com/microsoft/vscode-documentdb/blob/dec9ac64cbdb18f295fb0f05a7ebe12955703c47/src/commands/signInAgain/signInAgain.ts#L146) -still rejects the old epoch/credentials, but `reportClosed()` then has no typed change reason. -A probe replacing credentials and clearing the latch during acquisition confirmed refresh without -a modal or client startup. This probe models the completed-edit outcome, not a real storage write. -Safety is intact; only feedback is missing in a two-action overlap. **Low.** - -**Options.** - -- **Recommended won't fix / defer:** keep quiet supersession and refreshed tree state. - **Pros:** no new history, storage reads, secret comparisons or ambiguous attribution. - **Cons:** the older sign-in action can end without explaining why. -- Capture authoritative saved settings and compare later. **Pros:** can identify some completed edits. - **Cons:** asynchronous storage/error handling and sensitive in-memory comparison for a small benefit; - cache object inequality or epoch alone is not proof of an edit. -- Add a bounded change-version token. **Pros:** precise if lifecycle-wide semantics are well-defined. - **Cons:** new state and call-site responsibilities; disproportionate for this round. - -Do not relax the stale credential/epoch guard. A future fix must distinguish real edits from Retry, -Disconnect/reconnect, and concurrent successful sign-in without guessing. - -**Author decision (2026-11-27):** selected the recommended won't-fix/defer outcome: retain quiet -supersession and refreshed tree state; do not add richer completed-edit attribution this round. - -**No-code outcome recorded (2026-11-27):** no implementation change; the selected safe -supersession behavior remains. [Individual thread reply](https://github.com/microsoft/vscode-documentdb/pull/1146#discussion_r4722321228) -records the tradeoff. The thread was not resolved. +[Discussion](https://github.com/microsoft/vscode-documentdb/pull/1146#discussion_r4721515692) · Medium → Low. +A [completed save](https://github.com/microsoft/vscode-documentdb/blob/dec9ac64cbdb18f295fb0f05a7ebe12955703c47/src/commands/saveConnectionEdit.ts#L120) +can clear the latch. [Sign-in](https://github.com/microsoft/vscode-documentdb/blob/dec9ac64cbdb18f295fb0f05a7ebe12955703c47/src/commands/signInAgain/signInAgain.ts#L146) +still rejected the old credentials/epoch. The probe modeled completion (no real write): tree +refresh, no modal, no client startup. **Selected: won't fix / defer.** Keep quiet supersession +and refresh. Epoch or object inequality cannot distinguish an edit from Retry, reconnect or a +concurrent sign-in; richer attribution would need history or sensitive settings comparisons for +a missing explanation. No guard was relaxed. [No-code reply](https://github.com/microsoft/vscode-documentdb/pull/1146#discussion_r4722321228). ## C06. Genuine sign-in dismissal can show a stale modal -**Comment:** [Copilot C06](https://github.com/microsoft/vscode-documentdb/pull/1146#discussion_r4721515749). - -**Evidence and impact.** -[The catch order](https://github.com/microsoft/vscode-documentdb/blob/dec9ac64cbdb18f295fb0f05a7ebe12955703c47/src/commands/signInAgain/signInAgain.ts#L211) -checks stale acquisition before genuine dismissal. A probe rejecting acquisition with -`User did not consent to login.` after removal showed a modal and started no client. -Internal stale-acquisition checks also use UserCancelledError, so blindly moving the cancellation -check first loses intentional feedback for genuine stale actions. **Low.** - -**Options.** - -- **Recommended bounded fix:** distinguish actual dismissal at the session-acquisition boundary - from internally generated stale cancellation, then keep genuine dismissal quiet. - **Pros:** matches the approved cancellation UX with local control flow. - **Cons:** needs two clearly distinguished outcomes and tests; avoid broad message heuristics. -- Won't fix / defer. **Pros:** the modal is truthful and only appears in the overlapping tree path. - **Cons:** contradicts the quiet-user-cancellation policy. - -**Acceptance:** dismissal after removal/update is quiet; accepted sign-in superseded by removal -still explains; worker-origin recovery remains quiet; no client starts for either stale case. - -**Author decision (2026-11-27):** selected distinguishing actual session-acquisition dismissal -from internally generated stale cancellation, keeping genuine dismissal quiet. - -**Done (2026-11-27), commit `2688f86ca` (local, not pushed):** gpt-6.1-sol captures genuine -acquisition dismissal and handles it before stale-action presentation. Successful stale acquisition, -worker quietness and identity/provider/epoch guards are preserved. Added 13 focused cases; -sign-in suite: 41 passed. Advised (claude-opus-5.5): approved at 90% confidence, including exact -error identity through the acquisition handler. Final batch build remains pending. -[Thread reply](https://github.com/microsoft/vscode-documentdb/pull/1146#discussion_r4722213722). +[Discussion](https://github.com/microsoft/vscode-documentdb/pull/1146#discussion_r4721515749) · Medium → Low. +The [catch order](https://github.com/microsoft/vscode-documentdb/blob/dec9ac64cbdb18f295fb0f05a7ebe12955703c47/src/commands/signInAgain/signInAgain.ts#L211) +showed a stale modal when acquisition returned `User did not consent to login.` after removal. +Internal stale acquisition also used cancellation, so reversing the checks would suppress real +stale-action feedback. **Selected and implemented:** identify genuine dismissal at the acquisition +boundary and keep it quiet. Accepted-but-superseded sign-in still explains; worker-origin recovery, +error identity and provider/identity/epoch fences were preserved. [Fix `2688f86ca`](https://github.com/microsoft/vscode-documentdb/commit/2688f86cac9f813df05b63218b50ca2e9d6574bf): +13 cases added, 41 passed. [Reply](https://github.com/microsoft/vscode-documentdb/pull/1146#discussion_r4722213722). ## C07. Disconnect restores text but not the cursor -**Comment:** [Copilot C07](https://github.com/microsoft/vscode-documentdb/pull/1146#discussion_r4721515827). - -**Evidence and impact.** -[Disconnect](https://github.com/microsoft/vscode-documentdb/blob/dec9ac64cbdb18f295fb0f05a7ebe12955703c47/src/documentdb/shell/DocumentDBShellPty.ts#L282) -captures the partial buffer, moves to End, and restores text with the cursor at its end. -The actual PTY probe typed `abcdef`, moved to position 2, disconnected, inserted `X`, and submitted: -evaluation received `abcdefX`, not `abXcdef`. -Nothing executes automatically, and the relocated cursor is visible. **Low**, rather than -claiming this alone causes database loss; nonetheless preserve editing intent with a small fix. - -**Options.** - -- **Recommended with C09:** capture logical cursor position and use an input-handler - text-and-cursor restore operation backed by the existing wrap-aware renderer. - **Pros:** predictable editing; reusable for asynchronous feedback. - **Cons:** a small input API addition and wrapped-line tests. -- Won't fix. **Pros:** visible End placement is understandable after explicit Disconnect. - **Cons:** breaks the "keep typing where I was" expectation for retained drafts. -- Restore through repeated synthetic arrow keys. **Pros:** no new method. - **Cons:** couples to escape parsing, Unicode movement and repeated rendering; not recommended. - -Do not change the separately approved behavior that drops incomplete multiline/queued executing -input on Disconnect. No reconnect or replay is part of this restoration. - -**Author decision (2026-11-27):** selected restoring the partial input's logical cursor together -with its text through the wrap-aware renderer, shared with C09. - -**Done (2026-11-27), commit `ce2cf8d8b` (local, not pushed):** mai-code-2 added `restoreLine` -and captures the idle single-line cursor before Disconnect moves to End. The next edit submits -the intended command; multiline/evaluating discard and C08's notification guard are unchanged. -Added five focused cases; input/PTY suites: 228 passed. The wrapped Home exact-output expectation -was updated for the selected cursor restoration; the End-position assertion stays unchanged. -Advised (claude-opus-5.5): approved at 90% confidence after checking wrap-row tracking and no replay. -The leader requested a C09 render-origin refinement before dispatch, because a newly emitted prompt -must not inherit the old wrapped cursor row. Final batch build and live terminal checks remain pending. -[Thread reply](https://github.com/microsoft/vscode-documentdb/pull/1146#discussion_r4722303779). +[Discussion](https://github.com/microsoft/vscode-documentdb/pull/1146#discussion_r4721515827) · Medium → Low. +After [Disconnect](https://github.com/microsoft/vscode-documentdb/blob/dec9ac64cbdb18f295fb0f05a7ebe12955703c47/src/documentdb/shell/DocumentDBShellPty.ts#L282), +inserting `X` at the former position 2 submitted `abcdefX`, not `abXcdef`. The cursor move was +visible; nothing ran automatically. **Selected and implemented:** capture idle single-line text +and its logical cursor together; `restoreLine` uses the wrap-aware renderer, not synthetic arrows. +Share it with C09; do not restore incomplete multiline or queued executing input, reconnect or replay. +[Fix `ce2cf8d8b`](https://github.com/microsoft/vscode-documentdb/commit/ce2cf8d8b11a64260fffafa307e1c897bc46462c): +five cases added, 228 passed. The wrapped Home output changed intentionally; the End assertion did not. +[Reply](https://github.com/microsoft/vscode-documentdb/pull/1146#discussion_r4722303779). ## C08. Anonymous startup failure also notifies the host -**Comment:** [Copilot C08](https://github.com/microsoft/vscode-documentdb/pull/1146#discussion_r4721515913). - -**Evidence and impact.** -[The ordinary startup catch](https://github.com/microsoft/vscode-documentdb/blob/dec9ac64cbdb18f295fb0f05a7ebe12955703c47/src/documentdb/shell/DocumentDBShellPty.ts#L673) -skips the credential-backed explanation for anonymous sessions but still sends the host notification. -A probe confirmed terminal output plus `showErrorMessage`. **Low; trivial policy fix.** - -**Options.** - -- **Recommended:** guard only the host notification with `!this._unauthenticated`. - **Pros:** matches the diagnostic terminal-only policy; no normal Shell behavior change. - **Cons:** a background diagnostic terminal will not additionally notify the host. -- Won't fix and explicitly change the policy. **Pros:** retains normal Shell's background visibility. - **Cons:** conflicts with [current feature intent](../README.md#intent) and - [the error-translation skill](../../../../../.github/skills/error-translation/SKILL.md). - -**Advisor disagreement:** the advisor considered the existing notification a reasonable won't-fix -and said no decision required quiet feedback. The leader did not adopt that conclusion: -current feature intent expressly says later failures stay in the terminal. Do not silently -reinterpret the approved boundary just because normal Shells deliberately notify. - -**Author decision (2026-11-27):** selected the anonymous-only host-notification guard, retaining -normal Shell notifications and terminal feedback. - -**Done (2026-11-27), commit `bd70e3298` (local, not pushed):** mai-code-2 guarded only the -anonymous startup host notification. Terminal output, safe logging and retained retry prompt stay -unchanged; normal Shell failures still notify. Added assertions to two existing tests rather than -new suites; all 134 PTY tests passed. Advised design (claude-opus-5.5): 95% confidence; the leader's -mechanical diff review confirmed the exact guard and retained behaviors at 95% confidence. -Final batch build remains pending. [Thread reply](https://github.com/microsoft/vscode-documentdb/pull/1146#discussion_r4722276450). +[Discussion](https://github.com/microsoft/vscode-documentdb/pull/1146#discussion_r4721515913) · Medium → Low. +The [startup catch](https://github.com/microsoft/vscode-documentdb/blob/dec9ac64cbdb18f295fb0f05a7ebe12955703c47/src/documentdb/shell/DocumentDBShellPty.ts#L673) +produced both terminal output and a host notification. The advisor considered retaining normal +background visibility a reasonable won't-fix. The lead disagreed: the [feature intent](../README.md#intent) +and [error-translation guidance](../../../../../.github/skills/error-translation/SKILL.md) placed later +diagnostic failures in the terminal. **Selected and implemented:** guard only the anonymous host +notification; keep terminal feedback, safe logging, retry prompt and normal Shell notifications. +[Fix `bd70e3298`](https://github.com/microsoft/vscode-documentdb/commit/bd70e3298ee841fa50ff0bf10981b950dcfec995): +assertions added to two existing tests, 134 passed. Advisor-approved design; lead reviewed the +one-line guard. [Reply](https://github.com/microsoft/vscode-documentdb/pull/1146#discussion_r4722276450). ## C09. Late Shell sign-in output corrupts the visible prompt -**Comment:** [Copilot C09](https://github.com/microsoft/vscode-documentdb/pull/1146#discussion_r4721515975). - -**Evidence and impact.** -[Late sign-in feedback](https://github.com/microsoft/vscode-documentdb/blob/dec9ac64cbdb18f295fb0f05a7ebe12955703c47/src/documentdb/shell/DocumentDBShellPty.ts#L1007) -calls `handleWorkerFailure()` at the live cursor without separating output or redrawing input. -The success text has the same pattern. The PTY probe typed a partial command, moved Home, -then accepted a stale notification: output was only the error plus CRLF, with no prompt/input redraw. -[writeLine](https://github.com/microsoft/vscode-documentdb/blob/dec9ac64cbdb18f295fb0f05a7ebe12955703c47/src/documentdb/shell/DocumentDBShellPty.ts#L1200) -does not manage input state. - -The logical buffer is retained, but the displayed command can be overwritten or split across -incorrect rows. Later edits/Enter may operate on text the user cannot accurately see. -No automatic replay or database loss was observed. **Medium** because visual/logical command -divergence has a plausible destructive-command consequence, not just a missing empty prompt. - -**Options.** - -- **Recommended:** one bounded asynchronous-output helper using C07's restore primitive. - When idle, move past the rendered input, separate the message, and redraw the current prompt, - current line and cursor. Preserve accumulated multiline state; do not call `showPrompt()` - and erase it. When evaluating, defer the message to the next safe prompt boundary instead - of injecting a second prompt. Apply to failure and success callbacks. - **Pros:** correct visible command; shared fix for realistic asynchronous arrivals. - **Cons:** a small queued-feedback path plus idle/evaluating/multiline tests. -- Queue every message until the user submits. **Pros:** simpler live-rendering handling. - **Cons:** hides explicit recovery feedback indefinitely while an idle user waits. -- Won't fix. **Pros:** no input changes. - **Cons:** invisible buffered command text is an avoidable safety/UX defect; not recommended. - -**Advisor disagreement:** Opus rated this upper-Low because empty prompts are common and the -buffer remains intact. The leader retains Medium for the populated-prompt consequence. -The advisor's suggested `showPrompt()`-then-restore must be qualified: that method resets -multiline state. The helper must preserve it, not reconstruct only the current line. - -**Acceptance:** empty prompt, populated mid-line and wrapped cursor, continuation/multiline state, -evaluation in progress, delayed success, delayed failure, and closed/disconnected terminals. -Assert both visible redraw and the exact next submitted command, with no automatic evaluation. - -**Author decision (2026-11-27):** selected the bounded asynchronous-output helper using C07's -restore primitive, preserving multiline state and deferring output during evaluation to a safe -prompt boundary. Apply to delayed success and failure feedback. - -**Implementation refinement (advised claude-opus-5.5, 2026-11-27, 90% confidence):** the existing -`setPromptWidth` already resets only the physical render-origin row, preserving logical input, -multiline and history state. No additional input API is needed. First move to End using the old -origin, separate/write the message, then call `setPromptWidth(terminalDisplayWidth(prompt))` -at the new prompt row before emitting the prompt and restoring text/cursor. Do not call -`showPrompt` or `resetLine` for idle asynchronous feedback. Queue while evaluating or input-disabled; -flush at the next safe `showPrompt` boundary and discard queued feedback on Disconnect. -This answers the C07 review's wrapped-row concern without expanding the accepted scope. - -**Done (2026-11-27), commit `b32d0a0dc` (local, not pushed):** gpt-6.1-sol separates late -sign-in feedback from the live prompt, restores its input/cursor without clearing multiline/history -state, and queues feedback while evaluation or disabled input owns the terminal. Disconnect/close -discard obsolete queued messages. Existing identity/lifecycle guards, synchronous messages and -C10 behavior remain unchanged. Added 21 focused cases; input/PTY suites: 249 passed. -Six existing late-failure assertions now include the deliberately redrawn prompt while retaining -the original message and no-reset/no-replay assertions. Advised (claude-opus-5.5): exact revision -approved at 90% confidence. Final Case 1 build and all 652 targeted tests passed. -Bounded residual: feedback queued during a paste-choice dialog dismissed without a new prompt -appears at the next prompt. This timing edge was noted by the advisor as non-blocking, not expanded -into additional handling. Real-terminal visual checks remain pending. -[Thread reply](https://github.com/microsoft/vscode-documentdb/pull/1146#discussion_r4722358367). +[Discussion](https://github.com/microsoft/vscode-documentdb/pull/1146#discussion_r4721515975) · Medium → Medium. +[Delayed success/failure](https://github.com/microsoft/vscode-documentdb/blob/dec9ac64cbdb18f295fb0f05a7ebe12955703c47/src/documentdb/shell/DocumentDBShellPty.ts#L1007) +wrote over a live prompt without redrawing input; [writeLine](https://github.com/microsoft/vscode-documentdb/blob/dec9ac64cbdb18f295fb0f05a7ebe12955703c47/src/documentdb/shell/DocumentDBShellPty.ts#L1200) +did not own input state. The advisor rated this upper-Low because the logical buffer survived. +The lead retained Medium: the next submitted command need not match what the user sees. + +**Selected and implemented:** separate asynchronous output from idle input, then restore text +and cursor using C07. The advisor's `showPrompt()`-then-restore proposal would reset multiline +state. Instead, move to End using the old render origin and reset only the physical origin with +`setPromptWidth` at the new prompt. During evaluation or disabled input, queue feedback until a +safe prompt; discard it on Disconnect/close. No history reset or automatic evaluation. +[Fix `b32d0a0dc`](https://github.com/microsoft/vscode-documentdb/commit/b32d0a0dc0e71840d93b55a81c6813520329ecf6): +21 cases added, 249 passed. Six exact-output assertions added the intended redraw without losing +message/no-replay checks. **Accepted residual:** after dismissal of a paste-choice dialog that +doesn't emit a prompt, queued feedback waits for the next prompt. [Reply](https://github.com/microsoft/vscode-documentdb/pull/1146#discussion_r4722358367). ## C10. Anonymous command result is discarded on host-client churn -**Comment:** [Copilot C10](https://github.com/microsoft/vscode-documentdb/pull/1146#discussion_r4721516027). - -**Evidence and impact.** +[Discussion](https://github.com/microsoft/vscode-documentdb/pull/1146#discussion_r4721516027) · Medium → Medium for outcome messaging; Low for the rare overlap. [Anonymous evaluation](https://github.com/microsoft/vscode-documentdb/blob/dec9ac64cbdb18f295fb0f05a7ebe12955703c47/src/documentdb/shell/ShellSessionManager.ts#L399) -maps any intervening epoch change to `credentialsChanged`, after awaiting the worker response. -[Host client deletion](https://github.com/microsoft/vscode-documentdb/blob/dec9ac64cbdb18f295fb0f05a7ebe12955703c47/src/documentdb/ClustersClient.ts#L1252) -advances that epoch even when the diagnostic endpoint has not changed. -Initialization also checks this conservative fence. - -The important distinction: a submitted command **may already have completed on the server** -before its reply is rejected. The extension does not replay it, but "open a new Shell" is not -an accurate account of benign client churn and can encourage a manual rerun. -**Medium for post-command outcome messaging; Low for the rare concurrency inconvenience.** -No mutation was executed during this review. - -**Options.** - -- **Recommended:** keep epoch/latch guards, but distinguish an epoch-only stale _evaluation reply_ - from a proven settings change when presenting it. Proposed bounded copy: - **"This command may have completed, but its result is no longer current. Check the database - before running it again."** - Do not use this completion warning for startup, which has not evaluated a command. - **Pros:** honest outcome and less rerun risk; no safety relaxation. - **Cons:** a small host-local outcome distinction and dependent PTY tests/localization. -- Won't fix epoch tolerance. **Pros:** preserves the existing conservative fence. - **Cons:** benign host churn can still discard a useful reply; acceptable alongside the message fix. -- Accept replies whenever the current endpoint matches. **Pros:** fewer discarded results. - **Cons:** cannot rule out Disconnect/update that occurred and cleared during the operation; - equality now is not lifecycle history. Rejected without a justified stronger invariant. - -Do not add a second epoch/state machine for this edge case, replay any operation, claim rollback, -or treat a warm worker's current model URI as proof that a previous reply is safe. - -**Author decision (2026-11-27):** **won't fix / ignore**, overriding the message-change -recommendation. Operator instruction: **"c10, ignore/wont fix."** No C10 guard, classification, -or message changes are selected. The existing behavior and safety fences remain unchanged. -No additional rationale was supplied. - -**No-code outcome recorded (2026-11-27):** the operator's override is retained without changing -guards or wording. [Individual thread reply](https://github.com/microsoft/vscode-documentdb/pull/1146#discussion_r4722321276) -records the selected outcome, not an implemented fix. The thread was not resolved. +discarded a reply after an epoch change, even [host-client deletion](https://github.com/microsoft/vscode-documentdb/blob/dec9ac64cbdb18f295fb0f05a7ebe12955703c47/src/documentdb/ClustersClient.ts#L1252) +at the same endpoint. A command may already have completed; rejecting its reply is not rollback. +Endpoint equality cannot exclude an intervening Disconnect/update. + +**Operator override: "c10, ignore/wont fix."** The review recommended retaining the epoch/latch +fences but changing **evaluation-only** feedback to “This command may have completed, but its result +is no longer current. Check the database before running it again.” The operator did **not** select +that warning or any guard/classification change, and supplied no further rationale. No replay or +second epoch mechanism. [No-code reply](https://github.com/microsoft/vscode-documentdb/pull/1146#discussion_r4722321276). ## C11. Index failures can show two tree modals -**Comment:** [Copilot C11](https://github.com/microsoft/vscode-documentdb/pull/1146#discussion_r4721516084). - -**Evidence and impact.** -[hideIndex](https://github.com/microsoft/vscode-documentdb/blob/dec9ac64cbdb18f295fb0f05a7ebe12955703c47/src/commands/index.hideIndex/hideIndex.ts#L74) -and its drop/unhide peers show a modal, set `suppressDisplay`, and rethrow. -[Their registration](https://github.com/microsoft/vscode-documentdb/blob/dec9ac64cbdb18f295fb0f05a7ebe12955703c47/src/documentdb/ClustersExtension.ts#L1087) -uses the diagnostics wrapper, which then shows another modal. -A callback-owned-modal probe confirmed two presentations with the same original error. -**Medium; fix this routine failure regression.** - -**Important correction:** `suppressDisplay` is **not** an "already presented" flag. -[rethrowBoundCommandUnavailable](https://github.com/microsoft/vscode-documentdb/blob/dec9ac64cbdb18f295fb0f05a7ebe12955703c47/src/commands/rethrowBoundCommandUnavailable.ts#L9) -sets it without showing anything. Honoring it blindly would make other tree failures silent. - -**Options.** - -- **Recommended:** explicitly mark feedback ownership for the particular error/invocation when - an index catch actually presents it; the tree wrapper skips additional UI only for that marker. - Use a narrow shared helper rather than mutating/wrapping errors or changing the SDK flag's meaning. - **Pros:** preserves original errors, telemetry, early validation failures and webview behavior. - **Cons:** small ownership bookkeeping at the three existing catches and the wrapper. - Unknown/non-Error throws must still work; a different error thrown by cleanup must not be - hidden merely because an earlier error was presented. No extra explanation notification. -- Consolidate tree index feedback into the wrapper while retaining callback feedback for webview - invocations. **Pros:** one owner and no sidecar marker. - **Cons:** requires reliable invocation-origin plumbing and preserving index-specific headings. -- Declare the entire index callback presentation-owned at registration. **Pros:** simple option. - **Cons:** validation errors thrown before the callback's catch have no owner; unsafe unless those - paths are also covered. -- Won't fix. **Pros:** errors remain visible. **Cons:** two modal interruptions for normal failures; - not recommended. - -The advisor correctly identified the `suppressDisplay` counterexample. Its error-marker idea is -useful, but restoring an additional explanation notification would still duplicate feedback; -the final proposal keeps one presentation. **Acceptance:** exactly one modal for each index action, -early validation still visible, suppression-only bound errors still visible, original error -identity/telemetry retained, and webview behavior unchanged. - -**Author decision (2026-11-27):** selected explicit feedback ownership for the particular -error/invocation when an index catch presents it, with one presentation and no generic -`suppressDisplay` shortcut. - -**Done (2026-11-27), commit `61f09ffcd` (local, not pushed):** mai-code-2 added exact -invocation/error ownership markers at the three index catches and gated only additional tree -modals. Suppression-only errors, early validation, primitives and replacement cleanup errors remain -visible; original errors, explanation telemetry and webview behavior are unchanged. Added 12 -focused cases, including real callback/wrapper integration; 26 passed. Advised (claude-opus-5.5): -approved with high confidence after checking context lifetime and original error identity. -Final batch build remains pending. [Thread reply](https://github.com/microsoft/vscode-documentdb/pull/1146#discussion_r4722240271). +[Discussion](https://github.com/microsoft/vscode-documentdb/pull/1146#discussion_r4721516084) · Medium → Medium. +[Hide](https://github.com/microsoft/vscode-documentdb/blob/dec9ac64cbdb18f295fb0f05a7ebe12955703c47/src/commands/index.hideIndex/hideIndex.ts#L74), +drop and unhide presented an error and rethrew; their [tree wrapper](https://github.com/microsoft/vscode-documentdb/blob/dec9ac64cbdb18f295fb0f05a7ebe12955703c47/src/documentdb/ClustersExtension.ts#L1087) +presented it again. The advisor identified the counterexample: [bound-command errors](https://github.com/microsoft/vscode-documentdb/blob/dec9ac64cbdb18f295fb0f05a7ebe12955703c47/src/commands/rethrowBoundCommandUnavailable.ts#L9) +can set `suppressDisplay` without presenting anything. **Selected and implemented:** mark the +particular invocation and error only when the callback presents it. No generic suppression or +extra explanation notification. Early validation, primitives and different cleanup errors remain +visible; original identity, telemetry and webview behavior survive. [Fix `61f09ffcd`](https://github.com/microsoft/vscode-documentdb/commit/61f09ffcd6eef8b0e4e035145ab9e8c943df8cf1): +12 cases added, 26 passed including callback/wrapper integration. [Reply](https://github.com/microsoft/vscode-documentdb/pull/1146#discussion_r4722240271). ## C12. Host-side stale Retry cancellation becomes an alert -**Comment:** [Copilot C12](https://github.com/microsoft/vscode-documentdb/pull/1146#discussion_r4721516133). - -**Evidence and impact.** -[The bound-view guard](https://github.com/microsoft/vscode-documentdb/blob/dec9ac64cbdb18f295fb0f05a7ebe12955703c47/src/webviews/documentdb/boundViewOperations.ts#L55) -can throw `UserCancelledError('staleBoundViewOperation')` without a new unavailable event. -[The Retry catch](https://github.com/microsoft/vscode-documentdb/blob/dec9ac64cbdb18f295fb0f05a7ebe12955703c47/src/webviews/documentdb/useBoundViewRecovery.ts#L150) -shows a generic failure when its local revision has not changed. -[The telemetry runner](https://github.com/microsoft/vscode-documentdb/blob/dec9ac64cbdb18f295fb0f05a7ebe12955703c47/src/webviews/_integration/trpc.ts#L149) -recognizes cancellation, but does not provide a client-side cancellation discriminator. -The transport wraps errors; frontend `instanceof UserCancelledError` is not a reliable solution. - -A client-shaped stale rejection probe confirmed the alert, with Retry retained and recovery reset. -This was a hook probe plus source tracing, **not an end-to-end transport reproduction**. -Normal successful Retry is unaffected; concurrent epoch changes are required. -The view stays blocked, its contents remain, and no database operation is replayed. **Low.** - -**Options.** - -- **Recommended won't fix / defer:** keep the bounded "Try Retry again" feedback. - **Pros:** safe and actionable; no cross-router protocol work for a rare superseded attempt. - **Cons:** an obsolete host attempt is announced as a failure rather than staying quiet. - This is an explicit tradeoff for the author, not a claim that cancellation is already filtered. -- Add a distinct typed cancellation result to bound-view recovery and consume it in the shared hook. - **Pros:** precise quiet handling without raw error inspection. - **Cons:** host result contract, three bound-view integrations and transport tests must stay aligned. -- Match cancellation strings or treat every INTERNAL_SERVER_ERROR as cancellation. - **Pros:** little code. **Cons:** hides genuine failures and depends on transport details; rejected. - -If the author prioritizes exact quiet-obsolete-attempt semantics, select the typed option. -Do not return a recovered/success-shaped result for cancelled work or remove the episode's Retry. - -**Author decision (2026-11-27):** selected the recommended won't-fix/defer outcome: retain the -bounded Retry-failure feedback and do not introduce a typed cancellation protocol this round. - -**No-code outcome recorded (2026-11-27):** no protocol or UI change; retained-view safety guards -and bounded Retry feedback remain. [Individual thread reply](https://github.com/microsoft/vscode-documentdb/pull/1146#discussion_r4722321308) -records the tradeoff. The thread was not resolved. +[Discussion](https://github.com/microsoft/vscode-documentdb/pull/1146#discussion_r4721516133) · Medium → Low. +The [host guard](https://github.com/microsoft/vscode-documentdb/blob/dec9ac64cbdb18f295fb0f05a7ebe12955703c47/src/webviews/documentdb/boundViewOperations.ts#L55) +could cancel a stale Retry without a new unavailable event. The [hook](https://github.com/microsoft/vscode-documentdb/blob/dec9ac64cbdb18f295fb0f05a7ebe12955703c47/src/webviews/documentdb/useBoundViewRecovery.ts#L150) +then showed a generic failure; the [transport](https://github.com/microsoft/vscode-documentdb/blob/dec9ac64cbdb18f295fb0f05a7ebe12955703c47/src/webviews/_integration/trpc.ts#L149) +had no reliable client-side cancellation discriminator. This was a hook probe, not end-to-end RPC. +**Selected: won't fix / defer.** Keep bounded “Try Retry again” feedback and Retry itself. The view +stays blocked and contents survive; nothing replays. A typed result across three routers was not +selected; string matching or suppressing all internal errors could hide real failures. +[No-code reply](https://github.com/microsoft/vscode-documentdb/pull/1146#discussion_r4722321308). ## Verification and outcome -- GitHub REST and GraphQL retrieval confirmed the same HEAD and all 12 current unresolved threads; - there was no additional human review request or substantive timeline feedback to assess. - The active-PR tool returned an unrelated cached merged PR, so this review used explicit #1146 - retrieval rather than that cached result. -- Source/control-flow verification covered all 12 comments. A narrow advisor sweep also checked - feedback-ownership counterexamples and unavailable provider endpoints; this was not a broad audit. -- **Run 1:** nine focused existing test files, **428 tests passed**, including **8 temporary probes**. - Run by MAI Code 2 Flash. -- **Run 2:** three of those files after four further probes, **72 tests passed**. - Counts overlap; they are not 500 unique tests. Across the runs there were **12 distinct probes**. -- No TDD-prefixed contract failed. The probes intentionally asserted observed defective behavior - to establish evidence; their passing does **not** mean the proposed fixes exist. -- Temporary probe edits were removed. The deliverable is this report only; proposed permanent - regression coverage is listed with the relevant findings. - -Commands used: - -```bash -npx vitest run \ - src/documentdb/playground/WorkerSessionManager.test.ts \ - src/documentdb/shell/ShellSessionManager.test.ts \ - src/documentdb/shell/DocumentDBShellPty.test.ts \ - src/commands/signInAgain/signInAgain.test.ts \ - src/commands/playground/executePlaygroundCode.test.ts \ - src/commands/openInteractiveShell/openInteractiveShell.test.ts \ - src/utils/commandErrorHandling.test.ts \ - src/webviews/documentdb/useBoundViewRecovery.test.tsx \ - src/webviews/documentdb/documentView/documentsViewRouter.test.ts \ - --maxWorkers=2 - -npx vitest run \ - src/utils/commandErrorHandling.test.ts \ - src/webviews/documentdb/useBoundViewRecovery.test.tsx \ - src/commands/playground/executePlaygroundCode.test.ts \ - --maxWorkers=2 -``` - -Not verified here: actual server mutations, real VM custom-port connectivity, installed-workbench -terminal rendering, live account dialogs, screen-reader behavior, or complete RPC transport -cancellation. No shared accounts, services or database contents were altered. -Build, lint, packaging and the full Case 2 suite were not rerun for this documentation-only review. - -This is comment validation with an advisor, not a completed replacement for every -[CONTRIBUTING section 6 stage](../../../../../CONTRIBUTING.md#6-ai-assisted-review-workflow). -Author decisions are recorded inline above. At lead-run intake the nine selected fixes were -unimplemented; all nine are in scope after the operator's correction. Subsequent commits and -verification belong in the corresponding item's progress note. No GitHub thread was resolved -by recording these selections. +**Validation, before fixes:** explicit REST and GraphQL reads agreed on head and threads; the +active-PR tool had returned an unrelated cached PR. There was no additional substantive human +feedback. Source tracing covered all 12 items; the advisor's counterexample/provider sweep was +narrow, not a feature-wide audit. Nine files passed 428 tests (eight temporary probes); a second +run of three overlapping files passed 72 (four more probes). These were **12 distinct probes, not +500 distinct tests**. They asserted observed behavior, including defects, and were removed. No +`TDD:` contract failed. No production edit, commit, push or reply occurred in validation. ## Lead outcome (2026-11-27, 17:53 UTC snapshot) ### Unverified live checks first -- **C02:** on a real Azure VM node, fail a connection on a custom port, then open the diagnostic - Shell and verify its banner/target uses that port. Refresh/recreate the node and verify an unknown - attempted endpoint reports unavailable rather than using 27017. Do not run destructive commands. -- **C07/C09:** in the installed terminal, check idle/mid-line/wrapped cursor restoration on Disconnect; - check delayed sign-in success/failure with partially typed and multiline input, and while evaluating. - Verify visible text and the next submitted read-only command agree. -- Unit tests exercised PTY output and mocked VM attempts, not a running workbench, live authentication - or real VM networking. Try these checks before pushing. +- **C02:** real Azure VM, failed custom-port attempt, diagnostic Shell banner/target, then a + refreshed/recreated node with no known endpoint. Expected: unavailable, never fallback to 27017. +- **C07/C09:** installed terminal, idle/mid-line/wrapped Disconnect; delayed success and failure + with partial, multiline and evaluating input. Compare visible text to the next read-only submission. +- No live account dialog, real server mutation, screen-reader or full transport cancellation test. + Mocked VM attempts and PTY output do not establish these results. ### Endpoint and completed work -**Local implementation complete:** all nine accepted fixes have separate code commits and passed -the final Case 1 checks. The source plan was committed before coding; progress notes were committed -separately from code. No push, PR-status change, thread resolution, or Case 2 handoff was performed. -The remote PR head remains `dec9ac64c`; the new code is local. - -| Item | Code commit (local) | Actual coding model | Outcome | -| ---- | ------------------- | ------------------- | ------------------------------------------------------------- | -| C01 | `476e65176` | gpt-6.1-sol | Diagnostic startup capability across the worker boundary | -| C02 | `e3bd77b21` | gpt-6.1-sol | Sanitized attempted VM endpoint, unknown fails closed | -| C03 | `c952e9624` | mai-code-2 | Current-state stale diagnostic feedback and supported refresh | -| C04 | `1fdcfd43d` | mai-code-2 | Playground document-connection feedback ownership | -| C06 | `2688f86ca` | gpt-6.1-sol | Genuine dismissal separated from internal stale acquisition | -| C07 | `ce2cf8d8b` | mai-code-2 | Retained input cursor restored with wrap-aware rendering | -| C08 | `bd70e3298` | mai-code-2 | Anonymous errors stay terminal-only | -| C09 | `b32d0a0dc` | gpt-6.1-sol | Asynchronous feedback preserves input and defers safely | -| C11 | `61f09ffcd` | mai-code-2 | Exact callback error-presentation ownership | - -C05, C10 and C12 retain their operator-selected no-code outcomes. -**All 12 comments received individual replies in their own Copilot review threads**; links are -recorded inline. No omnibus PR comment was posted. Earlier replies and done notes stating that -the batch build was pending describe their posting-time snapshot; this final verification supersedes -that pending status for all nine code commits. - -Models match the advisor recommendations; no substitutions or unavailable-model retries occurred. -The C08/C07 same-file chain reused one MAI Code 2 agent with a commit between items. -Technical decisions are recorded inline: operator selections; advisor-approved interfaces and logic; -the leader's C08 mechanical review; C02's rejected silent catch and revised new test; and C09's use of -the existing render-origin reset rather than a new API. No unresolved technical question was parked. -The operator's initial C01/C02 skip was withdrawn before coding. - -Advisor work: two planning consultations plus ten logic-review consultations across nine advisor -contexts, including the C02 follow-ups. C08's one-line guard had the advisor-approved design and a -leader mechanical review. All final logic revisions received approval; C02's initial approval was -not treated as sufficient after the leader found the silent catch. C07's Home-output assertion and -C09's redrawn-prompt assertions changed only to match selected behavior, not to weaken contracts. +The nine fixes were separate **local** commits when the individual replies were posted; the remote +head was still `dec9ac64c`. All 12 threads received individual replies, none were resolved, and +there was no omnibus comment or PR-state change. The lead recorded two planning and ten logic +consultations across nine advisor contexts. All final logic revisions were accepted (C08 used a +lead mechanical review); C02 required rework. No unresolved technical question was parked. ### Final verification -- `npm run build`: **passed**, exit 0. -- One focused Vitest run: **13 files, 652 tests passed, 0 skipped, 0 failures**, exit 0; - Vitest duration **17.58 seconds**. -- Build ran before the root tests. Combined build/test tool span was about **1m04s**; - build elapsed time was not separately reported. -- No TDD-prefixed contract failed. No dependencies were installed or changed. -- Source user-facing localization keys were unchanged; generation, formatting, lint, strict - package-test checks, full Vitest and packaging were not run for this Case 1 endpoint. -- The feature README and user manual still describe the selected recovery behavior; the README - now links this review/progress record. No documentation drift sweep was performed. -- Tracked worktree was clean at verification. Only the two pre-existing untracked - `.copilot-connection-*` directories remained, untouched. - -Final command: - -```bash -npx vitest run \ - src/documentdb/playground/WorkerSessionManager.test.ts \ - src/documentdb/shell/ShellSessionManager.test.ts \ - src/documentdb/playground/PlaygroundEvaluator.test.ts \ - src/commands/openInteractiveShell/openInteractiveShell.test.ts \ - src/plugins/service-azure-vm/discovery-tree/vm/AzureVMResourceItem.test.ts \ - src/tree/documentdb/diagnosticCredentialRead.test.ts \ - src/tree/documentdb/ClusterItemBase.test.ts \ - src/commands/playground/executePlaygroundCode.test.ts \ - src/commands/signInAgain/signInAgain.test.ts \ - src/documentdb/shell/ShellInputHandler.test.ts \ - src/documentdb/shell/DocumentDBShellPty.test.ts \ - src/utils/commandErrorHandling.test.ts \ - src/commands/index.shared/indexCommandFeedback.test.ts \ - --maxWorkers=2 -``` - -Full Case 2 remains for an explicit review handoff. This run does not claim completion of all -CONTRIBUTING section 6 initial-review/validation/sweep requirements or the pending live checks. +**Case 1:** `npm run build`, then 13 targeted Vitest files with `--maxWorkers=2`: **652 passed, +0 skipped, 0 failed** (17.58s). This superseded the build-pending notes in the replies. No `TDD:` +failure or dependency/localization change. The tracked tree was clean; the two pre-existing +untracked connection directories were untouched. This was not a full +[CONTRIBUTING §6](../../../../../CONTRIBUTING.md#6-ai-assisted-review-workflow) review or a live check. ### Usage snapshot -Window: **2026-11-27T17:17:00.522Z through the host's 17:53 UTC snapshot** (about 36 minutes). -This is the current lead run only, not the earlier implementation/review sessions. -The final response and subsequent report-persistence operations are excluded. -AIU are usage units, not dollars. Model-request spans overlap and are not wall-clock elapsed time. - -| Model | Role | Requests | Summed model time | AIU | AIU share | -| ---------------- | ------- | -------: | ----------------: | ----: | --------: | -| claude-opus-5.5 | advisor | 106 | 11m09s | 522.2 | 56.9% | -| gpt-6.1-sol | leader | 73 | 21m07s | 249.0 | 27.1% | -| gpt-6.1-sol | coding | 52 | 8m19s | 102.1 | 11.1% | -| mai-code-2 | coding | 66 | 10m23s | 43.8 | 4.8% | -| mai-code-2-flash | checks | 3 | 12s | 0.1 | 0.0% | - -| Role | Requests | Summed model time | AIU | AIU share | -| ------- | -------: | ----------------: | ----: | --------: | -| leader | 73 | 21m07s | 249.0 | 27.1% | -| coding | 118 | 18m42s | 145.8 | 15.9% | -| advisor | 106 | 11m09s | 522.2 | 56.9% | -| checks | 3 | 12s | 0.1 | 0.0% | - -**Totals:** leader **249.0 AIU**, subagents **668.2 AIU**, run **917.2 AIU**. -Rounding individual rows can differ from these host totals. - -| Model | Role | Input | Output | Cache read | Cache write | Reasoning | -| ---------------- | ------- | ---------: | -----: | ---------: | ----------: | --------: | -| claude-opus-5.5 | advisor | 7,417,828 | 66,866 | 6,917,519 | 500,069 | 32,299 | -| gpt-6.1-sol | leader | 16,168,987 | 62,617 | 16,066,066 | 102,702 | 27,412 | -| gpt-6.1-sol | coding | 2,599,223 | 29,702 | 2,405,939 | 193,128 | 9,412 | -| mai-code-2 | coding | 3,261,276 | 35,323 | 2,697,728 | 0 | 17,143 | -| mai-code-2-flash | checks | 49,634 | 798 | 31,744 | 0 | 310 | - -Cache and reasoning fields may overlap input/output; they must not be added into a purported -token total. Figures are copied from the host session-log helper with explicit agent roles. -The helper's multi-turn elapsed summaries are not used as per-item wall-clock measurements. - -**Optimization note:** advising was the largest measured category (56.9%), followed by leading -(27.1%). The planning context alone accounted for 334.5 AIU, including its late C09 follow-up. -Future runs could use a smaller planning packet and a fresh, narrowly scoped context for late -interface questions instead of rehydrating a large planning context. C02 needed one bounded -implementation rework and a final re-review; no coding model was silently downgraded to reduce cost. +17:17:00.522Z–17:53 UTC, lead run only: **917.2 AIU** (249.0 leader, 668.2 subagents). Advisor: +522.2 (56.9%), including 334.5 for the planning context with the late C09 follow-up. The audit +suggested smaller planning packets and a fresh context for late questions, not a model downgrade. +[Per-model requests, times and tokens](https://github.com/microsoft/vscode-documentdb/blob/01590e0617e3dcf70cb237acab3fd880ca908162/docs/ai-and-plans/features/connection-lifecycle/iterations/02-pr1146-copilot-review.md#usage-snapshot) +exclude later persistence and the final response. AIU are not dollars; request spans overlap. ## Case 2 pre-push verification (2026-11-27, 18:24 UTC snapshot) -The operator expanded the endpoint: **"run case 2 checks, address issues, then push."** -The earlier local-only endpoint and deferred Case 2 notes are historical. This snapshot was -recorded after all local checks passed and before the authorized push; the delivered head and CI -state are reported in the handoff. No PR-status change or thread resolution is part of this request. +The operator expanded the endpoint: **"run case 2 checks, address issues, then push."** This +snapshot is **after local verification, before the authorized push**; it does not attest delivery or CI. ### All eight commands passed -| Command | Result | -| ------------------------- | --------------------------------------------------------------- | -| `npm run l10n` | Passed; generated bundle unchanged | -| `npm run prettier-fix` | Passed; nine tracked files formatted | -| `npm run l10n:check` | Passed | -| `npm run lint` | Passed on full rerun after fixture corrections | -| `npm run build` | Passed | -| `npm run typecheck:tests` | Passed; exact strict workspace-test script | -| `npx vitest run` | Passed: 451 files, 10,294 passed, 1 skipped; 118.89s | -| `npm run package` | Passed: `vscode-documentdb-1.1.1-alpha.4.vsix`, 9,268,165 bytes | - -Formatting was committed separately as `e33bb7bb1`. -The full runtime suite passed before the two test-only fixture corrections; afterwards the -two relevant suites passed **26/26**, and full lint passed. Those 26 tests are not additional -unique tests. Production source did not change after the successful build, strict package-test -checks and package run. No TDD-prefixed contract failed, no dependencies were changed or installed, -and no larger-heap or worktree-ignore workaround was needed. +`npm run l10n` left the bundle unchanged; `npm run prettier-fix` formatted nine tracked files +([`e33bb7bb1`](https://github.com/microsoft/vscode-documentdb/commit/e33bb7bb11f0fba90c59afcd7c29b9610ff993f3)). +`npm run l10n:check`, `npm run build`, `npm run typecheck:tests` and `npm run package` passed +(VSIX `vscode-documentdb-1.1.1-alpha.4.vsix`, 9,268,165 bytes). Full `npx vitest run`: **10,294 +passed, 1 skipped, 451 files** (118.89s), before the test-only corrections below. Afterwards +`npm run lint` passed in full and the two affected suites passed 26/26, not 26 additional unique +tests. No production change after build, strict test type-check and package; no `TDD:` failure, +dependency change, larger heap or worktree-ignore workaround. ### C11 fixture correction -**Commit `2589ec75d`:** the primitive-error fixture now uses a typed -`vi.fn<() => Promise>().mockRejectedValue(error)` instead of a direct primitive throw. -The cleanup fixture calls a typed throwing cleanup function from `finally`. -Error/primitive identity, marked-feedback modal counts, explanation telemetry, cleanup precedence -and the exact replacement-error assertions remain unchanged. No lint rule was disabled. - -The first attempt used `Promise.reject(error)`, which triggered a second production-style rule, -`prefer-promise-reject-errors`. Advised (claude-opus-5.5): use the existing typed rejection-mock -pattern; the advisor verified its `unknown` rejection input and awaited-wrapper equivalence. -MAI Code 2 applied the final fixture changes and passed targeted Prettier, ESLint and Vitest. -This is test setup, not a production behavior change or a weakened contract. +[`2589ec75d`](https://github.com/microsoft/vscode-documentdb/commit/2589ec75d3a4a4b2169598858487bd045d813e5d) +replaced a primitive throw with a typed `mockRejectedValue(error)` and called a typed throwing +cleanup function in `finally`. An intermediate `Promise.reject(error)` had also failed lint. +No rule was disabled; rejection identity, modal counts, explanation telemetry, cleanup precedence +and exact replacement-error assertions remained intact. ### Publishing and remaining checks -The verified commits and this record are to be pushed together to -`dev/tnaum/connection-lifecycle-ux`, targeting `feature/connection-lifecycle` in PR #1146. -The milestone remains 1.2.0. Individual thread updates will reference published commits; -no omnibus PR comment or automatic thread resolution is requested. - -C05/C10/C12 retain their selected no-code outcomes. Real VM node-lifetime/custom-port and installed -terminal visual checks remain unperformed, as listed above. All CONTRIBUTING section 6 -initial-review/validation/sweep requirements are not claimed complete merely because Case 2 passed. +The authorized destination was `dev/tnaum/connection-lifecycle-ux` → `feature/connection-lifecycle` +in #1146, milestone 1.2.0. Thread updates were to cite published commits, not resolve threads. +Case 2 did not complete the VM/terminal checks above or certify all §6 initial-review, validation +and sweep stages. ### Case 2 follow-up usage -Window: **2026-11-27T17:59:57.853Z through the host's 18:24 UTC snapshot**. -These figures are separate from the earlier lead snapshot; publication, subsequent report -persistence and the final response are excluded. AIU are not dollars. - -| Model | Role | Requests | Summed model time | AIU | AIU share | -| ---------------- | ------- | -------: | ----------------: | ----: | --------: | -| claude-opus-5.5 | advisor | 3 | 14s | 25.5 | 7.0% | -| gpt-6.1-sol | leader | 20 | 17m02s | 336.1 | 92.2% | -| mai-code-2 | coding | 9 | 49s | 2.6 | 0.7% | -| mai-code-2-flash | checks | 13 | 46s | 0.5 | 0.1% | - -**Role totals:** leader 336.1 AIU; coding 2.6; advisor 25.5; checks 0.5. -**Host totals:** leader 336.1 AIU, subagents 28.6 AIU, follow-up run 364.7 AIU. -Rounded rows may differ from the host total. - -| Model | Role | Input | Output | Cache read | Cache write | Reasoning | -| ---------------- | ------- | --------: | -----: | ---------: | ----------: | --------: | -| claude-opus-5.5 | advisor | 122,674 | 1,445 | 80,680 | 41,986 | 400 | -| gpt-6.1-sol | leader | 6,087,797 | 42,590 | 5,774,418 | 313,319 | 37,441 | -| mai-code-2 | coding | 218,487 | 2,089 | 186,368 | 0 | 699 | -| mai-code-2-flash | checks | 254,047 | 1,913 | 179,200 | 0 | 901 | - -Cache/reasoning fields overlap input/output and are not a token total. Request spans are not -wall-clock elapsed time. The full-suite agent's initial tool span was about 8m31s; per-step -durations other than the runtime suite were not reported. Leading was the largest measured -follow-up cost; a fresh, smaller-context session for long verification/publishing rounds would -reduce coordination overhead. +17:59:57.853Z–18:24 UTC, separate from the lead run: **364.7 AIU** (336.1 leader, 28.6 subagents). +Leading accounted for 92.2%; a smaller verification context was suggested. The +[follow-up audit](https://github.com/microsoft/vscode-documentdb/blob/01590e0617e3dcf70cb237acab3fd880ca908162/docs/ai-and-plans/features/connection-lifecycle/iterations/02-pr1146-copilot-review.md#case-2-follow-up-usage) +excludes publication, later persistence and final response; rounded rows and overlapping +cache/reasoning fields are not additive. diff --git a/docs/ai-and-plans/features/connection-lifecycle/iterations/02-ux-implementation-plan.md b/docs/ai-and-plans/features/connection-lifecycle/iterations/02-ux-implementation-plan.md index 2c02f1659..42e72fc6f 100644 --- a/docs/ai-and-plans/features/connection-lifecycle/iterations/02-ux-implementation-plan.md +++ b/docs/ai-and-plans/features/connection-lifecycle/iterations/02-ux-implementation-plan.md @@ -1,7 +1,7 @@ --- feature: connection-lifecycle kind: plan -status: draft +status: historical created: 2026-11-27 code: - src/tree/documentdb/ClusterItemBase.ts @@ -22,58 +22,35 @@ code: # Iteration 2: implement the connection-lifecycle UX review findings -> **Purpose:** translate the open findings in the -> [PR #1136 UX review](./01-pr1136-ux-review.md) into bounded implementation work for -> review, then execution by the `lead` skill. This plan is not approval to implement -> unresolved recommendations. +> **Historical plan and execution record, 2026-11-27.** The [UX review](./01-pr1136-ux-review.md) +> holds the observations and alternatives. Below, each work item separates the original +> request from its disposition. The [unabridged plan and checkpoints](https://github.com/microsoft/vscode-documentdb/blob/01590e0617e3dcf70cb237acab3fd880ca908162/docs/ai-and-plans/features/connection-lifecycle/iterations/02-ux-implementation-plan.md) +> preserve the sequence between the initial local-only authorization and the later Case 2 run. -**Source of truth:** the review records the observed behavior, operator decisions, -recommendations and remaining uncertainty. Existing feature intent and accepted -constraints remain in the [feature overview](../README.md) and -[decisions](../decisions.md). If current code differs from the review's cited snapshot, -verify the current behavior before changing it; do not treat snapshot references as proof -that a reported issue still reproduces. +This is not a current specification. See the [feature overview](../README.md) and +[decisions](../decisions.md), especially 0031–0036: the later design no longer lets +an explicitly disconnected retained tab resume database operations. ## Goal and scope -Implement the review's open, actionable user-experience findings while preserving the -connection-lifecycle safety rules: never change the identity bound to a retained view, -never replay a failed database operation, retain action-only tree recovery rows, and keep -worker/webview feedback on its intended surface. - -In scope: F1–F5 and F7–F12 from the review. F6 is closed as accepted-as-is; Q1 is answered -without an extension change; the Dashboard diagnostics link is tracked in #1141. Do not -expand this work into broader network resilience, account sign-out handling, telemetry -redesign, or unrelated error-message cleanup. +The plan covered F1–F5 and F7–F12. Recovery must preserve the bound identity, never +replay an operation, keep tree recovery rows actionable and report failures on the +initiating surface. F6 was accepted as-is; Q1 needed no extension change; the +Dashboard diagnostics link went to #1141. Network resilience, account sign-out, +telemetry redesign and unrelated error copy were out of scope. ## Authority and decision gates -1. Approved directions in the UX review are constraints: F2's rerun guidance, F3's - tree-action modal policy, F8's separate Shell system-output line, F9's “Keep open” - label, F10's explicit saved-password explanation, F11's accessible name, and F12's - human-readable shared debug format. -2. The review's recommendations for F1, F4 and F5 are **not all final decisions**. - Before implementing each item, confirm its unresolved behavior or exact wording with - the operator. In particular: - - F1 leans toward an unauthenticated Shell from error rows, but final label and - behavior are still open. - - F4's recommended in-dialog Retry failure treatment is not approved. - - F5's recommended stale-explicit-click handling is not approved. -3. F7 is a reproduction gate, not a confirmed regression. Reproduce the exact credential - repair sequence on the current build before changing menu eligibility. If it does not - reproduce, record the evidence and close it without a speculative code change. -4. Do not append a decision to `decisions.md` for a recommendation merely because this - plan records it. Once the operator confirms a significant new behavior, record that - decision with their rationale before or alongside implementation. -5. Recheck affected source, related tests, and current localization patterns at execution - time. Keep changes in the existing command/tree/webview surfaces; avoid new lifecycle - abstractions unless current code demonstrates they are necessary. +**At intake:** F2/F3 and F8–F12 had approved directions, not necessarily final copy. +F1's Shell behavior/label, F4's Retry feedback and F5's stale-click policy still +needed operator decisions; F7 needed live evidence. The plan required rechecking the +source, tests and localization, using existing surfaces, and recording significant +choices with the operator's rationale, not promoting suggestions to decisions. ### Execution authorization (2026-11-27) -The operator invoked `/lead` to process this plan, then explicitly approved the item/model -mapping and the remaining F1/F4/F5/F3 choices. The endpoint is **local work and commits**: -no push, external edits or Case 2 handoff was requested. +The operator invoked `/lead` and approved the choices below for **local work and +commits**. No push, external edit or Case 2 handoff was initially requested. - Advisor: `claude-opus-5.5`. - WI-1 expansion, WI-2, WI-3 and WI-5: `mai-code-2`, substituted for the advisor's @@ -104,99 +81,32 @@ no push, external edits or Case 2 handoff was requested. - F7: current source inspection has not established a defect. A live reproduction is still pending; no speculative menu change is authorized. -Unrelated untracked `.copilot-connection-relays/` and `.copilot-connection-telemetry/` -directories were present at intake and are left untouched. - ## Workstream order and dependencies -```text -WI-0: Revalidate findings and settle gates - ├── WI-1: Tree feedback and explicit stale tree actions (F3; F5 decision-gated) - ├── WI-2: Worker recovery wording and Shell output line (F2, F8) - ├── WI-3: Retained-view Retry failure feedback (F4) - ├── WI-4: Teardown, decoded-password, and overlay wording (F9–F11) - ├── WI-5: Human-readable connection and worker stats (F12) - ├── WI-6: Unauthenticated Shell from connection failure rows (F1) - └── WI-7: Investigate F7 only if it reproduces -``` - -WI-1 through WI-6 are independent after WI-0 except: - -- WI-1's stale-action behavior depends on the operator choosing an F5 option. -- WI-3 depends on the operator choosing an F4 option. -- WI-6 depends on the operator confirming F1's behavior and label. -- F7 is included in WI-0; only a reproducible defect creates a small implementation - follow-up, which must be reviewed as a separate scoped change. - -Workstreams may be grouped into reviewable PRs by surface, but keep distinct behavior -changes and their tests independently reviewable. Do not combine unrelated changes just -to reduce the number of PRs. +WI-0 checked the baseline. Its F5, F4 and F1 decisions gated WI-1's stale actions, +WI-3 and WI-6 respectively; WI-2, WI-4 and WI-5 needed no such choice. Only a +reproduced F7 would open WI-7. Work could be grouped by surface as long as each +behavior and its tests remained independently reviewable. ## WI-0: Revalidate findings and settle decision gates -**Review items:** F1, F4, F5, F7 -**Depends on:** none -**Deliverable:** verified current-code baseline and explicit operator answers for the -behavior gates. - -1. Check the current branch/build against the review's evidence; inspect the current - implementations and tests named in the relevant F sections. -2. Reproduce F7 in the current build: failed connection → Update Credentials → choose - reconnect with fresh credentials → inspect the cluster context menu after refresh. - Capture whether a client exists, whether a latch applies, and the refreshed tree - context tag. Do not infer the cause from a restart. -3. Present the operator the options and trade-offs in O2 and O3 and ask for a decision - before coding F4 or F5. -4. Confirm F1's error-row Shell behavior and user-facing label. Keep normal context-menu - Shell startup authenticated unless explicitly changed by a decision. -5. Record what was confirmed, rejected, or not reproducible in the progress notes for - this plan. No code change is required for a non-reproducible F7. - -**Done when:** current behavior is verified; F4/F5/F1 are either explicitly decided or -marked blocked; F7 has reproduction evidence and a disposition. Do not silently resolve -any of these gates in implementation. - -> **Baseline verified; live evidence pending (2026-11-27):** advisor -> `claude-opus-5.5` revalidated the relevant current source against `dd11ca7d3`. -> The operator explicitly decided F1/F4/F5 and approved the model mapping. -> The connected context tag still requires a cached client without a lifecycle hold; -> credential-save completion releases the update hold. Source inspection did not -> establish an F7 defect and is not a reproduction. The operator selected **Leave -> pending for operator testing; no speculative fix**. WI-0 is not claimed fully -> verified until that live evidence is supplied. +**Plan:** compare source/tests to the review; present the [O2 Retry alternatives](./01-pr1136-ux-review.md#o2-where-should-a-failed-in-view-retry-be-explained-f4) +and [O3 stale-click alternatives](./01-pr1136-ux-review.md#o3-how-should-an-explicit-stale-action-end-f5). +Settle the failure-row Shell label without changing normal startup. Record each choice or blocker and +collect the F7 build, client, latch and refreshed context tag. + +**Result:** the advisor checked `dd11ca7d3`; the operator settled F1/F4/F5 above. The +connected tag required a cached client without a hold; credential-save completion +released the update hold. That did not reproduce or disprove F7. The operator chose +live testing, not a speculative fix; WI-0 remained incomplete on that point. ## WI-1: Align tree-action failures and stale explicit recovery (F3, F5) -**Depends on:** WI-0 for F5; F3's tree-modal direction is already approved. -**Likely areas:** `BaseExtendedTreeDataProvider`, database/index expansion providers, -tree recovery commands, and their existing tests. - -- Use modal feedback for failures caused by tree actions, including descendant tree - expansion and explicit tree commands, consistent with the cluster-expansion pattern - and error-translation guidance. -- Present a translated heading and separate error detail. Avoid duplicate modals for one - action, raw error paragraphs in tree children, or changing recovery children from - actions into status text. -- Apply the chosen F5 policy only to an explicit click on a still-visible stale action: - re-check state, refresh/reveal current tree state where appropriate, and explain an - actually failed action using the selected behavior. Keep cancellation, disposed work, - obsolete background replies, and already-completed recovery quiet. -- Never connect a different identity or restart work for a removed/disposed target just - to make the stale action appear successful. - -**Acceptance:** - -- A failed database or index expansion gives one modal with the actionable explanation; - no second notification/modal is emitted for the same failure. -- Tree items still expose recovery actions only. -- An explicit stale action follows the operator-approved outcome; cancellation and stale - background work remain silent. -- The result does not bypass existing identity, epoch, or latch guards. - -**Tests:** focused provider/command tests for modal feedback, one-error/one-feedback -behavior, current-state refresh, and quiet cancellation/background paths. Use existing -tree/error-translation helpers and assert the translated-message contract rather than -duplicating framework behavior. +**Plan:** one modal per failed tree action, including database/index expansion, with a +translated heading and separate detail; children remain actions. Test the provider and +commands for duplicate feedback. For F5, test refresh on an explicit stale click, an +accurate explanation only on actual failure, and quiet cancellation/disposal/obsolete +background replies. Never bypass identity, epoch or latch guards to complete a click. > **Deferred, escalated (2026-11-27), WI-1a/F3 descendant expansion:** the advisor > (`claude-opus-5.5`, 40% confidence in origin attribution) found no documented ordering @@ -208,266 +118,107 @@ duplicating framework behavior. > attribution is supported. No expansion code was changed. The issue records Azure > scenarios, benefits, background-noise risks and host-coordination trade-offs. -> **Done (2026-11-27), WI-1b commit `57f96b23b`:** explicit cluster-associated -> tree-command failures use one modal with an explained/localized heading and separate -> error detail. The Diagnostics wrapper was changed in place; command registrations and -> webview/no-cluster feedback are unchanged. Decisions: operator, explicit tree-origin -> policy; advised (`claude-opus-5.5`), 90% approval of the exact implementation after -> checking callers, cancellation, original error identity and single-feedback ownership. -> The worker (`gpt-6.1-sol`, as recommended) verified the installed azext runtime at -> 99% confidence. Fourteen focused tests were added and passed. Batch 1 -> `npm run build` passed; seven touched test files passed (67 tests). No Case 2 checks ran. -> The initial wrapper-selection blocker was resolved by preserving registrations and -> changing Diagnostics itself; no public argument contract changed. F5/WI-1c remains open. - -> **Done (2026-11-27), WI-1c-tree commit `c77ba2115`:** supported explicit stale recovery -> actions refresh first, then show one accurate removed/changed modal. Other stale states -> refresh quietly; a connection disconnected during sign-in retains the existing closed -> explanation. Worker sign-in entry points, identity checks, key/latch mutations and unsupported -> Azure Workspace guards are unchanged. Decisions: operator, explicit F5 option C; advised -> (`claude-opus-5.5`), 85% approval of the exact revision. Actual/recommended model: -> `gpt-6.1-sol`; the worker verified preserved invariants at 97%. Forty-four focused cases -> were added across the three command test files; 73 tests passed. Epoch-only presentation -> assertions intentionally became quiet, retaining no-auth-start assertions. No helper export -> or helper expansion was added. Worker notification handling remains a separate follow-up. - -> **Done (2026-11-27), WI-1c-worker commit `0a01a24e4`:** an explicit stale sign-in click -> gets existing Shell/Playground-specific removed/changed guidance only when the terminal/file -> still exists and the current typed latch proves that failure. Cancellation, closed work, -> already-reported revisions, epoch-only and no-latch cases stay quiet. No worker is reset, -> stopped, restarted or rebound by these stale callbacks. Decisions: operator, explicit F5 -> worker-surface policy; advised (`claude-opus-5.5`), 85% approval; actual/recommended -> `gpt-6.1-sol`. The leader's initial helper-name error was corrected before edits to reuse -> `handleWorkerFailure` and `getPlaygroundRecovery`. Thirty-eight focused cases were added; -> 163 tests passed. Existing ownership assertions are unchanged; the telemetry mock suppresses -> only the production fire-and-forget sign-in action. Final batch verification remains pending. +**WI-1b — explicit tree commands (`57f96b23b`).** Cluster-associated commands got the +single modal. Changing Diagnostics in place resolved the wrapper choice without changing +registrations, public arguments or webview/no-cluster feedback. Review checked callers, +cancellation, original error identity and feedback ownership (advisor 90%; worker's azext +runtime check 99%). Fourteen tests added; Batch 1 build passed, 67 tests in seven files. +Case 2 had not run. + +WI-1c split F5 by the surface that owned the action: + +**WI-1c-tree — stale clicks (`c77ba2115`).** Under option C, supported actions +refreshed first; only a proven removal/change gave a modal. Disconnect during sign-in +retained the closed-connection explanation. Worker sign-in entry, identity checks, +key/latch mutations and unsupported Azure Workspace guards stayed intact. No helper +export/expansion. Epoch-only tests expected silence but still checked no auth started. +44 cases added across three command files; 73 passed (advisor 85%, worker 97%). + +**WI-1c-worker — stale sign-in (`0a01a24e4`).** Only a click from a still-open +terminal/file with a typed removed/changed latch got worker-specific guidance. +Cancellation, closed work, reported revisions, epoch-only and no-latch states stayed +quiet; no reset, stop, restart or rebind. A helper-name error was corrected before edits +to reuse `handleWorkerFailure` and `getPlaygroundRecovery`. Ownership assertions stayed; +the telemetry mock suppressed only the fire-and-forget sign-in action. 38 cases added; +163 passed (advisor 85%). ## WI-2: Correct worker recovery guidance and Shell status output (F2, F8) -**Depends on:** none. -**Likely areas:** `DocumentDBShellPty`, `executePlaygroundCode`, their tests, and the -connection-lifecycle user manual. - -- For an unchanged disconnected connection, tell the user to reconnect from the tree and - run the command/script again in the existing Shell/Playground. Do not request a new - Shell or a new connection pick when the retained binding can recover in place. -- Preserve stricter guidance for a removed connection or changed host/identity. Do not - promise worker-local variables survive when a worker must restart. -- Emit Shell “Disconnected” as system output on a separate line from the interactive - prompt. Handle idle, partially typed, and evaluating states deliberately; preserve - user input when possible rather than applying a newline blindly. -- Localize changed/new user-facing copy and update the manual's disconnect/reconnect - guidance so it matches the implemented behavior. - -**Acceptance:** - -- Same-identity Disconnect → Reconnect guidance allows a retained Shell and Playground - to retry without reopening/re-picking. -- Changed or removed bindings retain their accurate non-recovery guidance. -- “Disconnected” cannot be mistaken for text typed at the Shell prompt, including when - emitted during partial input or evaluation. - -**Tests:** focused Shell output tests for idle/partial/evaluating states; Playground -message tests for unchanged versus changed/removed bindings; relevant manual link/content -check if available. - -> **Execution split (2026-11-27):** WI-2a implements the approved, unit-testable F2 guidance -> first (`mai-code-2`, substituted for the advisor's Terra recommendation). WI-2b implements -> F8 system-output/input handling last, after other Shell changes, because terminal timing -> also needs a live workbench check. This is a coordination split, not additional scope; -> the accepted work-item count remains seven, plus conditional WI-7. No Shell-writing workers -> run concurrently. - -> **Done (2026-11-27), WI-2a commit `a2eba522a`:** Shell and Playground now give the approved -> reason-specific recovery guidance. Unchanged Disconnect asks for tree reconnect and a new -> run in the existing terminal/file; removed and changed bindings keep their stricter guidance. -> Decisions: operator, explicit approval of the reason-specific copy; leader, 99% confidence -> after reviewing the message-selector diff and direct-latch reuse that execution guards and -> no-replay behavior are unchanged. Advised (`claude-opus-5.5`); recommended Terra, actual -> `mai-code-2` per the approved substitution. Eighteen focused cases were added across the -> existing two tests, retaining no-start/no-replay assertions; 118 tests passed. The new -> asynchronous Shell assertions use `vi.waitFor`, not a fixed sleep. Batch build/localization -> remain pending. WI-2b/F8 output is not implemented. - -> **Done (2026-11-27), WI-2b commit `9d434732d`:** Disconnected is system output on its own -> line. Idle single-line input is preserved and visibly restored; partial multiline and queued -> evaluating input are cleared as approved. Wrapped input moves its caret to the end before the -> newline, preventing old input tails from appearing beside the status. Decisions: operator, -> explicit input-state policy; advised (`claude-opus-5.5`), 88% final approval. Recommended -> Terra, actual `mai-code-2` per the approved substitution. Five focused output cases were added; -> 134 Shell tests passed. Final build passed after the wrapped-cursor fix. Real terminal behavior -> still needs the operator check below; no live workbench verification is claimed. +**Plan:** localize the rerun guidance and align the manual; do not promise worker-local +variables survive restart. Test same versus changed/removed bindings, and separate +system output from idle, partial and evaluating input. Check manual links/content where +available. WI-2a took the unit-testable wording first; WI-2b ran last because terminal +timing needed a live check. No concurrent Shell edits or added workstream. -## WI-3: Keep failed retained-view Retry feedback in context (F4) +**WI-2a (`a2eba522a`):** unchanged settings prompted a tree reconnect and new run in +the existing terminal/file, not a new Shell or pick. Stricter reasons stayed distinct. +The leader checked selector/direct-latch reuse (99%); tests kept no-start/no-replay +assertions and used `vi.waitFor`, not a fixed sleep. 18 new cases in two files; 118 passed. -**Depends on:** WI-0 operator decision. -**Likely areas:** `useBoundViewRecovery`, `DisconnectedOverlay`, and the three retained -view recovery tests/scenarios. - -Implement only the operator-selected O2 option. If the recommended in-dialog option is -selected: - -- Keep the persistent unavailable reason distinct from the latest Retry failure. -- Show a concise, bounded failure explanation in the existing dialog; do not replace the - original reason with unsupported network/server assumptions or expose a raw stack. -- Make Retry, Close view, and X behavior available again after failure. Ensure an - assistive-technology user is notified of the new failure. -- Do not add a host modal, replay the failed database operation, or change the retained - content/copy behavior. - -**Acceptance:** a typed unavailable result and an unclassified thrown exception both -leave the user with one coherent in-view explanation and usable recovery/close controls; -failure does not execute the original operation again. - -**Tests:** focused hook/component tests for typed and thrown Retry failures, restored -controls, announcement, and no operation replay. Exercise Collection View, Document View, -and Dashboard if their shared integration wiring differs. - -> **Review correction pending (2026-11-27):** the first `mai-code-2` implementation passed -> 19 focused tests and type-checking, but advisor `claude-opus-5.5` (80%) found that a Retry -> reply can disclose a new irrecoverable reason. Keeping the old reason hides actual -> removal/settings/identity state. The operator selected adopting truthful current reasons, -> with the explicit constraint that an already-visible Retry button must not disappear after -> Retry or runtime state changes. This is not permission to change identity or bypass a hold. -> The corrected UI contract is pending; the initial implementation is not marked done. - -> **Scope confirmed (2026-11-27):** the operator selected **1A**: retained Retry availability -> lasts for the current unavailable episode, including dialog dismissal/reopening. Successful -> recovery ends the episode; a later initially Close-only episode does not inherit Retry. -> New terminal reasons remain truthful, but cannot remove Retry already offered in that episode. - -> **Done (2026-11-27), commit `6d2e10715`:** failed Retry feedback stays in the existing dialog. -> The current unavailable reason updates when the host reports a different reason/action; a -> separate bounded alert announces every failed attempt. Retry, once offered, remains through -> failures, runtime updates and dismissal/reopening of the same unavailable episode. Successful -> recovery resets availability for a later episode. Retained Retry explicitly dispatches `retry`, -> never `close`, and no original operation is replayed. Decisions: operator, explicit 2.A -> qualification and 1A episode scope; advised (`claude-opus-5.5`), 88% approval of the exact -> corrected revision. Recommended Terra, actual `mai-code-2` per the approved substitution. -> Eight focused tests were added across the two existing files; 23 tests passed. The interim -> type-check encountered concurrent WI-6 edits; WI-6 subsequently reported a successful root -> type-check. Final batch build and browser scenarios remain pending. - -> **Browser fixture follow-up (2026-11-27), commit `039c1cbd8`:** real Document View lifecycle -> scenarios failed because the existing fixture did not acknowledge the void `reportDirty` -> mutation. The shared fixture now returns transport-compatible `null`; application code and -> scenario behavior are unchanged. Model `mai-code-2`; leader, 99% confidence after checking -> the actual host/link void-result contract. Static browser scenario tests passed (47). -> The nine Document View routes are being rerun; the earlier Collection View/Dashboard runs -> passed. This is a required validation-fixture repair, not a new product behavior. - -> **Browser verification update (2026-11-27):** all 24 unique source routes passed: -> Collection View 9, Document View 9 and Dashboard 6, across dark, light and high contrast. -> No page/CSP/unknown-RPC or assertion failures remained. The `reportDirty` mutation was -> exercised successfully. Static scenario tests passed (47). Only owned watch servers were -> started/stopped; no background verification server was left running. These are source -> browser checks, not a live extension-host or screen-reader verification. +**WI-2b (`9d434732d`):** “Disconnected” got its own line. The approved policy restored +single-line input and cleared partial multiline and queued evaluation input. Wrapped +input moved the caret to the end first so no old tail appeared beside the status. +Five cases added; 134 Shell tests and the post-fix build passed (advisor 88%). +Real terminal behavior remained a workbench gate. -## WI-4: Clarify teardown and retained-content wording (F9–F11) +## WI-3: Keep failed retained-view Retry feedback in context (F4) -**Depends on:** none. -**Likely areas:** `connectionTeardown`, `DocumentDBClusterItem`, `DisconnectedOverlay`, -related tests, and localization. - -- Change the retained-view choice label from “Keep open (disabled)” to “Keep open”. - Preserve the disabled-operation behavior and existing help that explains the resulting - state. -- In the decoded-password confirmation, say that the correctly formatted password will - be saved into the connection's saved credentials. Preserve the existing explicit - opt-in action and never include the secret value. -- Change the overlay X accessible name to “Dismiss dialog to access view contents”. - Preserve the existing behavior: dismissing exposes retained contents for inspection - and copying but does not restore database operations. -- Update localized strings using the repository localization workflow when implementing. - -**Acceptance:** - -- The teardown option is “Keep open” and does not change teardown semantics. -- The password confirmation communicates what is saved without revealing the password - or changing the save action. -- The accessible name describes content access, and dismissing still leaves database - operations blocked. - -**Tests:** focused existing component/command tests for the rendered label, confirmation -copy and action, accessible name, and blocked-operation behavior. - -> **Done (2026-11-27), commit `5d00558cb`:** F9 now says **Keep open**; F10 retains the -> successful decoded-password/cluster context and explicitly names the correctly formatted -> password saved in credentials; F11 names access to retained contents. The save branch, -> teardown settings and blocked-operation behavior are unchanged. Decisions: operator, -> explicit approval of the exact copy; leader, 99% confidence after reviewing the -> mechanical source diff that the action/save semantics were preserved. Advised -> (`claude-opus-5.5`) during WI-0; its `gpt-6-luna` recommendation was used. One added -> decoded-password workflow test proves dismissal does not save. The three focused -> Vitest files passed (26 tests), including after the operator-driven F10 correction. -> The original generic F10 prompt was a leader error, corrected before commit. -> Batch build/localization and live workbench presentation checks remain pending. - -> **Verification update (2026-11-27):** Batch 1 build and focused tests passed. Localization -> generation will run once after all string-changing items. Live presentation remains pending. +**Plan:** if the operator chose O2/B, distinguish the unavailable reason from the +latest attempt. Test typed and thrown failures, restored controls (Retry/Close/X), +announcement, copy access and no replay in the shared hook/overlay and all three views. +No stacked host modal, speculative network diagnosis or raw stack. + +**Correction:** the first implementation passed 19 tests and type-checking but could +hide a _new_ removal/settings/identity reason (advisor 80%). The operator qualified +the choice (**2.A**): show the true current reason, but do not take away a previously +offered Retry. They chose **1A**, the current unavailable episode: dismissal/reopening +does not end it; successful recovery does. A later Close-only episode does not inherit +Retry. Neither identity nor hold checks change. + +**Result (`6d2e10715`):** each failure announced a separate bounded alert in the dialog. +Retained Retry dispatched `retry`, never `close` or the interrupted operation. Eight +cases added across two files; 23 passed (advisor 88%). An interim type-check met +unfinished WI-6 edits; WI-6 later passed the root check. + +**Fixture repair (`039c1cbd8`):** six Document View routes failed because the fixture +did not acknowledge the void `reportDirty` mutation. Returning transport-compatible +`null` fixed the fixture, not the application (`mai-code-2`; leader review 99%). +The rerun exercised the mutation with no remaining page, CSP, RPC or assertion failures. +See [Verification](#verification) for the routes/themes; source scenarios did not verify +the live extension host or screen reader. -## WI-5: Unify human-readable debug-stat formatting (F12) +## WI-4: Clarify teardown and retained-content wording (F9–F11) -**Depends on:** none. -**Likely areas:** `showConnectionStats`, `showWorkerStats`, their tests. - -- Use multiline labeled records for both commands, with consistent headings, indentation, - units, and a single explicit missing-value convention. Do not use decorative rulers. -- Preserve each command's existing facts and availability, including worker/session - counts, held/pending states, Entra expiry, session identifiers, and init-duration facts - where currently available. -- Keep state descriptions truthful: a cached client is not a successful ping; pending - startup is not a live connection. Preserve redaction boundaries and do not add - credential values or new identifying information. -- Keep host-client and worker/session data distinct; formatting consistency does not - imply they measure the same thing. - -**Acceptance:** both commands use the same readable record conventions without losing -existing fields, inventing values, or disclosing sensitive data. - -**Tests:** focused output tests for headings, field labels/units, missing values, and -redaction-safe output. Assert representative formatting without overfitting whitespace -that is not user-visible. - -> **Done (2026-11-27), commit `e4a6ad337`:** both stats commands now use labeled -> multiline records, explicit units and **(not available)** for missing values, preserving -> existing host-client, pending/held, worker/session, expiry and username facts. -> Decisions: operator, explicit F12/model approval; leader, 99% confidence after comparing -> the mechanical output diff that existing values/redaction boundaries were retained. -> Advised (`claude-opus-5.5`); recommended `gpt-6.1-terra`, actual `mai-code-2` per the -> approved substitution. Five tests were added across the two stats test files; all -> nine focused tests passed. Review replaced an `as never` evaluator fixture with a real, -> typed evaluator using a mocked worker. Batch build remains pending. - -> **Verification update (2026-11-27):** Batch 1 `npm run build` passed; both stats files were -> included in the seven-file focused test run (67 tests total). +**Plan:** localize and test three wording changes, not new behavior. “Keep open” drops +the confusing disabled suffix, not the operation block or its help. The F10 prompt +above explains what the opt-in action saves without showing the password. “Dismiss +dialog to access view contents” names inspection as well as copying, not reconnection. -## WI-6: Offer an unauthenticated Shell from connection failure rows (F1) +**Result (`5d00558cb`):** the operator corrected the leader's generic F10 wording +before commit to retain the cluster and successful decoded-password context. Teardown +settings, save branch and guards stayed unchanged (leader review 99%). One new workflow +test proved dismissal did not save; 26 tests passed in three files, including after +the correction. Batch 1 passed; live presentation was still unverified. -**Depends on:** WI-0 operator confirmation of behavior and label. -**Likely areas:** `ClusterItemBase`, `openInteractiveShell`, Shell startup options, and -focused command/tree tests. +## WI-5: Unify human-readable debug-stat formatting (F12) -- Add a distinct error-row entry path that starts a Shell without attempting the failed - saved authentication. Do not change ordinary authenticated Shell startup from the - cluster context menu. -- Keep saved credentials, `CredentialCache`, connection identity, and existing clients - unchanged. Do not silently fall back to saved authentication after anonymous database - operations are rejected. -- Make clear in the final, operator-approved label that this Shell starts without - authentication. Opening it does not promise that database commands are authorized. -- Preserve existing error-row recovery behavior and action ordering. +**Plan:** use labeled multiline records, consistent headings/indentation, explicit units, +one missing-value convention and no rulers. Test readable output and redaction, not +incidental whitespace. A cached client is not a ping; pending startup is not a live +connection. Keep host and worker counts, held states, Entra expiry, session IDs, +initialization durations and existing username facts only where available. -**Acceptance:** +**Result (`e4a6ad337`):** both commands used **(not available)** for missing fields; +review confirmed the values and redaction boundaries stayed intact (leader 99%). +A typed evaluator with a mocked worker replaced an `as never` fixture. Five new tests; +nine passed across both files, also included in Batch 1. -- Error-row Shell startup does not read/use cached credentials or make an authenticated - startup attempt. -- Normal context-menu Shell startup remains authenticated and unchanged. -- Anonymous command failure is surfaced honestly; no credential state is modified. +## WI-6: Offer an unauthenticated Shell from connection failure rows (F1) -**Tests:** focused command tests contrasting error-row and normal entry, proving no -credential use or mutation on the former and preserving the latter's existing startup -path. Test the anonymous command failure feedback. +**Plan:** distinguish the error-row entry from ordinary authenticated context-menu +startup without reordering recovery rows. Test both paths: no credential read, +mutation or fallback on the anonymous path; if a database command is rejected, +report that failure. Opening a Shell does not authorize an operation. > **Gate resolved (2026-11-27):** the worker stopped before edits because URI parser errors > can contain credentials. Advisor `claude-opus-5.5` approved a constructor-only bounded @@ -481,7 +232,7 @@ path. Test the anonymous command failure feedback. > local completion/ghost behavior but excludes authenticated shared metadata from the new > anonymous diagnostic path. The completion provider and its existing tests are directly > dependent owned files. Normal Shell behavior is unchanged; no fake IDs, new setting or -> blanket completion disablement is authorized. Implementation is in progress, not complete. +> blanket completion disablement was authorized. > **Done (2026-11-27), commit `aea08108a`:** the failure-row Shell is a separate NoAuth entry > with a sanitized, re-read endpoint and epoch/latch guards. It does not read `CredentialCache`, @@ -495,25 +246,14 @@ path. Test the anonymous command failure feedback. > Actual/recommended model: `gpt-6.1-sol`. Seventy-two cases were added across the existing/new > test files; the initial eight-suite run passed 392 tests without TDD failures, the final > command suite passed 29 and the strengthened Shell suite passed 111. Root type-check passed; -> final build/localization remain pending. No public command contract or manifest entry was added. +> build/localization followed in the final batch. No public command contract or manifest entry was added. ## WI-7: Investigate F7 only if WI-0 reproduces it -**Depends on:** WI-0 evidence. -**Likely areas if confirmed:** credential repair refresh path, connected context-tag -calculation, Disconnect menu condition. - -Do not pre-emptively alter command visibility. If reproduced, identify and fix the -smallest stale-state or refresh defect supported by evidence; preserve the rule that -Disconnect is available only for a currently connected eligible tree item. If not -reproduced, record the tested build and state checks in this plan and close the finding -without a code change. - -**Acceptance if fixed:** after successful credential repair and reconnect, the refreshed -connected cluster item exposes Disconnect; disconnected/error items do not. - -**Tests if fixed:** regression test the exact state transition and ensure the menu remains -hidden when no connected client is present or a latch applies. +**Conditional plan:** fix only a demonstrated refresh/context-tag defect. Regression +test the exact repaired-and-connected transition and that Disconnect stays hidden for +disconnected/error items, no client or an active latch. A negative live run needed a +record of the build and state checks before closing F7 without code. > **Deferred, escalated (2026-11-27), operator decision:** leave F7 pending live testing > with no speculative implementation. On the current build, try failed saved-password @@ -525,24 +265,12 @@ hidden when no connected client is present or a latch applies. ## Cross-workstream verification -For code changes, follow the repository's Case 1 checks while implementation is in -progress: `npm run build` and `npx vitest run `. Run `npm run l10n` -only if localized strings change. Do not claim the full handoff suite passed unless it -was actually run; if this work is later prepared for review, follow the repository's -Case 2 requirements. - -Before calling this iteration complete: - -- Verify all new/changed strings use `vscode.l10n.t()` where required and generated - localization output is current. -- Verify tree recovery remains action-only and connection/view identity safety is - unchanged. -- Run the focused regression tests for every implemented workstream; run relevant webview - scenarios for changed retained-view behavior. -- Update the user manual only where the implemented recovery guidance changes. -- Record each operator decision, deviation, test result, and any non-reproduced finding - in the corresponding workstream progress record. Do not mark an unimplemented finding - fixed. +The plan called for a Case 1 build (`npm run build`) and focused tests +(`npx vitest run `) for each implemented workstream, plus webview +scenarios where behavior changed. Check action-only rows, identity safety and +`vscode.l10n.t()` usage; regenerate localization for changed strings and edit the manual +only for changed guidance. Record deviations and negative evidence, not just passes. +Case 2 was a separate handoff gate. Results for both endpoints follow. ## Progress @@ -559,11 +287,11 @@ Before calling this iteration complete: ## Outcome -**Endpoint: local work, committed and Case 1 verified.** No push or review handoff was requested. +**Initial endpoint: local work, committed and Case 1 verified.** No push or review handoff was requested. The only external edit was the operator-requested enhancement issue [#1143](https://github.com/microsoft/vscode-documentdb/issues/1143). No CI run for a pushed head is claimed. Case 2 (including `prettier-fix`, lint, strict package-test type-check, full runtime -suite and packaging) was not run and remains deferred until review handoff. +suite and packaging) had not run at this point; see the [subsequent authorization and results](#case-2-follow-up-2026-11-27). ### Unverified workbench checks @@ -598,19 +326,10 @@ suite and packaging) was not run and remains deferred until review handoff. ### Decisions, review and model plan -Operator decisions are recorded in 0022–0025 and inline above. Retry availability is sticky only -within its unavailable episode; successful recovery resets it. The anonymous path isolates -authenticated metadata while preserving local completion behavior. Descendant expansion is -explicitly deferred to #1143, and F7 is pending operator evidence. No identity/latch guard was -weakened. The unsupported/no-latch cases stay quiet instead of receiving speculative explanations. - -Thirty substantive advisory packets ran across six `claude-opus-5.5` agents. Exact code revisions -received their required logic reviews. The operator's sticky Retry direction superseded the initial -remove-Retry recommendation, and metadata isolation replaced the rejected blanket-completion and -fake-ID proposals. The leader's F10-copy and worker-helper-name mistakes were corrected before their -code commits. There were no coding-model authorization substitutions; Terra recommendations used -`mai-code-2`, mechanical WI-4 used `gpt-6-luna`, lifecycle/authentication used `gpt-6.1-sol`, and -checks used `mai-code-2-flash`, as approved. +Thirty substantive advisory packets ran across six `claude-opus-5.5` agents. The exact +code revisions received logic reviews under the approved model mapping. Decisions +0022–0025 record the operator's choices; WI-1, WI-3, WI-4 and WI-6 record where a +proposed implementation was rejected or corrected and why. ### Usage: cumulative run diff --git a/docs/ai-and-plans/features/connection-lifecycle/iterations/03-complexity-reduction-analysis.md b/docs/ai-and-plans/features/connection-lifecycle/iterations/03-complexity-reduction-analysis.md index 2d3c87051..ba379364f 100644 --- a/docs/ai-and-plans/features/connection-lifecycle/iterations/03-complexity-reduction-analysis.md +++ b/docs/ai-and-plans/features/connection-lifecycle/iterations/03-complexity-reduction-analysis.md @@ -1,7 +1,7 @@ --- feature: connection-lifecycle kind: analysis -status: active +status: historical prs: [1136] created: 2026-11-29 verified: 2026-11-30 @@ -28,8 +28,9 @@ code: **Recover the connection, not a retired tab.** A socket closing does not mean the user chose Disconnect. The “80%” is a product priority, not a measured usage share. Build and verify the common path first. [Decisions 0031–0032](../decisions.md) define the following minimum for #1136; -[section 6](#6-packages-regenerated-2026-11-30) compares packages. **Implementers:** read this -table, then use the [implementation handoff](#implementation-handoff). +[section 6](#6-packages-regenerated-2026-11-30) compares the packages as proposed on November 30. +The [implementation handoff](#implementation-handoff) records what landed; the [feature README](../README.md) +gives current status. The scenarios below describe the decision at the time, not later UI wording. | What the user does or sees | What must happen | | ------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | @@ -725,636 +726,64 @@ mechanisms and boundaries, not that hypothetical diff. #### Implementation handoff -**Deliverable:** implement P on the feature line for #1136. The table at the top and decisions -0030–0032 are the target; old tests which revive a _deliberately disconnected_ view describe the -previous target. Preserve their protections for dirty text and late replies, not the revival. Do -not add a recovery framework, redesign unrelated worker features, or pursue a line-count target. - -**First run:** record the starting SHA, run `npm run build`, then run the relevant existing tests -before modifying their area. For example, from the repository root: - -```sh -npx vitest run src/documentdb/ClustersClient.test.ts src/documentdb/auth/MicrosoftEntraIDAuthHandler.test.ts src/documentdb/shell/ShellSessionManager.test.ts src/documentdb/playground/PlaygroundEvaluator.test.ts -``` - -Use the [repository verification rules](../../../../../.github/copilot-instructions.md#verification-two-cases): -build and focused Vitest during implementation; full Case 2 only for review handoff. Record any -baseline failure separately. Reuse passing behavior tests; for a missing contract, add the -smallest regression that distinguishes old and new behavior. Do not add a test-only production -switch. Respect the repository's `TDD:` contract rule if an existing contract conflicts. - -**Work and progress ledger.** All rows start **not run** for this iteration. Start R first; R and -W can be characterized independently. Settle the F host invalidation boundary before integrating -E, U or H; their test cases can be prepared in parallel. Integrate and rerun affected rows on the -combined revision before P. Plan the live gate early; unavailable live infrastructure does not -block independent deterministic work. - -**Run started (2026-11-30, 12:16 UTC):** baseline -`3d66aa9374fefadcde8c236e0384cc8d18310372`; implementation branch -`dev/tnaum/connection-lifecycle-simplification`, targeting `feature/connection-lifecycle`. -The operator requested a stacked draft PR, then Case 2 after the implementation push, fixes for -any failures, and readiness only after the required gates pass. The existing untracked relay -and telemetry directories are outside this work. - -**Baseline evidence (2026-11-30):** at the starting revision, `npm run build` passed -(exit 0, 51.09 s). The exact first-run Vitest command above passed all 271 tests in four -files (5.44 s wall time). Evidence: command-runner agent -`6fe1d510-b864-4fc4-81f1-2667393cb664`, completed baseline report. This establishes the -pre-change host baseline, not R/W completion, rendered behavior, packaged activation or live -expiry/sleep-wake. Planning advisor: `claude-opus-5.5`; command runner: `mai-code-2-flash`. -At docs-only revision `17225d6f938c80b52e9dc2e543539f0b78cb07b6`, the expanded baseline -command passed 413 tests in 13 files (16.52 s), including sign-in, worker/PTY execution, -teardown and all three controller/router suites. No failures or `TDD:` failures occurred. -Exact command/evidence: agent `666c92f9-15bf-4764-a3c9-fa13a6cebfeb`, baseline-extension -report; the original build and four initial suites were not rerun for docs-only changes. - -```sh -npx vitest run src/commands/signInAgain/signInAgain.test.ts src/documentdb/playground/WorkerSessionManager.test.ts src/documentdb/shell/DocumentDBShellPty.test.ts src/commands/playground/executePlaygroundCode.test.ts src/documentdb/connectionTeardown.test.ts src/documentdb/connectionSurfaces.test.ts src/commands/disconnect/disconnect.test.ts src/webviews/documentdb/collectionView/collectionViewController.test.ts src/webviews/documentdb/collectionView/collectionViewRouter.test.ts src/webviews/documentdb/documentView/documentsViewController.test.ts src/webviews/documentdb/documentView/documentsViewRouter.test.ts src/webviews/documentdb/clusterDashboard/clusterDashboardController.test.ts src/webviews/documentdb/clusterDashboard/clusterDashboardRouter.test.ts -``` - -| ID / status | Deliverable | How the agent demonstrates it | -| -------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| **R — host pass; integrated/live pending** | Token expiry/drop is not Disconnect. Same-account tree repair keeps the same tab usable. | In the client/auth and `signInAgain.test.ts` suites, drive silent success, no session and a rejected callback. Replace the client, then release an old client's failure: no extra replacement or eviction. Assert no background interactive request; wrong account cannot repair; next explicit operation on the repaired connection runs once. Commit/revision/command evidence is recorded under R below. | -| **W — host pass; integrated/live pending** | Shell and Playground renew independently; explicit teardown stops the old worker, not the user's text. | Exercise both manager/evaluator suites, PTY and `executePlaygroundCode.test.ts`. Hold a token reply or evaluation across Disconnect, release it after reconnect: no delivery to the replacement worker, automatic command replay or silent rebinding; scrollback/file contents survive. Positive control: a valid pinned worker receives its reply and executes once. Commit/revision/command evidence is recorded under W below. | -| **F — host pass; integrated pending** | End the old host lifetime once; freezing is permanent. Cover Collection, Document and Dashboard. | In `connectionTeardown.test.ts`, controller and router suites, keep an old dirty view, reconnect, open a fresh view, then disconnect again. Old snapshot retains its draft and is not included in the second Close all. Invoke an old RPC and an old Dashboard native menu action directly, not just disabled buttons: **zero** database calls on the new client. A fresh panel's action must work. Advance polling while frozen: zero new polls; background work cannot redial or prompt. Commit/revision/command evidence is recorded under F1/F2 below. | -| **E — host pass; integrated pending** | A2 uses ordinary Disconnect; edits cannot cross a reconnect or expose mixed credentials. | Cover **both** `updateCredentials.test.ts` and `updateConnectionString.test.ts`. Successful teardown precedes wizard/save; already safely disconnected skips redundant teardown. Cancel, active transfer, dirty-close refusal or teardown failure: zero saves, active transfer unaffected. Cancel after Disconnect stays disconnected. Include evicted-client/pending-startup cases. Pause between storage writes, attempt reconnect, then fail metadata: no client sees mixed settings, no success report; partial failure is visible. A wizard superseded before save does not write. Commit/revision/command evidence is recorded under E below. | -| **U — host/unit pass; rendered pending** | X dismisses the frozen notice; Close closes the tab. Ordinary recoverable errors do not freeze it. | Update the existing rendered scenarios below. Keep a draft, dismiss with X, select/copy the original text, attempt Save, release a stale response: draft unchanged, no new save RPC. Close/cancel the dirty-close confirmation separately. Pair with a failed live query → same-account repair → user runs again in the **same tab**, with no unlock RPC and no automatic replay. On uncertain write outcome retain text and never claim nothing was written. Commit/revision/command evidence is recorded under U1/U2 below. | -| **H — host pass; integrated pending** | Shared host checks stop delayed side effects without making ordinary reads carry identity policy. | Exercise [review cases C01–C03](./02-pr1136-copilot-review.md): pause create after client resolution; pause query generation before sampling and again at model selection; pause Playground document opening, including a retained Shell link. End the old lifetime, install the replacement, release the pause. Assert zero stale writes, replacement-schema samples, model sends after invalidation, or replacement bindings, as applicable. Run the same paths without invalidation to rule out a blanket disable. Use fake DB/model boundaries, not real data or model calls. Commit/revision/command evidence is recorded under H1/H2/H3 below. | -| **P — draft published; final receipts in #1149; live blocked** | Combined candidate and release evidence. | Rerun affected checks after integration. Walk a normal read and a delayed write/send in the diff: the read uses a shared path, the delayed side effect checks its captured origin. Record obsolete recovery handlers/tests removed and guards intentionally retained. Update user-facing docs/localization and affected telemetry contracts for the behavior actually shipped. Run the repository handoff gates and the live checks below on the identified candidate. The draft's validation section records the final pushed-head results; manual/live readiness gates remain outstanding. | - -**Implementation mapping (2026-11-30, advised by `claude-opus-5.5`):** the seven -accepted checkpoints remain the plan; the lettered slices below do not expand its scope. -Advisor verdict: follow the mapping, **82/100 confidence**. The remaining technical risks -require direct effects checks for synchronous cutoff retirement, retained-registry exclusion -and originating Dashboard menu routing; they are not substitutes for passing tests. -Coordination decision (leader, 99% confidence): run disjoint files in parallel, but serialize -shared controllers/routers and teardown edits so every work-item commit has clear ownership. - -- **R / `mai-code-2`, implementation committed; integrated checks pending:** agent - `48d5a5d1-32c4-4352-a808-ae0dd072317f`. Enforce the existing pinned-account tree sign-in contract and add - recovery/late-failure controls in the sign-in, client and auth tests. It is independent of W - and F, but must not edit F's client implementation. The advisor recommended this model for - the small source change and focused tests. - **Done (2026-11-30), commit `b58b74501`:** tree recovery now rejects every different account - ID, retaining the pinned-account success path and existing messages. Seven regressions - cover account rejection, silent callbacks, same-account replacement and late-failure - attribution. Decision: implement the operator's pinned-account contract without new wording; - advised (`claude-opus-5.5`), review approved at 88% confidence. The changed acceptance test - preserves exact pinned-session/startup assertions and adds zero-startup/unchanged-pin/hold - assertions for rejection; no `TDD:` contract was weakened. - **Interim host pass:** the three R suites passed within the R/W command below at - `af8ace13b` plus the working changes; the combined command failed in W, not R. - Build and affected suites are being rerun on the stabilized R/F1 candidate before - claiming the integrated gate. - **Stabilized host pass:** at `8c4854f0d` plus F1 working changes, `npm run build` - passed (exit 0, 43 s), and the combined R/F1 command recorded below passed all - 302 tests in 11 files (5 s). Evidence: runner - `cb8fea69-b6fd-4ce2-95b1-b2d18f2a7bb2`, corrected F1 rerun. R's same-account - repair and late-failure tests are green; this still does not pass the live gates. -- **W / `mai-code-2`, host pass; integrated rerun pending:** agent - `6b87164b-c07d-4fb5-a918-488b29840278`. Characterize held worker-token replies and evaluations across - Disconnect/reconnect, including a valid-worker positive control and retained text. Own the - manager/evaluator, PTY and execution tests; preserve `TDD:` contracts. Existing production - guards should suffice; a discovered production lifecycle defect returns to the advisor. - **Host fail (2026-11-30), revision `af8ace13b` plus R/W/F1 working changes:** - `npx vitest run src/commands/signInAgain/signInAgain.test.ts src/documentdb/ClustersClient.test.ts src/documentdb/auth/MicrosoftEntraIDAuthHandler.test.ts src/documentdb/shell/ShellSessionManager.test.ts src/documentdb/playground/PlaygroundEvaluator.test.ts src/documentdb/playground/WorkerSessionManager.test.ts src/documentdb/shell/DocumentDBShellPty.test.ts src/commands/playground/executePlaygroundCode.test.ts` - passed 601 tests in seven files but failed the new held-evaluation test in - `PlaygroundEvaluator.test.ts` after 15 s, with one unhandled rejection: expected - `Worker terminated`, received `The connection is unavailable.` The credential-cleanup - assertion also failed. Evidence: runner `05e84afa-064f-49cb-95bb-5e07f6ac1441` - (22.22 s). Technical diagnosis is assigned to the advisor; no production behavior or - existing contract has been changed to make this failure disappear. - **Done (2026-11-30), commit `4c5ff5fa2`:** added held-token and in-flight evaluation - regressions. The first attempt latched before the evaluation reached the worker; advised - (`claude-opus-5.5`), about 90% confidence, the correction waits for the actual `old` - `sendEval` effect before teardown. Exact no-replay sequence, replacement reply count and - silent pinned-account assertions are unchanged. No production behavior or existing - `TDD:` contract changed. - **Host pass:** at `d6be5ea89` plus W/F1 working changes, - `npx vitest run src/documentdb/shell/ShellSessionManager.test.ts src/documentdb/playground/PlaygroundEvaluator.test.ts src/documentdb/playground/WorkerSessionManager.test.ts src/documentdb/shell/DocumentDBShellPty.test.ts src/commands/playground/executePlaygroundCode.test.ts` - passed all 391 tests in five files (14.58 s), no failures/unhandled errors/TDD failures. - Evidence: runner `05e84afa-064f-49cb-95bb-5e07f6ac1441`, corrected-test rerun. - The root build also passed on the stabilized R/W/F1 working candidate (43 s); - no test type errors remained. Integrated candidate rerun is still required. -- **F1 / `gpt-6.1-sol`, committed and host-verified:** agent - `3c5e8387-8a8d-45bf-bd21-39c89459d597`. Reuse the existing binding-retirement cutoff as the one-way host - lifetime end, with its reason and synchronous cancellation. Explicit teardown ends that - lifetime before awaiting; same-account replacement does not. Detach retained surfaces from - the active registry and cover absent/held clients and pending startup. - **Review/checks fail (2026-11-30):** advised (`claude-opus-5.5`), changes requested at - 85% confidence. Failed storage removal must not leave kept tabs/old RPCs claiming the - connection was removed; the detached-surface failure path needs truthful disconnected - feedback without reviving the lifetime. This is an introduced regression, not an accepted - cosmetic exception. - At `af8ace13b` plus working R/F1 changes, `npm run build` failed after 55 s with TS2352 - in `src/commands/disconnect/disconnect.test.ts:190`: the new shell fixture lacks its - required terminal and complete info. The F1 command above, preceded by the three R suites, - passed 292/293 tests in 10/11 files (5 s), failing - `keeps teardown scoped to the current registered surfaces for one cluster` because a new - `it()` was nested inside it. Evidence: runner `cb8fea69-b6fd-4ce2-95b1-b2d18f2a7bb2` - and advisor `873c8316-29fd-47c1-aa2d-ff9dce2f1254`. Neither failure is a `TDD:` - behavior-contract failure; fix the fixture/registration, not the assertions. - **Correction authorized by the advisor:** only the matching newest failed-removal - retirement range can be corrected to `userDisconnected`, under the existing epoch/latch - guard. Captured detached surfaces receive the truthful notice; their signals stay aborted - and earlier/later lifetimes are untouched. Fix the shell fixture with complete proper types - and move the surface test to top level. Worker rework is running; review and checks must rerun. - **Rerun pass, review still pending:** at `8c4854f0d` plus F1 working changes, - `npm run build` passed (43 s), and the exact command below passed 302/302 tests - in 11/11 files (5 s). Evidence: runner `cb8fea69-b6fd-4ce2-95b1-b2d18f2a7bb2`. - Advisor review then found a repeated-failed-Remove regression: a no-op retirement - correction must not prevent the epoch/latch-guarded restoration of `userDisconnected`. - Decision: advisor, 88% confidence, restore that latch unconditionally inside the existing - guard and add two regressions; keep the exact-range correction and all supersession guards. - This corrective slice must be checked and reviewed before F1 is committed. - **Technical gate, no edits made:** the worker found that the new `laterGeneration` - superseded-delete fixture keeps the epoch unchanged, so the unconditional restoration - would change its latch/redisable expectations. The advisor must distinguish incidental - fixture expectations from a real newer-lifetime protection before approving a correction. - Preserve the epoch-superseded case and retirement-range immutability; do not weaken the - newer-lifetime contract to make the tests green. - **Gate resolved, advised (`claude-opus-5.5`), 85% confidence:** use the narrower helper - eligibility contract instead of the unconditional caller proposal. A matching latest - generation returns true even when its reason is already truthful; rewrite only - `connectionRemoved`, never existing `userDisconnected`/`credentialsChanged`. Missing or - later generations return false. The caller's existing epoch/latch/eligibility guards and - both superseded-test branches stay unchanged. Add repeated-failure and already-ended - reason cases; the operator's newer-lifetime contract is preserved without a new framework. - **Done (2026-11-30), commit `b7fd8bff5`:** explicit teardown now synchronously retires the - old host lifetime and detaches retained Collection/Document surfaces before async cleanup; - same-account client replacement stays live. Direct stale RPC/background-effect tests have - fresh-client positive controls. Failed storage removal restores truthful feedback without - reviving the lifetime or touching earlier/later ranges; repeated failures remain retryable. - Decisions: reuse the existing cutoff/cancellation boundary, advised (`claude-opus-5.5`); - final exact revision approved at 90% confidence. Correct the introduced failed-removal - feedback and idempotency defects within that boundary, advised at 85-88% confidence. - No user wording, persisted schema or `TDD:` contract changed. - **Final affected host pass:** at `dce388d99` plus final F1 changes, - `npx vitest run src/documentdb/connectionBindingRetirement.test.ts src/documentdb/connectionTeardown.test.ts` - passed 40/40 tests in two files (4 s, exit 0). Evidence: runner - `cb8fea69-b6fd-4ce2-95b1-b2d18f2a7bb2`; final advisor - `873c8316-29fd-47c1-aa2d-ff9dce2f1254`. The preceding root build and 302-test - R/F1 run passed before the final small helper/test delta. Rerun the integrated candidate - after F2/E/U/H; Dashboard native-menu coverage is still F2, not passed by F1. - - ```sh - npx vitest run src/commands/signInAgain/signInAgain.test.ts src/documentdb/ClustersClient.test.ts src/documentdb/auth/MicrosoftEntraIDAuthHandler.test.ts src/documentdb/connectionTeardown.test.ts src/documentdb/connectionSurfaces.test.ts src/documentdb/connectionBindingRetirement.test.ts src/commands/disconnect/disconnect.test.ts src/webviews/documentdb/collectionView/collectionViewController.test.ts src/webviews/documentdb/collectionView/collectionViewRouter.test.ts src/webviews/documentdb/documentView/documentsViewController.test.ts src/webviews/documentdb/documentView/documentsViewRouter.test.ts - ``` - -- **F2 / `gpt-6.1-sol`, running after F1:** agent - `3c5e8387-8a8d-45bf-bd21-39c89459d597`. Route native Dashboard actions to the originating panel - session, never a replacement panel; remove frozen panels from the live-panel lookup. - F1/F2 are genuinely complex host lifecycle and cross-module work. - **F2 pre-edit gate resolved:** the existing ordinary-unreachable/Retry-lock test predates - D2. Advisor `4b1a9f9a-4c67-40c4-8e3f-2a8fcdeb5cbe`, 85% confidence, confirmed that - it must now preserve same-account/no-replay coverage while allowing the next explicit - native action without Retry. Keep explicit-end copy-only/frozen protections. NamespaceTable - already has `configuration.dashboardSessionId`; no extra parent prop wiring is needed. - The worker is implementing those scoped changes and its direct H1 mock dependencies. - **F2 implementation returned; first host check failed:** at `95cd11d0a` plus F2/E - working changes, - `npx vitest run src/webviews/documentdb/clusterDashboard/clusterDashboardController.test.ts src/webviews/documentdb/clusterDashboard/clusterDashboardRouter.test.ts` - passed 48/49 tests in one of two files (2.57 s runtime). The new - `blocks frozen poll timers before acquisition, database calls or prompts and lets a fresh poll run once` - failed before its behavior assertions because the VS Code mock lacked `authentication`. - Source inspection confirmed neither suite nor test has a `TDD:` prefix; fix only the - fixture, retaining the effect assertions. Evidence: runner - `786c177f-56f7-4d20-9574-ac466cb4ac5a`. F2 advisor review and the fixture correction - are active; no F2 pass is claimed. - **Done (2026-11-30), commit `7417e01ea`:** native actions resolve the originating - Dashboard session only; retained snapshots leave the live-panel index without deleting a - newer panel. Ordinary failures do not lock the next explicit action. Decisions: advised - (`claude-opus-5.5`), source approved at 88% confidence; poll evidence reviewed at 87%. - Eight focused regressions were added; five scheduled frozen polls are explicitly awaited - and resolved, with zero acquisition/DB effects and a fresh-poll positive control. - The missing authentication fixture and two terminal `retry` expectations were corrected - without relaxing zero-delete, reason, ordering or polling assertions. - **F2 host pass:** at `b322b7463` plus F2/E/U1/H2 working changes, the same two-suite - command above passed all 49 tests in two files (2.70 s). Evidence: runner - `786c177f-56f7-4d20-9574-ac466cb4ac5a`. Final wave build also passed - (43.19 s); integrated rerun remains required. -- **E / `gpt-6.1-sol`, running after F1 in parallel with F2:** agent - `dfd29c24-8a4e-4f14-990e-6ad883077a38`. Ordinary Disconnect completes before either edit - wizard. Preserve the epoch/latch across disconnected editing and both storage writes; - cancellation or supersession writes nothing and partial failures remain visible. - The settled internal interface is - `ensureDisconnectedForEdit(clusterId: string, refreshTree: () => void): Promise`. - Capture its returned epoch after ordinary teardown, before wizard/storage reads; pass the - epoch guard to the existing save path. Reuse `Disconnect?` and the approved - `Disconnect and update` button, remove the obsolete post-save Shell notice, and retain - the existing partial-save warning. No new persisted schema or general source parameter. - Coordination decision: E's owned teardown/save/update files do not overlap F2's Dashboard - files, so F1 approval is the actual prerequisite; F2 is not an edit dependency. - **Partial implementation returned, not verified:** the worker added 35 cases and the - ordinary-disconnect edit flow, then stopped on an idle-startup race: a new client can start - during an unlatched idle wizard without changing its epoch. No completion is claimed. - **Gate resolved:** advisor `06b2055c-d1d9-416f-a12c-7a2af7657e55`, 85% confidence, - chose a behavior-preserving atomic pre-save predicate, not a new wizard hold or changed - cancellation/presentation. Export `canSaveEdit(clusterId, epoch)` using matching epoch - and either `userDisconnected` or the existing idle predicate; use it after prompts and - in `canStart`. Registered disconnected shells must remain allowed under `userDisconnected`. - The existing synchronous task guard/latch then excludes startup during both storage writes. - Add concurrent-work/no-write cases and positive controls; the worker is finishing this correction. - **E first host check failed:** at `b322b7463` plus E/F2/U1 working changes, - `npx vitest run src/commands/updateCredentials src/commands/updateConnectionString src/commands/saveConnectionEdit.test.ts src/documentdb/connectionTeardown.test.ts` - passed 143 tests and failed two failed-startup/disappearance positive controls (3.22 s). - Their real startup error path hit a missing `vscode.CancellationError` in the fixture - parser; the worker repaired only the parser fixture, keeping the original failure and - zero/positive-save assertions. Evidence: runner `3b7b403c-c6b3-46fc-b2cf-23a2860b3158`. - **E review:** advisor approved the atomic edit flow at 87% confidence, then confirmed - that the existing Yes/Reconnect choice became a no-op after restoring `userDisconnected`. - Correct it at 90% confidence: only a successful error-node Yes choice clears that hold - before resetting errors and refreshing; No, failure and another hold never clear it. - This honors the existing choice without reviving old views. Four regressions were added. - **Done (2026-11-30), commit `1d971f4c1`:** ordinary Disconnect now precedes either edit; - atomic save eligibility prevents newly started work from crossing an idle wizard, and the - existing storage latch prevents mixed settings. Existing partial-save feedback is retained. - Successful explicit Yes/Reconnect starts a fresh session; kept dirty tabs stay retired. - Decisions: advised (`claude-opus-5.5`), core review 87%, final Reconnect correction - approved at 92%. No temporary wizard hold, schema change or cancellation-policy change. - New effect cases cover both actual command paths, failed startup, active/pending work, - storage exclusion and the four Reconnect outcomes. - **E host pass:** at `b322b7463` plus final E/F2/U1/H2 working changes, the exact E - command above passed 149 tests in eight files (3.28 s), no failures. Evidence: runner - `3b7b403c-c6b3-46fc-b2cf-23a2860b3158`. Final root build passed - (43.19 s), including the typed fixture repairs. Integrated candidate rerun remains. -- **H1 / `mai-code-2`, after F1:** fence the shared client-operation callback and add C01 - effect-level regressions. **H2/H3 / `gpt-6.1-sol`, after F2:** propagate the captured host - lifetime/cancellation through schema/model and Playground handoffs; serialize H2/H3 because - they share the Collection router. The Sol slices involve multiple async side-effect boundaries. - **H1 preparation returned:** agent `12d342e8-2c9c-42f2-b4d8-619c13473792` added nine - create-command race/control cases in the new namespace-helper test file. No production - code or existing tests changed and no tests were run. The shared source guard remains - gated on F1 approval; preparation alone is not H host evidence. - **H1 source implementation running after F1 approval:** the same `mai-code-2` worker - now owns the shared last-synchronous operation check and the prepared namespace-helper - tests. E/F2 use disjoint files. Review and focused runtime evidence remain pending. - **H1 implementation returned:** the shared operation fence and nine effect cases are - written. Direct-dependent Class mock fixtures need the new method; the H1 worker owns - the five disjoint fixtures, and F2 owns its two Dashboard fixtures. No existing test - assertions or behavior are being changed merely to accommodate a mock method. Advisor - `789b6f3c-8f68-4bed-ba93-3fd0c2ec9d78` is reviewing the source boundary. - **H1 Done (2026-11-30), commit `95cd11d0a`:** the shared binding check now runs after - client resolution at the last synchronous point before the operation callback. Nine - regressions cover stale creates, temporary holds, permanent retirement, same-account - replacement and stale delete confirmation. Decisions: advised (`claude-opus-5.5`), - source review approved at about 90% confidence; retain the existing failure-attribution path. - Existing fixtures gained the required mock method without changing assertions. - **H1 host pass:** at `a0cb19066` plus H1/F2/E working changes, the command below passed - 151 tests in seven files (4.55 s), no failures. Evidence: runner - `14f3d87b-cf9c-40f6-96f0-3650c02abfd8`, advisor - `789b6f3c-8f68-4bed-ba93-3fd0c2ec9d78`. H2/H3 and integrated rerun remain pending. - - ```sh - npx vitest run src/commands/runBoundNamespaceCommand.test.ts src/commands/dashboardBoundCommands.test.ts src/commands/importDocuments/importDocuments.test.ts src/webviews/documentdb/collectionView/collectionViewController.test.ts src/webviews/documentdb/documentView/documentsViewController.test.ts src/webviews/documentdb/documentView/documentsViewRouter.test.ts src/documentdb/ClustersClient.test.ts - ``` - -- **H2 / `gpt-6.1-sol`, implementation running:** agent - `b07a97fc-1db9-4155-9be9-3983e34df17c`; planned by advisor - `77bcdc61-58c3-480b-8775-0fee9bcbe27b` at 88% confidence. The sole producer is - Collection View, so `QueryGenerationContext` replaces `clusterId` with required - `binding: ConnectionBinding` and `signal: AbortSignal`. Capture the origin before - availability, but create the operation-epoch guard afterwards so same-account replacement - stays usable. Guard every sample; cancellation reaches the existing post-model-selection - send fence. Catch typed unavailable inside the telemetry callback rather than letting it - be swallowed, and pass client cancellation from QueryEditor. - **Done (2026-11-30), commit `54e890813`:** captured-origin sampling and combined - cancellation now fence schema/model side effects; typed unavailability and original - cancellation cross the telemetry wrapper correctly. Decisions: advised - (`claude-opus-5.5`), initial review 85%, final model-boundary correction approved at 90%. - Preserve DB epoch guards, but use the lifetime/request signal around the model call so - same-account repair does not discard a valid result. Twenty-four new effect cases include - same-account replacement, stale sampling, post-selection zero sends and ignored-abort replies. - The new cancellation assertion was corrected to `stepName`, not the generic translated message. - **H2 host pass:** at `b322b7463` plus working changes, `npm run build` passed - (43.19 s) and the three-suite H2 command passed 31 tests (4.07 s) before the final two - model cases. At `52a70c00b` plus final H2 changes, - `npx vitest run src/commands/llmEnhancedCommands/queryGenerationCommands.test.ts` - passed all 14 generator cases (4.15 s). Evidence: runner - `9a70e0df-465b-417f-9b58-3a680ee602b0`; integrated rerun still required. -- **H3 / `gpt-6.1-sol`, exact contract settled; queued after H2:** advisor follow-up, - 85% confidence, reuses `DocumentDBShellPty._disconnectRevision`, not the host epoch. - Same-account recovery does not change that counter; explicit teardown does. A retained - Shell's links capture origin at click and remain unbound after any Disconnect. - Required `PlaygroundHandoffOrigin` has four cases: binding plus optional original pin/signal; - shell fingerprint/pin with an `isCurrent()` counter check; saved tree origin with epoch; - or none for anonymous/uninitialized/disconnected Shells. The saved case has no fingerprint - because no identity was captured. Validate after document display, remove any restored - connection on rejection, and preserve the supplied original pin using the existing service API. - No new lifetime framework or `PlaygroundService` change is authorized. - **H3 implementation running:** the same Sol worker starts only after the H2 commit, - with exclusive ownership of the shared Collection router. Docs-only P work is independent. - **H3 source review approved, 87% confidence; checks failed:** thirty effect cases were - added across six tests. At `1a1c6ceff` plus H3 working changes, `npm run build` failed - (47.31 s) with twelve TS2352 diagnostics from incomplete Uri/TextDocument fixtures in - four new/extended test files. The nine-suite H3 command below passed 395 tests and failed - eleven (16.43 s): the new Playground/index table cases accumulated earlier spy calls. - Exact-once and anonymous-no-warning assertions must stay; fix fixture types and clear each - owned mock's history between cases. No product logic change is indicated by these failures. - Evidence: runner `25c30672-1fd3-44ee-b249-979bd51c8647`, advisor - `77bcdc61-58c3-480b-8775-0fee9bcbe27b`. Source approval is not a host pass. - **Done (2026-11-30), commit `c640d447d`:** all four handoffs capture their originating - lifetime/pin before document-opening awaits. Rejected handoffs clear any restored binding - but retain text. Anonymous/missing/ended Shell origins stay unbound; same-account Shell - recovery uses the existing PTY disconnect counter rather than the host recovery epoch. - Decision: advised (`claude-opus-5.5`), exact source approved at 87% confidence; retain - existing explicit re-pick and the service API, without a new framework or worker pin removal. - Thirty regressions were added. Proper existing Uri/document builders and per-case mock - cleanup fixed the fixture failures without changing production logic or effect assertions. - **H3 host pass:** at `1a1c6ceff` plus final H3 changes, `npm run build` passed - (exit 0; precise wall duration not reported by runner), and the nine-suite command below - passed all 406 tests in nine files (15.29 s). Evidence: runner - `25c30672-1fd3-44ee-b249-979bd51c8647`. Integrated candidate rerun remains required. - - ```sh - npx vitest run src/commands/playground/newPlayground.test.ts src/documentdb/playground/PlaygroundService.test.ts src/documentdb/playground/PlaygroundEvaluator.test.ts src/documentdb/shell/ShellTerminalLinkProvider.test.ts src/documentdb/shell/ShellSessionManager.test.ts src/documentdb/shell/DocumentDBShellPty.test.ts src/commands/openInteractiveShell/openInteractiveShell.test.ts src/webviews/documentdb/collectionView/collectionViewRouter.test.ts src/webviews/documentdb/collectionView/indexesTab/indexViewRouter.test.ts - ``` - -- **U1 / `mai-code-2`, running after F1 in parallel with F2:** agent - `559eab2f-1c5b-4190-9c53-0e959a8c756e`. Terminal notice only, X/copy without writes, ordinary - recoverable errors without freezing, and rendered-scenario updates. Exclude F2's Dashboard - row/session wiring from parallel ownership. **U2 / `mai-code-2`, after H2/H3:** remove - obsolete host Retry/unlock procedures and protocol; shared routers/controllers require serialization. - Coordination decision: F2's existing session configuration makes its files disjoint from U1. - Keep the approved notice and existing translated repair instruction, removing only the obsolete - Retry clause rather than introducing new recovery prose; uncertain-write cautions remain. - Rendered runs stay last, on the integrated candidate, not during parallel source edits. - **Close-path gate resolved:** advisor `439e40a0-1e6c-4d2a-9322-3c127897f0e9`, - 85% confidence, approved temporary close-only use of the existing recovery RPC for U1. - The hook accepts only `{ action: 'close' }`; keep dirty confirmation, cancellation, - double-click guard and translated close failures. U1 must remove all Retry/unlock calls from the UI. - U2 must replace this with a dedicated `closeView` procedure and remove the old protocol, - including its action field, after H2/H3. This is an intermediate compatibility slice, - not final protocol-removal evidence. - **U1 review/checks:** the one-way notice, close confirmation and stale-text protections - are present, but the advisor found repeating Dashboard recoverable-poll toasts and a - stale-close busy flag. Fix only failed-sample accounting for nonterminal polls and clear - the busy flag when still mounted; preserve the latest notice. A poll scenario and the - close-race assertion were added. - At `b322b7463` plus working changes, the wave `npm run build` failed (43.16 s) on - 13 E test-fixture overload/unused-import diagnostics and one U1 deferred-resolver type. - U1 unit command passed 20/25 tests (11.01 s); five Document View normal-save/dirty/ID/error - cases failed and require root-cause diagnosis, not assertion changes. The browser manifest - command passed 47 tests (1.96 s), which is not rendered proof. Evidence: runner - `35fcbb46-f009-4eeb-90ee-cae3703b37de`. Owners are fixing the typed fixtures and the - advisor is investigating valid Save completion suppression. - **Done (2026-11-30), commit `674ab9c41`:** terminal tabs keep a copy-only notice; - ordinary recoverable failures no longer lock the tab, and the UI has no Retry/unlock. - X only hides the notice. Close retains confirmation, dirty warning, cancellation and - error feedback through the temporary close-only RPC, pending U2 removal. - Decisions: advised (`claude-opus-5.5`), final source review 85%. Corrected the introduced - unstable callback dependency that falsely marked normal rerenders disposed (90% - diagnosis); existing Save/dirty/ID/error assertions are unchanged and all pass. - Repeating recoverable polls count failed samples without toasts; Close always clears its - busy flag while mounted. The new poll scenario waits for handled failed-sample readiness - rather than racing an exact repeating call count. - **U1 unit/fixture pass:** at `b322b7463` plus the corrected working changes, the four - UI suites passed 25/25 tests (10.62 s), including the five previously failing Save cases. - At `52a70c00b` plus U1 changes, the browser-manifest command passed 47/47 tests - (2.36 s), with 189 routes including the new three-theme poll scenario; only incidental - total counts changed. Evidence: runner `35fcbb46-f009-4eeb-90ee-cae3703b37de`. - Root build passed in the same wave before the final small hook/scenario correction. - **Rendered U, final U2 protocol and integrated checks remain pending.** - **U2 implementation running:** `mai-code-2` agent - `efa3a45f-b1e8-4d2a-882d-36cdc2232126`, after H3 commit. Advisor mapping approved - at 85% confidence: dedicated no-input `closeView` disposes the original controller; - remove old recovery callbacks, request/response/action types and Retry episodes. A shared - terminal-reason predicate preserves the exact prior terminal/recoverable split. Keep - frontend dirty confirmation and all F/E/H guards unchanged. The automatic RPC event - becomes `...closeView`; `unavailableReason` enrichment is unchanged. - **Blocked (2026-11-30), CONTENT-POLICY:** U2 returned 27 changed files and three - added close-router tests, with no build or runtime validation. Its final inspection - reported organization content exclusions for `src/webviews/`, - `src/webviews/documentdb/`, `documentsViewRouter.test.ts` and - `src/documentdb/connectionBindingRetirement.ts`. No alternate access, reconstruction - or validation that would access excluded code is authorized. U2 remains uncommitted - and unverified; its worker's zero-symbol claim is not an integrated verdict. - Further inspection, integrated/rendered checks, final pre-review and publication are - blocked until the organization policy administrator reviews access. Do not mark the PR - ready or infer a pass from earlier candidate checks. The already committed work through - `c640d447d` and docs commit `1a1c6ceff` remains separate from this unfinished slice. - **Access restored and Done (2026-11-30), commit `6bcf634e7`:** the operator confirmed - administrator restoration; a direct source read succeeded before normal checks resumed. - U2 removes the obsolete recovery/action protocol and supplies dedicated no-input - `closeView` RPCs. Three close-router cases prove disposal does not acquire a client or - revive a retired binding. Decision: advised (`claude-opus-5.5`), final corrections - approved at 90% confidence. Unique retirement IDs prevent test-state pollution, and the - hook retains the prior fire-and-forget callback shape with its existing error/busy guards. - No assertions were weakened. Automatic telemetry uses the new close procedure name. - **Integrated host/unit pass:** at `9222ec8f1` plus final U2 changes, `npm run build` - passed (7 s), all 1,157 tests in the 51 affected suites passed (31.58 s), and the - browser-manifest command passed 47/47 tests (1.30 s). Evidence: runner - `82a22618-e841-49f1-af0c-df4bb76f3613`, corrected integrated run. Rendered and live - results are separate; this is not a packaged or expiry pass. - **Latest endpoint clarification (2026-11-30):** the organization administrator restored - source access before this runbook was written; that updates the access prerequisite, not the - historical fact that U2's earlier inspection was content-restricted. H3 source is committed - at `c640d447d`; U2 remains pending review and integrated validation. Source access is no longer - a blocker. Manual live gates and the missing dedicated environments do not block an - implementation commit, the authorized stacked draft PR, or execution of Case 2; they block - readiness. Do not infer that any such commit, PR, Case 2 run, or manual pass has occurred from - this documentation clarification. -- **P / `mai-code-2` documentation, `mai-code-2-flash` checks:** align only directly affected - docs/contracts, rerun the integrated effects, collect rendered and packaged evidence, and - preserve separate live gates. The authorized order is implementation push and stacked - draft PR, then Case 2, then readiness only if all required gates and pre-review pass. - **Case 1 integrated pass (2026-11-30):** the candidate containing the committed U2 - source passed the build, 1,157 focused runtime tests and 47 fixture-manifest tests. - The exact root focused command follows. Publication is authorized now; Case 2 follows - the implementation push even with manual gates outstanding. The draft must not imply - readiness, final AI pre-review, packaged activation or live evidence that has not run. - - ```sh - npm run build - npx vitest run src/documentdb/ClustersClient.test.ts src/documentdb/auth/MicrosoftEntraIDAuthHandler.test.ts src/commands/signInAgain/signInAgain.test.ts src/documentdb/shell/ShellSessionManager.test.ts src/documentdb/playground/PlaygroundEvaluator.test.ts src/documentdb/playground/WorkerSessionManager.test.ts src/documentdb/shell/DocumentDBShellPty.test.ts src/commands/playground/executePlaygroundCode.test.ts src/documentdb/connectionTeardown.test.ts src/documentdb/connectionSurfaces.test.ts src/documentdb/connectionBindingRetirement.test.ts src/commands/disconnect/disconnect.test.ts src/commands/updateCredentials src/commands/updateConnectionString src/commands/saveConnectionEdit.test.ts src/commands/runBoundNamespaceCommand.test.ts src/commands/dashboardBoundCommands.test.ts src/commands/importDocuments/importDocuments.test.ts src/commands/llmEnhancedCommands/queryGenerationCommands.test.ts src/services/copilotService.test.ts src/commands/playground/newPlayground.test.ts src/documentdb/playground/PlaygroundService.test.ts src/documentdb/shell/ShellTerminalLinkProvider.test.ts src/commands/openInteractiveShell/openInteractiveShell.test.ts src/webviews/_integration src/webviews/components/DisconnectedOverlay.test.tsx src/webviews/documentdb/useBoundViewRecovery.test.tsx src/webviews/documentdb/documentView src/webviews/documentdb/collectionView/collectionViewController.test.ts src/webviews/documentdb/collectionView/collectionViewRouter.test.ts src/webviews/documentdb/collectionView/indexesTab/indexViewRouter.test.ts src/webviews/documentdb/clusterDashboard - npx vitest run --config build/verification/browser/vitest.config.ts build/verification/browser/scenarios.test.ts - ``` - - **Documentation slice Done (2026-11-30), commit `1a1c6ceff`:** aligned the feature - intent/index, user manual, existing unpublished 1.2 draft and shared cluster skill with - one-way teardown and live same-account repair. Removed Retry-unlock/revival and post-save - Shell-choice instructions; no new release, screenshots or announcement. The feature README - links this ledger instead of duplicating per-slice progress. Telemetry documentation required - no change for this slice. Decisions: leader review, 95% confidence, keep public instructions - concise and verification records here; no design deviation. Docs-only; no checks required. - **Live blocked, operator response (2026-11-30):** an authorized disposable Entra target is - unavailable; the operator will have manual tests performed at a selected candidate checkpoint. - A dedicated physical sleep/wake environment is unavailable. Deterministic implementation - continues; these responses are not live passes or permission to waive required readiness gates. - **Prerequisite evidence:** runner `f2f3b0ec-2762-4135-b213-b7778305f791` verified an - integrated browser page at `about:blank` (`readyState: complete`). Direct cached Chromium - launches failed because `libatk-1.0.so.0` is missing; pinned VS Code 1.109.0 is cached and - the X11 display socket is reachable, but packaged activation is untested. Use the working - integrated browser for U; attempt candidate packaged checks or matching candidate CI for P. - Neither a blank-page check nor an old VSIX is candidate rendered/activation/live evidence. - **Delivery preflight (2026-11-30):** origin's feature branch is still - `1e362403b`; it lacks the two pre-existing baseline commits through `3d66aa937`. - The new implementation branch has not been pushed and has no PR yet. Publish the exact - baseline to the feature ref before opening the stacked PR, so its diff contains only this - work. Parent #1136 uses milestone 1.2.0. Live gates block readiness, not publication - of the authorized draft or Case 2 execution. - Cached Linux VS Code 1.109.0 cannot even report its version: exit 127, missing - `libatk-1.0.so.0`. No system installation was attempted on this shared host. Actual candidate - packaged activation must use a working isolated runtime or matching full CI; a draft's - default fast CI tier is not that evidence. The repository has an explicit full-tier CI - request workflow. Evidence: runner `bb424424-de74-4168-9f05-f12f723fe609`. - Final AI pre-review remains a separate gate; per-item approvals do not pass it. - **Published draft (2026-11-30):** [#1149](https://github.com/microsoft/vscode-documentdb/pull/1149), - base `feature/connection-lifecycle`, milestone 1.2.0, first pushed head - `c4cc00e5663312e0f6a3002d936e13ccf30ad80b`. The feature baseline was safely advanced - to `3d66aa937` separately. All implementation and the detailed manual runbook were committed - before publication. The operator explicitly authorized full CI while retaining draft status; - run [46452303937](https://github.com/microsoft/vscode-documentdb/actions/runs/46452303937) - targets that first head, not later generated changes. - **Case 2 first post-push run:** at `c4cc00e56`, `npm run l10n`, - `npm run prettier-fix`, `npm run l10n:check`, `npm run build`, - `npm run typecheck:tests` and `npm run package` passed. Strict package-test type-checking - passed separately (17.169 s). Lint failed on eleven test-only import-type/unnecessary-cast - findings. Full `npx vitest run` passed 10,448 tests with one skipped, but one of 458 suites - could not load: `ClusterItemBase.test.ts` omitted the `AzureWizardPromptStep` dependency - from its partial azext mock. This is a failing suite, not a full runtime pass. - Formatting and localization output was committed separately as `37917fc74`; the mechanical - lint and mock-load repairs are in progress. Evidence: runner - `241b37a8-7866-4868-805f-274116b2843b`; all eight requested commands ran. - The intermediate VSIX packaged successfully, but is not the final candidate artifact. - **Rendered attempt, not a lifecycle pass:** runner - `45ca6ac4-9aa9-443f-aebb-82f1dd848693` attempted 27 affected routes across three themes - on first pushed head `c4cc00e56` (source hash - `cd5c27f83944864115f422ec1f7463079cbd65218a1f68e8ca41d03e5431a5bc`). - Only Document View default routes completed their layout assertions (3/3). - Collection routes timed out at readiness; dirty/stale Document scenarios timed out replacing - Monaco contents or lost execution context; Dashboard scenarios showed readiness/healthy-status - or held-reply-release mismatches. The lifecycle effect assertions were not established. - Do not attribute every mismatch to the product or environment without evidence, and do not - claim rendered X/copy/no-save or same-tab recovery passed. The runner stopped its own Vite - server and browser page. Keep rendered/workbench verification outstanding in the draft and - use the detailed manual runbook below; deterministic host evidence remains separately valid. - **Case 2 repair review:** the six changed test files replace prohibited inline module types - and unnecessary assertions without changing test expectations. The tree suite now forwards - real azext exports while retaining its custom telemetry/error mocks. Namespace imports that - accidentally included repository-restricted null helpers were replaced with the existing - opaque-export record pattern. The focused six-suite repair run passed 135 tests; a final lint - check and complete post-push Case 2 rerun follow. No production behavior was changed. - **Integrated path walk:** ordinary Collection reads still use `ClusterSession` and the shared - `runWithClient` resolution path. Delayed writes are fenced immediately before the operation - callback; query generation carries the originating lifetime/request signal through sampling - and the post-model-selection send boundary. Playground handoffs validate their captured - origin after document-opening awaits. Same-account client replacement does not retire the - logical lifetime. Intentionally retained safeguards are physical-client generation attribution, - startup/operation epochs, current holds, fingerprint guards, worker Entra pins and cancellation. - Removed mechanisms include the Retry/unlock RPC/action protocol, revival of explicitly ended - views, redundant post-save teardown and the post-save Shell choice. - **Delivery policy:** the final test/format repair commits are pushed before rerunning all eight - Case 2 commands. The draft PR's validation section and linked CI runs carry the exact final - head/VSIX receipt and results. These receipts do not turn unrun manual, rendered or author - pre-review gates into passes; #1149 must remain draft. - **E/H/U pre-edit baseline pass:** at `8c4854f0d` plus F1 working changes, - the command below passed 167 tests in 14 files (12.82 s). The distinct browser-manifest - command passed 47 tests in one file (1.28 s). No missing paths, failures or `TDD:` - failures. Evidence: runner `83db6668-3669-435b-b1a0-76a8ed2c89d0`. - These are host/fixture baselines, not rendered U or candidate P gates. - - ```sh - npx vitest run src/commands/updateCredentials src/commands/updateConnectionString src/services/copilotService.test.ts src/commands/playground/newPlayground.test.ts src/documentdb/playground/PlaygroundService.test.ts src/documentdb/shell/ShellTerminalLinkProvider.test.ts src/webviews/documentdb/useBoundViewRecovery.test.tsx src/webviews/components/DisconnectedOverlay.test.tsx src/webviews/documentdb/documentView/documentView.test.tsx src/webviews/_integration/describeUnavailableConnection.test.ts - npx vitest run --config build/verification/browser/vitest.config.ts build/verification/browser/scenarios.test.ts - ``` - -**F shared boundary:** `retireConnectionBindings(clusterId, generation, reason)` records -an ended lifetime without lowering its cutoff; `getRetiredBindingReason(binding)` preserves -the first end reason; `getBindingLifetimeSignal(binding)` aborts synchronously on teardown. -On failed Remove, correct only the matching latest retirement range to the truthful -`userDisconnected` reason; its lifetime remains permanently ended. -`ClustersClient.assertBindingActive(binding)` rejects ended lifetimes or current holds at -side-effect boundaries. `takeConnectionSurfaces(clusterId)` removes and returns the active -surfaces, so an old frozen snapshot is not closed by the next session's Close all. -Keep the existing internal physical generation and binding guards until replacement coverage -exists; no second general-purpose lifetime framework or worker-pin removal is authorized. - -For each completed slice update **its row** with status, revision, exact command or test name, -observed result and a short evidence pointer. Use `pass`, `fail`, or `blocked: `; -where layers differ, record them separately (e.g. `host pass; live blocked: test account`). -A rerun on a different revision needs its own result. Report failures, fix and rerun, or give -the smallest reproducible blocker and continue independent rows. The orchestrator owns the -integrated verdict; a worker's “done” or a green suite from the pre-change baseline is not it. +The November 30 plan started from `3d66aa937`, with a passing build and 271 focused tests. +Renewal and worker tests could proceed independently; edits, views and asynchronous handoffs +depended on ending the old host session **before** cleanup could wait. Each entry below gives +the outcome, not a new task. The [original handoff at the reviewed revision](https://github.com/microsoft/vscode-documentdb/blob/01590e0617e3dcf70cb237acab3fd880ca908162/docs/ai-and-plans/features/connection-lifecycle/iterations/03-complexity-reduction-analysis.md#implementation-handoff) +retains the per-slice commands, receipts and intermediate failures. + +- **R — pinned recovery (`b58b74501`).** Tree sign-in accepts only the original account ID. A late + failure from the old physical client cannot evict its replacement. +- **W — worker isolation (`4c5ff5fa2`).** The test waits until evaluation actually reaches the old + worker before Disconnect. Stopping earlier had tested startup cancellation, not in-flight work. + The new worker gets neither the stale token reply nor an automatic replay. +- **F — retained views (`b7fd8bff5`, `7417e01ea`).** Teardown retires the logical lifetime + synchronously and detaches kept views from the active registry. A later Close all cannot close + the old snapshot. Dashboard menu commands resolve their originating panel, not the newest one. + At this iteration failed Remove corrected the last retirement reason without reviving the tab; + [decision 0036](../decisions.md#0036-simplify-obsolete-actions-and-ended-bindings-without-cutting-useful-features) + later kept the disconnected state on the surviving connection but dropped per-tab reason history. +- **E — disconnected edits (`1d971f4c1`).** Both editors use ordinary Disconnect. Check eligibility + again before saving; the wizard can outlive a reconnect. A partial storage failure remains visible. + The later [#1149 review](./03-pr1149-copilot-review.md) records the concurrent-edit edge the + operator accepted rather than adding teardown-completion tracking. +- **H — delayed work ([review findings C01–C03](./02-pr1136-copilot-review.md)).** Check after + resolving the client and before issuing the write (`95cd11d0a`); carry cancellation through schema + sampling and model selection to the send boundary (`54e890813`); preserve the originating binding + when opening a Playground asynchronously (`c640d447d`). On rejection keep the text, not the binding. +- **U — recoverable vs. terminal (`674ab9c41`, `6bcf634e7`).** Removed the Retry/unlock action + and its RPC protocol. A live tab reports a failed operation without replaying it. On a retained + tab X only dismisses the notice; host checks still prevent database access. +- **P — integration and delivery.** `1a1c6ceff` aligned the manual, draft notes and feature intent. + [#1149](https://github.com/microsoft/vscode-documentdb/pull/1149) records candidate-specific + Case 2 and VSIX receipts. The [initial full CI run](https://github.com/microsoft/vscode-documentdb/actions/runs/46452303937) + applies only to `c4cc00e56`. Its first local Case 2 attempt had lint failures and one suite that + could not load an incomplete azext mock; the passing test count was not a full-suite pass. + +**Limits of the rendered attempt:** 27 routes were attempted across three themes on `c4cc00e56`. +Only the three default Document View layouts passed. Collection readiness, Monaco editing and +Dashboard readiness/held replies prevented the lifecycle assertions from completing. This was +neither proof of a product defect nor a pass for copy, no-save, or same-tab recovery. Local packaged +activation was blocked by a missing `libatk` dependency; use a receipt for the exact candidate. #### Manual-test follow-up (2026-11-30, 20:25 UTC) -The operator reported three follow-ups on the same draft. These are three additional accepted -items, not a reinterpretation of the original seven checkpoints. Baseline `2f704aaad` has the -previously recorded passing Case 1, Case 2 and matching full CI; no tracked edits were present -at this follow-up's intake. The unrelated relay/telemetry directories remain out of scope. - -- **FUP-1 — contextual edit prompt; committed/verified (`mai-code-2`):** explain in the shared - Disconnect-and-update modal that credentials and connection strings can only be updated - while disconnected. Keep the existing heading/button and all teardown/cancellation guards. - Acceptance: both commands use the same explanatory path; ordinary Disconnect is unchanged. - **Done (2026-11-30), commit `e1757115d`:** added the shared modal detail, - "You can only update credentials or the connection string while disconnected." The original - heading, button and teardown guards are unchanged. Decision: operator's requested wording - context, implemented directly; leader review 98% confidence. Existing real-dialog assertions - now include the explanation. -- **FUP-2 — direct clean-view close; committed/verified (`mai-code-2`):** Close view dismisses - Dashboard, Collection View and clean Document View without a confirmation. Preserve the - existing warning, cancel, busy and error handling when Document View is dirty. This is the - operator-approved clarification recorded under decision 0032. - **Done (2026-11-30), commit `dcbf37fd8`:** confirmation runs only with the existing dirty - flag. Default/clean views close directly; dirty confirm, cancel, busy and failure protections - remain. Two focused cases assert zero confirmation RPCs and exactly one close for clean views. - Decision: operator's explicit clean-versus-dirty behavior; leader review 97% confidence. - **Combined focused pass:** at `2f704aaad` plus both follow-ups, the teardown/update/save and - overlay/hook/Document suites passed 170 tests in 11 files (12.29 s). Evidence: runner - `03fdc6df-e172-48e9-82b4-e88d7c893512`. Root build follows the Playground slice. -- **FUP-3 — truthful Playground status; committed/verified (`mai-code-2`):** the CodeLens must - stop claiming Connected after explicit Disconnect without needing a failed Run first. - Preserve file text, selected connection metadata where appropriate, pinned-account recovery, - execution holds and no automatic replay. Advisor diagnosis (`claude-opus-5.5`, 85% - confidence): display used only the selected-connection map, while Run checks a lifecycle hold. - Add a lazy internal latch-change event and reuse the service's existing disposable state-change - notification to refresh CodeLens/status bar. A shared service predicate distinguishes only - explicit `userDisconnected`, without altering selection, saved bindings or other recovery holds. - The existing information action must also describe that state truthfully. This is presentation - synchronization, not new connection or execution policy. - **Done (2026-11-30), commit `39be627c4`:** the lazy host latch event forwards through the - service's existing disposable state notification. CodeLens, status bar and the information action - share the explicit-disconnect predicate. Selection, file text, pins, remembered bindings and Run's - execution guard are unchanged. Ten regressions cover immediate refresh before Run, retained - selection, unlatch recovery, other holds, disposal and truthful information/switch actions. - Decision: advised (`claude-opus-5.5`), implementation reviewed and approved at 88% confidence. - **Combined Case 1 pass:** at `dcbf37fd8` plus the final Playground changes, `npm run build` - passed (44.305 s) and the command below passed 587 tests in 25 files (13.664 s). Evidence: - runner `dbf71ff3-5eeb-4e81-9301-b59b48c73cbe`. No runtime failures or contract changes. - - ```sh - npx vitest run src/documentdb/playground src/commands/playground src/documentdb/ClustersClient.test.ts src/documentdb/connectionTeardown.test.ts src/commands/updateCredentials src/commands/updateConnectionString src/commands/saveConnectionEdit.test.ts src/webviews/components/DisconnectedOverlay.test.tsx src/webviews/documentdb/useBoundViewRecovery.test.tsx src/webviews/documentdb/documentView/documentView.test.tsx - ``` - -The first two slices own disjoint source/tests and run independently of Playground changes. -Focused coding verification is Case 1. The operator subsequently chose to push the follow-up -commits to draft #1149 and rerun Case 2 after that push. Previous-head Case 2 results remain -historical until the new requested full run completes; manual/live readiness gates stay pending. - -**Follow-up post-push Case 2, first run:** on `117e9cce5`, localization, formatting, -localization check, lint, build, strict `typecheck:tests` and packaging passed. The full runtime -suite passed 10,493 tests but failed eight setup-dependent cases in -`TDD: CollectionNameCache`: its automatic client mock omitted the new latch-change subscription. -The operator explicitly approved a **mock-only update, keeping every TDD assertion unchanged**. -No contract expectation or production guard is being weakened. That fixture repair and its -focused verification must be committed/pushed before repeating the full eight-command run. -Final follow-up head, Case 2 outcomes and VSIX receipt are recorded in draft #1149. -The next post-push run on `a9d540c83` passed all 10,501 runtime tests (one skipped), -localization, formatting, lint, strict package-test type checks and packaging, but root build -rejected Vitest's getter-spy overload for a function-valued event getter. The mock fixture uses a -typed property descriptor instead; the event contract and every TDD assertion remain unchanged. -Root build, lint and the focused fixture must pass before publishing that typing correction. - -**Short manual retest for this feedback (not yet run by the agent):** open each update command on -a connected disposable target and verify the shared explanation before accepting or cancelling. -Disconnect with kept views, then Close view on Dashboard, Collection View and a clean Document: -each should close directly. A dirty Document must still allow cancelling the unsaved-changes -warning. With a selected Playground open, invoke Disconnect and do not run it first: both its -connection CodeLens and status bar should show Disconnected while the file and selection remain. -Run must still be blocked; tree Reconnect should refresh the label without automatically executing -the script. These observations supplement, not replace, the longer A–H live verification below. +The operator added three requests after the original seven checkpoints: + +- **Edit prompt (`e1757115d`):** explain why updating credentials or the connection string + requires Disconnect; leave the existing heading, button and cancellation behavior alone. +- **Close view (`dcbf37fd8`):** close clean Dashboard, Collection and Document views directly. + Only dirty Document views need confirmation; cancelling must preserve the draft. +- **Playground status (`39be627c4`):** CodeLens, status bar and the information action must show + Disconnect immediately, without a failed Run first. Update the display when the latch changes; + do not start a worker, change the selection, or execute the script. + +The combined build and 587 focused tests passed. Post-push Case 2 exposed a test fixture +missing the latch-change subscription, then a getter-spy type error. The operator approved +a **mock-only** repair, keeping every `TDD:` assertion; [#1149](https://github.com/microsoft/vscode-documentdb/pull/1149) +holds the final receipt. **Manual retest outstanding:** try both edit prompts, close a clean view, +cancel closing a dirty one, and watch Playground's status across Disconnect/Reconnect without Run. +These checks do not replace the candidate-specific A–H runbook below. #### Evidence the agent collects directly diff --git a/docs/ai-and-plans/features/connection-lifecycle/iterations/03-pr1149-copilot-review.md b/docs/ai-and-plans/features/connection-lifecycle/iterations/03-pr1149-copilot-review.md index 56645d03f..448091ca9 100644 --- a/docs/ai-and-plans/features/connection-lifecycle/iterations/03-pr1149-copilot-review.md +++ b/docs/ai-and-plans/features/connection-lifecycle/iterations/03-pr1149-copilot-review.md @@ -1,7 +1,7 @@ --- feature: connection-lifecycle kind: review -status: active +status: historical prs: [1149, 1154] created: 2026-12-01 verified: 2026-12-01 @@ -28,995 +28,306 @@ code: ## Approved dispositions and implementation ledger -**Operator-approved on 2026-12-01; see inline progress for implementation status.** The operator approved the -recommended options except for C01, C06, C08 and C10, as recorded below and in -[decision 0033](../decisions.md#0033-approve-the-pr1149-review-dispositions-with-explicit-complexity-tradeoffs). -These dispositions take precedence over the original recommendations and acceptance criteria -later in this document. The original findings and evidence are retained, not reclassified. - -| Item | Approved disposition | Scope | -| ---- | ---------------------------------------------- | ----------------------------------------------------------------------------------------------- | -| C01 | Option 3: retain the existing latch/idle check | Accepted edge case; no completion-tracking fix | -| C02 | Option 1 | Retire the prior lifetime at the common edit boundary, including idle edits | -| C03 | Option 1 | Reject closed Shell origins, including previously captured callbacks | -| C04 | Option 1 | Carry the Dashboard origin through bound session creation and panel publication | -| C05 | Option 1 | Defer the full binding guard until after client resolution | -| C06 | Option 2 direction | Clear a removed connection's Playground selection; reuse the existing Connect path | -| C07 | Option 1 | Treat rejected Entra accounts as explicit same-account sign-in recovery, not binding retirement | -| C08 | Won't fix | Keep the overlay and database guards; accept local query editing after dismissal | -| C09 | Option 1 | Settle an invalidated current collections read as interrupted; enable manual Refresh | -| C10 | Option 2 | Stop polling after a recoverable failure; only explicit manual Refresh can resume it | -| C11 | Option 1 | Send localized title and detail through the existing notification contract | -| C12 | Option 1 | No standalone retained-state refactor | - -This authorizes **nine code fixes**: C02, C03, C04, C05, C06, C07, C09, C10 and C11. -C01, C08 and C12 are approved no-code dispositions. All twelve still need their original -discussion thread answered. Record implementation progress, advisor acceptance, commit, push, -checks and reply URL inline under the corresponding item; approval alone is not completion. - -**Execution:** [draft #1154](https://github.com/microsoft/vscode-documentdb/pull/1154) targets -`feature/connection-lifecycle`. The `claude-opus-5.5` advisor confirmed the handoff order and found -no new decision to escalate. Recommended implementation models: `gpt-6.1-sol` for C04's -cross-module startup and publication race; `mai-code-2` for C02, C03, C05, C06, C07, C09, C10 -and C11. C04 and C07 share a client test file; the C11 notification-contract change follows the -C09 and C10 hook changes. The final workbench and live checks are separate from Case 1 and Case 2. +On 2026-12-01 the operator approved nine fixes and three no-code dispositions for +[draft #1154](https://github.com/microsoft/vscode-documentdb/pull/1154). +[Decision 0033](../decisions.md#0033-approve-the-pr1149-review-dispositions-with-explicit-complexity-tradeoffs) +accepted the recommendations **except C01, C06, C08 and C10**. Each finding below pairs the +evidence at the reviewed head with the choice actually made, the pushed commit and the reply. +The [unabridged ledger at `01590e0`](https://github.com/microsoft/vscode-documentdb/blob/01590e0617e3dcf70cb237acab3fd880ca908162/docs/ai-and-plans/features/connection-lifecycle/iterations/03-pr1149-copilot-review.md) +preserves the original alternatives, acceptance criteria, run instructions and per-item checks. +Neither the rejected proposals nor this historical ledger are a current product specification. ## Scope and verdict -Evaluated [Copilot's 2026-12-01 review](https://github.com/microsoft/vscode-documentdb/pull/1149#pullrequestreview-6128681886) -against PR head `f8da433c084d298bdecfe09a8003408dd7dcd708`. Local HEAD matched GitHub. All **12** -inline threads were unresolved and not outdated; a second GitHub read confirmed the same head, -review and thread inventory. The PR remains a draft. - -This follows the [previous comment-evaluation workflow](./02-pr1136-copilot-review.md): -collect the comments with discussion links, verify each claim, independently assess severity, -compare solutions and recommend one with reasons. **The following is the original technical -evaluation. The approved dispositions above now govern implementation; no fixes, GitHub replies -or thread resolutions have been performed by this document update.** - -**Result: 11 confirmed findings and one optional refactoring suggestion.** Copilot assigned four -High, seven Medium and one Low ratings. This assessment assigns **one High, six Medium, four Low -and one non-blocking optional item**: - -| Item | Finding | Copilot | Reassessed | Verdict | -| ------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------- | ------------- | ---------- | ----------------------------------------- | -| [C01](#c01-editing-can-start-before-teardown-finishes-or-after-it-fails) | Edit admitted before teardown succeeds | High | Medium | Confirmed | -| [C02](#c02-idle-edits-do-not-retire-pending-playground-origins) | Idle edit leaves a pending Playground origin valid | High | Medium | Confirmed | -| [C03](#c03-closing-a-shell-does-not-invalidate-its-captured-handoff-origin) | Closed Shell origin remains current | High | Medium | Confirmed | -| [C04](#c04-dashboard-navigation-can-create-a-session-for-a-replacement-identity) | Dashboard opens a view on a replacement identity | High | High | Confirmed | -| [C05](#c05-query-generation-cannot-be-the-first-operation-to-recover-an-evicted-client) | Generate Query cancels before client recovery | Medium | Medium | Confirmed | -| [C06](#c06-removed-playground-connections-are-presented-as-connected) | Removed Playground connection shown as connected | Medium | Low | Confirmed | -| [C07](#c07-a-rejected-entra-account-is-mistaken-for-a-permanently-ended-binding) | Wrong-account token freezes an otherwise recoverable tab | Medium | Medium | Confirmed | -| [C08](#c08-retained-collection-queries-remain-editable-after-notice-dismissal) | Copy-only Collection View still permits query edits | Medium | Low | Confirmed | -| [C09](#c09-a-recoverable-failure-can-leave-an-independent-dashboard-read-loading-forever) | Invalidated Dashboard read never settles its loading state | Medium | Medium | Confirmed | -| [C10](#c10-index-build-polling-can-repeat-recoverable-error-notifications) | Background index poll repeats notifications | Medium | Low | Confirmed | -| [C11](#c11-recovery-notifications-display-an-internal-reason-and-omit-the-title) | Notification exposes reason code instead of localized context | Medium | Low | Confirmed | -| [C12](#c12-persistent-retained-state-would-clarify-rendering-but-no-rendering-defect-was-demonstrated) | Render persistent retention from state rather than a ref | Low, optional | Optional | No current functional defect demonstrated | - -Severity reflects demonstrated impact, not just the presence of a race: - -- **High:** an old-origin action can create a live view for a different connection identity. -- **Medium:** a lifecycle safety precondition is violated, a delayed action survives the intended - session boundary, or a supported recovery workflow becomes unusable. -- **Low:** local retained-content editing or misleading/noisy presentation, without a demonstrated - database-access or identity bypass. -- **Optional:** a maintainability improvement without an identified failing behavior. - -The behavioral baseline for the original evaluation was [decisions 0030-0032](../decisions.md#0030-offer-disconnect-and-update-performing-the-ordinary-disconnect-flow-before-editing): -successful teardown before editing, guarded handoffs, permanently read-only retained views, and -usable existing tabs after same-account recovery. Decision 0033 qualifies the teardown guarantee -for C01's accepted edge case and the local Collection View editing policy for C08. It also selects -the simpler C06 and C10 alternatives. No additional general-purpose identity/lease framework is -approved. +Two reads confirmed [Copilot's review](https://github.com/microsoft/vscode-documentdb/pull/1149#pullrequestreview-6128681886) +of draft #1149 at `f8da433c084d298bdecfe09a8003408dd7dcd708`: local HEAD matched and all 12 +threads were current and unresolved. Following the [previous evaluation](./02-pr1136-copilot-review.md), +the lead assessed 11 confirmed findings and one optional refactor. Ratings below are **Copilot → +assessment**: four High, seven Medium and one Low became one High, six Medium, four Low and one +optional. Only C04 demonstrated a live surface bound to a different identity. + +[Decisions 0030–0032](../decisions.md#0030-offer-disconnect-and-update-performing-the-ordinary-disconnect-flow-before-editing) +were the baseline. Decision 0033 qualified teardown success for a concurrent edit (C01) and +copy-only retention for local Collection query text (C08); it did not approve a general lease +framework or relax database-operation guards. ## C01. Editing can start before teardown finishes or after it fails -**Discussion:** [Copilot comment](https://github.com/microsoft/vscode-documentdb/pull/1149#discussion_r4752057973). -**Copilot: High. Assessment: confirmed, Medium.** - -**Approved disposition: option 3; no code fix.** The operator considers this an edge case and -rejects option 1's additional complexity. Keep the existing latch/idle eligibility check; do not -add teardown-completion tracking or claim this race has been fixed. The original option 1 -acceptance criteria below are not requirements for this round. - -**Done (2026-12-01), decision commit [`1b98521`](https://github.com/microsoft/vscode-documentdb/commit/1b985210362510facc41862314b712b785161fae):** -operator approved option 3 in Decision 0033; the edit/teardown race remains an accepted edge case. -No implementation or new tests. The checkpoint was pushed to draft #1154 after `npm run build` -passed. [Original-thread reply](https://github.com/microsoft/vscode-documentdb/pull/1149#discussion_r4757117308). - -> The `userDisconnected` latch is set before `commitTeardown` finishes closing the driver client, -> so another Update command can pass this check and save while Disconnect is still pending. If -> close later fails, editing has already started despite the requirement that teardown must -> succeed first. Track teardown completion separately from the latch, and await it or reject -> edits until it succeeds. - -**Evidence.** [canSaveEdit](https://github.com/microsoft/vscode-documentdb/blob/f8da433c084d298bdecfe09a8003408dd7dcd708/src/documentdb/connectionTeardown.ts#L66) -treats `userDisconnected` as sufficient. [commitTeardown](https://github.com/microsoft/vscode-documentdb/blob/f8da433c084d298bdecfe09a8003408dd7dcd708/src/documentdb/connectionTeardown.ts#L173) -sets that latch before awaiting driver close. -[deleteClient](https://github.com/microsoft/vscode-documentdb/blob/f8da433c084d298bdecfe09a8003408dd7dcd708/src/documentdb/ClustersClient.ts#L1274) -also removes the cached client before the close promise settles. A second edit therefore passes -preflight and the [save-time guard](https://github.com/microsoft/vscode-documentdb/blob/f8da433c084d298bdecfe09a8003408dd7dcd708/src/commands/saveConnectionEdit.ts#L34). - -An offline probe held driver close, invoked the real second-edit preflight and save helper, and -observed the mocked storage save run before close settled. After close rejected, a fresh edit -check still returned true. The -[existing ordering test](https://github.com/microsoft/vscode-documentdb/blob/f8da433c084d298bdecfe09a8003408dd7dcd708/src/documentdb/connectionTeardown.test.ts#L619) -covers the edit that initiates Disconnect, not another edit entering while it is pending. - -**Why Medium rather than High:** this concretely violates the approved teardown-success -precondition. It does not by itself demonstrate a database write or cross-identity access; the -probe changed only synthetic storage. - -**Options.** - -1. **Recommended:** track the outcome of an actual teardown attempt at the existing per-cluster - teardown boundary. An edit must await that attempt or fail explicitly while it is pending; - a rejected attempt must not become eligible merely because its latch or empty registries - remain. Recheck the epoch and task guard before saving. **Pros:** distinguishes intent from - completed teardown and covers both pending and failed closes. **Cons:** requires explicit - ownership/cleanup of the completion record and a defined retry path after failure. -2. Refuse an edit while teardown is pending, but discard that record on rejection. - **Pros:** a smaller concurrency fix. **Cons:** fixes only the overlap; subsequent edits can - still mistake failed teardown for safe disconnection. -3. Check only for an absent client or `userDisconnected`. **Pros:** no added state. - **Cons:** those facts become true before close completes; this is the current defect. - -**Why option 1:** the condition being enforced is successful teardown, not a request to -disconnect. Keep this bookkeeping local to teardown rather than building a second session system. - -**Acceptance:** hold driver close and start a second Update command; neither its wizard nor save -may proceed prematurely. Reject close and verify later edits also remain blocked with explicit -failure feedback. A successful close permits editing; cancellation, task conflicts and a genuinely -unused connection retain their intended behavior. +[Discussion](https://github.com/microsoft/vscode-documentdb/pull/1149#discussion_r4752057973) · High → Medium. +[Teardown](https://github.com/microsoft/vscode-documentdb/blob/f8da433c084d298bdecfe09a8003408dd7dcd708/src/documentdb/connectionTeardown.ts#L173) +sets the latch and [deletes the cached client](https://github.com/microsoft/vscode-documentdb/blob/f8da433c084d298bdecfe09a8003408dd7dcd708/src/documentdb/ClustersClient.ts#L1274) +before close settles. A **second** edit passed [preflight](https://github.com/microsoft/vscode-documentdb/blob/f8da433c084d298bdecfe09a8003408dd7dcd708/src/documentdb/connectionTeardown.ts#L66) +and the [save guard](https://github.com/microsoft/vscode-documentdb/blob/f8da433c084d298bdecfe09a8003408dd7dcd708/src/commands/saveConnectionEdit.ts#L34) +against mocked storage while close was pending; another check still passed after rejection. +The [ordering test](https://github.com/microsoft/vscode-documentdb/blob/f8da433c084d298bdecfe09a8003408dd7dcd708/src/documentdb/connectionTeardown.test.ts#L619) +covered the initiating command, which still waits for its own teardown. No database write was shown. + +**Option 3, no fix:** keep the latch/idle check. The operator's reason: “this is an edge case, and +option 1 adds a lot of complexity.” The review recommended tracking actual teardown completion +through success **and** failure; tracking only pending close would miss the latter. Neither was +implemented or tested as a fix. [Decision checkpoint `1b98521`](https://github.com/microsoft/vscode-documentdb/commit/1b985210362510facc41862314b712b785161fae) +· [reply](https://github.com/microsoft/vscode-documentdb/pull/1149#discussion_r4757117308). ## C02. Idle edits do not retire pending Playground origins -**Discussion:** [Copilot comment](https://github.com/microsoft/vscode-documentdb/pull/1149#discussion_r4752058063). -**Copilot: High. Assessment: confirmed, Medium.** - -**Approved disposition: option 1.** Implement existing lifetime retirement at the common edit -boundary, including idle edits, without reintroducing C01's rejected completion-tracking design. -**Done (2026-12-01), commit [`d0132088`](https://github.com/microsoft/vscode-documentdb/commit/d0132088cbcf21ee56333c9668197c8d1409a076):** -the shared save boundary retires the prior lifetime after acquiring the update latch and before -storage changes, including idle edits. Earlier Disconnect retirement keeps its reason; eviction -alone does not retire. The operator approved option 1 in Decision 0033. Advised -(`claude-opus-5.5`), accepted at about 85% confidence based on the latch ordering and idempotent -retirement. Implementation: `mai-code-2`, as recommended. Added two `saveConnectionEdit` cases. -The exact-call assertions now pin both retirement reasons in order and retain the existing -Disconnect-before-prompt assertion; the advisor's optional extra call-count assertion was not needed. -Case 1 (`mai-code-2-flash`): `npm run build` and focused `npx vitest run` on `saveConnectionEdit`, -`updateCredentials`, `updateConnectionString` and `newPlayground` passed (105 tests, four suites). -Pushed to [draft #1154](https://github.com/microsoft/vscode-documentdb/pull/1154). -[Original-thread reply](https://github.com/microsoft/vscode-documentdb/pull/1149#discussion_r4757355849). - -> The idle shortcut checks registered resources but does not account for pending handoffs. A -> tree-to-Playground handoff can be waiting when credential rejection evicts the last client; -> this branch then permits a password edit without retiring the old binding, allowing the -> delayed handoff to bind to the edited connection. Retire the previous lifetime even when -> the registries are empty, or track pending handoffs in the edit preflight. - -**Evidence.** [Edit preflight](https://github.com/microsoft/vscode-documentdb/blob/f8da433c084d298bdecfe09a8003408dd7dcd708/src/documentdb/connectionTeardown.ts#L73) -returns immediately for the idle case. The -[save helper](https://github.com/microsoft/vscode-documentdb/blob/f8da433c084d298bdecfe09a8003408dd7dcd708/src/commands/saveConnectionEdit.ts#L34) -latches storage writes but does not retire bindings. A -[tree Playground launch](https://github.com/microsoft/vscode-documentdb/blob/f8da433c084d298bdecfe09a8003408dd7dcd708/src/commands/playground/newPlayground.ts#L41) -captures a binding before opening the document; its -[late validation](https://github.com/microsoft/vscode-documentdb/blob/f8da433c084d298bdecfe09a8003408dd7dcd708/src/commands/playground/newPlayground.ts#L169) -checks retirement and fingerprint, not every intervening epoch. - -The probe paused document creation, reported a native-auth credential rejection through the real -client failure handler, and edited the now-idle connection through the real preflight/save path. -The old binding remained unretired. After a same-fingerprint replacement was published, resuming -the handoff bound the Playground. The -[fingerprint helper](https://github.com/microsoft/vscode-documentdb/blob/f8da433c084d298bdecfe09a8003408dd7dcd708/src/documentdb/connectionFingerprint.ts#L18) -was also checked: changing only the URI authority password preserves the fingerprint. - -**Why Medium rather than High:** a pending old-origin action crosses the intended edit boundary, -but the demonstrated case preserves identity/fingerprint. Creating the Playground does not run -its contents; a later explicit Run is needed for database effects. - -**Options.** - -1. **Recommended:** retire the prior logical lifetime at the common edit boundary, including the - idle shortcut, before storage can change. Reuse the existing idempotent retirement helper and - epoch/task checks. **Pros:** catches pending binding-based handoffs without enumerating every - producer; a password-only edit cannot hide behind fingerprint equality. **Cons:** an empty - registry can no longer be treated as proof that no old logical lifetime needs ending. -2. Register every pending handoff as a resource and include it in preflight. - **Pros:** preflight can enumerate and cancel outstanding handoffs explicitly. - **Cons:** adds registration/disposal obligations to every producer and can miss future ones. - -**Why option 1:** an explicit saved edit is the lifetime boundary. Ordinary credential rejection -or physical-client eviction must remain recoverable and must not itself retire views. - -**Acceptance:** hold a tree handoff, evict its last client, edit only the password, reconnect and -release the handoff. Preserve the document text, but leave the stale handoff unbound with guidance. -An ordinary same-account recovery without an edit must still permit a valid handoff. +[Discussion](https://github.com/microsoft/vscode-documentdb/pull/1149#discussion_r4752058063) · High → Medium. +The probe paused a [tree handoff](https://github.com/microsoft/vscode-documentdb/blob/f8da433c084d298bdecfe09a8003408dd7dcd708/src/commands/playground/newPlayground.ts#L41), +evicted the last client on credential rejection, then used the [idle preflight](https://github.com/microsoft/vscode-documentdb/blob/f8da433c084d298bdecfe09a8003408dd7dcd708/src/documentdb/connectionTeardown.ts#L73) +and [save helper](https://github.com/microsoft/vscode-documentdb/blob/f8da433c084d298bdecfe09a8003408dd7dcd708/src/commands/saveConnectionEdit.ts#L34). +A password-only edit preserved the [fingerprint](https://github.com/microsoft/vscode-documentdb/blob/f8da433c084d298bdecfe09a8003408dd7dcd708/src/documentdb/connectionFingerprint.ts#L18); +the [resumed handoff](https://github.com/microsoft/vscode-documentdb/blob/f8da433c084d298bdecfe09a8003408dd7dcd708/src/commands/playground/newPlayground.ts#L169) +bound the document but did not run it. + +**Option 1:** retire the prior lifetime at the common edit boundary, after acquiring the update +latch and before storage changes, even when idle. No registry of pending handoffs or C01 +completion tracking. Earlier Disconnect keeps its reason; eviction alone does not retire. +[Fix `d0132088`](https://github.com/microsoft/vscode-documentdb/commit/d0132088cbcf21ee56333c9668197c8d1409a076): +two new cases pin retirement order without weakening Disconnect-before-prompt; 105 tests passed. +[Reply](https://github.com/microsoft/vscode-documentdb/pull/1149#discussion_r4757355849). ## C03. Closing a Shell does not invalidate its captured handoff origin -**Discussion:** [Copilot comment](https://github.com/microsoft/vscode-documentdb/pull/1149#discussion_r4752058111). -**Copilot: High. Assessment: confirmed, Medium.** - -**Approved disposition: option 1.** -**Done (2026-12-01), commit [`2e01db69`](https://github.com/microsoft/vscode-documentdb/commit/2e01db6951268337eb3804424bf82b36f2d9f320):** -closed Shells no longer supply a Playground origin, and previously captured callbacks reject -the handoff after closure. Disconnect and authentication behavior are unchanged. The operator -approved option 1 in Decision 0033. Advised (`claude-opus-5.5`), accepted at about 90% confidence -after tracing both close paths and the final handoff guard. Implementation: `mai-code-2`, as -recommended. Added one `DocumentDBShellPty` regression covering both lookups and the captured -callback. Case 1 (`mai-code-2-flash`): `npm run build` and focused `npx vitest run` on -`DocumentDBShellPty`, `ShellTerminalLinkProvider` and `newPlayground` passed (208 tests, three -suites). Pushed to [draft #1154](https://github.com/microsoft/vscode-documentdb/pull/1154). -[Original-thread reply](https://github.com/microsoft/vscode-documentdb/pull/1149#discussion_r4757418958). - -> Closing the terminal sets `_closed` and unregisters the Shell, but this captured origin still -> reports itself current. If a Playground handoff is waiting during closure and a later -> Disconnect or password-only edit, teardown cannot reach that Shell and the matching fingerprint -> can let the old handoff bind to the replacement session. Include `_closed` in the validity check -> and cover terminal closure during a pending handoff. - -**Evidence.** [close](https://github.com/microsoft/vscode-documentdb/blob/f8da433c084d298bdecfe09a8003408dd7dcd708/src/documentdb/shell/DocumentDBShellPty.ts#L253) -sets `_closed` and unregisters the terminal, but does not advance `_disconnectRevision`. -[getPlaygroundOrigin](https://github.com/microsoft/vscode-documentdb/blob/f8da433c084d298bdecfe09a8003408dd7dcd708/src/documentdb/shell/DocumentDBShellPty.ts#L329) -checks only the disconnect revision, authentication mode and fingerprint; its captured callback -also ignores closure. The -[handoff consumer](https://github.com/microsoft/vscode-documentdb/blob/f8da433c084d298bdecfe09a8003408dd7dcd708/src/commands/playground/newPlayground.ts#L182) -accepts that callback plus expected-fingerprint equality. - -A probe captured an origin, called the real PTY `close()` with mocked terminal/session resources, -and found both `origin.isCurrent() === true` and a newly queried origin still reporting `shell`. -Later teardown cannot call `disconnect()` on an unregistered terminal. - -**Why Medium rather than High:** the demonstrated gap bypasses origin-lifetime validity, not -fingerprint or Entra-pin comparison. The stated password-only/same-identity replacement case is -valid; arbitrary different-identity adoption is not established by this finding. - -**Options.** - -1. **Recommended:** reject a closed PTY when creating an origin and include `!_closed` in the - already-captured `isCurrent` callback. **Pros:** fixes both new and pending handoffs with the - existing source-owned lifetime check. **Cons:** a handoff interrupted by terminal closure - becomes an unbound document and needs explicit re-selection. -2. Increment `_disconnectRevision` during close. **Pros:** reuses the current invalidation test. - **Cons:** conflates terminal closure with the separate Disconnect behavior; directly checking - `_closed` expresses the missing condition more clearly. - -**Why option 1:** a source that has closed cannot authorize delayed navigation. Checking only -future calls to `getPlaygroundOrigin` would leave previously captured callbacks valid. - -**Acceptance:** close a terminal during a held Playground handoff, then Disconnect/edit/reconnect -with the same fingerprint. No stale binding is installed; text remains available. A still-open, -current Shell continues to support the handoff. +[Discussion](https://github.com/microsoft/vscode-documentdb/pull/1149#discussion_r4752058111) · High → Medium. +After [PTY close](https://github.com/microsoft/vscode-documentdb/blob/f8da433c084d298bdecfe09a8003408dd7dcd708/src/documentdb/shell/DocumentDBShellPty.ts#L253) +unregistered the Shell, a probe could still obtain a [new origin and a current captured callback](https://github.com/microsoft/vscode-documentdb/blob/f8da433c084d298bdecfe09a8003408dd7dcd708/src/documentdb/shell/DocumentDBShellPty.ts#L329). +Later teardown could not reach that Shell. The [consumer](https://github.com/microsoft/vscode-documentdb/blob/f8da433c084d298bdecfe09a8003408dd7dcd708/src/commands/playground/newPlayground.ts#L182) +still checked fingerprint; this was stale authority within a matching identity, not arbitrary substitution. + +**Option 1:** check closure at origin creation **and** in the captured callback, rather than +treating close as Disconnect. An interrupted handoff can keep its text without binding; normal +Disconnect/authentication behavior is unchanged. [Fix `2e01db69`](https://github.com/microsoft/vscode-documentdb/commit/2e01db6951268337eb3804424bf82b36f2d9f320): +one regression exercised both lookups and the callback; 208 tests passed. [Reply](https://github.com/microsoft/vscode-documentdb/pull/1149#discussion_r4757418958). ## C04. Dashboard navigation can create a session for a replacement identity -**Discussion:** [Copilot comment](https://github.com/microsoft/vscode-documentdb/pull/1149#discussion_r4752058182). -**Copilot: High. Assessment: confirmed, High.** - -**Approved disposition: option 1.** -**Done (2026-12-01), commit [`5e39ca70`](https://github.com/microsoft/vscode-documentdb/commit/5e39ca709a59728ef89395bef9575ac9cfbc7f2b):** -both Dashboard paths pass the captured connection binding through session creation and panel -publication. The final guard rejects retired, changed or cancelled origins and closes the -unpublished session; a same-identity replacement within the lifetime can still open the view. -Decision: operator selected option 1 in Decision 0033; advised (`claude-opus-5.5`), accepted at -about 85% confidence based on the bound resolver, final synchronous guard, cleanup and both -entry points. Implementation: `gpt-6.1-sol`, as recommended. Added 15 cases across client, opener, -controller and router tests; updated the host action assertion to include the binding while keeping -the namespace, tab and no-relay assertions. Case 1 (`mai-code-2-flash`): `npm run build` passed; -focused `npx vitest run` on `ClustersClient`, `openCollectionView`, `clusterDashboardController`, -`clusterDashboardRouter`, `vscodeUriHandler` and `collectionViewRouter` passed (319 tests, six suites). -Pushed to [draft #1154](https://github.com/microsoft/vscode-documentdb/pull/1154). -[Original-thread reply](https://github.com/microsoft/vscode-documentdb/pull/1149#discussion_r4757276509). - -> Open Collection and Manage Indexes call `openCollectionViewInternal`, which creates a session -> without the Dashboard's captured binding. If client startup spans Disconnect/Reconnect, that -> lookup can retry against the replacement and open a live view from the ended Dashboard. Carry -> the originating binding through session creation and check it before opening the panel; the -> Dashboard toolbar needs the same fix. - -**Evidence.** Both the -[row-action path](https://github.com/microsoft/vscode-documentdb/blob/f8da433c084d298bdecfe09a8003408dd7dcd708/src/webviews/documentdb/clusterDashboard/clusterDashboardController.ts#L281) -and [toolbar procedure](https://github.com/microsoft/vscode-documentdb/blob/f8da433c084d298bdecfe09a8003408dd7dcd708/src/webviews/documentdb/clusterDashboard/clusterDashboardRouter.ts#L505) -check the Dashboard binding before calling the -[opening helper](https://github.com/microsoft/vscode-documentdb/blob/f8da433c084d298bdecfe09a8003408dd7dcd708/src/commands/openCollectionView/openCollectionView.ts#L40), -but do not pass it. [Session creation](https://github.com/microsoft/vscode-documentdb/blob/f8da433c084d298bdecfe09a8003408dd7dcd708/src/documentdb/ClusterSession.ts#L804) -awaits unbound `getClient(clusterId)` and captures whichever client's binding comes back. -[Client acquisition](https://github.com/microsoft/vscode-documentdb/blob/f8da433c084d298bdecfe09a8003408dd7dcd708/src/documentdb/ClustersClient.ts#L1000) -can retry a stale startup after an epoch change. - -The composition probe passed the source Dashboard guard, held client startup, completed explicit -teardown, published a different-fingerprint replacement and released the old startup. The real -acquisition/session/opening helpers created a new, unretired session for the replacement identity. -The originating Dashboard binding was retired. Only driver startup and the panel were mocked; -no database was read. - -**Why High:** unlike C02/C03, the receiving session no longer has the originating fingerprint. -The opened view is live for a different identity, so its subsequent reads and writes are not -protected by the old Dashboard's binding. A pre-await guard or discarding a later RPC result is -too early or too late, respectively. - -**Options.** - -1. **Recommended:** carry the originating binding/lifetime through both Dashboard entry paths - into session creation. Resolve through the existing bound-client mechanism, revalidate before - publishing the panel, and clean up any abandoned session. Keep ordinary tree/deep-link entry - semantics separate where there is no originating bound view. **Pros:** protects the point - that creates the new live surface, including same-fingerprint Disconnect/Reconnect. - **Cons:** changes the internal opening/session API and its directly dependent callers. -2. Check the Dashboard again only after `openCollectionViewInternal` returns. - **Pros:** a small caller change. **Cons:** the replacement-bound panel already exists and can - start its own work; rejecting the original RPC does not undo that side effect. -3. Disable these Dashboard navigation actions. **Pros:** fail-closed mitigation. - **Cons:** removes useful navigation instead of preserving its origin. - -**Why option 1:** this is a guarded-handoff requirement, not a need for more UI blocking. -Preserve the original lifetime across awaits and allow physical-client replacement only within -that still-live, same-identity lifetime. - -**Acceptance:** hold startup for Open Collection, Manage Indexes and toolbar navigation; end the -source session and reconnect with both the same and a different fingerprint. Neither case may -publish a live view from the ended source. Normal navigation and ordinary same-identity recovery -must work, with no orphaned session when opening is cancelled. +[Discussion](https://github.com/microsoft/vscode-documentdb/pull/1149#discussion_r4752058182) · High → High. +Both [row actions](https://github.com/microsoft/vscode-documentdb/blob/f8da433c084d298bdecfe09a8003408dd7dcd708/src/webviews/documentdb/clusterDashboard/clusterDashboardController.ts#L281) +and the [toolbar](https://github.com/microsoft/vscode-documentdb/blob/f8da433c084d298bdecfe09a8003408dd7dcd708/src/webviews/documentdb/clusterDashboard/clusterDashboardRouter.ts#L505) +checked but did not pass the source binding to the [opener](https://github.com/microsoft/vscode-documentdb/blob/f8da433c084d298bdecfe09a8003408dd7dcd708/src/commands/openCollectionView/openCollectionView.ts#L40). +The probe held [client acquisition](https://github.com/microsoft/vscode-documentdb/blob/f8da433c084d298bdecfe09a8003408dd7dcd708/src/documentdb/ClustersClient.ts#L1000) +across teardown/reconnect: [session creation](https://github.com/microsoft/vscode-documentdb/blob/f8da433c084d298bdecfe09a8003408dd7dcd708/src/documentdb/ClusterSession.ts#L804) +opened a live view for a **different fingerprint** although the Dashboard was retired. Startup and +panel were mocked; no database read was needed to show the wrong binding. + +**Option 1:** carry the originating binding through bound-client resolution and check it immediately +before panel publication for Open Collection, Manage Indexes and toolbar navigation. Checking +after the opener returns is too late. Reject retirement/change/cancellation and close the unpublished +session; allow physical-client replacement within the same live identity. Ordinary tree/deep-link +opens remain separate. [Fix `5e39ca70`](https://github.com/microsoft/vscode-documentdb/commit/5e39ca709a59728ef89395bef9575ac9cfbc7f2b): +15 cases added, 319 tests passed. [Reply](https://github.com/microsoft/vscode-documentdb/pull/1149#discussion_r4757276509). ## C05. Query generation cannot be the first operation to recover an evicted client -**Discussion:** [Copilot comment](https://github.com/microsoft/vscode-documentdb/pull/1149#discussion_r4752058252). -**Copilot: Medium. Assessment: confirmed, Medium.** - -**Approved disposition: option 1.** -**Done (2026-12-01), commit [`94d6287e`](https://github.com/microsoft/vscode-documentdb/commit/94d6287e93d193e40e8fae2419eb7baf26e4e8e0):** -Generate Query checks cancellation before resolving a client, then validates the binding before -sampling or sending. It can recover an evicted same-identity client without another operation -running first. The operator approved option 1 in Decision 0033. Advised (`claude-opus-5.5`), -accepted at about 90% confidence based on the unchanged lifetime and identity checks and the -epoch staying current across same-identity publication. If Copilot is unavailable, its existing -notice can precede a stale-binding error; neither path sends a request. Implementation: -`mai-code-2`, as recommended. Added four `queryGenerationCommands` regressions. -Case 1 (`mai-code-2-flash`): `npm run build` and `npx vitest run -src/commands/llmEnhancedCommands/queryGenerationCommands.test.ts` passed (18 tests). -Pushed to [draft #1154](https://github.com/microsoft/vscode-documentdb/pull/1154). -[Original-thread reply](https://github.com/microsoft/vscode-documentdb/pull/1149#discussion_r4757492585). - -> This preflight requires a cached client before the recovery path can resolve one. After a tree -> failure evicts the client without retiring the view, Generate Query repeatedly cancels here -> even after connectivity returns. Check cancellation here and defer the full binding guard -> until after resolution, where `runBoundViewOperation` already performs it. - -**Evidence.** [generateQuery](https://github.com/microsoft/vscode-documentdb/blob/f8da433c084d298bdecfe09a8003408dd7dcd708/src/commands/llmEnhancedCommands/queryGenerationCommands.ts#L179) -calls the full guard before `runBoundViewOperation`. That -[guard](https://github.com/microsoft/vscode-documentdb/blob/f8da433c084d298bdecfe09a8003408dd7dcd708/src/webviews/documentdb/boundViewOperations.ts#L13) -throws `UserCancelledError` when `getBinding` returns no cached client, even if the binding is -unretired and there is no latch. The subsequent bound-resolution path is therefore never reached. - -A probe supplied an unretired binding and non-aborted request with no cached client: generation -cancelled and made **zero** client-resolution calls. The -[existing replacement test](https://github.com/microsoft/vscode-documentdb/blob/f8da433c084d298bdecfe09a8003408dd7dcd708/src/commands/llmEnhancedCommands/queryGenerationCommands.test.ts#L120) -has the replacement binding already cached, so its passing result does not cover this case. - -**Impact:** Generate Query cannot initiate this recovery; another operation that repopulates the -client can make it work again. This is not a permanent retirement or an identity bypass. - -**Options.** - -1. **Recommended:** check request cancellation at preflight, then let bound resolution validate - the lifetime/identity and create or recover the client. Keep the full guard after resolution - and before sampling/model sends. **Pros:** restores recovery without weakening the existing - side-effect fences. **Cons:** a request can enter client resolution before discovering that - it cannot proceed, so cancellation and retirement tests remain important. -2. Change the shared guard to accept a missing cached client everywhere. - **Pros:** avoids this particular early cancellation. **Cons:** broadens the guard's contract - for callers that use it immediately before side effects. -3. Require a separate tree action first. **Pros:** no code change. - **Cons:** contradicts the same-tab recovery design and leaves a silent cancellation trap. - -**Why option 1:** the guard is appropriate after acquisition; it is misplaced before the path -that can supply the missing client. - -**Acceptance:** an unretired view with valid connection settings and no cached client can recover, -sample and send once. Abort, explicit retirement and different-identity replacement must still -prevent sampling/model sends. No failed operation is automatically replayed. +[Discussion](https://github.com/microsoft/vscode-documentdb/pull/1149#discussion_r4752058252) · Medium → Medium. +[Generate Query](https://github.com/microsoft/vscode-documentdb/blob/f8da433c084d298bdecfe09a8003408dd7dcd708/src/commands/llmEnhancedCommands/queryGenerationCommands.ts#L179) +called the [full guard](https://github.com/microsoft/vscode-documentdb/blob/f8da433c084d298bdecfe09a8003408dd7dcd708/src/webviews/documentdb/boundViewOperations.ts#L13) +too early. With an unretired binding and empty cache, the probe counted **zero** resolution +attempts; the [existing replacement test](https://github.com/microsoft/vscode-documentdb/blob/f8da433c084d298bdecfe09a8003408dd7dcd708/src/commands/llmEnhancedCommands/queryGenerationCommands.test.ts#L120) +started with a cached replacement. + +**Option 1:** check cancellation first, resolve the bound client, then validate lifetime/identity +before sampling or sending. Do not weaken the shared guard or require a separate tree action. +An unavailable-Copilot notice can precede a stale-binding error; neither path sends a request. +[Fix `94d6287e`](https://github.com/microsoft/vscode-documentdb/commit/94d6287e93d193e40e8fae2419eb7baf26e4e8e0): +four regressions added, 18 tests passed. [Reply](https://github.com/microsoft/vscode-documentdb/pull/1149#discussion_r4757492585). ## C06. Removed Playground connections are presented as connected -**Discussion:** [Copilot comment](https://github.com/microsoft/vscode-documentdb/pull/1149#discussion_r4752058319). -**Copilot: Medium. Assessment: confirmed, Low.** - -**Approved disposition: option 2 direction.** Prefer clearing a removed connection's selected -Playground binding and reusing the existing **Connect** affordance/picker. The operator chose -this because it is simpler than adding shared reason-aware presentation. Keep the file text; -do not clear the selection for ordinary Disconnect or cancelled removal. - -**Approved acceptance:** after successful Remove, the affected Playground has no selected -connection, no connected claim, and the existing Connect path can select another database. -File contents remain intact. This replaces the original option 1 presentation requirements below. -**Done (2026-12-01), commit [`eb57981f`](https://github.com/microsoft/vscode-documentdb/commit/eb57981f01ea3d06d9dfc559cf298ecfaad68844):** -successful connection or folder removal clears matching selections and remembered bindings after -the storage delete. Playground uses the existing Connect picker and keeps the file text. -Disconnect and cancelled or failed removal retain the selection. The operator approved option 2 -in Decision 0033. Advised (`claude-opus-5.5`), accepted with high confidence based on ordering, -target scope, and the single state event. Implementation: `mai-code-2`, as recommended; added two -regressions for selection restoration and batch removal, and extended negative assertions. -Case 1 (`mai-code-2-flash`): `npm run build` and focused `npx vitest run` on `PlaygroundService`, -`connectionTeardown`, `deleteFolder` and `executePlaygroundCode` passed (126 tests, four suites). -Pushed to [draft #1154](https://github.com/microsoft/vscode-documentdb/pull/1154). Workbench -presentation remains unverified. [Original-thread reply](https://github.com/microsoft/vscode-documentdb/pull/1149#discussion_r4757815667). - -> Remove Connection sets `connectionRemoved` but retains the Playground's selected connection, -> so this predicate returns false after its worker has stopped. The refreshed status bar, CodeLens -> and information action therefore claim that the removed connection is connected. Handle -> removal as an ended connection with guidance to select another database, rather than suggesting -> Reconnect for an item that no longer exists. - -**Evidence.** [isUserDisconnected](https://github.com/microsoft/vscode-documentdb/blob/f8da433c084d298bdecfe09a8003408dd7dcd708/src/documentdb/playground/PlaygroundService.ts#L320) -recognizes only `userDisconnected`. With a retained selection, the -[status bar](https://github.com/microsoft/vscode-documentdb/blob/f8da433c084d298bdecfe09a8003408dd7dcd708/src/documentdb/playground/PlaygroundService.ts#L423), +[Discussion](https://github.com/microsoft/vscode-documentdb/pull/1149#discussion_r4752058319) · Medium → Low. +The [predicate](https://github.com/microsoft/vscode-documentdb/blob/f8da433c084d298bdecfe09a8003408dd7dcd708/src/documentdb/playground/PlaygroundService.ts#L320) +missed `connectionRemoved`; a probe saw a connected [status bar](https://github.com/microsoft/vscode-documentdb/blob/f8da433c084d298bdecfe09a8003408dd7dcd708/src/documentdb/playground/PlaygroundService.ts#L423). [CodeLens](https://github.com/microsoft/vscode-documentdb/blob/f8da433c084d298bdecfe09a8003408dd7dcd708/src/documentdb/playground/PlaygroundCodeLensProvider.ts#L84) -and [information action](https://github.com/microsoft/vscode-documentdb/blob/f8da433c084d298bdecfe09a8003408dd7dcd708/src/commands/playground/connectDatabase.ts#L35) -fall through to connected wording for `connectionRemoved`. A real-method probe confirmed both -the false predicate and the connected status-bar tooltip after setting that latch. - -**Why Low:** the selection's presentation is wrong, but this predicate does not authorize -execution. Removal's host-side latch and worker teardown remain in place; no database-access -bypass was demonstrated. - -**Options.** - -1. **Recommended:** expose a shared reason-aware ended-connection presentation for these three - consumers. Keep the selected target/text, distinguish Remove from Disconnect, and offer the - existing database picker for a removed connection. **Pros:** truthful and consistent guidance - without changing execution policy. **Cons:** requires coordinated wording and assertions - across the three surfaces. -2. Delete every selected Playground binding when its connection is removed. - **Pros:** existing unbound UI offers Connect. **Cons:** loses the remembered target/context - and changes selection behavior more broadly than this presentation defect. -3. Treat both reasons as a boolean disconnected state with the same Reconnect message. - **Pros:** smallest code edit. **Cons:** Reconnect cannot recover an item that was removed. - -**Why option 1:** absence of a connection and deliberate disconnection need different next -actions, not just the same warning icon. - -**Acceptance:** Remove immediately updates all three surfaces with select-another-database -guidance and preserves file text. Disconnect still gives valid tree-reconnect guidance; ordinary -same-account recovery must not be reported as removal. +and the [information action](https://github.com/microsoft/vscode-documentdb/blob/f8da433c084d298bdecfe09a8003408dd7dcd708/src/commands/playground/connectDatabase.ts#L35) +used the same distinction. Misleading presentation did not authorize execution. + +**Option 2 direction, not recommended option 1:** the operator preferred clearing the selected +binding and reusing **Connect** because it was simpler than retaining the target and adding shared +reason-aware wording. Successful connection/folder removal clears matching selections and remembered +bindings **after** storage deletion, preserving file text. Ordinary Disconnect and cancelled or +failed removal keep the selection. [Fix `eb57981f`](https://github.com/microsoft/vscode-documentdb/commit/eb57981f01ea3d06d9dfc559cf298ecfaad68844): +two regressions plus negative assertions, 126 tests passed. [Reply](https://github.com/microsoft/vscode-documentdb/pull/1149#discussion_r4757815667). ## C07. A rejected Entra account is mistaken for a permanently ended binding -**Discussion:** [Copilot comment](https://github.com/microsoft/vscode-documentdb/pull/1149#discussion_r4752058391). -**Copilot: Medium. Assessment: confirmed, Medium.** - -**Approved disposition: option 1.** -**Done (2026-12-01), commit [`82723db3`](https://github.com/microsoft/vscode-documentdb/commit/82723db379c3bc89c5d499083b3623d57757593d):** -a rejected Entra account now requires sign-in without retiring the binding. The wrong account is -still rejected, the original account can repair the existing view explicitly, and actual identity -changes remain terminal. No operation replays. The bounded `connectionFailureKind` now records -`signInRequired` for this case. The operator approved option 1 in Decision 0033. Advised -(`claude-opus-5.5`), accepted with high confidence based on the unchanged pin checks and explicit -replacement path. Implementation: `mai-code-2`, as recommended; added one mocked host recovery -regression and updated classifier and host reason assertions without weakening the no-replay -assertion. Case 1 (`mai-code-2-flash`): `npm run build` and focused `npx vitest run` on -`connectionFailures`, `ClustersClient`, `signInAgain`, `startupFailureTelemetry` and diagnostics -`authenticate` passed (253 tests, five suites); live Entra was not exercised. Pushed to -[draft #1154](https://github.com/microsoft/vscode-documentdb/pull/1154). -[Original-thread reply](https://github.com/microsoft/vscode-documentdb/pull/1149#discussion_r4757586804). - -> `identityChanged` also represents an `EntraIdentityMismatchError` from a silent token lookup, -> not just a changed connection binding: `classifyConnectionFailure` maps that error to this -> reason and evicts the client. A provider returning the wrong account therefore permanently -> freezes the tab, even if the user subsequently signs in with the original account; the hook -> never clears its terminal ref. Distinguish a rejected token/account from an actual binding -> change so same-account repair can keep the tab usable without accepting the wrong account. - -**Evidence.** The -[silent token callback](https://github.com/microsoft/vscode-documentdb/blob/f8da433c084d298bdecfe09a8003408dd7dcd708/src/documentdb/auth/MicrosoftEntraIDAuthHandler.ts#L244) -correctly rejects a different account. The -[classifier](https://github.com/microsoft/vscode-documentdb/blob/f8da433c084d298bdecfe09a8003408dd7dcd708/src/documentdb/connectionFailures.ts#L98) -maps that error to `identityChanged` with eviction. -[runWithClient](https://github.com/microsoft/vscode-documentdb/blob/f8da433c084d298bdecfe09a8003408dd7dcd708/src/documentdb/runWithClient.ts#L19) -preserves the reason, which the -[webview contract](https://github.com/microsoft/vscode-documentdb/blob/f8da433c084d298bdecfe09a8003408dd7dcd708/src/webviews/_integration/connectionUnavailable.ts#L20) -classifies as terminal. - -The probe reported a real `EntraIdentityMismatchError` against a synthetic Entra client. Its -logical binding was not retired, but the real recovery hook permanently blocked the view for -the resulting reason. Publishing a same-fingerprint replacement did not clear that block. - -**Impact:** fail-closed behavior is maintained: the wrong account is rejected, not accepted. -The defect is unnecessarily losing same-tab recovery after repairing the original account. - -**Options.** - -1. **Recommended:** classify a typed token/account mismatch as requiring explicit same-account - sign-in recovery, using the existing `signInRequired`/`replaceOnRecovery` path where possible. - Preserve the original pin and error cause. Reserve terminal `identityChanged` for an actual - incompatible binding. **Pros:** separates failed authentication from a changed identity - without adding another general lifecycle state. **Cons:** changes the classifier's expected - outcome and requires checking host/worker recovery consumers and wording. -2. Add a dedicated bounded account-mismatch reason through the host/webview protocol. - **Pros:** can provide more specific original-account guidance. - **Cons:** wider protocol, classifier and UI changes if existing sign-in recovery is sufficient. -3. Make every `identityChanged` response recoverable in the hook. - **Pros:** tiny change. **Cons:** conflates actual binding changes with rejected tokens and - weakens a boundary that must remain terminal. Do not choose this. - -**Why option 1:** rejecting an offered account does not mean the established binding changed. -Retain the refusal and the pinned identity while allowing the approved explicit repair workflow. - -**Acceptance:** a wrong account returned silently is never used. After explicit sign-in with -the original account, the same tab can execute one new user-requested operation. An actually -different fingerprint and explicit Disconnect/Remove remain permanently blocked. Preserve -worker pin checks, fresh-client recovery and the no-automatic-replay rule. +[Discussion](https://github.com/microsoft/vscode-documentdb/pull/1149#discussion_r4752058391) · Medium → Medium. +The [token callback](https://github.com/microsoft/vscode-documentdb/blob/f8da433c084d298bdecfe09a8003408dd7dcd708/src/documentdb/auth/MicrosoftEntraIDAuthHandler.ts#L244) +correctly rejected a different account. The [classifier](https://github.com/microsoft/vscode-documentdb/blob/f8da433c084d298bdecfe09a8003408dd7dcd708/src/documentdb/connectionFailures.ts#L98) +mapped the mismatch to `identityChanged`; [runWithClient](https://github.com/microsoft/vscode-documentdb/blob/f8da433c084d298bdecfe09a8003408dd7dcd708/src/documentdb/runWithClient.ts#L19) +carried that [terminal reason](https://github.com/microsoft/vscode-documentdb/blob/f8da433c084d298bdecfe09a8003408dd7dcd708/src/webviews/_integration/connectionUnavailable.ts#L20) +to the hook. Even a same-fingerprint replacement could not unblock the synthetic client's view. + +**Option 1:** classify the rejected account as `signInRequired`, keeping the original pin and +explicit same-account replacement path. Actual incompatible bindings remain terminal; the wrong +account is never used and no operation replays. No new protocol reason or blanket recovery for +`identityChanged`. [Fix `82723db3`](https://github.com/microsoft/vscode-documentdb/commit/82723db379c3bc89c5d499083b3623d57757593d): +mocked host recovery and updated classifier/telemetry expectations, 253 tests passed; not live Entra. +[Reply](https://github.com/microsoft/vscode-documentdb/pull/1149#discussion_r4757586804). ## C08. Retained Collection queries remain editable after notice dismissal -**Discussion:** [Copilot comment](https://github.com/microsoft/vscode-documentdb/pull/1149#discussion_r4752058453). -**Copilot: Medium. Assessment: confirmed, Low.** - -**Approved disposition: won't fix.** The operator considers the existing overlay sufficient to -make the disabled connection clear; choosing to edit local query text after dismissing it is the -user's responsibility. Keep the overlay and all database-operation/lifetime guards. Do not add -query-editor read-only gates or treat the original acceptance criteria below as implementation -requirements. This does not authorize database access or relax Document View's existing guards. - -**Done (2026-12-01), decision commit [`1b98521`](https://github.com/microsoft/vscode-documentdb/commit/1b985210362510facc41862314b712b785161fae):** -operator approved local Collection View query editing after notice dismissal in Decision 0033; -the overlay, database guards and Document View protections are unchanged. No implementation or -new tests. The pushed checkpoint passed `npm run build`. -[Original-thread reply](https://github.com/microsoft/vscode-documentdb/pull/1149#discussion_r4757120247). - -> Passing the retained unavailable state here does not make the Collection View read-only: -> after dismissing the notice, `QueryEditor` still creates its Monaco editors with -> `readOnly: false`, and its Clear Query and skip/limit inputs remain active. Users can therefore -> overwrite the retained query even though the notice promises a copy-only snapshot. Apply -> this state to the query editors and mutating controls while keeping text selection and -> copying available. - -**Evidence.** [Collection View](https://github.com/microsoft/vscode-documentdb/blob/f8da433c084d298bdecfe09a8003408dd7dcd708/src/webviews/documentdb/collectionView/CollectionView.tsx#L818) -keeps terminal details in its lifecycle context after the dismissible notice is cleared. -However, [QueryEditor options](https://github.com/microsoft/vscode-documentdb/blob/f8da433c084d298bdecfe09a8003408dd7dcd708/src/webviews/documentdb/collectionView/components/queryEditor/QueryEditor.tsx#L274) -hard-code `readOnly: false`; [Clear Query](https://github.com/microsoft/vscode-documentdb/blob/f8da433c084d298bdecfe09a8003408dd7dcd708/src/webviews/documentdb/collectionView/components/queryEditor/QueryEditor.tsx#L688) -still resets values, and [Skip/Limit](https://github.com/microsoft/vscode-documentdb/blob/f8da433c084d298bdecfe09a8003408dd7dcd708/src/webviews/documentdb/collectionView/components/queryEditor/QueryEditor.tsx#L817) -have neither read-only nor disabled state. - -**Why Low:** this breaks the promised retained snapshot and can overwrite local query text, -but the operation/lifetime guards still block database submissions. It is not evidence that a -retained view can write to a replacement connection. This finding was verified by source tracing, -not by rendering production Monaco in VS Code. - -**Options.** - -1. **Recommended:** use persistent retained status to make all query editors and value-mutating - controls read-only/disabled, including programmatic Clear/history replacement paths. Keep - selection, copying and presentation-only navigation available. **Pros:** implements the - accepted copy-only behavior without removing the retained contents. **Cons:** controls need - consistent state and focused UI checks after notice dismissal. -2. Change the notice to allow local query editing while continuing to block execution. - **Pros:** smaller implementation and potentially useful scratch editing. - **Cons:** changes the approved permanent-read-only behavior and would require an explicit - operator decision, not just a wording adjustment. - -**Why option 1:** the existing decision is clear; this is missing application of that state, -not ambiguity about whether database operations should resume. - -**Acceptance:** after Disconnect/Keep and X, typing, Clear Query, query replacement and Skip/Limit -cannot change retained values. Text selection/copy and access to already-loaded query fields work. -Recoverable sign-in/network failures leave the editors usable. +[Discussion](https://github.com/microsoft/vscode-documentdb/pull/1149#discussion_r4752058453) · Medium → Low. +After dismissing the [Collection View notice](https://github.com/microsoft/vscode-documentdb/blob/f8da433c084d298bdecfe09a8003408dd7dcd708/src/webviews/documentdb/collectionView/CollectionView.tsx#L818), +[Monaco](https://github.com/microsoft/vscode-documentdb/blob/f8da433c084d298bdecfe09a8003408dd7dcd708/src/webviews/documentdb/collectionView/components/queryEditor/QueryEditor.tsx#L274), +[Clear Query](https://github.com/microsoft/vscode-documentdb/blob/f8da433c084d298bdecfe09a8003408dd7dcd708/src/webviews/documentdb/collectionView/components/queryEditor/QueryEditor.tsx#L688) +and [Skip/Limit](https://github.com/microsoft/vscode-documentdb/blob/f8da433c084d298bdecfe09a8003408dd7dcd708/src/webviews/documentdb/collectionView/components/queryEditor/QueryEditor.tsx#L817) +could change retained local values. Source trace only; no database submission or rendered Monaco test. + +**Won't fix:** the operator considered the overlay sufficient notice that the connection was +disabled; choosing to edit local query text after dismissal was the user's responsibility. +The proposed read-only/mutation gates were **not** required. The overlay, database/lifetime +guards and Document View's read-only/dirty protection were unchanged. No code or new tests. +[Decision checkpoint `1b98521`](https://github.com/microsoft/vscode-documentdb/commit/1b985210362510facc41862314b712b785161fae) +· [reply](https://github.com/microsoft/vscode-documentdb/pull/1149#discussion_r4757120247). ## C09. A recoverable failure can leave an independent Dashboard read loading forever -**Discussion:** [Copilot comment](https://github.com/microsoft/vscode-documentdb/pull/1149#discussion_r4752058526). -**Copilot: Medium. Assessment: confirmed, Medium.** - -**Approved disposition: option 1.** -**Done (2026-12-01), commit [`0b81b831`](https://github.com/microsoft/vscode-documentdb/commit/0b81b83199ef0f7f47ae49cdf3ebf9241b65960a):** -invalidated collections reads settle as interrupted without replacing rows. Manual Refresh can -start a new request; background retry and terminal submissions stay blocked. Operator approved -option 1 in Decision 0033. Advised (`claude-opus-5.5`): the first review found a same-key return -navigation defect, and the first focused run exposed an unstable mocked client. `mai-code-2` -corrected the navigation state and test harness and added five focused cases overall. The advisor -accepted the revision at about 85% confidence. Workbench transition timing remains unverified. -Final Case 1 (`mai-code-2-flash`): `npm run build` and focused `npx vitest run` on -`useDatabaseCollections.test.tsx` and `useBoundViewRecovery.test.tsx` passed (14 tests, two suites). -Pushed to [draft #1154](https://github.com/microsoft/vscode-documentdb/pull/1154). -[Original-thread reply](https://github.com/microsoft/vscode-documentdb/pull/1149#discussion_r4757735541). - -**Integration follow-up [`269d371f`](https://github.com/microsoft/vscode-documentdb/commit/269d371f7bda21aa828ecd5bf3cee9938c02619b):** -the Dashboard regression now depends on the stable ref objects to satisfy React Compiler lint. -Advised (`claude-opus-5.5`), about 85% confidence in the final correction; implemented by -`mai-code-2`. No runtime or assertion changes. Final lint, test type-check, affected tests and -the full runtime suite passed. - -> A recoverable failure still advances the view-wide revision, so it discards unrelated pending -> reads without blocking submissions. If Dashboard storage refresh fails before its collections -> read returns, `useDatabaseCollections` drops that reply but never settles its request key, -> leaving Refresh disabled even after sign-in repair. Settle invalidated loads as interrupted, -> or use request-scoped invalidation so independent reads can finish. - -**Evidence.** [showUnavailable](https://github.com/microsoft/vscode-documentdb/blob/f8da433c084d298bdecfe09a8003408dd7dcd708/src/webviews/documentdb/useBoundViewRecovery.ts#L75) -increments the shared revision even for recoverable failures. -[Storage loading](https://github.com/microsoft/vscode-documentdb/blob/f8da433c084d298bdecfe09a8003408dd7dcd708/src/webviews/documentdb/clusterDashboard/ClusterDashboard.tsx#L218) -calls it on a typed unavailable result. The independent -[collections hook](https://github.com/microsoft/vscode-documentdb/blob/f8da433c084d298bdecfe09a8003408dd7dcd708/src/webviews/documentdb/clusterDashboard/components/useDatabaseCollections.ts#L81) -then ignores its late success/failure. Its abandonment bookkeeping only notices a submission -block, which recoverable failures no longer create. -[isLoading](https://github.com/microsoft/vscode-documentdb/blob/f8da433c084d298bdecfe09a8003408dd7dcd708/src/webviews/documentdb/clusterDashboard/components/useDatabaseCollections.ts#L131) -stays true for the unsettled key, and -[Dashboard Refresh](https://github.com/microsoft/vscode-documentdb/blob/f8da433c084d298bdecfe09a8003408dd7dcd708/src/webviews/documentdb/clusterDashboard/ClusterDashboard.tsx#L831) -is disabled. - -A React probe composed the real recovery and collections hooks, held a collections reply, -reported a recoverable sign-in failure, then resolved the reply and rendered again. It observed -`isLoading=true`, `isInterrupted=false` and no submission block. The operation had finished, but -its UI request remained outstanding. - -**Options.** - -1. **Recommended:** explicitly settle an invalidated current collections request as interrupted, - retaining existing rows and enabling manual Refresh. Do not let an old request settle or - overwrite a newer database/request key. **Pros:** repairs the demonstrated dead end while - preserving existing stale-result guards and the no-replay policy. **Cons:** still discards an - independent read that might otherwise have been useful. -2. Make recoverable failures request-scoped and reserve view-wide invalidation for terminal - transitions. **Pros:** unrelated valid reads can complete normally. - **Cons:** requires auditing pending reads, mutations and loading resets across all hook - consumers; broader than fixing this request's settlement. -3. Automatically reload discarded requests after failure. **Pros:** can clear the spinner. - **Cons:** adds background work/retry policy and may repeatedly fail rather than repairing - request accounting. - -**Why option 1:** no UI request should remain loading after its completion has been deliberately -discarded. This can be fixed without weakening identity fences or automatically replaying work. - -**Acceptance:** with storage and collections reads outstanding, fail storage first and complete -collections afterward. Preserve existing rows or show an interrupted state, stop the spinner and -enable explicit Refresh after repair. Also cover late rejection, database navigation, a newer -request and explicit terminal teardown. +[Discussion](https://github.com/microsoft/vscode-documentdb/pull/1149#discussion_r4752058526) · Medium → Medium. +A recoverable [storage failure](https://github.com/microsoft/vscode-documentdb/blob/f8da433c084d298bdecfe09a8003408dd7dcd708/src/webviews/documentdb/clusterDashboard/ClusterDashboard.tsx#L218) +advanced the [view revision](https://github.com/microsoft/vscode-documentdb/blob/f8da433c084d298bdecfe09a8003408dd7dcd708/src/webviews/documentdb/useBoundViewRecovery.ts#L75). +The [collections hook](https://github.com/microsoft/vscode-documentdb/blob/f8da433c084d298bdecfe09a8003408dd7dcd708/src/webviews/documentdb/clusterDashboard/components/useDatabaseCollections.ts#L81) +dropped its reply but did not settle the request. The React probe found [loading](https://github.com/microsoft/vscode-documentdb/blob/f8da433c084d298bdecfe09a8003408dd7dcd708/src/webviews/documentdb/clusterDashboard/components/useDatabaseCollections.ts#L131) +true with no interruption or submission block; [Refresh](https://github.com/microsoft/vscode-documentdb/blob/f8da433c084d298bdecfe09a8003408dd7dcd708/src/webviews/documentdb/clusterDashboard/ClusterDashboard.tsx#L831) +stayed disabled. + +**Option 1:** settle only the invalidated current read as interrupted; retain existing rows and +enable manual Refresh. Do not settle a newer key, redesign view-wide invalidation or retry in +the background. Review caught a same-key return-navigation defect; the first run also exposed +an unstable mock. [Fix `0b81b831`](https://github.com/microsoft/vscode-documentdb/commit/0b81b83199ef0f7f47ae49cdf3ebf9241b65960a): +five cases added, 14 tests passed. [Reply](https://github.com/microsoft/vscode-documentdb/pull/1149#discussion_r4757735541). +[Integration correction `269d371f`](https://github.com/microsoft/vscode-documentdb/commit/269d371f7bda21aa828ecd5bf3cee9938c02619b) +used stable ref objects in the test for React Compiler lint; no runtime or assertion change. ## C10. Index build polling can repeat recoverable-error notifications -**Discussion:** [Copilot comment](https://github.com/microsoft/vscode-documentdb/pull/1149#discussion_r4752058577). -**Copilot: Medium. Assessment: confirmed, Low.** - -**Approved disposition: option 2.** Stop index-build polling after a recoverable failure. -Connectivity returning or successful sign-in must not resume it automatically; the user must -explicitly refresh the table. Do not implement option 1's foreground/background callback expansion. - -**Approved acceptance:** after the first recoverable poll failure, no new automatic poll or -repeated notification occurs, including after repair. Explicit manual Refresh is the only resume -action for that paused table; a failed refresh leaves it paused, and a successful one may resume -normal build polling while a row is still building. Terminal teardown still prevents submissions. -This replaces the original option 1 acceptance criteria below. -**Done (2026-12-01), commit [`700c6d1f`](https://github.com/microsoft/vscode-documentdb/commit/700c6d1f91960a4a4f17f3e19ad7d5c287192256):** -the first recoverable poll failure pauses periodic index loads, even through repair and -switching tabs within the same Collection View. Only a successful manual Refresh resumes polling; -failed Refresh and terminal blocking are unchanged. The operator approved option 2 in Decision 0033. Advised (`claude-opus-5.5`): the first review surfaced a pause lost on remount. The advisor -accepted the per-view correction with high confidence. Implementation: `mai-code-2`, as -recommended; five fake-timer regressions include the remount case. Final Case 1 -(`mai-code-2-flash`): `npm run build` and focused `npx vitest run` on `IndexesTab.test.tsx` -passed (five tests). Pushed to [draft #1154](https://github.com/microsoft/vscode-documentdb/pull/1154). -Workbench timing remains unverified. [Original-thread reply](https://github.com/microsoft/vscode-documentdb/pull/1149#discussion_r4757984995). - -> The Indexes tab's five-second build poll also sends recoverable failures through this -> notification path. Because these failures no longer block submissions, a retained building -> row keeps the poll running and produces another notification every five seconds until repair. -> Carry a foreground/background option through the lifecycle callback so background failures -> stay quiet or inline while explicit operations still show actionable errors. - -**Evidence.** [Index refresh](https://github.com/microsoft/vscode-documentdb/blob/f8da433c084d298bdecfe09a8003408dd7dcd708/src/webviews/documentdb/collectionView/indexesTab/IndexesTab.tsx#L289) -already limits ordinary rejected-request notifications to initial/manual loads. Its typed -unavailable branch instead always calls `showUnavailable`, which -[always notifies for recoverable reasons](https://github.com/microsoft/vscode-documentdb/blob/f8da433c084d298bdecfe09a8003408dd7dcd708/src/webviews/documentdb/useBoundViewRecovery.ts#L73). -The [build timer](https://github.com/microsoft/vscode-documentdb/blob/f8da433c084d298bdecfe09a8003408dd7dcd708/src/webviews/documentdb/collectionView/indexesTab/IndexesTab.tsx#L451) -re-arms while retained rows are building/creating and submissions remain permitted. - -The actual hook produced three notifications for three successive recoverable callbacks, without -a terminal block. The polling route was source-traced, not exercised as a rendered five-second -timer. More precisely, the repetition is once per failed poll cycle: the five-second timer plus -request duration, not necessarily every five seconds of wall-clock time. - -**Why Low:** this is disruptive notification noise and violates the background-presentation -policy, but does not itself execute a write, accept another identity or block explicit repair. - -**Options.** - -1. **Recommended:** carry foreground/background intent into unavailable presentation. Use the - existing initial/manual distinction for index reads; keep background recoverable failures - inline or otherwise quiet. Still apply terminal lifetime invalidation from any source. - **Pros:** preserves actionable explicit-operation errors and quiet polling. - **Cons:** requires propagating intent through the lifecycle callback/context and its callers. -2. Stop build polling after its first recoverable failure and require manual refresh to resume. - **Pros:** prevents repetition and reduces failed requests. - **Cons:** changes automatic build-status recovery and introduces an extra resume policy. -3. Suppress every repeated error globally. **Pros:** fewer notifications. - **Cons:** can hide a later explicit user operation's failure and does not model intent. - -**Why option 1:** the same failure needs different presentation depending on who initiated the -read. The existing rejected-request branch already follows that principle. - -**Acceptance:** retain a building row and return typed recoverable failures over several poll -cycles: no repeated toast. A manual refresh still explains the failure. Explicit Disconnect stops -new polling/submissions, and a background terminal event still freezes the old view. +[Discussion](https://github.com/microsoft/vscode-documentdb/pull/1149#discussion_r4752058577) · Medium → Low. +The [poll](https://github.com/microsoft/vscode-documentdb/blob/f8da433c084d298bdecfe09a8003408dd7dcd708/src/webviews/documentdb/collectionView/indexesTab/IndexesTab.tsx#L451) +re-armed while a row was building. Typed [index refresh failures](https://github.com/microsoft/vscode-documentdb/blob/f8da433c084d298bdecfe09a8003408dd7dcd708/src/webviews/documentdb/collectionView/indexesTab/IndexesTab.tsx#L289) +always reached the [recoverable notification path](https://github.com/microsoft/vscode-documentdb/blob/f8da433c084d298bdecfe09a8003408dd7dcd708/src/webviews/documentdb/useBoundViewRecovery.ts#L73). +Three hook callbacks gave three notifications. Source tracing established one per failed cycle +(five-second delay **plus request time**), not a rendered timer measurement. + +**Option 2, not recommended option 1:** stop polling on the first recoverable failure rather +than extending callbacks to distinguish foreground/background errors. Repair, sign-in or switching +tabs must not restart that table. Only a **successful explicit Refresh** may resume polling if a +row is still building. Failed Refresh leaves it paused; terminal teardown still blocks submission. +Review found the pause initially lost on remount. [Fix `700c6d1f`](https://github.com/microsoft/vscode-documentdb/commit/700c6d1f91960a4a4f17f3e19ad7d5c287192256): +five fake-timer regressions passed, including remount. [Reply](https://github.com/microsoft/vscode-documentdb/pull/1149#discussion_r4757984995). ## C11. Recovery notifications display an internal reason and omit the title -**Discussion:** [Copilot comment](https://github.com/microsoft/vscode-documentdb/pull/1149#discussion_r4752058652). -**Copilot: Medium. Assessment: confirmed, Low.** - -**Approved disposition: option 1.** -**Done (2026-12-01), commit [`dc4a95b7`](https://github.com/microsoft/vscode-documentdb/commit/dc4a95b7d2b0c07521354dde51d6572a9f14bb61):** -recoverable notices pass the existing localized title and detail to the non-modal host contract -instead of the internal reason. Terminal and close behavior are unchanged. The operator approved -option 1 in Decision 0033. Advised (`claude-opus-5.5`), accepted with high confidence based on -the host formatting contract and all five recoverable reasons. Implementation: `mai-code-2`, as -recommended. Expanded the hook regression and added a host-formatting test; updated the exact -Document View and browser scenario payloads without changing call counts or modality. -Case 1 (`mai-code-2-flash`): `npm run build`, five focused webview and host suites (35 tests), and -the separately configured static browser-scenario suite (47 tests) passed. This did not render -the journey or the workbench toast. No localization source strings changed. Pushed to -[draft #1154](https://github.com/microsoft/vscode-documentdb/pull/1154). -[Original-thread reply](https://github.com/microsoft/vscode-documentdb/pull/1149#discussion_r4758052211). - -> `common.displayErrorMessage` appends a non-modal `cause` to the message, so this produces text -> such as "Sign in from the connection tree. (signInRequired)". It also drops the localized title -> that explains what failed. Use the localized title and detail instead of the internal reason -> code, and update the exact-payload assertions. - -**Evidence.** The [recovery hook](https://github.com/microsoft/vscode-documentdb/blob/f8da433c084d298bdecfe09a8003408dd7dcd708/src/webviews/documentdb/useBoundViewRecovery.ts#L87) -sends `message: failure.detail` and `cause: failure.reason`. -The [host procedure](https://github.com/microsoft/vscode-documentdb/blob/f8da433c084d298bdecfe09a8003408dd7dcd708/src/webviews/_integration/appRouter.ts#L249) -appends a non-empty non-modal cause in parentheses. The real-hook probe observed that exact -payload for `signInRequired`; the localized `title` was absent. The existing hook test explicitly -asserts this payload, so test success does not establish correct user-facing wording. - -**Why Low:** a bounded internal category is shown, not a credential or private raw error. -The remediation detail is still present, but its context/localization is unnecessarily degraded. - -**Options.** - -1. **Recommended:** send the existing localized title as `message` and localized detail as - `cause`, following the current non-modal display contract. **Pros:** includes both explanation - and action without a transport change or new reason-code prose. **Cons:** uses the existing - parenthesized detail presentation rather than redesigning notification layout. -2. Format title and detail into a single localized message and send an empty cause. - **Pros:** more control over readable sentence structure. - **Cons:** adds a formatting string and changes the payload convention for this caller. -3. Change the shared host procedure to ignore non-modal causes. - **Pros:** hides this enum. **Cons:** removes useful details for unrelated callers and still - does not restore this title. - -**Why option 1:** repair the incorrect caller payload, not a shared renderer that is doing what -its other callers expect. - -**Acceptance:** exact-payload and rendered-message checks contain localized title/detail and no -raw reason token for each recoverable category. Preserve error-display failure reporting. -Update localization only if the chosen implementation adds or changes localization source strings. +[Discussion](https://github.com/microsoft/vscode-documentdb/pull/1149#discussion_r4752058652) · Medium → Low. +The [hook](https://github.com/microsoft/vscode-documentdb/blob/f8da433c084d298bdecfe09a8003408dd7dcd708/src/webviews/documentdb/useBoundViewRecovery.ts#L87) +sent `failure.detail` and `failure.reason`; the [host](https://github.com/microsoft/vscode-documentdb/blob/f8da433c084d298bdecfe09a8003408dd7dcd708/src/webviews/_integration/appRouter.ts#L249) +appended the raw category (e.g. `signInRequired`) in parentheses, omitting the localized title. +The prior exact-payload test asserted that behavior; the token was an enum, not a credential. + +**Option 1:** send the localized title as `message` and detail as `cause` through the existing +non-modal contract. No shared formatter or localization-source change; terminal/close behavior +stayed intact. [Fix `dc4a95b7`](https://github.com/microsoft/vscode-documentdb/commit/dc4a95b7d2b0c07521354dde51d6572a9f14bb61): +all five recoverable reasons covered, 35 focused and 47 static scenario tests passed. Neither a +rendered journey nor a workbench toast was tested. [Reply](https://github.com/microsoft/vscode-documentdb/pull/1149#discussion_r4758052211). ## C12. Persistent retained state would clarify rendering, but no rendering defect was demonstrated -**Discussion:** [Copilot comment](https://github.com/microsoft/vscode-documentdb/pull/1149#discussion_r4752058722). -**Copilot: Low, explicitly optional. Assessment: optional, not a merge-blocking bug.** - -**Approved disposition: option 1; no standalone refactor.** Keep the current behavior and -terminal/dismissal coverage. Option 2 is not an extra work item authorized by this round. -**Done (2026-12-01), decision commit [`1b98521`](https://github.com/microsoft/vscode-documentdb/commit/1b985210362510facc41862314b712b785161fae):** -operator approved option 1 in Decision 0033; no rendering defect warranted a standalone refactor. -No implementation or new tests. The pushed checkpoint passed `npm run build`. -[Original-thread reply](https://github.com/microsoft/vscode-documentdb/pull/1149#discussion_r4757120153). - -> Optional: Save/Refresh disabled state and Monaco `readOnly` now read a mutable ref during render, -> so their updates depend on the separate dismissible state also triggering a render. Expose a -> persistent `retained` state from `useBoundViewRecovery` for rendering, while keeping the ref for -> synchronous operation guards. - -**Evidence.** [Document View](https://github.com/microsoft/vscode-documentdb/blob/f8da433c084d298bdecfe09a8003408dd7dcd708/src/webviews/documentdb/documentView/documentView.tsx#L448) -does read the ref for disabled/read-only props. However, the -[current terminal transition](https://github.com/microsoft/vscode-documentdb/blob/f8da433c084d298bdecfe09a8003408dd7dcd708/src/webviews/documentdb/useBoundViewRecovery.ts#L75) -sets both the ref and `unavailable` state. Dismissing the notice changes that state again while -leaving the ref set. Both transitions schedule the render needed by these props. - -A React probe using the same render-time ref pattern observed editable controls initially, -read-only/disabled controls after the terminal event, and continued read-only/disabled controls -after dismissal. This was not a production-Monaco/workbench test, but it does not support a claim -that these current transitions fail to render. - -**Options.** - -1. **Recommended disposition:** do not make a standalone refactor a requirement for this review. - Keep the existing behavior and its terminal/dismissal coverage. **Pros:** avoids expanding a - bug-fix round without demonstrated impact. **Cons:** the render dependency remains implicit. -2. If the hook is already changing for accepted findings, expose persistent retained state for - rendering and keep the ref only for synchronous guards. **Pros:** expresses the distinction - between retained state and visible notice, and can simplify C08's control wiring. - **Cons:** adds state synchronization obligations and caller changes; must not accidentally - make dismissing the notice restore access. - -**Why option 1:** the observation is a valid maintainability suggestion, not evidence of broken -current behavior. Option 2 is reasonable as a small coordinated implementation choice, not a new -required lifecycle redesign. - -**Acceptance if option 2 is chosen:** terminal event, notice dismissal, repeated notice and -subsequent unrelated renders all preserve disabled/read-only controls and immediate submission -guards. Recoverable errors must not set retained state. +[Discussion](https://github.com/microsoft/vscode-documentdb/pull/1149#discussion_r4752058722) · Low (optional) → optional. +[Document View](https://github.com/microsoft/vscode-documentdb/blob/f8da433c084d298bdecfe09a8003408dd7dcd708/src/webviews/documentdb/documentView/documentView.tsx#L448) +read a ref during render. The [terminal transition](https://github.com/microsoft/vscode-documentdb/blob/f8da433c084d298bdecfe09a8003408dd7dcd708/src/webviews/documentdb/useBoundViewRecovery.ts#L75) +also set notice state; dismissal changed state again without clearing the ref. A React probe +observed editable → disabled/read-only → still disabled/read-only. It did not render production Monaco. + +**Option 1, no standalone refactor:** keep terminal/dismissal coverage and the implicit render +dependency. Separate persistent render state plus synchronous guard ref (option 2) might clarify +the code, but no failing behavior warranted the extra synchronization. No code or new tests. +[Decision checkpoint `1b98521`](https://github.com/microsoft/vscode-documentdb/commit/1b985210362510facc41862314b712b785161fae) +· [reply](https://github.com/microsoft/vscode-documentdb/pull/1149#discussion_r4757120153). ## Approved execution handoff ### Branch and pull request -- Prepared local work branch: `dev/tnaum/connection-lifecycle-pr1149-review-fixes`, starting at - reviewed head `f8da433c084d298bdecfe09a8003408dd7dcd708`. -- **The operator explicitly selected `feature/connection-lifecycle` as the new PR's base.** - Create a separate draft PR; do not push fixes onto the original simplification branch or the - feature branch. At approval time #1149 is still unmerged, so this base choice includes its - simplification changes as well as this follow-up. Do not merge or retarget existing PRs. -- The approval/review documents are uncommitted on the prepared branch. The recovered feature - README link was already staged; preserve it. Commit the decision record as an initial - checkpoint so accepted no-code replies can cite a real pushed commit. -- The earlier stash recovery is complete. Keep stash `ce93e767475777c94dd20c5d49c44cd9413a32c0` - as a backup; do not apply it again. Leave unrelated untracked connection-relay/telemetry - directories out of commits. +The operator chose a **separate draft**, `dev/tnaum/connection-lifecycle-pr1149-review-fixes` → +`feature/connection-lifecycle`, starting at the reviewed #1149 head. Because #1149 was unmerged, +that base included the simplification in #1154. No merge, retarget or push onto either original +branch was authorized. ### Authority and model routing -- **Technical advisor:** `claude-opus-5.5` for implementation judgment, acceptance and difficult - decisions within the approved scope. -- **Implementation:** `mai-code-2` for every task that would normally use Terra and for simpler - Sol-class tasks. Keep genuinely complex Sol-class work on the lead skill's normal Sol routing. -- **CLI/tool execution:** `mai-code-2-flash` for command execution, builds/tests, Git/GitHub - operations and collection of verification evidence. -- The lead orchestrator **trusts the advisor's decisions**. It must not repeat the advisor's - code review, reopen settled options or independently re-verify the same technical judgment. - Mandatory build/test execution still applies. A concrete failing check or new external fact - goes back to the advisor for disposition, rather than prompting a second leader-led review. - Changes to the operator-approved behavior require the operator, not an advisor override. +`claude-opus-5.5` owned technical judgment and acceptance within scope; the lead reused it rather +than repeating reviews. New failures went back to the advisor; only the operator could change an +approved behavior. `gpt-6.1-sol` handled C04's cross-module publication race; `mai-code-2` handled +the other eight fixes (Terra-class and simpler Sol work); `mai-code-2-flash` ran commands and checks. ### Items, commits and replies -1. Implement C04, C02 and C03's distinct handoff protections, then C05/C07/C09 recovery fixes - and C06/C10/C11's selected presentation/polling behavior. The advisor may adjust execution - order for real dependencies without changing the approved options. -2. Keep **each of the nine code fixes in its own commit**, including its directly related - regression coverage and documentation. Push each item before reporting it addressed. -3. After the item is accepted and pushed, reply in its original Copilot discussion linked above: - summarize **what changed, why this approved solution was chosen, and the full commit URL**. - Report verification accurately; do not imply that deferred full checks already passed. -4. Reply to C01, C08 and C12 with the approved no-code disposition and rationale, citing the - pushed decision-record commit. Do not fabricate a fix or add code merely to create a commit. -5. Update the item's inline progress immediately with advisor acceptance, commit/push, commands - and results, and reply URL. Keep the lead skill's per-return progress checkpoints. Preserve - all author decisions and the original review evidence. +The decision checkpoint was pushed after a passing build. Each accepted fix had its own commit, +regression coverage, advisor acceptance, push and original-thread reply explaining the choice +with its commit URL. The three no-code replies cited the decision checkpoint instead. The Flash +runner counted one reply from this round in each of the 12 original threads; a reply is not a resolution. ### Verification and final iteration -- Keep the required **Case 1** fast loop for implementation commits/pushes: - `npm run build` and the smallest combined `npx vitest run ` selection covering that - item. Use the Flash runner and reuse its reported evidence; no duplicate leader reruns. -- Defer the expensive **Case 2** suite, global formatting/localization generation and full - runtime suite until all item dispositions are complete. Do not run these between fixes. -- Finish with a distinct integration iteration covering Case 1 and the complete Case 2 list. - Run the integrated focused tests, then the full list below; its build also supplies the final - Case 1 build result, so do not run an identical second build without intervening changes: - - ```bash - npm run l10n # only if localization source strings were added, changed or removed - npm run prettier-fix - npm run l10n:check - npm run lint - npm run build - npm run typecheck:tests - npx vitest run - npm run package - ``` - -- Fix in-scope failures in follow-up commits, push again, and rerun checks affected by the - correction. Every required check must cover the final integrated candidate; separately report - `npm run typecheck:tests`. Do not weaken assertions or silently change `TDD:` contracts. -- Complete the required advisor-led AI pre-review and commit its review record under this - feature's iterations directory. The lead consumes the advisor's verdict without redoing it. -- Keep evidence of mocked, rendered, packaged and live checks separate. Do not claim real - authentication, expiry or sleep/wake passed because unit tests did. Report remaining gates - honestly and do not mark the PR ready while required checks or other handoff gates are blocked. +Case 1 was `npm run build` plus focused Vitest for each fix (results above). Formatting, +localization checks, full tests and packaging were reserved for the integrated candidate. Its +build also counted for final Case 1. The separate advisor sweep, final checks and remaining live +gates follow; a passing package was not authorization to mark the PR ready. ## Advisor-led integrated AI pre-review for draft #1154 -- **Reviewed:** `f8da433c084d298bdecfe09a8003408dd7dcd708..e8479641793bbcc0c5d4910c75c0d335e17c86f0` - (runtime changes). Earlier item sections preserve the initial findings, original Copilot threads, - author decisions, advisor acceptance and exact published fixes. -- **Independent sweep:** `claude-opus-5.5` checked lifetime retirement and publication across - Dashboard, Shell, Playground and Generate Query; and Entra recovery, concurrent request state, - index polling and notifications across webviews. High confidence from source inspection: - no Critical, High or Medium findings. One valid Low finding is recorded below. The advisor - did not rerun checks or reopen the approved C01, C08 or C12 dispositions. -- **Cross-item checks:** retirement is checked after bound startup and before panel publication. - Dashboard interruption and Collection View polling state are scoped to their respective views. - Same-account sign-in recovery does not itself re-arm index polling or replay a failed operation. +`claude-opus-5.5` independently swept `f8da433c084d298bdecfe09a8003408dd7dcd708..e8479641793bbcc0c5d4910c75c0d335e17c86f0` +for runtime interactions. It checked retirement after bound startup and before publication, +Shell/Playground origins, query generation, Entra recovery, concurrent Dashboard reads and +per-view polling/notification state. Same-account sign-in neither re-armed polling nor replayed +work. **No Critical, High or Medium; one valid Low (N01)**, high confidence from source. The +advisor did not rerun checks or reopen C01/C08/C12. ### N01. Creating an index while polling is paused -**Low, valid; advisor confidence high.** A typed unavailable result can pause index polling, -including on initial load. A later successful Create shows a **Creating** row and relies on the -poll to update it. After repair, that row can stay at **Creating** until the user selects -**Refresh**; the index request itself is not blocked by the pause. The relevant paths are -[`IndexesTab.tsx`](../../../../../src/webviews/documentdb/collectionView/indexesTab/IndexesTab.tsx) -and the per-view pause state in -[`CollectionView.tsx`](../../../../../src/webviews/documentdb/collectionView/CollectionView.tsx). - -**Options considered:** (1) keep manual Refresh and document the workaround; (2) resume polling -after a successful Create (the advisor's recommendation, which changes Decision 0033); (3) keep -manual Refresh and add a localized pause hint. **Author decision (2026-12-01):** option 1, with -no code change. Recorded in [Decision 0034](../decisions.md#0034-keep-manual-refresh-as-the-only-way-to-resume-paused-index-polling-after-create). - -**Still manual/live:** Dashboard navigation and interruption timing; Shell closure during a pending -handoff; Playground removal and file preservation; Generate Query with a genuinely evicted client -and live Copilot; wrong-account Entra rejection and explicit original-account recovery; index poll -pause/resume and Create with polling paused; localized notification in the workbench; token expiry -and sleep/wake. Mocked cases and static scenario tests do not certify these. +A typed unavailable result, even on initial load, can pause polling in +[IndexesTab](../../../../../src/webviews/documentdb/collectionView/indexesTab/IndexesTab.tsx); +[CollectionView](../../../../../src/webviews/documentdb/collectionView/CollectionView.tsx) retains +the pause. Create may succeed after repair while its row stays **Creating**. **Operator decision +(2026-12-01), option 1:** keep manual Refresh and document the workaround. Select **Refresh** for +current status; a successful refresh may resume polling if a build is active. The operator did +**not** select automatic resume after successful Create (the advisor's recommendation) or a localized +pause hint. [Decision 0034](../decisions.md#0034-keep-manual-refresh-as-the-only-way-to-resume-paused-index-polling-after-create) +made no runtime change or exception to C10. ## Final integration evidence -The Flash runner confirmed all twelve original Copilot discussions have one reply from this round. -Case 1 and Case 2 ran on the integrated candidate. The formatting-only commit was `754098c83`. -Initial Case 2 lint failed on the Dashboard collections test harness; after the test-only -correction, the affected checks passed on `269d371f`. The later changes were the test and review, -decision, and manual documentation; production build, package, and localization inputs did not -change. No new or changed localization source strings required generation. - -| Check | Result | -| ----------------------------- | ------------------------------------------------------------------------------------------------------------------------------------- | -| `npm run prettier-fix` | Passed in a detached worktree; round-only formatting applied. Targeted Prettier also passed after the test and author-record updates. | -| `npm run l10n:check` | Passed (3,732 keys); `npm run l10n` not needed. | -| `npm run lint` | Passed after the test-only correction; focused ESLint had zero errors and 20 existing warnings. | -| `npm run build` | Passed; this also supplies the integrated Case 1 build. | -| `npm run typecheck:tests` | Passed on the corrected candidate. | -| Integrated focused Vitest | 939 passed across 26 suites; after correction, 18 passed across the two affected suites. | -| Static browser scenario tests | 47 passed; did not run the rendered journeys. | -| Full `npx vitest run` | 10,541 passed, 1 skipped across 461 files on the corrected candidate. | -| `npm run package` | Passed; generated `vscode-documentdb-1.1.1-alpha.4.vsix` (9,270,193 bytes). The VSIX was not installed or exercised in the workbench. | +- **Formatting/localization:** `npm run prettier-fix` ran in a detached worktree; round-only + formatting landed in [`754098c83`](https://github.com/microsoft/vscode-documentdb/commit/754098c83ffdb0f6e2b33f10df5a4adb1554e1f4). + Targeted Prettier passed after the later edits. `npm run l10n:check` passed (3,732 keys); + unchanged source strings did not require generation. +- **Static/build:** initial lint failed on the Dashboard test harness (C09); full `npm run lint` + and `npm run typecheck:tests` passed on the corrected candidate. Focused ESLint: zero errors, + 20 existing warnings. `npm run build` passed; later test and documentation edits did not change + production build, package or localization inputs. +- **Runtime:** integrated focused run **939 passed / 26 suites**; after correction, **18 passed / + two affected suites**. Static browser scenarios: 47 passed, not rendered journeys. Full + `npx vitest run` on the corrected candidate: **10,541 passed, 1 skipped / 461 files**. +- **Package:** `npm run package` produced `vscode-documentdb-1.1.1-alpha.4.vsix` (9,270,193 bytes). + It was not installed or exercised in the workbench. ## Approval-update outcome -The original branch/stash recovery was verified against its saved blob, and the separate follow-up -branch was prepared. All twelve dispositions, their execution contract and the changed feature -intent are recorded. No production fixes, commits, pushes, new PR, replies or thread resolutions -were performed in this approval-recording step. The verification below belongs to the original -evaluation, not to an implementation of the now-approved fixes. +The earlier approval-only step verified branch/stash recovery against the saved blob, preserved +the staged README link and retained stash `ce93e767475777c94dd20c5d49c44cd9413a32c0` as backup. +The unrelated untracked relay/telemetry directories were excluded. That step prepared the branch; +it did not implement, publish, reply or resolve. Those implementation and reply results above +belong to the subsequent draft #1154 run. ## Verification and limits -- Read all 12 Copilot comments, their severity labels and the active design decisions. Traced the - affected production paths at the pinned head, including both Dashboard navigation paths and - all three Playground connection-status consumers. -- Ran offline probes by transpiling the current TypeScript modules and composing the real - lifecycle helpers and React hooks. Driver startup/close, VS Code APIs, panel creation, storage - and RPC responses were mocked with synthetic data. Unexpected dependency use failed the - probe rather than silently invoking infrastructure. -- The probes corroborated C01-C07 and C09 at their relevant host/hook boundaries. C10/C11 were - corroborated by the actual repeated-notification/payload behavior plus the polling/host-renderer - source paths. C08 was source-verified. C12's suspected missed-render behavior was not reproduced. -- **12 existing focused Vitest files passed: 382 tests, zero failures.** The command was: - - ```bash - npx vitest run --maxWorkers=2 \ - src/documentdb/connectionTeardown.test.ts \ - src/commands/saveConnectionEdit.test.ts \ - src/commands/playground/newPlayground.test.ts \ - src/documentdb/shell/DocumentDBShellPty.test.ts \ - src/commands/openCollectionView/openCollectionView.test.ts \ - src/webviews/documentdb/clusterDashboard/clusterDashboardController.test.ts \ - src/webviews/documentdb/clusterDashboard/clusterDashboardRouter.test.ts \ - src/commands/llmEnhancedCommands/queryGenerationCommands.test.ts \ - src/documentdb/playground/PlaygroundService.test.ts \ - src/documentdb/connectionFailures.test.ts \ - src/webviews/documentdb/useBoundViewRecovery.test.tsx \ - src/webviews/documentdb/documentView/documentView.test.tsx - ``` - -- These passing tests preserve evidence of existing covered behavior; they do not disprove the - separately demonstrated gaps. No behavior-contract tests or production files were changed. -- No live database, real authentication provider, Copilot model request, rendered production - Monaco, installed-workbench race, expiry or sleep/wake test was performed. No actual disclosure - or database write was observed. The PR's existing live/rendered gates remain outstanding. -- **Case 1, review/documentation only.** No production code changed, so the build was not rerun. - Full Case 2 checks, including `prettier-fix`, were not rerun in this triage and are deferred to - ready-for-review verification of any follow-up fixes. Earlier PR validation is not represented - as a new pass from this evaluation. -- No GitHub reply, resolution, commit, push or PR-state change was made. +**Initial #1149 triage, before fixes:** 382 existing tests passed in 12 files, zero failures. +Offline probes composed the real lifecycle helpers/hooks with synthetic storage, client/driver, +VS Code, panel and RPC boundaries. C01–C07 and C09 were corroborated at those boundaries; C10/C11 +combined hook behavior with polling/host source tracing. C08 was source-only; C12 did not reproduce +a missed render. Passing tests did not disprove the gaps. No actual disclosure or database write, +production/test contract change, build, Case 2, GitHub reply or PR-state change in triage. + +**Still manual/live at handoff:** Dashboard navigation and interruption timing; Shell closure during +a pending handoff; Playground removal and file preservation; Generate Query with a genuinely evicted +client and live Copilot; wrong-account Entra rejection and explicit original-account repair; index +poll pause/Refresh and Create while paused; localized notification in the workbench; production +Monaco, real authentication, token expiry and sleep/wake. Mocked, static and packaged checks did +not close those gates. diff --git a/docs/ai-and-plans/features/connection-lifecycle/iterations/04-pr1136-scope-and-test-review.md b/docs/ai-and-plans/features/connection-lifecycle/iterations/04-pr1136-scope-and-test-review.md index 56d55a10d..2cedd567e 100644 --- a/docs/ai-and-plans/features/connection-lifecycle/iterations/04-pr1136-scope-and-test-review.md +++ b/docs/ai-and-plans/features/connection-lifecycle/iterations/04-pr1136-scope-and-test-review.md @@ -8,7 +8,7 @@ created: 2026-12-02 # PR #1136: what to cut from connection recovery -**After operator review: simplify what happens to obsolete work; keep the useful features.** Accepted: one explanation for a stale user action (#2), one terminal “session ended” outcome for an old binding (#3), and trimming duplicate tests. Keep Azure Discovery/ARM **in this PR**, Close/Keep/Cancel for webviews, and Show Connection Stats for debugging. Do not cut ordinary Shell or Playground recovery. [Decision 0036](../decisions.md#0036-simplify-obsolete-actions-and-ended-bindings-without-cutting-useful-features) records the disposition; these changes have not been implemented by this review. +**After operator review: simplify what happens to obsolete work; keep the useful features.** Accepted: one explanation for a stale user action (#2), one terminal “session ended” outcome for an old binding (#3), and trimming duplicate tests. Keep Azure Discovery/ARM **in this PR**, Close/Keep/Cancel for webviews, and Show Connection Stats for debugging. Do not cut ordinary Shell or Playground recovery. [Decision 0036](../decisions.md#0036-simplify-obsolete-actions-and-ended-bindings-without-cutting-useful-features) records the disposition. The changes landed in #1169; see the [post-merge assessment](#post-merge-assessment). **One open question: the isolated Shell.** The operator sees value in launching it from Connection Diagnostics, but considers it substantial work for an edge case. Extraction and placement are under evaluation, **not approved for removal or implementation**. Keep the current action and its isolation tests pending that decision. [Options and recommendation below](#isolated-shell-extract-the-feature-or-move-the-button). @@ -148,4 +148,20 @@ The operator chose local-only Case 1 delivery on a branch based on `feature/conn The operator subsequently authorized publishing [draft #1169](https://github.com/microsoft/vscode-documentdb/pull/1169) against `feature/connection-lifecycle` before running Case 2. All eight checks passed: `npm run l10n`, `npm run prettier-fix`, `npm run l10n:check`, `npm run lint`, `npm run build`, `npm run typecheck:tests`, `npx vitest run` (**11,011 passed, 1 skipped; 473 files**) and `npm run package` (8.65 MB VSIX). Commit `868cfe934` regenerates the localization bundle, applies formatting and replaces two lint-rejected mock type annotations with Vitest's typed mock syntax. Repository-wide lint passed on retry; no production behavior changed. -The PR remains in draft. Local checks do not replace the live workbench checks above or the formal AI pre-review and author decisions for #1169 required before requesting human review. +At the time of this verification the PR was in draft. Local checks do not replace the live workbench checks above. + +### Post-merge assessment + +[#1169](https://github.com/microsoft/vscode-documentdb/pull/1169) merged into #1136 as `01590e061`. Compared with its parent `7a1a7f5d2`, all three approved work items landed. **The code now does less; the overall PR did not get smaller.** `git diff --numstat` between those commits gives: + +| Category | Added | Removed | Net | +| ---------------------------- | ------: | ------: | -------: | +| Runtime (`src/`, non-test) | 75 | 142 | −67 | +| Named tests (`*.test.*`) | 692 | 685 | +7 | +| Documentation | 184 | 4 | +180 | +| Browser scenarios and locale | 7 | 8 | −1 | +| **Total (43 files)** | **958** | **839** | **+119** | + +- **Test trimming was real but local.** WI-1 alone removed 114 net test lines; its five focused suites went from 166 to 143 cases, including 12 superseded-dismissal combinations reduced to two. WI-2 and WI-3 added 90 and 38 net test lines respectively; final formatting/lint fixes removed seven. The tests now distinguish a stale key read, a late sign-in, a pending write and failed removal rather than crossing every reason with every caller. Some modal and “no side effect” assertions still repeat in the [sign-in suite](../../../../../src/commands/signInAgain/signInAgain.test.ts#L285). That's a small test-only opportunity, not an unimplemented feature. +- **The main benefit is structural.** The four named tree actions use [one feedback policy](../../../../../src/commands/retryAuthentication/retryAuthentication.ts#L71); deliberate quiet refreshes remain quiet. [Retirement](../../../../../src/documentdb/connectionBindingRetirement.ts#L16) stores one cutoff per cluster instead of a growing history of reasons. [Failed Remove](../../../../../src/documentdb/connectionTeardown.ts#L322) still verifies ownership before restoring the current disconnected state without rewriting history or notifying stale panels twice. Keeping Azure Discovery, Show Connection Stats, retained views, ordinary workers and the isolated Shell was intentional. The 876 diagnostic-Shell test lines were never an approved saving. +- **What is still missing is runtime evidence, not another abstraction.** On the merged head the build and 307 focused cases in 10 suites passed independently, as did 80 browser scenario-definition tests. The latter do not drive a browser. The prior Case 2 results are recorded above, not rerun here. Before release, exercise same-account expiry/idle wake in a real tab, dirty **Keep open → dismiss/copy → reconnect** with the old tab still unable to save, and a tree Retry/sign-in superseded in flight. No blocking implementation omission was found in the accepted scope. Stop cutting unless one of those checks exposes a problem.