Skip to content

Retry Azure container creation after a failed first attempt - #9

Merged
FlyOverCoderKY merged 2 commits into
mainfrom
claude/intelligent-chebyshev-33931a
Jul 30, 2026
Merged

FlyOverCoderKY merged 2 commits into
mainfrom
claude/intelligent-chebyshev-33931a

Conversation

@FlyOverCoderKY

Copy link
Copy Markdown
Contributor

Summary

The Azure Blob adapter's lazy container-creation memo cached rejections as well as successes: ready() set ensureContainer once to the createIfNotExists() promise, so a single transient failure (network blip, Azurite API-version rejection) latched the store into replaying the same error on every subsequent operation until the host process restarted. Observed empirically during the Exsimplify migration's Phase 2 boot smoke — identical error RequestId returned minutes apart, across an emulator restart.

  • Clear the memo when container creation rejects, so the next operation retries. The happy path keeps its single-flight memoization.
  • Regression test: a stub ContainerClient whose createIfNotExists rejects once then succeeds — first op fails, second op succeeds, and success stays memoized (exactly 2 create attempts). Verified the test fails against the unfixed code. A stub is used because Azurite can't be induced to fail exactly once; the conformance suites still run against the real emulator.
  • Checked the sibling adapters: neither storage-s3 nor storage-cloudflare-r2 lazily creates buckets, so the latching pattern was Azure-only.
  • Patch release: all four packages bumped to 0.1.2 (release tooling requires one shared exact version), adapter pins on @pegma/storage-blobs updated, lockfile re-synced.

Testing

  • npm test: 224/224 across all five test files (Azurite + LocalStack via Docker)
  • npm run check and prettier --check pass
  • Mutation check: stashed the fix, new test fails with the replayed cached rejection; restored, passes

🤖 Generated with Claude Code

The lazy createIfNotExists memo cached rejections as well as successes,
so one transient failure (network blip, emulator API-version rejection)
latched the store into replaying the same error on every subsequent
operation until the host process restarted. Clear the memo on rejection
so the next operation retries; the happy path keeps its single-flight
memoization. Observed during the Exsimplify migration's Phase 2 boot
smoke against Azurite.

The S3 and Cloudflare R2 adapters do not lazily create buckets, so only
the Azure adapter carried this pattern.

Bump all published packages to 0.1.2 (release tooling requires one
shared version).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings July 30, 2026 02:25
@cursor

cursor Bot commented Jul 30, 2026

Copy link
Copy Markdown

Bugbot is not enabled for your account, so this pull request was not reviewed.

Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs.

@github-actions

github-actions Bot commented Jul 30, 2026 •

Copy link
Copy Markdown

Grok Grok Build Review — no issues

Review complete. No issues found — the changes look solid.

This change correctly repairs a process-lifetime failure latch in the Azure adapter’s lazy container creation path. Clearing the memo only on rejection preserves single-flight behavior on the success path while allowing subsequent operations to retry after a transient createIfNotExists failure. The regression test establishes the intended contract (first call fails, second succeeds, create is not re-invoked after success), and the coordinated 0.1.2 version alignment is consistent with the repository’s shared-version release constraint. No defects warrant blocking this merge.

Reviewed commit 9490141 · workflow run

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 18802b101a

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Improves the Azure Blob adapter’s lazy container creation so transient failures don’t get permanently memoized, and aligns the monorepo packages to a patch release version bump.

Changes:

  • Reset the ensureContainer single-flight memo when createIfNotExists() rejects, allowing subsequent operations to retry container creation.
  • Add a regression test covering “fail once, then succeed” behavior for container creation memoization.
  • Bump all package versions (and adapter pins) from 0.1.1 to 0.1.2 and resync the lockfile.

Reviewed changes

Copilot reviewed 6 out of 7 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
packages/storage-azure-blob/src/index.ts Clears the container-creation memo on rejection so retries can occur after transient failures.
packages/storage-azure-blob/src/index.test.ts Adds a regression test asserting retry-after-first-failure and continued memoization after success.
packages/storage-blobs/package.json Bumps @pegma/storage-blobs version to 0.1.2.
packages/storage-azure-blob/package.json Bumps adapter version and updates the pinned @pegma/storage-blobs dependency.
packages/storage-s3/package.json Bumps adapter version and updates the pinned @pegma/storage-blobs dependency.
packages/storage-cloudflare-r2/package.json Bumps adapter version and updates the pinned @pegma/storage-blobs dependency.
package-lock.json Updates workspace package versions and pinned internal dependencies to 0.1.2.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Review feedback: the retry regression test stubbed the whole
ContainerClient, which conflicts with the repository rule to verify
adapters against a real backend. Use a real client against Azurite and
inject the one-shot fault into createIfNotExists only, delegating to
the real implementation on retry, so the second attempt actually
creates the container and the subsequent head round-trips the emulator.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@FlyOverCoderKY
FlyOverCoderKY merged commit 1450333 into main Jul 30, 2026
5 checks passed
@FlyOverCoderKY
FlyOverCoderKY deleted the claude/intelligent-chebyshev-33931a branch July 30, 2026 02:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants