Uh oh!
There was an error while loading. Please reload this page.
Add Blob Versioning Support to Azurite - #2735
Add Blob Versioning Support to Azurite#2735Rodolfo Orozco Vasquez (rorozcov) wants to merge 85 commits into
Conversation
…eate blob. No testing yet. All theoretical
…tore. Now local testing needed. Saving progress
…tests with versioning enabled. Must add versioning related checks
Rodolfo Orozco Vasquez (rorozcov)
commented
Sep 2, 2026
Will do! Give me 1-2 days at most. |
…nto copilot/testblob-versioning-gc-regression-again # Conflicts: # src/blob/BlobConfiguration.ts # src/blob/BlobEnvironment.ts # src/blob/BlobServer.ts # src/blob/BlobServerFactory.ts # src/blob/errors/StorageErrorFactory.ts # src/blob/handlers/BlobHandler.ts # src/blob/persistence/IBlobMetadataStore.ts # src/blob/persistence/LokiBlobMetadataStore.ts # src/blob/persistence/PageWithDelimiter.ts # src/blob/persistence/SqlBlobMetadataStore.ts # src/common/Environment.ts # src/common/VSCEnvironment.ts # src/common/VSCServerManagerBlob.ts Co-authored-by: rorozcov <44987991+rorozcov@users.noreply.github.com>
Co-authored-by: rorozcov <44987991+rorozcov@users.noreply.github.com>
Co-authored-by: rorozcov <44987991+rorozcov@users.noreply.github.com>
There was a problem hiding this comment.
🔵 Needs a closer look
The version-aware continuation token encoding introduced in PageWithDelimiter can become ambiguous with user-controlled blob names, risking broken pagination for valid names and should be made unambiguous before approval.
Review details
Suppressed comments (4)
Previously missed (4) — in code that hasn't changed since the last review.
src/blob/persistence/PageWithDelimiter.ts:16
- The continuation token format for version-aware listings uses a plain delimiter string (
__version_marker__) to join[name, timestamp]. Since blob names are user-controlled, a blob name containing this substring will make markers ambiguous and can cause listing to fail when the marker is later parsed/split. Consider encoding the marker as a structured value (e.g., JSON array likeListAllBlobsMarker) or escaping the name component before concatenation.
tests/blob/apis/versioning.azurite.parity.test.ts:185 - This Azurite parity test is tagged
@productionin its title, which appears to be a copy/paste mistake (the file/suite is for Azurite). If you use these tags to filter test runs, this mislabel can cause the test to be skipped or miscategorized.
src/blob/BlobServer.ts:82 - The error thrown when
accountModelStoreis missing is correct, but it can be confusing because BlobServer still has a code path that constructs a defaultBlobConfigurationwhen none is provided. Consider clarifying the message so callers know BlobServer must be created via BlobServerFactory (or with an explicit configuration that includesaccountModelStore).
tests/testutils.ts:30 exportis split across lines (export\n async function ...), which is unusual in this codebase and can be reformatted by Prettier/linting. Keepingexport async functionon one line improves readability and avoids style tool churn.
- Files reviewed: 58/60 changed files
- Comments generated: 0 new
- Review effort level: Lite
Co-authored-by: rorozcov <44987991+rorozcov@users.noreply.github.com>
Co-authored-by: rorozcov <44987991+rorozcov@users.noreply.github.com>
Co-authored-by: rorozcov <44987991+rorozcov@users.noreply.github.com>
Co-authored-by: rorozcov <44987991+rorozcov@users.noreply.github.com>
There was a problem hiding this comment.
🔵 Needs a closer look
The change set is large and feature-defining (new persistence/config abstractions plus handler/store contract changes), so it warrants final human verification despite only minor specific issues noted.
Review details
Suppressed comments (1)
Previously missed (1) — in code that hasn't changed since the last review.
tests/blob/apis/versioning.azurite.parity.test.ts:185
- The test case name ends with
@productioneven though this is the Azurite parity suite. This can cause the test to be skipped or mis-grouped when running with grep/tag filters.
- Files reviewed: 59/61 changed files
- Comments generated: 1
- Review effort level: Lite
| const accountModels = new Map<string, AccountModel>(); | ||
| accountModels.set(EMULATOR_ACCOUNT_NAME, { | ||
| key: EMULATOR_ACCOUNT_KEY, | ||
| isBlobVersioningEnabled: versioningEnabled | ||
| }); | ||
| return new LokiAccountModelStore(databaseFile, true, accountModels); |
Co-authored-by: rorozcov <44987991+rorozcov@users.noreply.github.com>
…eam-main-into-blobversioning # Conflicts: # ChangeLog.md # README.md # src/blob/handlers/ContainerHandler.ts # src/blob/persistence/IBlobMetadataStore.ts # src/blob/persistence/LokiBlobMetadataStore.ts # src/blob/persistence/SqlBlobMetadataStore.ts Co-authored-by: rorozcov <44987991+rorozcov@users.noreply.github.com>
There was a problem hiding this comment.
🔵 Needs a closer look
The new continuation-token encoding for version-aware pagination is ambiguous for certain valid blob names and can break paging behavior, so it should be made robust before merge.
Review details
Suppressed comments (2)
Previously missed (2) — in code that hasn't changed since the last review.
src/blob/persistence/PageWithDelimiter.ts:226
- Continuation tokens for name+timestamp mode are currently built by joining
[name, timestamp]with the hard-coded__version_marker__separator. If a blob name contains that substring, the token becomes ambiguous andmarker.split(VERSIONING_MARKER)(e.g., in LokiBlobMetadataStore.listBlobs) will fail and return 400, breaking pagination for valid blob names. Consider encoding the marker tuple as an unambiguous format (e.g., JSON string or base64 of JSON) and accepting the legacy joined format for backward compatibility.
src/blob/persistence/LokiBlobMetadataStore.ts:166 - PR description mentions version IDs using JavaScript millisecond precision rather than Azure's 7 fractional digits, but the implementation converts timestamps to 7 fractional digits and even uses a per-blob sub-millisecond counter (see generateVersionId). Please align the PR description (and any external docs) with the implemented 7-digit RFC3339 versionId format so expectations match runtime behavior.
- Files reviewed: 59/61 changed files
- Comments generated: 0 new
- Review effort level: Lite
Rodolfo Orozco Vasquez (rorozcov)
commented
Sep 4, 2026
Akanksha Jain (@jainakanksha-msft) Your comments have been addressed. I am merging main into my branch again. I am also working on the pagination continuation token and wanted your input. Initially, I made it very simple to keep it backwards compatible with how azurite used to do it. However, it is technically opaque from Azure's point of view so I am thinking of making it opaque as well rather than azurite's current use of the blob name as the continuation token and my PR's use of blobname__Version_marker__timestamp. Let me know what you think. If not once I merge main we should be good to go |
There was a problem hiding this comment.
🟡 Changes recommended
Continuation token encoding in PageWithDelimiter is ambiguous for certain blob names and can break listing pagination, and there is also a mislabeled test tag in the Azurite parity suite.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Review details
- Files reviewed: 59/61 changed files
- Comments generated: 2
- Review effort level: Lite
| added < docs.length | ||
| ? this.markerMode === "name" | ||
| ? this.latestMarker[0] | ||
| : this.latestMarker.join(PageWithDelimiter.VERSIONING_MARKER) | ||
| : "" |
| ); | ||
| }); | ||
| it("should match versioning behaviour from production when listing blobs after creation operations @production", async () => { |
Title: Add Blob Versioning Support to Azurite
Summary
Adds Azure Blob Storage versioning support to Azurite, enabling applications to create, list, retrieve, and delete previous blob versions during local development.
Closes#665.
Account model
This work introduces the account model abstraction designed in collaboration with the Azurite team. The account model provides a central place for account-scoped feature configuration so additional Azure Storage capabilities can be added without coupling them directly to server startup or individual blob handlers.
Blob versioning is currently the first and only feature backed by this abstraction. The design supports Azurite's multi-account mode, allowing each configured account to enable or disable versioning independently. Accounts without an explicit versioning setting retain the existing non-versioned behavior for backward compatibility.
Motivation
Blob versioning automatically preserves previous blob states after modification or deletion. Without emulator support, applications that depend on version-aware workflows cannot be tested locally before deployment to Azure.
Implementation
AccountModelsetting for enabling blob versioning.versionId.includeVersionswith version-aware continuation markers.Configuration
Blob versioning can be configured using:
--accountConfigFilePathfor JSON configuration files.--accountConfigAsJsonfor inline JSON configuration.Configured accounts must also be present in
AZURITE_ACCOUNTSfor authentication.Behavior
Limitations
This change does not currently support:
Validation