Skip to content

Feature/aspire update and linting v13.2.1#190

Merged
frigini merged 4 commits intomasterfrom
feature/aspire-update-and-linting-v13.2.1
Apr 8, 2026
Merged

Feature/aspire update and linting v13.2.1#190
frigini merged 4 commits intomasterfrom
feature/aspire-update-and-linting-v13.2.1

Conversation

@frigini
Copy link
Copy Markdown
Owner

@frigini frigini commented Apr 8, 2026

Summary by CodeRabbit

Notas de Lançamento

  • Chores

    • Atualizadas versões de SDKs e pacotes centrais (incluindo ferramentas de teste, OpenTelemetry, Aspire e bibliotecas auxiliares).
    • Ajustadas regras de análise estática e configurações globais de analisadores.
    • Atualizados arquivos de build/configuração e .gitignore.
  • Correções / Confiabilidade

    • Melhor coordenação do bootstrap do Keycloak com um sentinel e publicação de estado para garantir inicialização ordenada dos serviços.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Apr 8, 2026

📝 Walkthrough

Walkthrough

Adiciona 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

Cohort / File(s) Summary
Configuração de Análise de Código
/.editorconfig
Altera severidades globais de analisadores (dotnet_analyzer_diagnostic.severitysuggestion), adiciona/ajusta várias dotnet_diagnostic.* para none/suggestion e insere blocos de supressão com escopo por arquivo/glob.
Gerenciamento de Dependências
Directory.Packages.props, global.json
Bump de múltiplos pacotes (Aspire.* → 13.2.1, OpenTelemetry → 1.15.1, Refit → 10.1.6, WireMock.Net → 2.2.0, SonarAnalyzer → 10.22.0, Microsoft.NET.Test.Sdk → 18.4.0, etc.) e atualização de Aspire.AppHost.Sdk em global.json.
AppHost — Orquestração Keycloak
src/Aspire/MeAjudaAi.AppHost/Program.cs, src/Aspire/MeAjudaAi.AppHost/Extensions/KeycloakExtensions.cs
Adiciona criação e passagem de KeycloakBootstrapResource sentinel; atualiza assinaturas de ConfigureDevelopmentEnvironment/ConfigureProductionEnvironment; insere .WaitFor(keycloak.Keycloak) e .WaitFor(keycloakBootstrap) em dependências de apps; remove comentários antigos.
Novo Resource & Bootstrap Flow
src/Aspire/MeAjudaAi.AppHost/Resources/KeycloakBootstrapResource.cs, src/Aspire/MeAjudaAi.AppHost/Services/KeycloakBootstrapService.cs
Adiciona KeycloakBootstrapResource público; altera KeycloakBootstrapService para observar o sentinel, exigir presença do sentinel antes de encerrar loop e publicar atualização de recurso definindo Running e propriedade Status.
Supressões / Cobertura de Código
src/Shared/GlobalSuppressions.cs, src/Modules/Providers/Application/GlobalSuppressions.cs, src/Contracts/GlobalSuppressions.cs, src/Shared/Messaging/MessagingExtensions.cs
Remove arquivo src/Shared/GlobalSuppressions.cs e várias supressões de assembly; remove SuppressMessage(S2094) em Messaging; adiciona ExcludeFromCodeCoverage em vários arquivos/projetos e novo GlobalSuppressions.cs em src/Contracts.
Anotações de Cobertura em Utilitários
src/Shared/Extensions/ModuleServiceRegistrationExtensions.cs, src/Shared/Extensions/ServiceCollectionExtensions.cs, src/Shared/Monitoring/BusinessMetrics.cs, src/Bootstrapper/MeAjudaAi.ApiService/Program.cs
Aplica [ExcludeFromCodeCoverage] a classes/assembly conforme indicado (importa System.Diagnostics.CodeAnalysis quando necessário).
Configuração do Projeto
src/Aspire/MeAjudaAi.AppHost/MeAjudaAi.AppHost.csproj
Remove versão fixa do SDK no atributo Project Sdk para Aspire.AppHost.Sdk e adiciona <GenerateAssemblyInfo>true</GenerateAssemblyInfo>.
Ignorar Padrões
/.gitignore
Adiciona padrão /*.txt para ignorar arquivos .txt no nível raiz.

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)
Loading

Estimated code review effort

🎯 4 (Complexo) | ⏱️ ~45 minutos

Possibly related PRs

Poem

🐰 Subi versões, plantei um sinal,

Keycloak esperou até ficar legal.
O bootstrap tilta, publica sinal verde,
Apps acordam e o fluxo procede.
Saltinhos de código — tudo em ordem, pode crer! 🎉

🚥 Pre-merge checks | ✅ 1 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning A descrição do PR está completamente vazia, não seguindo o template obrigatório do repositório que inclui seções de Summary, Problem, Solution, Changes, Impact, Testing e Checklist. Preencha a descrição do PR seguindo o template do repositório, incluindo resumo das mudanças, problemas resolvidos, solução implementada, lista de mudanças principais, impacto esperado, testes realizados e checklist de validação.
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (1 passed)
Check name Status Explanation
Title check ✅ Passed O título menciona claramente as duas principais mudanças do PR: atualização do Aspire para v13.2.1 e linting, alinhado com as alterações em arquivos de configuração, dependências e análise de código.

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

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/aspire-update-and-linting-v13.2.1

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.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

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 em global.json.

A versão 13.2.1 está definida tanto no atributo Sdk do projeto quanto em global.json. Remova a versão do .csproj para evitar desincronização em futuros upgrades, mantendo a verdade única em global.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: Alinhar Refit e Refit.HttpClientFactory para a mesma versão (sugestão de boas práticas).

As versões 10.1.6 e 10.0.1 são compatíveis (NuGet unifica automaticamente para a mais alta). Alinhá-las na versão 10.1.6 melhora 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

📥 Commits

Reviewing files that changed from the base of the PR and between d4aa408 and b9556b2.

⛔ Files ignored due to path filters (41)
  • src/Aspire/MeAjudaAi.AppHost/packages.lock.json is excluded by !**/packages.lock.json
  • src/Aspire/MeAjudaAi.ServiceDefaults/packages.lock.json is excluded by !**/packages.lock.json
  • src/Bootstrapper/MeAjudaAi.ApiService/packages.lock.json is excluded by !**/packages.lock.json
  • src/Client/MeAjudaAi.Client.Contracts/packages.lock.json is excluded by !**/packages.lock.json
  • src/Contracts/packages.lock.json is excluded by !**/packages.lock.json
  • src/Modules/Documents/API/packages.lock.json is excluded by !**/packages.lock.json
  • src/Modules/Documents/Application/packages.lock.json is excluded by !**/packages.lock.json
  • src/Modules/Documents/Domain/packages.lock.json is excluded by !**/packages.lock.json
  • src/Modules/Documents/Infrastructure/packages.lock.json is excluded by !**/packages.lock.json
  • src/Modules/Documents/Tests/packages.lock.json is excluded by !**/packages.lock.json
  • src/Modules/Locations/API/packages.lock.json is excluded by !**/packages.lock.json
  • src/Modules/Locations/Application/packages.lock.json is excluded by !**/packages.lock.json
  • src/Modules/Locations/Domain/packages.lock.json is excluded by !**/packages.lock.json
  • src/Modules/Locations/Infrastructure/packages.lock.json is excluded by !**/packages.lock.json
  • src/Modules/Locations/Tests/packages.lock.json is excluded by !**/packages.lock.json
  • src/Modules/Providers/API/packages.lock.json is excluded by !**/packages.lock.json
  • src/Modules/Providers/Application/packages.lock.json is excluded by !**/packages.lock.json
  • src/Modules/Providers/Domain/packages.lock.json is excluded by !**/packages.lock.json
  • src/Modules/Providers/Infrastructure/packages.lock.json is excluded by !**/packages.lock.json
  • src/Modules/Providers/Tests/packages.lock.json is excluded by !**/packages.lock.json
  • src/Modules/SearchProviders/API/packages.lock.json is excluded by !**/packages.lock.json
  • src/Modules/SearchProviders/Application/packages.lock.json is excluded by !**/packages.lock.json
  • src/Modules/SearchProviders/Domain/packages.lock.json is excluded by !**/packages.lock.json
  • src/Modules/SearchProviders/Infrastructure/packages.lock.json is excluded by !**/packages.lock.json
  • src/Modules/SearchProviders/Tests/packages.lock.json is excluded by !**/packages.lock.json
  • src/Modules/ServiceCatalogs/API/packages.lock.json is excluded by !**/packages.lock.json
  • src/Modules/ServiceCatalogs/Application/packages.lock.json is excluded by !**/packages.lock.json
  • src/Modules/ServiceCatalogs/Domain/packages.lock.json is excluded by !**/packages.lock.json
  • src/Modules/ServiceCatalogs/Infrastructure/packages.lock.json is excluded by !**/packages.lock.json
  • src/Modules/ServiceCatalogs/Tests/packages.lock.json is excluded by !**/packages.lock.json
  • src/Modules/Users/API/packages.lock.json is excluded by !**/packages.lock.json
  • src/Modules/Users/Application/packages.lock.json is excluded by !**/packages.lock.json
  • src/Modules/Users/Domain/packages.lock.json is excluded by !**/packages.lock.json
  • src/Modules/Users/Infrastructure/packages.lock.json is excluded by !**/packages.lock.json
  • src/Modules/Users/Tests/packages.lock.json is excluded by !**/packages.lock.json
  • src/Shared/packages.lock.json is excluded by !**/packages.lock.json
  • tests/MeAjudaAi.ApiService.Tests/packages.lock.json is excluded by !**/packages.lock.json
  • tests/MeAjudaAi.Architecture.Tests/packages.lock.json is excluded by !**/packages.lock.json
  • tests/MeAjudaAi.E2E.Tests/packages.lock.json is excluded by !**/packages.lock.json
  • tests/MeAjudaAi.Integration.Tests/packages.lock.json is excluded by !**/packages.lock.json
  • tests/MeAjudaAi.Shared.Tests/packages.lock.json is excluded by !**/packages.lock.json
📒 Files selected for processing (7)
  • .editorconfig
  • Directory.Packages.props
  • build_error.txt
  • build_warnings.txt
  • global.json
  • restore_error.txt
  • src/Aspire/MeAjudaAi.AppHost/MeAjudaAi.AppHost.csproj

Comment thread .editorconfig
Comment thread Directory.Packages.props Outdated
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

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 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

📥 Commits

Reviewing files that changed from the base of the PR and between b9556b2 and 77964ad.

⛔ Files ignored due to path filters (15)
  • src/Aspire/MeAjudaAi.AppHost/packages.lock.json is excluded by !**/packages.lock.json
  • src/Bootstrapper/MeAjudaAi.ApiService/packages.lock.json is excluded by !**/packages.lock.json
  • src/Modules/Documents/Tests/packages.lock.json is excluded by !**/packages.lock.json
  • src/Modules/Locations/Tests/packages.lock.json is excluded by !**/packages.lock.json
  • src/Modules/Providers/Tests/packages.lock.json is excluded by !**/packages.lock.json
  • src/Modules/SearchProviders/Tests/packages.lock.json is excluded by !**/packages.lock.json
  • src/Modules/ServiceCatalogs/Tests/packages.lock.json is excluded by !**/packages.lock.json
  • src/Modules/Users/API/packages.lock.json is excluded by !**/packages.lock.json
  • src/Modules/Users/Infrastructure/packages.lock.json is excluded by !**/packages.lock.json
  • src/Modules/Users/Tests/packages.lock.json is excluded by !**/packages.lock.json
  • tests/MeAjudaAi.ApiService.Tests/packages.lock.json is excluded by !**/packages.lock.json
  • tests/MeAjudaAi.Architecture.Tests/packages.lock.json is excluded by !**/packages.lock.json
  • tests/MeAjudaAi.E2E.Tests/packages.lock.json is excluded by !**/packages.lock.json
  • tests/MeAjudaAi.Integration.Tests/packages.lock.json is excluded by !**/packages.lock.json
  • tests/MeAjudaAi.Shared.Tests/packages.lock.json is excluded by !**/packages.lock.json
📒 Files selected for processing (9)
  • .editorconfig
  • .gitignore
  • Directory.Packages.props
  • src/Aspire/MeAjudaAi.AppHost/Extensions/KeycloakExtensions.cs
  • src/Aspire/MeAjudaAi.AppHost/MeAjudaAi.AppHost.csproj
  • src/Aspire/MeAjudaAi.AppHost/Program.cs
  • src/Modules/Providers/Application/GlobalSuppressions.cs
  • src/Shared/GlobalSuppressions.cs
  • src/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

Comment thread src/Aspire/MeAjudaAi.AppHost/Program.cs
@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 8, 2026

Code Coverage Report

Code Coverage

Project Package Line Rate Branch Rate Health
MeAjudaAi.Web.Admin components/layout 72% 64%
MeAjudaAi.Web.Admin components/providers 93% 92%
MeAjudaAi.Web.Admin components/ui 100% 86%
MeAjudaAi.Web.Admin hooks/admin 95% 79%
MeAjudaAi.Web.Admin Summary 94% (253 / 269) 80% (117 / 146) -
MeAjudaAi.Web.Customer components/auth 62% 57%
MeAjudaAi.Web.Customer components/home 100% 100%
MeAjudaAi.Web.Customer components/layout 63% 36%
MeAjudaAi.Web.Customer components/profile 93% 94%
MeAjudaAi.Web.Customer components/providers 61% 64%
MeAjudaAi.Web.Customer components/reviews 64% 70%
MeAjudaAi.Web.Customer components/search 88% 70%
MeAjudaAi.Web.Customer components/service 100% 100%
MeAjudaAi.Web.Customer components/ui 97% 97%
MeAjudaAi.Web.Customer hooks 88% 63%
MeAjudaAi.Web.Customer lib/api 83% 80%
MeAjudaAi.Web.Customer lib/constants 100% 100%
MeAjudaAi.Web.Customer lib/schemas 92% 80%
MeAjudaAi.Web.Customer lib/services 94% 86%
MeAjudaAi.Web.Customer lib/utils 77% 90%
MeAjudaAi.Web.Customer Summary 80% (660 / 816) 74% (576 / 770) -
MeAjudaAi.Web.Provider root 53% 36%
MeAjudaAi.Web.Provider components/dashboard 100% 100%
MeAjudaAi.Web.Provider components/layout 100% 100%
MeAjudaAi.Web.Provider components/profile 100% 100%
MeAjudaAi.Web.Provider components/providers 100% 100%
MeAjudaAi.Web.Provider components/ui 100% 90%
MeAjudaAi.Web.Provider lib/api 100% 93%
MeAjudaAi.Web.Provider lib/constants 100% 100%
MeAjudaAi.Web.Provider lib/schemas 87% 75%
MeAjudaAi.Web.Provider lib/services 100% 100%
MeAjudaAi.Web.Provider lib/utils 96% 98%
MeAjudaAi.Web.Provider Summary 86% (277 / 321) 78% (357 / 457) -
Overall Summary 84% (1190 / 1406) 76% (1050 / 1373) -

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

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 exclua MessagingExtensions inteira 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

📥 Commits

Reviewing files that changed from the base of the PR and between 77964ad and 9ced8f2.

📒 Files selected for processing (9)
  • src/Aspire/MeAjudaAi.AppHost/Program.cs
  • src/Aspire/MeAjudaAi.AppHost/Resources/KeycloakBootstrapResource.cs
  • src/Aspire/MeAjudaAi.AppHost/Services/KeycloakBootstrapService.cs
  • src/Bootstrapper/MeAjudaAi.ApiService/Program.cs
  • src/Contracts/GlobalSuppressions.cs
  • src/Shared/Extensions/ModuleServiceRegistrationExtensions.cs
  • src/Shared/Extensions/ServiceCollectionExtensions.cs
  • src/Shared/Messaging/MessagingExtensions.cs
  • src/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

Comment on lines +26 to +32
IResource? sentinelResource = null;
await foreach (var resourceEvent in resourceNotificationService.WatchAsync(stoppingToken))
{
if (resourceEvent.Resource.Name == "keycloak-clients-ready")
{
sentinelResource = resourceEvent.Resource;
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

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).

@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 8, 2026

Code Coverage

Package Line Rate Branch Rate Complexity Health
MeAjudaAi.ApiService 87% 72% 435
MeAjudaAi.Modules.Documents.API 100% 100% 8
MeAjudaAi.Modules.Documents.Application 97% 49% 66
MeAjudaAi.Modules.Documents.Domain 99% 100% 32
MeAjudaAi.Modules.Documents.Infrastructure 91% 72% 98
MeAjudaAi.Modules.Locations.API 100% 100% 18
MeAjudaAi.Modules.Locations.Application 100% 100% 17
MeAjudaAi.Modules.Locations.Domain 95% 82% 128
MeAjudaAi.Modules.Locations.Infrastructure 93% 60% 41
MeAjudaAi.Modules.Providers.API 95% 100% 43
MeAjudaAi.Modules.Providers.Application 98% 60% 145
MeAjudaAi.Modules.Providers.Domain 89% 82% 288
MeAjudaAi.Modules.Providers.Infrastructure 100% 100% 25
MeAjudaAi.Modules.SearchProviders.API 100% 100% 3
MeAjudaAi.Modules.SearchProviders.Application 91% 54% 37
MeAjudaAi.Modules.SearchProviders.Domain 96% 82% 51
MeAjudaAi.Modules.SearchProviders.Infrastructure 93% 85% 39
MeAjudaAi.Modules.ServiceCatalogs.API 100% 100% 20
MeAjudaAi.Modules.ServiceCatalogs.Application 100% 100% 37
MeAjudaAi.Modules.ServiceCatalogs.Domain 96% 89% 70
MeAjudaAi.Modules.ServiceCatalogs.Infrastructure 100% 100% 7
MeAjudaAi.Modules.Users.API 100% 100% 20
MeAjudaAi.Modules.Users.Application 97% 73% 76
MeAjudaAi.Modules.Users.Domain 94% 95% 145
MeAjudaAi.Modules.Users.Infrastructure 90% 56% 94
MeAjudaAi.Shared 73% 66% 835
Summary 90% (8058 / 8934) 73% (1410 / 1936) 2778

Minimum allowed line rate is 90%

@frigini frigini merged commit 571e50e into master Apr 8, 2026
10 checks passed
@frigini frigini deleted the feature/aspire-update-and-linting-v13.2.1 branch April 8, 2026 19:44
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