Feature/aspire update and linting v13.2.1#190
Conversation
📝 WalkthroughWalkthroughAdiciona um recurso sentinel para bootstrap do Keycloak, altera wiring do AppHost para aguardar esse sentinel e o container Keycloak, ajusta serviço de bootstrap para publicar atualização de recurso, atualiza suppressions/coverage e aplica vários bumps de dependências e configurações de análise. Changes
Sequence Diagram(s)sequenceDiagram
participant AppHost as AppHost/Program
participant Keycloak as Keycloak Container
participant BootstrapSvc as KeycloakBootstrapService
participant ResourceSvc as ResourceNotificationService
participant Sentinel as KeycloakBootstrapResource
AppHost->>Keycloak: start Keycloak container
AppHost->>BootstrapSvc: start bootstrap loop
Keycloak->>BootstrapSvc: emit resource events (clients created)
BootstrapSvc->>Sentinel: observe resource "keycloak-clients-ready"
BootstrapSvc->>ResourceSvc: PublishUpdate(State=Running, Properties={Status:"Clients Configured Successfully"})
BootstrapSvc->>AppHost: signal bootstrap complete
AppHost->>AppHost: .WaitFor(Keycloak), .WaitFor(KeycloakBootstrapResource)
AppHost->>OtherApps: start dependent apps (apiservice, admin-portal, customer-web, provider-web)
Estimated code review effort🎯 4 (Complexo) | ⏱️ ~45 minutos Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 1 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (1 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (4)
build_error.txt (1)
1-11: Evite versionar log local de build no repositório.Mantém histórico ruidoso e desatualiza rápido; prefira anexar em CI ou descrição da PR.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@build_error.txt` around lines 1 - 11, The repo contains a local build log (build_error.txt) that should not be versioned and the MeAjudaAi.AppHost project is failing with ASPIRE008 because GenerateAssemblyInfo was disabled; open the MeAjudaAi.AppHost.csproj and remove the <GenerateAssemblyInfo>false</GenerateAssemblyInfo> entry (or set it to true) so assembly metadata is generated, delete the checked-in build_error.txt from the repository, and add an entry to .gitignore to prevent committing local CI/build logs in the future.restore_error.txt (1)
1-6: Evite versionar log local de restore no repositório.Esse tipo de arquivo envelhece rápido e gera ruído; melhor manter em artefato de CI ou na descrição da PR/issue.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@restore_error.txt` around lines 1 - 6, O arquivo restore_error.txt contém saída local de restore (inclui referências a MeAjudaAi.AppHost.csproj e ao pacote System.IO.Hashing) e não deve ser versionado; remova esse arquivo do commit, adicionar restore_error.txt ao .gitignore (ou mover para um diretório de artefatos/CI) e re-commit sem ele; se precisar manter histórico para a PR/issue, copie o conteúdo para a descrição da PR ou anexe como artefato de CI em vez de commitar.src/Aspire/MeAjudaAi.AppHost/MeAjudaAi.AppHost.csproj (1)
1-1: Centralize a versão do SDK do Aspire emglobal.json.A versão
13.2.1está definida tanto no atributoSdkdo projeto quanto emglobal.json. Remova a versão do.csprojpara evitar desincronização em futuros upgrades, mantendo a verdade única emglobal.json.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/Aspire/MeAjudaAi.AppHost/MeAjudaAi.AppHost.csproj` at line 1, O atributo Sdk no elemento Project em MeAjudaAi.AppHost.csproj contém a versão "Aspire.AppHost.Sdk/13.2.1"; remova a parte da versão deixando apenas Project Sdk="Aspire.AppHost.Sdk" (ou equivalente sem versão) para que a versão seja centralizada em global.json, garantindo que futuras atualizações usem a única fonte de verdade; atualize o atributo Sdk no arquivo que contém Project Sdk para refletir apenas o nome do SDK.Directory.Packages.props (1)
204-205: AlinharRefiteRefit.HttpClientFactorypara a mesma versão (sugestão de boas práticas).As versões
10.1.6e10.0.1são compatíveis (NuGet unifica automaticamente para a mais alta). Alinhá-las na versão10.1.6melhora consistência e reduz o risco de edge cases em atualizações futuras.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@Directory.Packages.props` around lines 204 - 205, Alinhe as versões do pacote ajustando o elemento PackageVersion que referencia "Refit.HttpClientFactory" para usar a mesma versão que "Refit" (10.1.6); atualize o atributo Version na entrada PackageVersion Include="Refit.HttpClientFactory" para "10.1.6" e confirme que a entrada PackageVersion Include="Refit" permanece "10.1.6", depois rode restore/build para validar que a solução compila com a versão unificada.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In @.editorconfig:
- Around line 52-75: Remova as supressões globais "none" para regras críticas
(por exemplo dotnet_diagnostic.CA1031, dotnet_diagnostic.CA1063,
dotnet_diagnostic.CA2227, dotnet_diagnostic.CA1851) e em vez disso aplique-as
localmente com justificativa; altere a severidade global mínima para
"suggestion" (ou remova a entrada) e introduza suppressions scoped em arquivos
específicos ou blocos de código onde houver justificativa documentada para cada
código (use comentários ou atributos SuppressMessage/local analyzer config junto
às declarações afetadas para CA1031, CA1063, CA2227 e CA1851).
In `@Directory.Packages.props`:
- Around line 149-151: Atualize a versão do pacote
System.IdentityModel.Tokens.Jwt para 8.16.0 para alinhar a família
IdentityModel; localize a PackageVersion entry with
Include="System.IdentityModel.Tokens.Jwt" e alterar o atributo Version de
"8.17.0" para "8.16.0" para ficar consistente com
Microsoft.IdentityModel.Protocols e
Microsoft.IdentityModel.Protocols.OpenIdConnect.
---
Nitpick comments:
In `@build_error.txt`:
- Around line 1-11: The repo contains a local build log (build_error.txt) that
should not be versioned and the MeAjudaAi.AppHost project is failing with
ASPIRE008 because GenerateAssemblyInfo was disabled; open the
MeAjudaAi.AppHost.csproj and remove the
<GenerateAssemblyInfo>false</GenerateAssemblyInfo> entry (or set it to true) so
assembly metadata is generated, delete the checked-in build_error.txt from the
repository, and add an entry to .gitignore to prevent committing local CI/build
logs in the future.
In `@Directory.Packages.props`:
- Around line 204-205: Alinhe as versões do pacote ajustando o elemento
PackageVersion que referencia "Refit.HttpClientFactory" para usar a mesma versão
que "Refit" (10.1.6); atualize o atributo Version na entrada PackageVersion
Include="Refit.HttpClientFactory" para "10.1.6" e confirme que a entrada
PackageVersion Include="Refit" permanece "10.1.6", depois rode restore/build
para validar que a solução compila com a versão unificada.
In `@restore_error.txt`:
- Around line 1-6: O arquivo restore_error.txt contém saída local de restore
(inclui referências a MeAjudaAi.AppHost.csproj e ao pacote System.IO.Hashing) e
não deve ser versionado; remova esse arquivo do commit, adicionar
restore_error.txt ao .gitignore (ou mover para um diretório de artefatos/CI) e
re-commit sem ele; se precisar manter histórico para a PR/issue, copie o
conteúdo para a descrição da PR ou anexe como artefato de CI em vez de commitar.
In `@src/Aspire/MeAjudaAi.AppHost/MeAjudaAi.AppHost.csproj`:
- Line 1: O atributo Sdk no elemento Project em MeAjudaAi.AppHost.csproj contém
a versão "Aspire.AppHost.Sdk/13.2.1"; remova a parte da versão deixando apenas
Project Sdk="Aspire.AppHost.Sdk" (ou equivalente sem versão) para que a versão
seja centralizada em global.json, garantindo que futuras atualizações usem a
única fonte de verdade; atualize o atributo Sdk no arquivo que contém Project
Sdk para refletir apenas o nome do SDK.
🪄 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: CHILL
Plan: Pro
Run ID: 39dc67f1-d659-46dd-8c54-5fd4e97ac26d
⛔ Files ignored due to path filters (41)
src/Aspire/MeAjudaAi.AppHost/packages.lock.jsonis excluded by!**/packages.lock.jsonsrc/Aspire/MeAjudaAi.ServiceDefaults/packages.lock.jsonis excluded by!**/packages.lock.jsonsrc/Bootstrapper/MeAjudaAi.ApiService/packages.lock.jsonis excluded by!**/packages.lock.jsonsrc/Client/MeAjudaAi.Client.Contracts/packages.lock.jsonis excluded by!**/packages.lock.jsonsrc/Contracts/packages.lock.jsonis excluded by!**/packages.lock.jsonsrc/Modules/Documents/API/packages.lock.jsonis excluded by!**/packages.lock.jsonsrc/Modules/Documents/Application/packages.lock.jsonis excluded by!**/packages.lock.jsonsrc/Modules/Documents/Domain/packages.lock.jsonis excluded by!**/packages.lock.jsonsrc/Modules/Documents/Infrastructure/packages.lock.jsonis excluded by!**/packages.lock.jsonsrc/Modules/Documents/Tests/packages.lock.jsonis excluded by!**/packages.lock.jsonsrc/Modules/Locations/API/packages.lock.jsonis excluded by!**/packages.lock.jsonsrc/Modules/Locations/Application/packages.lock.jsonis excluded by!**/packages.lock.jsonsrc/Modules/Locations/Domain/packages.lock.jsonis excluded by!**/packages.lock.jsonsrc/Modules/Locations/Infrastructure/packages.lock.jsonis excluded by!**/packages.lock.jsonsrc/Modules/Locations/Tests/packages.lock.jsonis excluded by!**/packages.lock.jsonsrc/Modules/Providers/API/packages.lock.jsonis excluded by!**/packages.lock.jsonsrc/Modules/Providers/Application/packages.lock.jsonis excluded by!**/packages.lock.jsonsrc/Modules/Providers/Domain/packages.lock.jsonis excluded by!**/packages.lock.jsonsrc/Modules/Providers/Infrastructure/packages.lock.jsonis excluded by!**/packages.lock.jsonsrc/Modules/Providers/Tests/packages.lock.jsonis excluded by!**/packages.lock.jsonsrc/Modules/SearchProviders/API/packages.lock.jsonis excluded by!**/packages.lock.jsonsrc/Modules/SearchProviders/Application/packages.lock.jsonis excluded by!**/packages.lock.jsonsrc/Modules/SearchProviders/Domain/packages.lock.jsonis excluded by!**/packages.lock.jsonsrc/Modules/SearchProviders/Infrastructure/packages.lock.jsonis excluded by!**/packages.lock.jsonsrc/Modules/SearchProviders/Tests/packages.lock.jsonis excluded by!**/packages.lock.jsonsrc/Modules/ServiceCatalogs/API/packages.lock.jsonis excluded by!**/packages.lock.jsonsrc/Modules/ServiceCatalogs/Application/packages.lock.jsonis excluded by!**/packages.lock.jsonsrc/Modules/ServiceCatalogs/Domain/packages.lock.jsonis excluded by!**/packages.lock.jsonsrc/Modules/ServiceCatalogs/Infrastructure/packages.lock.jsonis excluded by!**/packages.lock.jsonsrc/Modules/ServiceCatalogs/Tests/packages.lock.jsonis excluded by!**/packages.lock.jsonsrc/Modules/Users/API/packages.lock.jsonis excluded by!**/packages.lock.jsonsrc/Modules/Users/Application/packages.lock.jsonis excluded by!**/packages.lock.jsonsrc/Modules/Users/Domain/packages.lock.jsonis excluded by!**/packages.lock.jsonsrc/Modules/Users/Infrastructure/packages.lock.jsonis excluded by!**/packages.lock.jsonsrc/Modules/Users/Tests/packages.lock.jsonis excluded by!**/packages.lock.jsonsrc/Shared/packages.lock.jsonis excluded by!**/packages.lock.jsontests/MeAjudaAi.ApiService.Tests/packages.lock.jsonis excluded by!**/packages.lock.jsontests/MeAjudaAi.Architecture.Tests/packages.lock.jsonis excluded by!**/packages.lock.jsontests/MeAjudaAi.E2E.Tests/packages.lock.jsonis excluded by!**/packages.lock.jsontests/MeAjudaAi.Integration.Tests/packages.lock.jsonis excluded by!**/packages.lock.jsontests/MeAjudaAi.Shared.Tests/packages.lock.jsonis excluded by!**/packages.lock.json
📒 Files selected for processing (7)
.editorconfigDirectory.Packages.propsbuild_error.txtbuild_warnings.txtglobal.jsonrestore_error.txtsrc/Aspire/MeAjudaAi.AppHost/MeAjudaAi.AppHost.csproj
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@src/Aspire/MeAjudaAi.AppHost/Program.cs`:
- Line 199: The current WaitFor(keycloak.Keycloak) only waits for the container
to be running and does not guarantee the KeycloakBootstrapService has finished
creating OIDC clients, causing a race; update the resource graph so downstream
apps (e.g., apiservice, admin-portal) explicitly depend on the bootstrap
completion by either converting KeycloakBootstrapService into a first‑class
Aspire service or by adding a sentinel resource (e.g., WaitForBootstrap or
Keycloak.ClientsReady) that the bootstrap sets when it finishes; then replace
WaitFor(keycloak.Keycloak) with WaitFor(Keycloak.ClientsReady) or add
WaitFor(Keycloak.ClientsReady) alongside the existing wait to ensure apps only
start after KeycloakBootstrapService has completed creating admin-portal,
customer-app and provider-app clients.
🪄 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: CHILL
Plan: Pro
Run ID: e4dd5436-1aac-4910-878b-6cc79967e10c
⛔ Files ignored due to path filters (15)
src/Aspire/MeAjudaAi.AppHost/packages.lock.jsonis excluded by!**/packages.lock.jsonsrc/Bootstrapper/MeAjudaAi.ApiService/packages.lock.jsonis excluded by!**/packages.lock.jsonsrc/Modules/Documents/Tests/packages.lock.jsonis excluded by!**/packages.lock.jsonsrc/Modules/Locations/Tests/packages.lock.jsonis excluded by!**/packages.lock.jsonsrc/Modules/Providers/Tests/packages.lock.jsonis excluded by!**/packages.lock.jsonsrc/Modules/SearchProviders/Tests/packages.lock.jsonis excluded by!**/packages.lock.jsonsrc/Modules/ServiceCatalogs/Tests/packages.lock.jsonis excluded by!**/packages.lock.jsonsrc/Modules/Users/API/packages.lock.jsonis excluded by!**/packages.lock.jsonsrc/Modules/Users/Infrastructure/packages.lock.jsonis excluded by!**/packages.lock.jsonsrc/Modules/Users/Tests/packages.lock.jsonis excluded by!**/packages.lock.jsontests/MeAjudaAi.ApiService.Tests/packages.lock.jsonis excluded by!**/packages.lock.jsontests/MeAjudaAi.Architecture.Tests/packages.lock.jsonis excluded by!**/packages.lock.jsontests/MeAjudaAi.E2E.Tests/packages.lock.jsonis excluded by!**/packages.lock.jsontests/MeAjudaAi.Integration.Tests/packages.lock.jsonis excluded by!**/packages.lock.jsontests/MeAjudaAi.Shared.Tests/packages.lock.jsonis excluded by!**/packages.lock.json
📒 Files selected for processing (9)
.editorconfig.gitignoreDirectory.Packages.propssrc/Aspire/MeAjudaAi.AppHost/Extensions/KeycloakExtensions.cssrc/Aspire/MeAjudaAi.AppHost/MeAjudaAi.AppHost.csprojsrc/Aspire/MeAjudaAi.AppHost/Program.cssrc/Modules/Providers/Application/GlobalSuppressions.cssrc/Shared/GlobalSuppressions.cssrc/Shared/Messaging/MessagingExtensions.cs
💤 Files with no reviewable changes (4)
- src/Aspire/MeAjudaAi.AppHost/Extensions/KeycloakExtensions.cs
- src/Modules/Providers/Application/GlobalSuppressions.cs
- src/Shared/Messaging/MessagingExtensions.cs
- src/Shared/GlobalSuppressions.cs
✅ Files skipped from review due to trivial changes (1)
- .gitignore
🚧 Files skipped from review as they are similar to previous changes (2)
- .editorconfig
- Directory.Packages.props
…ervice registration pipeline
Code Coverage Report
|
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (2)
src/Contracts/GlobalSuppressions.cs (1)
3-3: Evite exclusão de cobertura no assembly inteiro.Essa estratégia é ampla demais e pode esconder código com regra de negócio no futuro. Prefira excluir apenas tipos realmente passivos (DTOs/eventos específicos).
💡 Ajuste sugerido
-using System.Diagnostics.CodeAnalysis; - -[assembly: ExcludeFromCodeCoverage(Justification = "The Contracts project consists purely of OIDC/API data models and integration events without business logic.")] +// Preferir exclusões pontuais por tipo (DTO/evento) em vez de assembly-wide.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/Contracts/GlobalSuppressions.cs` at line 3, Remove the assembly-level ExcludeFromCodeCoverage attribute in GlobalSuppressions.cs and instead annotate only the passive DTO/event types that truly have no business logic with [ExcludeFromCodeCoverage]; identify candidates by their class names (the OIDC/API models and integration event classes in the Contracts project) and add the attribute to those type declarations so business-containing types remain instrumented for coverage.src/Shared/Messaging/MessagingExtensions.cs (1)
28-28: Não excluaMessagingExtensionsinteira da cobertura.Aqui há lógica crítica de configuração (ambiente, DI e validações). A exclusão total enfraquece proteção contra regressões.
💡 Ajuste sugerido
- [ExcludeFromCodeCoverage] public static class MessagingExtensions🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/Shared/Messaging/MessagingExtensions.cs` at line 28, Remove the blanket [ExcludeFromCodeCoverage] on the MessagingExtensions type and instead either delete the attribute altogether from the class or apply it narrowly only to non-critical helper methods; locate the MessagingExtensions class and remove the attribute so environment/DI/validation logic remains covered (or move the attribute to specific trivial methods within MessagingExtensions if there are truly non-critical helpers), keeping all configuration/validation methods instrumented by tests and coverage tooling.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@src/Aspire/MeAjudaAi.AppHost/Services/KeycloakBootstrapService.cs`:
- Around line 26-32: O fluxo atual em KeycloakBootstrapService (dentro
resourceNotificationService.WatchAsync) depende da ordem dos eventos e pode
perder o estado "Running" se keycloak subir antes de "keycloak-clients-ready";
altere a lógica para manter o estado dos pré-requisitos no escopo do loop (por
exemplo variáveis locais como sentinelResource e um flag/instância de
KeycloakBootstrapResource) e só chamar
resourceNotificationService.PublishUpdateAsync para marcar o sentinel como
"Running" quando ambos existirem; alternativamente injete a instância de
KeycloakBootstrapResource e exponha um método (ex.: MarkBootstrapCompletedAsync)
que publique a atualização assim que detectar que os dois pré-requisitos estão
satisfeitos; aplique o mesmo ajuste também ao segundo trecho equivalente (linhas
53-60).
---
Nitpick comments:
In `@src/Contracts/GlobalSuppressions.cs`:
- Line 3: Remove the assembly-level ExcludeFromCodeCoverage attribute in
GlobalSuppressions.cs and instead annotate only the passive DTO/event types that
truly have no business logic with [ExcludeFromCodeCoverage]; identify candidates
by their class names (the OIDC/API models and integration event classes in the
Contracts project) and add the attribute to those type declarations so
business-containing types remain instrumented for coverage.
In `@src/Shared/Messaging/MessagingExtensions.cs`:
- Line 28: Remove the blanket [ExcludeFromCodeCoverage] on the
MessagingExtensions type and instead either delete the attribute altogether from
the class or apply it narrowly only to non-critical helper methods; locate the
MessagingExtensions class and remove the attribute so environment/DI/validation
logic remains covered (or move the attribute to specific trivial methods within
MessagingExtensions if there are truly non-critical helpers), keeping all
configuration/validation methods instrumented by tests and coverage tooling.
🪄 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: CHILL
Plan: Pro
Run ID: faa5a12f-ad3f-47b3-a72d-4b637f8617c4
📒 Files selected for processing (9)
src/Aspire/MeAjudaAi.AppHost/Program.cssrc/Aspire/MeAjudaAi.AppHost/Resources/KeycloakBootstrapResource.cssrc/Aspire/MeAjudaAi.AppHost/Services/KeycloakBootstrapService.cssrc/Bootstrapper/MeAjudaAi.ApiService/Program.cssrc/Contracts/GlobalSuppressions.cssrc/Shared/Extensions/ModuleServiceRegistrationExtensions.cssrc/Shared/Extensions/ServiceCollectionExtensions.cssrc/Shared/Messaging/MessagingExtensions.cssrc/Shared/Monitoring/BusinessMetrics.cs
✅ Files skipped from review due to trivial changes (3)
- src/Bootstrapper/MeAjudaAi.ApiService/Program.cs
- src/Shared/Extensions/ServiceCollectionExtensions.cs
- src/Shared/Extensions/ModuleServiceRegistrationExtensions.cs
🚧 Files skipped from review as they are similar to previous changes (1)
- src/Aspire/MeAjudaAi.AppHost/Program.cs
| IResource? sentinelResource = null; | ||
| await foreach (var resourceEvent in resourceNotificationService.WatchAsync(stoppingToken)) | ||
| { | ||
| if (resourceEvent.Resource.Name == "keycloak-clients-ready") | ||
| { | ||
| sentinelResource = resourceEvent.Resource; | ||
| } |
There was a problem hiding this comment.
Esse fluxo ainda depende da ordem dos eventos.
Se keycloak entrar em Running antes de keycloak-clients-ready, o bootstrap pode concluir com sucesso e mesmo assim nunca atualizar o sentinel. Como esse sucesso não é preservado entre iterações, o serviço fica esperando outro evento de keycloak para publicar o Running, e os recursos que fazem WaitFor nesse sentinel podem ficar bloqueados indefinidamente. Promova esse estado para o escopo do loop, ou injete a própria instância de KeycloakBootstrapResource, para publicar a atualização assim que os dois pré-requisitos existirem.
💡 Ajuste sugerido
- IResource? sentinelResource = null;
+ IResource? sentinelResource = null;
+ var bootstrapCompleted = false;
await foreach (var resourceEvent in resourceNotificationService.WatchAsync(stoppingToken))
{
if (resourceEvent.Resource.Name == "keycloak-clients-ready")
{
sentinelResource = resourceEvent.Resource;
}
@@
- var success = await BootstrapKeycloakAsync(url, stoppingToken);
+ bootstrapCompleted = await BootstrapKeycloakAsync(url, stoppingToken);
- // Interrompe o loop somente após sucesso na configuração
- if (success && sentinelResource != null)
- {
- // Notificar o Aspire que o bootstrap terminou
- await resourceNotificationService.PublishUpdateAsync(sentinelResource, snapshot => snapshot with
- {
- State = new ResourceStateSnapshot("Running", "green"),
- Properties = [new ResourcePropertySnapshot("Status", "Clients Configured Successfully")]
- });
-
- break;
- }
}
}
}
catch (Exception ex) when (ex is not OperationCanceledException)
{
logger.LogError(ex, "Failed to bootstrap Keycloak clients.");
}
}
+
+ if (bootstrapCompleted && sentinelResource != null)
+ {
+ await MarkBootstrapCompletedAsync(sentinelResource);
+ break;
+ }
}private Task MarkBootstrapCompletedAsync(IResource sentinelResource) =>
resourceNotificationService.PublishUpdateAsync(sentinelResource, snapshot => snapshot with
{
State = new ResourceStateSnapshot("Running", "green"),
Properties = [new ResourcePropertySnapshot("Status", "Clients Configured Successfully")]
});Also applies to: 53-60
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@src/Aspire/MeAjudaAi.AppHost/Services/KeycloakBootstrapService.cs` around
lines 26 - 32, O fluxo atual em KeycloakBootstrapService (dentro
resourceNotificationService.WatchAsync) depende da ordem dos eventos e pode
perder o estado "Running" se keycloak subir antes de "keycloak-clients-ready";
altere a lógica para manter o estado dos pré-requisitos no escopo do loop (por
exemplo variáveis locais como sentinelResource e um flag/instância de
KeycloakBootstrapResource) e só chamar
resourceNotificationService.PublishUpdateAsync para marcar o sentinel como
"Running" quando ambos existirem; alternativamente injete a instância de
KeycloakBootstrapResource e exponha um método (ex.: MarkBootstrapCompletedAsync)
que publique a atualização assim que detectar que os dois pré-requisitos estão
satisfeitos; aplique o mesmo ajuste também ao segundo trecho equivalente (linhas
53-60).
Minimum allowed line rate is |
Summary by CodeRabbit
Notas de Lançamento
Chores
Correções / Confiabilidade