microsoft / microsoft/vscode-documentdb
Harden connection storage reads for unknown future versions
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 31
- Forks
- 22
- Avg merge
- 2d 20h
- Merged PRs (30d)
- 21
Description
Problem
ConnectionStorageService.fromStorageItem() currently uses an exact version switch:
3.0reconstructs the current storage shape.2.0uses the v2 compatibility path.defaultassumes an unversioned v1 record.
The default branch therefore conflates two different cases:
item.versionis absent, which is a genuine v1 record.item.versionis present but unknown, such as a future3.1or4.0record.
Treating an unknown future record as v1 is destructive. A v3-shaped record sent through wrapV1AsV2() can lose folder membership, flatten the selected authentication method to Native authentication, drop structured credentials and Entra ID metadata, or skip a folder whose connection-string slot is empty. If the degraded item is later saved, those losses can become persistent.
This blocks a safe storage version bump. Older released versions cannot be changed retroactively, so a tolerant reader must ship and reach the relevant preview/release cohort before a new version is written.
Goal
Make the current reader forward-tolerant for future storage versions that remain additive-compatible with the newest known shape. Unknown version strings must never enter the unversioned-v1 path.
Recommended sequence
- Ship a tolerant reader. Distinguish a missing version from a present-but-unknown version. Only a missing version uses the v1 wrapper. A present unknown version is read as the newest known additive-compatible shape, with a non-sensitive diagnostic signal.
- Let the tolerant reader roll out. Wait until the release reaches the users who may switch between preview and older builds.
- Bump the storage version later. Choose
3.1or4.0based on the intended compatibility semantics. At that point the number is naming rather than a downgrade hazard.
Implementation scope
- Refactor
fromStorageItem()so the unversioned v1 case is explicit rather than thedefaultbranch. - Preserve the existing
2.0and3.0behavior. - Route a non-empty unknown version through the newest known reconstruction path only when the record is additive-compatible with that shape.
- Emit a non-sensitive warning or telemetry classification for an unknown version so future-format reads can be measured.
- Keep the conversion read-only. Reading an item must not persist a migration or rewrite its version.
- Document the compatibility contract: assigned secret indexes are append-only, never reordered, and never reused.
Acceptance criteria
- An unversioned v1 fixture still uses the v1 compatibility path and preserves its expected fields.
- A v2 fixture still uses the v2 compatibility path.
- A v3 fixture still reconstructs directly.
- Unknown-version fixtures such as
3.1and4.0, shaped additively like v3, do not usewrapV1AsV2(). - An unknown-version connection preserves
parentId,selectedAuthMethod, connection string, and every known authentication config. - An unknown-version folder remains a folder and is not skipped because its connection-string slot is empty.
- Reading an unknown-version record performs no storage write.
- Unknown-version handling emits no connection strings, credentials, tenant IDs, client IDs, or other identifiers in logs or telemetry.
- Focused tests use real v1, v2, v3, and future-version storage fixtures.
- A later version bump remains a separate change after the tolerant reader has shipped.
Out of scope
- Choosing or applying the next storage version number.
- Supporting a future format with breaking, non-additive shape changes without an explicit converter.
- Removing the legacy v1/v2 wrappers. That investigation is tracked separately in #729.
- Forced on-disk migration of existing records.
References
- Follow-up from #886, finding F8 and its versioning addendum.
- Related: #729 tracks whether telemetry eventually permits deleting legacy v1/v2 wrapping code; it does not address unknown future versions.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at ConnectionStorageService.fromStorageItem() and inspect the existing v1 wrapper, v2 compatibility path, and v3 reconstruction path. Add focused real v1, v2, v3, and future-version fixtures covering preservation, read-only behavior, and non-sensitive diagnostics; done means unknown additive versions avoid wrapV1AsV2() without changing known-version behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- databases, devtools
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 50/100