Skip to content

fix(apphost): disable Wolverine AutoProvision for the Service Bus emulator - #146

Merged
emeraldleaf merged 3 commits into
mainfrom
fix/asb-emulator-autoprovision
Jun 13, 2026
Merged

emeraldleaf merged 3 commits into
mainfrom
fix/asb-emulator-autoprovision

Conversation

@emeraldleaf

@emeraldleaf emeraldleaf commented Jun 13, 2026 •

Copy link
Copy Markdown
Owner

What

The four Wolverine services (order / payment / shipping / notification) crash-loop on every local AppHost run with:

Wolverine.Transports.BrokerInitializationException: Unable to initialize the Broker asb in time

Root cause

AutoProvision() (default on) provisions topics/subscriptions via the Service Bus management API (ServiceBusAdministrationClient.QueueExistsAsync). The Service Bus emulator implements only the AMQP data plane — not the management API, so every check fails, retries 4×, blows the broker-init timeout, and the host dies on startup. Sub-second, deterministic, all four Wolverine services; catalog has no ASB so it survives (which made it look selective and sent earlier debugging toward a dev-cert red herring).

Locally the topology is already declared in AppHost.cs (AddServiceBusTopic / AddServiceBusSubscription write the emulator's config), so provisioning is impossible AND redundant. The integration-test harnesses already hit this and set Wolverine:AutoProvision=false — the local AppHost run just never did.

Fix

  • AppHost.cs injects Wolverine__AutoProvision=false into each Wolverine service. In Publish mode against real Azure the flag stays true (provisioning creates entities).
  • Encoded the trap in CLAUDE.md next to the existing emulator rules (RunAsEmulator, WithReference≠WaitFor).
  • Corrected the now-stale "test-only" framing in each service's Program.cs AutoProvision comment.

Verification

dotnet build clean (0 warnings, analyzers-as-errors). Booting the AppHost with this change brings all four Wolverine services to Running (verified locally as part of the frontend Phase-2 live walkthrough).

Notes

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Chores

    • Disable Wolverine auto-provisioning in local/emulator development so services start reliably without the Service Bus management API; production auto-provisioning remains unchanged. Added local launch profiles to make running services locally easier.
  • Documentation

    • Updated docs and guidance explaining the emulator limitation and the local configuration behavior.

…lator (local dev)

The four Wolverine services (order/payment/shipping/notification) crash-looped
on every local AppHost run with:

  Wolverine.Transports.BrokerInitializationException:
  Unable to initialize the Broker asb in time

Root cause: AutoProvision() (default on) provisions topics/subscriptions via
the Service Bus MANAGEMENT API (ServiceBusAdministrationClient.QueueExistsAsync).
The Service Bus emulator implements only the AMQP data plane — not the
management API — so every check fails, retries 4×, blows the broker-init
timeout, and the host dies on startup. Sub-second, deterministic, all four
Wolverine services; catalog has no ASB so it survives (which made it look
selective and sent the earlier debugging toward a dev-cert red herring).

Locally the topology is already declared in AppHost.cs (AddServiceBusTopic /
AddServiceBusSubscription write the emulator's config), so provisioning is
impossible AND redundant. The integration-test harnesses already discovered
this and set Wolverine:AutoProvision=false; the local AppHost run never did.

Fix: AppHost injects Wolverine__AutoProvision=false into each Wolverine
service. In Publish mode against real Azure the flag stays true (provisioning
creates the entities). Encoded the trap in CLAUDE.md next to the existing
emulator rules + corrected the now-stale 'test-only' framing in each service's
Program.cs comment.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Jun 13, 2026 •

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 7b40cf09-4ba2-43ca-8415-2c369ed874a3

📥 Commits

Reviewing files that changed from the base of the PR and between ef87c09 and fb82828.

📒 Files selected for processing (5)
  • NotificationService/Properties/launchSettings.json
  • OrderService/Properties/launchSettings.json
  • PaymentService/Properties/launchSettings.json
  • ShippingService/Properties/launchSettings.json
  • docs/architecture.md

Walkthrough

This PR disables Wolverine Service Bus auto-provisioning in local development by injecting Wolverine__AutoProvision=false via AppHost for four services (Order, Payment, Shipping, Notification); it adds launchSettings for those services and updates CLAUDE.md, docs/architecture.md, and service-level comments to document the behavior and gating.

Changes

Service Bus Auto-Provision Configuration

Layer / File(s) Summary
Documentation rule for auto-provisioning requirement
CLAUDE.md
CLAUDE.md rule specifies that Wolverine AutoProvision() must be disabled for local development when using the Service Bus emulator, explaining the management API incompatibility and the AppHost configuration override.
AppHost configuration and service wiring
NextAurora.AppHost/AppHost.cs
Introduces a disableAutoProvision constant and applies WithEnvironment("Wolverine__AutoProvision", "false") to OrderService, PaymentService, ShippingService, and NotificationService to disable auto-provisioning during local development.
Service-level auto-provisioning documentation
NotificationService/Program.cs, OrderService/Program.cs, PaymentService/Program.cs, ShippingService/Program.cs
Comments across all four services are updated to clarify that Service Bus topic/subscription auto-provisioning uses the management API at host startup, document the environments where it is disabled (integration tests and emulator), and explain the AppHost injection and config-flag gating behavior.
Per-service launchSettings profiles
NotificationService/Properties/launchSettings.json, OrderService/Properties/launchSettings.json, PaymentService/Properties/launchSettings.json, ShippingService/Properties/launchSettings.json
Adds launchSettings.json profiles for each service configuring local applicationUrl, ASPNETCORE_ENVIRONMENT=Development, dotnetRunMessages, and disabling browser launch.
Architecture documentation update
docs/architecture.md
Adds a subsection describing the local Service Bus emulator's missing management API, the Wolverine AutoProvision() startup failure mode, and the AppHost configuration that disables auto-provisioning locally while keeping it enabled for real Azure.

Sequence Diagram(s)

(omitted — changes are configuration, comments, and per-service wiring without a complex multi-component runtime flow that requires a sequence diagram)

Estimated Code Review Effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related issues

Possibly related PRs

  • emeraldleaf/NextAurora#16: Both PRs gate/disable Wolverine Azure Service Bus AutoProvision via configuration (Wolverine:AutoProvision / Wolverine__AutoProvision) for non-Azure environments.
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title directly addresses the main change: disabling Wolverine AutoProvision for the Service Bus emulator in AppHost, which is the primary fix preventing service crash-loops in local development.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/asb-emulator-autoprovision

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@codecov

codecov Bot commented Jun 13, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 80.00000% with 5 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
NotificationService/Program.cs 0.00% 5 Missing ⚠️

📢 Thoughts on this report? Let us know!

@coderabbitai coderabbitai 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.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@CLAUDE.md`:
- Line 230: The CLAUDE.md reference to the Wolverine AutoProvision guidance is
stale; either add the full rationale and mitigation to docs/architecture.md or
change the CLAUDE.md pointer to the correct doc; specifically, document that
Wolverine's AutoProvision() (Wolverine:AutoProvision) uses
ServiceBusAdministrationClient which the Service Bus emulator lacks (causing
BrokerInitializationException and retries), show the AppHost pattern that
injects Wolverine__AutoProvision=false for local/dev (and that production
Publish mode leaves it enabled), and include the mention of
AddServiceBusTopic/AddServiceBusSubscription being the local topology
declaration so provisioning is redundant.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 1a04ee2e-915c-4788-ab45-fc14e9c4c44e

📥 Commits

Reviewing files that changed from the base of the PR and between 8f93d3e and ef87c09.

📒 Files selected for processing (6)
  • CLAUDE.md
  • NextAurora.AppHost/AppHost.cs
  • NotificationService/Program.cs
  • OrderService/Program.cs
  • PaymentService/Program.cs
  • ShippingService/Program.cs

Comment thread CLAUDE.md Resolved
…Notification

Second half of 'local full-stack never actually ran' (companion to the
AutoProvision fix in this branch). Order/Payment/Shipping/Notification had NO
launchSettings.json — only CatalogService, AppHost, and the two frontends did.
Without a launch profile's applicationUrl, Aspire has no HTTP endpoint to
assign, injects no ASPNETCORE_URLS, and the service falls back to the framework
default http://localhost:5000. All four then collide on 5000 (and with macOS
AirPlay Receiver, which squats on *:5000) — only the first to bind survives,
the rest die with 'address already in use'.

Each service gets an http profile with a distinct base port (5190-5193),
mirroring CatalogService's. Aspire reassigns dynamic proxy ports at runtime;
the profile just gives it an endpoint to manage so nothing defaults to 5000.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Addresses CodeRabbit on #146: the CLAUDE.md AutoProvision rule pointed at
docs/architecture.md Infrastructure section, but the behavior wasn't actually
documented there (dangling cross-reference). Adds the subsection so the
pointer resolves — why AutoProvision is disabled locally, the emulator's
missing management API, and the Publish-mode-keeps-it-on distinction.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.

1 participant