Skip to content

Keep Local Quick Start recreate on the image its data already uses - #1083

Merged
Tomasz Naumowicz (tnaum-ms) merged 16 commits into
mainfrom
dev/guanzhousong/quickstart-recreate-keeps-image
Nov 16, 2026
Merged

Tomasz Naumowicz (tnaum-ms) merged 16 commits into
mainfrom
dev/guanzhousong/quickstart-recreate-keeps-image

Conversation

@guanzhousongmicrosoft

@guanzhousongmicrosoft Guanzhou Song (guanzhousongmicrosoft) commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

Recreate container reuses the image reference stored for the instance, normally the floating documentdb-local:latest, and pulls it again. latest is now DocumentDB 1.2, which updates the extensions on an existing data volume at startup, and going back to 1.0 on that data isn't supported. So a user who removes the container to apply a new telemetry level, as the user manual says to, gets their data upgraded for good while setup says the image was kept. Start, Stop and Restart are not affected.

Pinning the default tag would only help new instances, since every existing record already stores :latest. So the record now keeps the image's repo digest, read from the container at setup, on every reconcile, and before a recreate removes the old container. A recreate runs that digest, pulling it only if the image was pruned, with the instance's recorded engine.

An older record that only has a tag runs the local image without pulling. If that image is gone too and the volume still exists, setup stops and explains that pulling may upgrade the data; the user can pull it and retry. Configure, the Preparing image stage and the ready page say which image was reused or downloaded, and don't promise the exact original image for a tag-only record. An in-place upgrade path is left for later.

Also corrects two comments: DocumentDB Local supports serverStatus from 1.2.

Tested with unit and browser-scenario tests; nothing was run against real containers.

A recreate pulled the stored tag again, normally :latest. Now that
:latest is DocumentDB 1.2, that image updates the extensions on the
existing volume at startup and the older image can't run it afterwards,
so Recreate container upgraded the data for good while setup said the
image was kept.

Store the image's repo digest when the container is created or adopted,
and recreate from it, pulling only when it is not local. A record that
only has a tag runs the local image; if that is gone too, setup stops
rather than pull a possibly newer one.

Signed-off-by: Guanzhou Song <[email protected]>
@github-actions

github-actions Bot commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

✅ CI passed: standard tier (ready PR)

Commit b9b9394, workflow run.

Layer Result Ran or skipped because
Static checks ✅ passed every push
Unit tests ✅ passed every push
npm packages: verify tarballs ⏭️ skipped no change to packages/**, package-lock.json or the CI workflow
VSIX: inspect contents ✅ passed ready PR
VSIX: self-test of the checks ✅ passed build/verification/**, build/vite/**, the Vite configs, package-lock.json or the CI workflow changed
VSIX: activate in VS Code ✅ passed ready PR
VSIX: self-test of the activation check ✅ passed build/verification/**, build/vite/**, the Vite configs, package-lock.json or the CI workflow changed
Webview host in unbundled extensions ⏭️ skipped no change to packages/vscode-ext-webview/**, package-lock.json or the CI workflow
E2E ⏭️ not available yet arrives with the E2E iteration (full tier)

Full run: add the ci:full-requested label to run every layer once on the current commit.
No full run yet.

Code quality

Check Status How to fix
Localization (l10n) ✅ Passed Nothing to fix
ESLint ✅ Passed Nothing to fix
Prettier formatting ✅ Passed Nothing to fix

Build size

No page, activation, VSIX or other bundle size changed by 5% or 50 KiB or more against main. VSIX: 9.0 MiB.

Artifacts: VSIX | Bundle-reports-43762750529 | L1-manifest-report-43762750529

All graphs (exact bytes)
Graph PR bytes Base bytes Delta bytes Delta %
Collection View page (collectionView) 6,037,227 6,037,227 ✅ 0 0.0%
Document View page (documentView) 4,809,730 4,809,730 ✅ 0 0.0%
Local Quick Start page (localQuickStart) 1,580,391 1,578,844 ⬆️ +1,547 +0.1%
Atlas Credentials page (atlasCredentials) 1,510,123 1,510,123 ✅ 0 0.0%
Cluster Dashboard page (clusterDashboard) 1,551,835 1,551,835 ✅ 0 0.0%
Diagnose Connection page (connectionDiagnostics) 1,533,014 1,533,014 ✅ 0 0.0%
Activation (mainStartup) 3,814,269 3,811,720 ⬆️ +2,549 +0.1%
Extension host (main) 10,341,771 10,339,222 ⬆️ +2,549 +0.0%
Playground worker (playgroundWorker) 5,405,385 5,405,385 ✅ 0 0.0%
VSIX (vsix) 9,390,173 9,388,959 ⬆️ +1,214 +0.0%
playgroundTsPlugin 6,175 6,175 ✅ 0 0.0%
viewsEntry 1,457,561 1,457,561 ✅ 0 0.0%
viewsAssets 80,340 80,340 ✅ 0 0.0%
editorWorker 259,528 259,528 ✅ 0 0.0%
jsonWorker 389,389 389,389 ✅ 0 0.0%

Packaged bytes. Shared chunks count in every graph that loads them, so rows do not add up.

Updated in place on every run.

Make image reuse and exact-image downloads visible before and after recreation, while retaining completed setup details and truthful legacy fallbacks.

Co-authored-by: Copilot <[email protected]>

Copy link
Copy Markdown
Collaborator

Added commit 5caea70 to make recreation's behind-the-scenes work understandable before and after it runs:

  • Configure: recreation-specific wording and action, with an explanation of the saved image. Legacy tag-only records do not promise an exact original image.
  • Progress: “Preparing image” reports whether the saved/local image was reused without downloading or the exact saved image was downloaded.
  • Done: keeps the completed stage list and expandable Details, plus a concise success-box summary of confirmed data/credential reuse, image handling, and the running server's DocumentDB version when available. Users can review the evidence or simply read the summary.

This makes clear what will happen and what actually happened, without adding another confirmation dialog. Regression tests, localization, and related docs were updated.

Validation: Case 1 passed (build, 556 targeted tests, 47 browser-scenario tests). All Case 2 commands passed: l10n, prettier-fix, l10n:check, lint, build, typecheck:tests, full Vitest (9,420 passed; 1 skipped), and package. Packaging emitted non-fatal dependency/CSS warnings. No real-container or manual UX testing was performed. The separate committed AI pre-review/author-decision record required by CONTRIBUTING §6 is still absent; these check results do not replace that review.

@tnaum-ms

Copy link
Copy Markdown
Collaborator

Guanzhou Song (@guanzhousongmicrosoft) I added UX enhancements (see #1083 (comment)) and requested a brief Copilot review. Please address its potential findings (won't fix is a valid action).

We'll merge once you approve / accept my changes below.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Container recreation still relies on mutable tags or stale, unverified image pins, allowing incompatible images to run against existing volumes and risking irreversible upgrades or unsafe downgrades.

4 open issues
What changed in this PR

This PR adds safeguards to Local Quick Start in the DocumentDB extension for Visual Studio Code, aiming to prevent container recreation from unintentionally upgrading existing data.

Changes:

  • Records running-image digests and distinguishes exact-image reuse from legacy local-tag reuse.
  • Updates recreation guidance, progress messages, success summaries, and documentation.
  • Adds runtime, service, router, and UI regression coverage, with updated browser scenarios.
File Description
src/​webviews/​documentdb/​localQuickStart/​stageDetailsPresentation.ts Adds image-preparation and recreation summaries.
src/​webviews/​documentdb/​localQuickStart/​stageDetailsPresentation.test.ts Tests image disposition messages.
src/​webviews/​documentdb/​localQuickStart/​localQuickStartRouter.ts Streams saved-image pin status.
src/​webviews/​documentdb/​localQuickStart/​localQuickStartRouter.test.ts Tests pin status updates and metadata filtering.
src/​webviews/​documentdb/​localQuickStart/​LocalQuickStart.tsx Adds recreation-specific labels and success messaging.
src/​webviews/​documentdb/​localQuickStart/​LocalQuickStart.details.test.tsx Covers recreation, fresh setup, and completed details.
src/​services/​localQuickStart/​quickStartTypes.ts Defines pin detection and image-preparation facts.
src/​services/​localQuickStart/​quickStartTypes.test.ts Tests pinned-reference detection.
src/​services/​localQuickStart/​quickStartStore.ts Clarifies the stored image reference in a comment.
src/​services/​localQuickStart/​QuickStartService.ts Adds digest capture and recreation image safeguards.
src/​services/​localQuickStart/​QuickStartService.test.ts Tests stored pin status and reconciliation backfill.
src/​services/​localQuickStart/​QuickStartProvisionDurability.test.ts Covers pinned, local-tag, and missing-image recreation.
src/​services/​localQuickStart/​ContainerRuntime.ts Supports repository-specific digest lookup by image ID.
src/​services/​localQuickStart/​ContainerRuntime.test.ts Tests digest lookup by image ID.
src/​documentdb/​utils/​getClusterHealth.ts Updates comments about pre-1.2 serverStatus support.
l10n/​bundle.l10n.json Updates localized recreation and image messages.
docs/​user-manual/​local-quick-start.md Documents recreation behavior and revised telemetry steps.
docs/​ai-and-plans/​features/​local-quickstart/​README.md Records saved-image recreation behavior.
docs/​ai-and-plans/​features/​local-quickstart/​design.md Describes recreation safeguards and UI outcomes.
build/​verification/​browser/​scenarios.ts Updates stage labels and recreation expectations.
build/​verification/​browser/​fixtures.ts Adds saved-image pin status to wizard fixtures.

Review effort: Balanced

A pin kept from an earlier container goes stale once a replacement has run a newer image on the data, and a recreate would then start the older image on upgraded data.

Signed-off-by: Guanzhou Song <[email protected]>
A recreate that finds the old container still there removed it before anything recorded its image, so a tag-only record could then start a newer local image on the data.

Signed-off-by: Guanzhou Song <[email protected]>
Running the tag let it move between the check and docker run, or be pulled implicitly if it was gone, either of which can start a newer image on the data.

Signed-off-by: Guanzhou Song <[email protected]>
… empty

An engine hiccup made setup say the image was gone and suggest pulling it, which would replace a local image the data can still run.

Signed-off-by: Guanzhou Song <[email protected]>
@guanzhousongmicrosoft

Copy link
Copy Markdown
Contributor Author

Copilot CODE REVIEW

@guanzhousongmicrosoft

Copy link
Copy Markdown
Contributor Author

Tomasz Naumowicz (@tnaum-ms) Reviewed and accepted 5caea70, thanks. It works with the later fixes: the image disposition is computed after the replaced container's image is pinned.

Copilot's four findings are fixed (09f231a, 0caa008, 7b10ce2, 6e881cd) and recorded in iterations/15-recreate-image-pin-review.md. Those pushes dismissed your approval, so could you take another look?

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Recreation can follow mutable image tags and irreversibly upgrade existing volumes when image inspection fails, digest persistence is delayed, or a volume reappears during a pull.

4 open issues
3 previously missed issues

In code that hasn't changed since last review

Medium severity Distinguish inspection failures from confirmed image absence

src/​services/​localQuickStart/​QuickStartService.ts:1196

An inconclusive digest inspection (undefined) triggers a registry pull even when the saved image is cached, so an offline recreation can fail unnecessarily. It is also reported as downloadedPinned at QuickStartService.ts:1266, even if the pull transfers nothing. Distinguish confirmed absence from inspection failure before pulling, and report a download only when that outcome is established.

Medium severity Update recreation announcements to match the recreation action

src/​webviews/​documentdb/​localQuickStart/​LocalQuickStart.tsx:2168

On recreation, the Configure announcer still tells users to start DocumentDB Local, and the provisioning announcer still says “Setting up DocumentDB Local.” These announcements do not match the new Recreate container action and recreation status. Choose the messages using isRecreate and recreating at LocalQuickStart.tsx:2517–2521, and regenerate the localization bundle.

Medium severity Restore completed stage facts when resuming recreation

src/​webviews/​documentdb/​localQuickStart/​LocalQuickStart.tsx:2312

After a readiness timeout, reopening the panel restores stage statuses but not their facts, and waitLonger only emits waiting-stage facts. A successful resumed recreation therefore falls back to “All set” and loses the saved-image outcome and completed-stage details. Retain the completed facts with the resumable operation and restore them when the panel opens or resumes.

4 resolved since last review

Review effort: Max

Copilot AI commented Nov 15, 2026

Copy link
Copy Markdown
Contributor

Copilot CODE REVIEW

Review result: there are valid issues to address before merge.

  • High — data safety (QuickStartService.ts:1107–1124): if the existing container inspection or image pin fails, the code still removes that container and can fall back to its mutable saved tag. The non-quiet inspection is also unbounded/non-cancellable, and cancellation is not checked before removal.
  • High — data safety (QuickStartService.ts:1191–1215, 1294–1305): when a tag is pulled while the volume is absent, a volume restored during the pull is accepted because the later guard excludes reusing; the pulled image can then run against that data.
  • High — pin durability (QuickStartService.ts:1437, 1725–1734): the discovered digest is only persisted after readiness succeeds. Discarding a timed-out recreation can remove the container but keep the volume and mutable tag record.
  • Medium — truthful image status (QuickStartService.ts:1253–1267): an inconclusive image inspection can still lead to a pull and be reported as downloadedPinned, even if the image was already local.
  • Medium — screen-reader wording (LocalQuickStart.tsx:2517–2521): Configure and provisioning announcements still say “start” / “setting up” during recreation.
  • Medium — resumed details (QuickStartService.ts:1800–1821, LocalQuickStart.tsx:1000–1041): reopening after a readiness timeout loses earlier stage facts; resume emits only waiting-stage events, so the success summary/details cannot recover the saved-image outcome.

The optional telemetry classification suggestion is useful but not a merge blocker; I would defer it. This was static review only; I did not run a reproduction or test against real containers. The PR CI run #3649 passed. The unrelated Dependabot quarantine run failed because the quarantine and ready-to-merge labels are missing.

Podman empties RepoDigests once the tag points elsewhere, so an instance still running an older DocumentDB was never pinned and a recreate could start the newer tag on its data.

Signed-off-by: Guanzhou Song <[email protected]>
An image with no digest fell back to the tag, and a failed inspect still removed the container. Run the container's own image by ID, and stop before removal when the inspect fails and the record names only a tag.

Signed-off-by: Guanzhou Song <[email protected]>
A recreate that failed readiness left the tag in the record, so a retry could follow it after it moved.

Signed-off-by: Guanzhou Song <[email protected]>
A run that replaced an earlier attempt's provisioning record deleted it on failure, taking the only credentials for the reused volume.

Signed-off-by: Guanzhou Song <[email protected]>
A container run by image ID, adopted without a record, saved an ID no pull can fetch.

Signed-off-by: Guanzhou Song <[email protected]>
@tnaum-ms
Tomasz Naumowicz (tnaum-ms) merged commit da4b1e5 into main Nov 16, 2026
15 checks passed
@tnaum-ms
Tomasz Naumowicz (tnaum-ms) deleted the dev/guanzhousong/quickstart-recreate-keeps-image branch November 16, 2026 10:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Development

Successfully merging this pull request may close these issues.

4 participants