Skip to content

feat(map): WA-E2 pins e filtros de corpos d'água - #464

Merged
sraphaz merged 3 commits into
mainfrom
feat/wa-e2-map-water-body-pins
Aug 10, 2026
Merged

feat(map): WA-E2 pins e filtros de corpos d'água#464
sraphaz merged 3 commits into
mainfrom
feat/wa-e2-map-water-body-pins

Conversation

@sraphaz

@sraphaz sraphaz commented Aug 10, 2026

Copy link
Copy Markdown
Owner

Summary

  • Filtro server-side de pins por assetSubtypes; assetTypes casa Type ou Subtype (legado + ponte WA-E1)
  • Pin response inclui assetType / assetSubtype; Flutter com chip Corpos d'água (filtro no servidor)
  • Sensibilidade HIGH/RESTRICTED fora do escopo (sem campos em TerritoryAsset; AC-WA-4 segue pending)

Spec-Id: water-bodies-curation

Test plan

  • dotnet build --configuration Release
  • dotnet test filtro Map_Pins / TerritoryAssetTypeMatch / NaturalWater
  • dart analyze em map + tokens
  • CI verde no PR
  • Smoke manual: mapa → chip Corpos d'água (assets Active com subtype hídrico)

Notes

  • Assets só aparecem no mapa após curadoria (Active); teste antigo Map_Pins_FilterAssets corrigido para curar antes de filtrar

Made with Cursor

Summary by CodeRabbit

  • New Features

    • Added map filters for all pins and water bodies.
    • Added filtering by asset type and subtype.
    • Map pins now include asset type and subtype details.
    • Added water-body icons and consistent map coloring.
    • Added English and Portuguese labels for the new filters.
  • Documentation

    • Updated map API documentation, changelog, and water-body specifications.
    • Documented active-asset visibility and current sensitivity limitations.

Permite filtrar pins por subtype hídrico no servidor e expor assetType/assetSubtype no app, com chip Corpos d'água no mapa.

Co-authored-by: Cursor <cursoragent@cursor.com>
@github-actions

Copy link
Copy Markdown
Contributor

PR Steward — Apontamentos de bots

Regra obrigatória

Todo apontamento de bot deve ser resolvido ou respondido antes de merge. Não deixar threads abertas em arquivos alterados neste PR.

Checklist

  • CI verde (build-test, Flutter, Agents Gates, CodeQL)
  • CodeRabbit / reviews — todos os threads tratados
  • Dependabot / segurança — CVEs novas endereçadas ou justificadas
  • Comentários inline em arquivos do diff — resolvidos ou respondidos
  • sync-docs-check sem erros bloqueantes
  • Corpo do PR preenchido (template agente)

Como resolver

./scripts/agents/arah-agents.ps1 bot-review -PrNumber <N>
./scripts/agents/arah-agents.ps1 pr-ready -PrNumber <N>

Merge

  • Steward posta ready-for-merge quando pr-ready passa.
  • Humano executa merge (ou workflow_dispatch em agents-pr-steward.yml com confirmação).

Automático via agents-pr-steward.yml

Status: CI OK — revisar checklist

@github-actions github-actions Bot added the ready-for-merge PR aprovado pelo steward; merge humano label Aug 10, 2026
@coderabbitai

coderabbitai Bot commented Aug 10, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

The change adds water-body subtype filtering to map pin APIs and repositories. It returns asset metadata, adds Flutter map filters and water-body marker rendering, updates localization, and documents the WA-E2 delivery.

Changes

Water-body map pin flow

Layer / File(s) Summary
Asset subtype filtering
backend/Arah.Modules.Assets/..., backend/Arah.Application/..., backend/Arah.Infrastructure/...
Repositories normalize and apply type and subtype filters. MapPinsService forwards subtype filters and includes asset metadata in pins.
Map API contracts and validation
backend/Arah.Api/..., backend/Arah.Api.Bff/..., backend/Tests/...
Map endpoints accept assetSubtypes and return assetType and assetSubtype. API descriptions, integration tests, and domain tests cover the new filters.

Flutter map filters

Layer / File(s) Summary
Map data, controls, and rendering
frontend/arah.app/lib/features/map/..., frontend/arah.app/lib/core/theme/...
The app requests water-body subtypes, adds filter chips, derives visual pin types, and renders water-related markers with water styling.
Map filter localization
frontend/arah.app/lib/l10n/...
English and Portuguese labels were added. Generated localization files were updated and reformatted.

Documentation

Layer / File(s) Summary
WA-E2 documentation
docs/...
API, backlog, phase status, specification, queue, and changelog entries document water-body map pins, subtype filters, and deferred sensitivity handling.

Estimated code review effort: 4 (Complex) | ~45 minutes

Possibly related PRs

  • sraphaz/arah#462: Defines the water-body functionality implemented by this change.
  • sraphaz/arah#463: Adds the asset subtype data consumed by this change.
  • sraphaz/arah#435: Modifies the same pin color mapping used for water-body rendering.
🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning A descrição resume as mudanças e os testes, mas omite várias seções obrigatórias do template, incluindo tipo de mudança, documentação, links e breaking changes. Complete as seções obrigatórias do template, marque os itens aplicáveis e liste a documentação atualizada, links relacionados, screenshots e breaking changes.
Docstring Coverage ⚠️ Warning Docstring coverage is 8.70% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed O título identifica de forma clara e concisa a implementação dos pins e filtros de corpos d'água da WA-E2.
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.
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/wa-e2-map-water-body-pins

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.

@cursor cursor Bot left a comment

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.

Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.

Fix All in Cursor

Bugbot Autofix prepared a fix for the issue found in the latest run.

  • ✅ Fixed: Water chip ignores legacy assets
    • O filtro Corpos d'água agora usa assetTypes, restaurando a compatibilidade com pins legados cujo tipo hídrico ainda vive em Type sem Subtype.

Create PR

Or push these changes by commenting:

@cursor push c857fa99c5
Preview (c857fa99c5)
diff --git a/frontend/arah.app/lib/features/map/presentation/providers/map_pins_provider.dart b/frontend/arah.app/lib/features/map/presentation/providers/map_pins_provider.dart
--- a/frontend/arah.app/lib/features/map/presentation/providers/map_pins_provider.dart
+++ b/frontend/arah.app/lib/features/map/presentation/providers/map_pins_provider.dart
@@ -8,13 +8,14 @@
   return MapRepository(client: ref.watch(bffClientProvider));
 });
 
-/// Filtro de pins do mapa (WA-E2: corpos d'água via assetSubtypes no servidor).
+/// Filtro de pins do mapa (WA-E2: corpos d'água com compatibilidade legado).
 enum MapPinsFilter {
   all,
   waterBodies,
 }
 
-final mapPinsFilterProvider = StateProvider<MapPinsFilter>((ref) => MapPinsFilter.all);
+final mapPinsFilterProvider =
+    StateProvider<MapPinsFilter>((ref) => MapPinsFilter.all);
 
 class MapPinsQuery {
   const MapPinsQuery({required this.territoryId, required this.filter});
@@ -35,8 +36,8 @@
 }
 
 /// Pins do mapa para o território. BFF map/pins (filtro server-side).
-final mapPinsProvider =
-    FutureProvider.autoDispose.family<List<MapPin>, MapPinsQuery>((ref, query) async {
+final mapPinsProvider = FutureProvider.autoDispose
+    .family<List<MapPin>, MapPinsQuery>((ref, query) async {
   final territoryId = query.territoryId;
   if (territoryId == null || territoryId.isEmpty) return [];
   final repo = ref.watch(mapRepositoryProvider);
@@ -44,7 +45,7 @@
     return repo.getPins(
       territoryId: territoryId,
       types: 'asset',
-      assetSubtypes: kWaterBodySubtypesCsv,
+      assetTypes: kWaterBodySubtypesCsv,
     );
   }
   return repo.getPins(territoryId: territoryId);

diff --git a/frontend/arah.app/test/features/map/presentation/map_pins_provider_test.dart b/frontend/arah.app/test/features/map/presentation/map_pins_provider_test.dart
new file mode 100644
--- /dev/null
+++ b/frontend/arah.app/test/features/map/presentation/map_pins_provider_test.dart
@@ -1,0 +1,59 @@
+import 'package:arah_app/core/config/app_config.dart';
+import 'package:arah_app/core/network/bff_client.dart';
+import 'package:arah_app/features/map/data/models/map_pin.dart';
+import 'package:arah_app/features/map/data/repositories/map_repository.dart';
+import 'package:arah_app/features/map/presentation/providers/map_pins_provider.dart';
+import 'package:flutter_riverpod/flutter_riverpod.dart';
+import 'package:flutter_test/flutter_test.dart';
+
+class _FakeMapRepository extends MapRepository {
+  _FakeMapRepository()
+      : super(
+            client:
+                BffClient(config: const AppConfig(bffBaseUrl: 'http://test')));
+
+  Map<String, String?>? lastArgs;
+
+  @override
+  Future<List<MapPin>> getPins({
+    required String territoryId,
+    String? types,
+    String? assetTypes,
+    String? assetSubtypes,
+  }) async {
+    lastArgs = {
+      'territoryId': territoryId,
+      'types': types,
+      'assetTypes': assetTypes,
+      'assetSubtypes': assetSubtypes,
+    };
+    return const [];
+  }
+}
+
+void main() {
+  test('waterBodies usa assetTypes para incluir pins legados', () async {
+    final fakeRepository = _FakeMapRepository();
+    final container = ProviderContainer(
+      overrides: [
+        mapRepositoryProvider.overrideWithValue(fakeRepository),
+      ],
+    );
+    addTearDown(container.dispose);
+
+    await container.read(
+      mapPinsProvider(
+        const MapPinsQuery(
+          territoryId: 'territory-1',
+          filter: MapPinsFilter.waterBodies,
+        ),
+      ).future,
+    );
+
+    expect(fakeRepository.lastArgs, isNotNull);
+    expect(fakeRepository.lastArgs!['territoryId'], 'territory-1');
+    expect(fakeRepository.lastArgs!['types'], 'asset');
+    expect(fakeRepository.lastArgs!['assetTypes'], kWaterBodySubtypesCsv);
+    expect(fakeRepository.lastArgs!['assetSubtypes'], isNull);
+  });
+}

You can send follow-ups to the cloud agent here.

Reviewed by Cursor Bugbot for commit a3633fc. Configure here.

@github-actions

Copy link
Copy Markdown
Contributor

QA Agent — Checklist

Revise este PR conforme docs/21_CODE_REVIEW.md e docs/22_COHESION_AND_TESTS.md.

Arquitetura

  • Dependências apontam para dentro (Clean Architecture)
  • Territory sem lógica social embutida
  • Nomenclatura: territory, items, membership (nunca place/listings)

Testes

  • Comportamento novo tem teste
  • run-tests passou na área alterada
  • Sem regressão óbvia em edge cases

UI (se aplicável)

  • Mobile-first
  • Sem cores hardcoded (variáveis CSS / tokens)
  • Acessibilidade básica (labels, contraste)

PR

  • Escopo atômico
  • sync-docs aplicado
  • Corpo do PR preenchido (template agente)

Automático via agents-gates.yml — comentário orientativo; merge continua humano.

Status gates: ✅ Gates automáticos passaram

@github-actions

Copy link
Copy Markdown
Contributor

Security Agent — Relatório

Dependências

  • dotnet list package --vulnerable sem críticas novas
  • lock files commitados quando deps mudaram

Secrets

  • Nenhum token/senha/API key no diff
  • Sem .env ou credenciais em paths rastreados

LGPD / dados sensíveis

  • Sem log de PII desnecessário
  • Dados sensíveis conforme SECURITY.md

Bloqueio recomendado

  • CVE crítico novo → não mergear até correção
  • Secret no diff → reverter imediatamente

Automático via agents-gates.yml.

assetSubtypes só casa Subtype e omitia pins com type=river/spring sem subtype.

Co-authored-by: Cursor <cursoragent@cursor.com>
@github-actions

github-actions Bot commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

Agente acionado: Spec Steward (SDD)

ID: spec-steward | Quando: 2026-08-10T04:15:06Z UTC | Gatilho: pull_request:synchronize
Workflow: 31354736088

Verificações automáticas de conduta

✅ Guardrail no_merge
✅ Guardrail require_ci (opcional por agente)
✅ Checklist de conduta (checklists/spec-steward.checklist.md)
❌ Escopo de paths respeitado — fora do escopo: backend/Arah.Api.Bff/Journeys/BffJourneyRegistry.cs, backend/Arah.Api/Contracts/Map/MapPinResponse.cs, backend/Arah.Api/Controllers/Map/MapController.cs, backend/Arah.Application/Models/MapPin.cs, backend/Arah.Application/Services/Map/MapPinsService.cs, backend/Arah.Infrastructure/InMemory/InMemoryAssetRepository.cs, backend/Arah.Modules.Assets.Infrastructure/Postgres/PostgresAssetRepository.cs, backend/Arah.Modules.Assets/Application/Interfaces/ITerritoryAssetRepository.cs, backend/Arah.Modules.Assets/Domain/TerritoryAssetTypeMatch.cs, backend/Tests/Arah.Tests/Api/ApiScenariosTests.cs, backend/Tests/Arah.Tests/Domain/Assets/TerritoryAssetTypeMatchTests.cs, docs/CHANGELOG.md, docs/STATUS_FASES.md, docs/_meta/PHASE_QUEUE.yaml, docs/api/60_06_API_MAPA.md, docs/backlog-api/CORPOS_DAGUA_TERRITORIO.md, frontend/arah.app/lib/core/theme/app_design_tokens.dart, frontend/arah.app/lib/features/map/data/models/map_pin.dart, frontend/arah.app/lib/features/map/data/repositories/map_repository.dart, frontend/arah.app/lib/features/map/presentation/providers/map_pins_provider.dart, frontend/arah.app/lib/features/map/presentation/screens/map_screen.dart, frontend/arah.app/lib/l10n/app_en.arb, frontend/arah.app/lib/l10n/app_localizations.dart, frontend/arah.app/lib/l10n/app_localizations_en.dart, frontend/arah.app/lib/l10n/app_localizations_pt.dart, frontend/arah.app/lib/l10n/app_pt.arb

Conduta compartilhada

Conduta comum (todos os agentes)

  • Merge humano — nunca mergear em main sem aprovação explícita
  • Escopo mínimo — alterar apenas paths permitidos no manifest
  • Sem secrets — nada de tokens, senhas ou chaves no diff
  • PR obrigatório — todo código via branch + Pull Request
  • CI verde — gates passam antes de pedir review
  • Bots resolvidos — apontamentos de CodeRabbit/Dependabot tratados (PR Steward)
  • Doc-syncsync-docs no mesmo PR quando código mudar comportamento documentado

Checklist do agente

Spec Steward (SDD) — Checklist de conduta

Escopo permitido

  • docs/specs/**, docs/_meta/SDD_AND_HARNESS.md, scripts/harness/**
  • .github/workflows/spec-harness.yml, manifests de agentes ligados a SDD

Antes do PR (spec-before-code)

  • Spec *.spec.yaml existe com id, acceptance, status: active|draft
  • Acceptance em formato EARS (when + then verificável) quando aplicável
  • Clarify: ambiguidades da spec listadas e resolvidas com o humano antes de ativar (nunca deixar o agente "adivinhar")
  • ./scripts/harness/validate-specs.ps1 passa (inclui gate covered_by/evidence)
  • harness.commands / harness.scripts apontam para comandos reais
  • PR referencia Spec-Id: <id> no corpo quando há código de implementação

Skills (ordem sugerida)

  1. spec-validate
  2. harness-run (opcional -SpecId)
  3. spec-author (criar/atualizar spec a partir do template)
  4. sync-docs (PLATFORM_STATE, STATUS_FASES, FASE*.md)
  5. open-pr

Aderência

  • Critérios acceptance cobertos por testes ou scripts no harness
  • Spec não contradiz handoff C4 nem docs/backlog-api/FASE*.md
  • Territory data stays on instance (Core não persiste dados de território)

Proibido

  • Implementar feature de fase sem spec active ou draft revisada
  • Merge sem workflow spec-harness verde (quando paths SDD alterados)

Skills sugeridas (ordem)

  1. spec-validate
  2. spec-author
  3. harness-run
  4. sync-docs
  5. open-pr

Manifest

.agents/spec-steward.agent.yaml


Visível via agents.yml — artifact agent-activity.json. Merge continua humano.

@github-actions

github-actions Bot commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

Agente acionado: Backend Agent

ID: backend | Quando: 2026-08-10T04:15:08Z UTC | Gatilho: pull_request:synchronize
Workflow: 31354736088

Verificações automáticas de conduta

✅ Guardrail no_merge
✅ Guardrail require_ci (opcional por agente)
✅ Checklist de conduta (checklists/backend.checklist.md)
❌ Escopo de paths respeitado — fora do escopo: backend/Arah.Modules.Assets.Infrastructure/Postgres/PostgresAssetRepository.cs, backend/Arah.Modules.Assets/Application/Interfaces/ITerritoryAssetRepository.cs, backend/Arah.Modules.Assets/Domain/TerritoryAssetTypeMatch.cs, docs/CHANGELOG.md, docs/STATUS_FASES.md, docs/_meta/PHASE_QUEUE.yaml, docs/api/60_06_API_MAPA.md, docs/backlog-api/CORPOS_DAGUA_TERRITORIO.md, docs/specs/features/water-bodies-curation.spec.yaml, frontend/arah.app/lib/core/theme/app_design_tokens.dart, frontend/arah.app/lib/features/map/data/models/map_pin.dart, frontend/arah.app/lib/features/map/data/repositories/map_repository.dart, frontend/arah.app/lib/features/map/presentation/providers/map_pins_provider.dart, frontend/arah.app/lib/features/map/presentation/screens/map_screen.dart, frontend/arah.app/lib/l10n/app_en.arb, frontend/arah.app/lib/l10n/app_localizations.dart, frontend/arah.app/lib/l10n/app_localizations_en.dart, frontend/arah.app/lib/l10n/app_localizations_pt.dart, frontend/arah.app/lib/l10n/app_pt.arb

Conduta compartilhada

Conduta comum (todos os agentes)

  • Merge humano — nunca mergear em main sem aprovação explícita
  • Escopo mínimo — alterar apenas paths permitidos no manifest
  • Sem secrets — nada de tokens, senhas ou chaves no diff
  • PR obrigatório — todo código via branch + Pull Request
  • CI verde — gates passam antes de pedir review
  • Bots resolvidos — apontamentos de CodeRabbit/Dependabot tratados (PR Steward)
  • Doc-syncsync-docs no mesmo PR quando código mudar comportamento documentado

Checklist do agente

Backend Agent — Checklist de conduta

Escopo permitido

  • Alterações em backend/Arah.*, backend/Tests/** (inclui Arah.Core)
  • Sem mudanças em Flutter, wiki ou docs fora de sync-docs / spec

SDD (fases S0+)

  • PR inclui Spec-Id: <id> ou spec atualizada em docs/specs/
  • Clarify antes de implementar: ambiguidades da spec listadas e resolvidas (não adivinhar intenção)
  • ./scripts/agents/arah-agents.ps1 spec-validate passa
  • Critérios acceptance cobertos: status: covered exige covered_by anotado (dotnet test --filter FullyQualifiedName~Core se Core); status: manual exige evidence

Antes do PR

  • dotnet build e dotnet test passam localmente ou via CI
  • Clean Architecture respeitada (Domain não depende de Infrastructure)
  • Nomenclatura: territory, items, membership (nunca place/listings)
  • Territory sem lógica social embutida
  • BFF: jornada registrada em BffJourneyRegistry se aplicável
  • sync-docs quando contrato API ou regra de negócio mudou

Skills (ordem sugerida)

  1. run-tests (area backend)
  2. spec-validate / harness-run (se fase S0+ ou Arah.Core)
  3. register-bff-journey (se BFF alterado)
  4. sync-docs
  5. open-pr

Consultar quando Core/federação

  • Domain control-plane + specialist core-control-plane

Proibido

  • Commit direto em main
  • Araponga.* namespaces ou Araponga.sln
  • Lógica HTTP em Application/Domain

Skills sugeridas (ordem)

  1. run-tests
  2. register-bff-journey
  3. sync-docs
  4. spec-validate
  5. harness-run
  6. open-pr
  7. code-review
  8. craft-review

Manifest

.agents/backend.agent.yaml


Visível via agents.yml — artifact agent-activity.json. Merge continua humano.

@github-actions

github-actions Bot commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

Agente acionado: Solutions Architect (Uncle Bob)

ID: solutions-architect | Quando: 2026-08-10T04:15:09Z UTC | Gatilho: pull_request:synchronize
Workflow: 31354736088

Verificações automáticas de conduta

✅ Guardrail no_merge
✅ Guardrail require_ci (opcional por agente)
✅ Checklist de conduta (checklists/solutions-architect.checklist.md)
✅ Escopo de paths respeitado — fora do escopo: backend/Arah.Api.Bff/Journeys/BffJourneyRegistry.cs, backend/Arah.Modules.Assets.Infrastructure/Postgres/PostgresAssetRepository.cs, backend/Arah.Modules.Assets/Application/Interfaces/ITerritoryAssetRepository.cs, backend/Arah.Modules.Assets/Domain/TerritoryAssetTypeMatch.cs, backend/Tests/Arah.Tests/Api/ApiScenariosTests.cs, backend/Tests/Arah.Tests/Domain/Assets/TerritoryAssetTypeMatchTests.cs, docs/CHANGELOG.md, docs/STATUS_FASES.md, docs/_meta/PHASE_QUEUE.yaml, docs/api/60_06_API_MAPA.md, docs/backlog-api/CORPOS_DAGUA_TERRITORIO.md, docs/specs/features/water-bodies-curation.spec.yaml, frontend/arah.app/lib/core/theme/app_design_tokens.dart, frontend/arah.app/lib/features/map/data/models/map_pin.dart, frontend/arah.app/lib/features/map/data/repositories/map_repository.dart, frontend/arah.app/lib/features/map/presentation/providers/map_pins_provider.dart, frontend/arah.app/lib/features/map/presentation/screens/map_screen.dart, frontend/arah.app/lib/l10n/app_en.arb, frontend/arah.app/lib/l10n/app_localizations.dart, frontend/arah.app/lib/l10n/app_localizations_en.dart, frontend/arah.app/lib/l10n/app_localizations_pt.dart, frontend/arah.app/lib/l10n/app_pt.arb

Conduta compartilhada

Conduta comum (todos os agentes)

  • Merge humano — nunca mergear em main sem aprovação explícita
  • Escopo mínimo — alterar apenas paths permitidos no manifest
  • Sem secrets — nada de tokens, senhas ou chaves no diff
  • PR obrigatório — todo código via branch + Pull Request
  • CI verde — gates passam antes de pedir review
  • Bots resolvidos — apontamentos de CodeRabbit/Dependabot tratados (PR Steward)
  • Doc-syncsync-docs no mesmo PR quando código mudar comportamento documentado

Checklist do agente

Solutions Architect — Checklist de conduta

Papel (Uncle Bob)

  • Consultivo + diagramação — desenho antes/durante implementação; merge continua humano
  • Clean Architecture: dependências apontam para dentro
  • SOLID, YAGNI, KISS — sem abstração prematura
  • Territory geográfico neutro; membership fora de Territory

LikeC4 e diagramas

  • Modelo atualizado em docs/architecture/likec4/ ou docs/design/arah.likec4
  • Views refletem containers/camadas reais (não genérico)
  • Export: ./scripts/diagrams/export-likec4.ps1 (PNG + SVG com design system)
  • SVG/PNG em docs/architecture/diagrams/ referenciados no ADR ou FASE*.md

ADR e specs

  • Mudança estrutural → register-adr (arquivo + ADR-REGISTRY.yaml + índice)
  • Status proposed no PR; accepted após revisão humana
  • Spec-Id: no PR quando aplicável
  • Fronteiras Core vs instância respeitadas (FASE53+)

Skills (ordem sugerida)

  1. register-adr (se nova decisão ou fronteira)
  2. architecture-review
  3. likec4-export (se paths arquitetura/diagrama)
  4. spec-author (se nova fase ou contrato)
  5. code-review (orientativo)

Autonomia

  • Comentário consultivo publicado no PR/issue (consult_post)
  • Skills invocadas automaticamente quando CI coreografia dispara

Skills sugeridas (ordem)

  1. register-adr
  2. architecture-review
  3. craft-review
  4. likec4-export
  5. spec-author
  6. code-review

Manifest

.agents/solutions-architect.agent.yaml


Visível via agents.yml — artifact agent-activity.json. Merge continua humano.

@github-actions

github-actions Bot commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

Agente acionado: Flutter Agent

ID: flutter | Quando: 2026-08-10T04:15:11Z UTC | Gatilho: pull_request:synchronize
Workflow: 31354736088

Verificações automáticas de conduta

✅ Guardrail no_merge
✅ Guardrail require_ci (opcional por agente)
✅ Checklist de conduta (checklists/flutter.checklist.md)
❌ Escopo de paths respeitado — fora do escopo: backend/Arah.Api.Bff/Journeys/BffJourneyRegistry.cs, backend/Arah.Api/Contracts/Map/MapPinResponse.cs, backend/Arah.Api/Controllers/Map/MapController.cs, backend/Arah.Application/Models/MapPin.cs, backend/Arah.Application/Services/Map/MapPinsService.cs, backend/Arah.Infrastructure/InMemory/InMemoryAssetRepository.cs, backend/Arah.Modules.Assets.Infrastructure/Postgres/PostgresAssetRepository.cs, backend/Arah.Modules.Assets/Application/Interfaces/ITerritoryAssetRepository.cs, backend/Arah.Modules.Assets/Domain/TerritoryAssetTypeMatch.cs, backend/Tests/Arah.Tests/Api/ApiScenariosTests.cs, backend/Tests/Arah.Tests/Domain/Assets/TerritoryAssetTypeMatchTests.cs, docs/CHANGELOG.md, docs/STATUS_FASES.md, docs/_meta/PHASE_QUEUE.yaml, docs/api/60_06_API_MAPA.md, docs/backlog-api/CORPOS_DAGUA_TERRITORIO.md, docs/specs/features/water-bodies-curation.spec.yaml

Conduta compartilhada

Conduta comum (todos os agentes)

  • Merge humano — nunca mergear em main sem aprovação explícita
  • Escopo mínimo — alterar apenas paths permitidos no manifest
  • Sem secrets — nada de tokens, senhas ou chaves no diff
  • PR obrigatório — todo código via branch + Pull Request
  • CI verde — gates passam antes de pedir review
  • Bots resolvidos — apontamentos de CodeRabbit/Dependabot tratados (PR Steward)
  • Doc-syncsync-docs no mesmo PR quando código mudar comportamento documentado

Checklist do agente

Flutter Agent — Checklist de conduta

Escopo permitido

  • Alterações apenas em frontend/arah.app/**
  • App fala somente com BFF (BFF_BASE_URL)

Antes do PR

  • flutter analyze e flutter test passam
  • gen-l10n se strings .arb alteradas
  • Material 3 + tokens do design system (sem cores hardcoded)
  • Mobile-first; flutter_map 8.x usa MapOptions.onTap
  • sync-docs se fluxo de jornada ou contrato mudou

Skills (ordem sugerida)

  1. run-tests (area flutter)
  2. gen-l10n (se l10n)
  3. sync-docs
  4. open-pr

Proibido

  • Chamar API backend diretamente (bypass BFF)
  • Commit direto em main

Skills sugeridas (ordem)

  1. run-tests
  2. gen-l10n
  3. sync-docs
  4. open-pr
  5. code-review
  6. craft-review

Manifest

.agents/flutter.agent.yaml


Visível via agents.yml — artifact agent-activity.json. Merge continua humano.

@github-actions

github-actions Bot commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

Agente acionado: Review / QA Agent

ID: qa | Quando: 2026-08-10T04:15:12Z UTC | Gatilho: pull_request:synchronize
Workflow: 31354736088

Verificações automáticas de conduta

✅ Guardrail no_merge
✅ Guardrail require_ci (opcional por agente)
✅ Checklist de conduta (checklists/qa.checklist.md)
✅ Escopo de paths respeitado

Conduta compartilhada

Conduta comum (todos os agentes)

  • Merge humano — nunca mergear em main sem aprovação explícita
  • Escopo mínimo — alterar apenas paths permitidos no manifest
  • Sem secrets — nada de tokens, senhas ou chaves no diff
  • PR obrigatório — todo código via branch + Pull Request
  • CI verde — gates passam antes de pedir review
  • Bots resolvidos — apontamentos de CodeRabbit/Dependabot tratados (PR Steward)
  • Doc-syncsync-docs no mesmo PR quando código mudar comportamento documentado

Checklist do agente

QA Agent — Checklist de conduta

Papel

  • Comentar e orientarcomment_only; não altera código de produto
  • Revisar todo PR aberto

Checklist de review

  • Clean Architecture e SOLID
  • Testes para comportamento novo
  • Spec-Id e critérios acceptance atendidos (SDD)
  • Escopo atômico do PR
  • sync-docs aplicado
  • Mobile-first e acessibilidade (se UI)
  • Sem regressão óbvia

Skills

  1. code-review
  2. run-tests (área inferida do diff)
  3. spec-validate (se docs/specs/ ou Arah.Core no diff)

Referência

Skills sugeridas (ordem)

  1. code-review
  2. craft-review
  3. run-tests
  4. spec-validate
  5. harness-run

Manifest

.agents/qa.agent.yaml


Visível via agents.yml — artifact agent-activity.json. Merge continua humano.

@github-actions

github-actions Bot commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

Agente acionado: PR Steward (Review & Merge)

ID: pr-steward | Quando: 2026-08-10T04:15:13Z UTC | Gatilho: pull_request:synchronize
Workflow: 31354736088

Verificações automáticas de conduta

✅ Guardrail no_merge
✅ Guardrail require_ci (opcional por agente)
✅ Checklist de conduta (checklists/pr-steward.checklist.md)
❌ Escopo de paths respeitado — fora do escopo: backend/Arah.Api.Bff/Journeys/BffJourneyRegistry.cs, backend/Arah.Api/Contracts/Map/MapPinResponse.cs, backend/Arah.Api/Controllers/Map/MapController.cs, backend/Arah.Application/Models/MapPin.cs, backend/Arah.Application/Services/Map/MapPinsService.cs, backend/Arah.Infrastructure/InMemory/InMemoryAssetRepository.cs, backend/Arah.Modules.Assets.Infrastructure/Postgres/PostgresAssetRepository.cs, backend/Arah.Modules.Assets/Application/Interfaces/ITerritoryAssetRepository.cs, backend/Arah.Modules.Assets/Domain/TerritoryAssetTypeMatch.cs, backend/Tests/Arah.Tests/Api/ApiScenariosTests.cs, backend/Tests/Arah.Tests/Domain/Assets/TerritoryAssetTypeMatchTests.cs, docs/CHANGELOG.md, docs/STATUS_FASES.md, docs/_meta/PHASE_QUEUE.yaml, docs/api/60_06_API_MAPA.md, docs/backlog-api/CORPOS_DAGUA_TERRITORIO.md, frontend/arah.app/lib/core/theme/app_design_tokens.dart, frontend/arah.app/lib/features/map/data/models/map_pin.dart, frontend/arah.app/lib/features/map/data/repositories/map_repository.dart, frontend/arah.app/lib/features/map/presentation/providers/map_pins_provider.dart, frontend/arah.app/lib/features/map/presentation/screens/map_screen.dart, frontend/arah.app/lib/l10n/app_en.arb, frontend/arah.app/lib/l10n/app_localizations.dart, frontend/arah.app/lib/l10n/app_localizations_en.dart, frontend/arah.app/lib/l10n/app_localizations_pt.dart, frontend/arah.app/lib/l10n/app_pt.arb

Conduta compartilhada

Conduta comum (todos os agentes)

  • Merge humano — nunca mergear em main sem aprovação explícita
  • Escopo mínimo — alterar apenas paths permitidos no manifest
  • Sem secrets — nada de tokens, senhas ou chaves no diff
  • PR obrigatório — todo código via branch + Pull Request
  • CI verde — gates passam antes de pedir review
  • Bots resolvidos — apontamentos de CodeRabbit/Dependabot tratados (PR Steward)
  • Doc-syncsync-docs no mesmo PR quando código mudar comportamento documentado

Checklist do agente

PR Steward — Checklist de conduta

Obrigatório antes de merge

  • Todo apontamento de bot resolvido ou respondido explicitamente
  • CI verde (build, testes, Agents Gates, CodeQL, spec-harness se SDD)
  • Spec-Id presente e spec válida quando Arah.Core ou docs/specs/ no PR
  • Label ready-for-merge só quando pr-ready passa
  • Merge continua humano (no_merge: true)

Skills

  1. address-bot-review
  2. spec-validate / harness-run (paths SDD/Core)
  3. code-review (orientativo)
  4. next-phase (após merge em main)

Referência

Skills sugeridas (ordem)

  1. address-bot-review
  2. respond-bot-review
  3. code-review
  4. run-tests
  5. spec-validate
  6. harness-run
  7. sync-docs
  8. next-phase
  9. open-pr

Manifest

.agents/pr-steward.agent.yaml


Visível via agents.yml — artifact agent-activity.json. Merge continua humano.

@github-actions

github-actions Bot commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

Parecer de domínio: Domain — Mapa, Lugares & Assets Territoriais

ID: mapa-lugares | Quando: 2026-08-10T04:15:17Z UTC | Gatilho: choreography-ci

Enriquecimento (negócio)

O mapa é a leitura do território real: entidades de mapa e assets curados
representam lugares vivos (rios, córregos, nascentes, fontes, trilhas, feiras,
pontos de cuidado). Corpos d'água (WaterBody = alias de produto/API para
NaturalAsset tipado RIVER|STREAM|SPRING|WATERFALL|POTABLE_WATER) são entidades
escopadas por territoryId — nunca campos de Territory. MapEntity é neutra como
o Territory — a curadoria (capability Curator) é camada social separada.
Geolocalização de pessoas é dado sensível; o mapa mostra o lugar, não rastreia
quem passa por ele. Nascentes e captações podem exigir sensitivity HIGH /
access RESTRICTED (filtragem server-side em list/get/pins).

Validar no PR

  • Lat/lng validados em ranges válidos (-90..90 / -180..180)
  • MapEntity/asset/corpo d'água escopados por territoryId; sem vazamento entre territórios
  • Curadoria de assets exige capability Curator verificada no servidor
  • Assets com sensitivity HIGH / access RESTRICTED: autorização de leitura no servidor; omitir pin/coordenadas se não autorizado (Curator ≠ leitura automática)
  • Assets hídricos nunca expostos como item de marketplace
  • Flutter acessa backend só via BFF (--dart-define=BFF_BASE_URL=...); sem URL direta da API
  • Nenhuma localização pessoal contínua persistida (sem tracking de usuários)
  • Paginação/bounding-box em consultas geoespaciais; sem N+1

Arquivos relacionados

  • backend/Arah.Api.Bff/Journeys/BffJourneyRegistry.cs
  • backend/Arah.Api/Contracts/Map/MapPinResponse.cs
  • backend/Arah.Api/Controllers/Map/MapController.cs
  • backend/Arah.Application/Models/MapPin.cs
  • backend/Arah.Application/Services/Map/MapPinsService.cs
  • backend/Arah.Infrastructure/InMemory/InMemoryAssetRepository.cs
  • backend/Arah.Modules.Assets.Infrastructure/Postgres/PostgresAssetRepository.cs
  • backend/Arah.Modules.Assets/Application/Interfaces/ITerritoryAssetRepository.cs

Referências

  • docs/backend/12_DOMAIN_MODEL.md
  • docs/product/05_GLOSSARY.md
  • docs/backlog-api/CORPOS_DAGUA_TERRITORIO.md
  • docs/funcional/09_ASSETS.md
  • docs/specs/features/water-bodies-curation.spec.yaml
  • docs/api/60_08_API_ASSETS.md

Autonomia via coreografia (.agents/choreography.yaml). Agente consultivo — não altera código.

@github-actions

github-actions Bot commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

Parecer de domínio: Domain — Design & Experiência (UX/UI)

ID: design-ux | Quando: 2026-08-10T04:15:18Z UTC | Gatilho: choreography-ci

Enriquecimento (negócio)

Design de baixa excitação, silêncio funcional e ação consciente — território
como referência visual. High-premium = consistência entre superfícies, tokens
como fonte única (web e Flutter), hierarquia clara e acessível. Mobile-first
obrigatório. Cores sempre via variáveis/tokens, nunca hardcoded. Toda revisão
captura lição (LICOES_APRENDIDAS) e evolui as diretrizes.

Validar no PR

  • Sem cores hardcoded (hex/rgb ou Tailwind arbitrárias) — usa var(--...), classes configuradas ou AppDesignTokens/AppColors no Flutter
  • Mobile-first: base sem media query; ajustes em @media (min-width) / lg:
  • Espaçamento e tipografia via tokens (escala 8px); sem px arbitrário
  • Contraste WCAG AA; focus-visible; navegação por teclado; alvo de toque >= 44px
  • HTML semântico + aria-label/alt; sem CSS/JS inline
  • Tokens de marca consistentes entre web e app (glass, raio, cores) — sem deriva por plataforma
  • Estados cobertos: loading, vazio, erro, foco, hover, desabilitado
  • Lição registrada em docs/LICOES_APRENDIDAS.md quando a revisão achar padrão recorrente

Arquivos relacionados

  • backend/Arah.Api.Bff/Journeys/BffJourneyRegistry.cs
  • backend/Arah.Api/Contracts/Map/MapPinResponse.cs
  • backend/Arah.Api/Controllers/Map/MapController.cs
  • backend/Arah.Application/Models/MapPin.cs
  • backend/Arah.Application/Services/Map/MapPinsService.cs
  • backend/Arah.Infrastructure/InMemory/InMemoryAssetRepository.cs
  • backend/Arah.Modules.Assets.Infrastructure/Postgres/PostgresAssetRepository.cs
  • backend/Arah.Modules.Assets/Application/Interfaces/ITerritoryAssetRepository.cs

Referências

  • docs/DESIGN_SYSTEM_IDENTIDADE_VISUAL.md
  • docs/CURSOR_DESIGN_RULES.md
  • docs/REVISAO_ARTE_DESIGN_WIKI.md
  • docs/LICOES_APRENDIDAS.md
  • docs/design/AUDITORIA_DESIGN.md

Autonomia via coreografia (.agents/choreography.yaml). Agente consultivo — não altera código.

@github-actions

Copy link
Copy Markdown
Contributor

Orquestrador Arah — PR

Agente principal: backend — Backend Agent
Skills sugeridas: run-tests, register-bff-journey, sync-docs, spec-validate, harness-run, open-pr, code-review, craft-review

Agentes por paths alterados:

  • backend (8 arquivo(s))
  • design-ux (10 arquivo(s))
  • docs-steward (6 arquivo(s))
  • flutter (10 arquivo(s))
  • mapa-lugares (12 arquivo(s))
  • planner (4 arquivo(s))
  • pr-steward (1 arquivo(s))
  • solutions-architect (8 arquivo(s))
  • spec-steward (1 arquivo(s))

Pareceres de domínio: mapa-lugares, design-ux
Regras de coreografia: map-places, specs-sdd, design-ux, craft-backend, craft-flutter, pr-always
Agentes co-ativados: spec-steward, backend, solutions-architect, flutter, qa, pr-steward

QA agent revisará este PR (checklist em .agents/qa.agent.yaml).

Use .agents/templates/pr-body.md no corpo do PR.


Automático via agents.yml.

@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: a3633fcb10

ℹ️ 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".

Comment on lines +141 to +143
query = query.Where(asset =>
typeList.Contains(asset.Type) ||
(asset.Subtype != null && typeList.Contains(asset.Subtype)));

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Preserve type-only filtering for the assets API

When a territory contains a new type=natural, subtype=river asset, this shared predicate also returns it from GET /api/v1/assets?types=river, because AssetsController passes that endpoint's types directly through TerritoryAssetService. That endpoint previously and documentarily filters TerritoryAsset.Type, and Assets_ListFiltersByIdAndType asserts that every result has Type == "river", so existing clients can now unexpectedly receive Type == "natural"; keep subtype matching confined to the map's assetTypes path or separate the repository predicates.

AGENTS.md reference: AGENTS.md:L19-L19

Useful? React with 👍 / 👎.

Comment on lines +44 to +47
return repo.getPins(
territoryId: territoryId,
types: 'asset',
assetSubtypes: kWaterBodySubtypesCsv,

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Include legacy water assets in the water-body chip

When a territory contains pre-WA-E1 assets stored as Type=river or Type=spring with a null subtype, selecting this chip sends only assetSubtypes; the server's subtype predicate requires a non-null Subtype, so those existing water pins disappear. The subtype migration only added a nullable column without backfilling old rows, while the new assetTypes behavior was explicitly implemented to match either legacy types or WA-E1 subtypes, so the chip should use that compatibility filter.

Useful? React with 👍 / 👎.

@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: 3

🧹 Nitpick comments (1)
backend/Arah.Modules.Assets.Infrastructure/Postgres/PostgresAssetRepository.cs (1)

118-164: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Split BuildQuery into focused filter helpers.

Lines 118-164 combine identity, classification, status, and text filtering in one 47-line method. Extract focused helpers that compose the same IQueryable<TerritoryAssetRecord>.

As per coding guidelines, “Cada classe ou função deve ter uma responsabilidade; prefira funções com menos de 20 linhas”.

🤖 Prompt for 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.

In
`@backend/Arah.Modules.Assets.Infrastructure/Postgres/PostgresAssetRepository.cs`
around lines 118 - 164, Split BuildQuery into focused private filter helpers for
identity, type/subtype classification, status, and text search, keeping
BuildQuery responsible only for composing them. Preserve the existing filtering
semantics and normalization behavior, including the legacy type-or-subtype
matching, while keeping each helper under 20 lines.

Source: Coding guidelines

🤖 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 `@backend/Tests/Arah.Tests/Api/ApiScenariosTests.cs`:
- Around line 1172-1178: Update the test flow before the curator actions in the
scenario containing CurateAssetApprovedAsync to query the map endpoint with
types=asset and the riverAsset.Id while the asset is still pending, and assert
that the response contains no results. Keep the existing post-curation
assertions unchanged so the test covers both the Active gate before curation and
visibility after approval.

In `@backend/Tests/Arah.Tests/Domain/Assets/TerritoryAssetTypeMatchTests.cs`:
- Around line 8-35: Add mixed-case assertions to the existing
Matches_Types_MatchesTypeOrSubtype, Matches_Subtypes_RequiresSubtype, and
Matches_TypesAndSubtypes_AppliesBoth tests, varying casing across Type, Subtype,
types, and subtypes while preserving the expected true and false outcomes. Cover
both matching and non-matching mixed-case inputs to verify case-insensitive
behavior.

In `@docs/backlog-api/CORPOS_DAGUA_TERRITORIO.md`:
- Line 83: Update the WA-E2 backlog entry to replace the English “follow-up”
wording with the Portuguese term “acompanhamento” or “continuação,” while
preserving the rest of the entry unchanged.

---

Nitpick comments:
In
`@backend/Arah.Modules.Assets.Infrastructure/Postgres/PostgresAssetRepository.cs`:
- Around line 118-164: Split BuildQuery into focused private filter helpers for
identity, type/subtype classification, status, and text search, keeping
BuildQuery responsible only for composing them. Preserve the existing filtering
semantics and normalization behavior, including the legacy type-or-subtype
matching, while keeping each helper under 20 lines.
🪄 Autofix

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

Review profile: CHILL

Plan: Pro Plus

Run ID: 7db8c908-f6e5-4c9e-b8e1-be759586d2dd

📥 Commits

Reviewing files that changed from the base of the PR and between 18ad9cd and a3633fc.

📒 Files selected for processing (27)
  • backend/Arah.Api.Bff/Journeys/BffJourneyRegistry.cs
  • backend/Arah.Api/Contracts/Map/MapPinResponse.cs
  • backend/Arah.Api/Controllers/Map/MapController.cs
  • backend/Arah.Application/Models/MapPin.cs
  • backend/Arah.Application/Services/Map/MapPinsService.cs
  • backend/Arah.Infrastructure/InMemory/InMemoryAssetRepository.cs
  • backend/Arah.Modules.Assets.Infrastructure/Postgres/PostgresAssetRepository.cs
  • backend/Arah.Modules.Assets/Application/Interfaces/ITerritoryAssetRepository.cs
  • backend/Arah.Modules.Assets/Domain/TerritoryAssetTypeMatch.cs
  • backend/Tests/Arah.Tests/Api/ApiScenariosTests.cs
  • backend/Tests/Arah.Tests/Domain/Assets/TerritoryAssetTypeMatchTests.cs
  • docs/CHANGELOG.md
  • docs/STATUS_FASES.md
  • docs/_meta/PHASE_QUEUE.yaml
  • docs/api/60_06_API_MAPA.md
  • docs/backlog-api/CORPOS_DAGUA_TERRITORIO.md
  • docs/specs/features/water-bodies-curation.spec.yaml
  • frontend/arah.app/lib/core/theme/app_design_tokens.dart
  • frontend/arah.app/lib/features/map/data/models/map_pin.dart
  • frontend/arah.app/lib/features/map/data/repositories/map_repository.dart
  • frontend/arah.app/lib/features/map/presentation/providers/map_pins_provider.dart
  • frontend/arah.app/lib/features/map/presentation/screens/map_screen.dart
  • frontend/arah.app/lib/l10n/app_en.arb
  • frontend/arah.app/lib/l10n/app_localizations.dart
  • frontend/arah.app/lib/l10n/app_localizations_en.dart
  • frontend/arah.app/lib/l10n/app_localizations_pt.dart
  • frontend/arah.app/lib/l10n/app_pt.arb

Comment thread backend/Tests/Arah.Tests/Api/ApiScenariosTests.cs
Comment thread docs/backlog-api/CORPOS_DAGUA_TERRITORIO.md Outdated
typesOrSubtypes só no map/pins; GET /assets?types= permanece Type-only.
Testes: gate Active pré-curadoria, casing misto; docs em PT.

Co-authored-by: Cursor <cursoragent@cursor.com>
@sraphaz
sraphaz merged commit f18b208 into main Aug 10, 2026
14 of 16 checks passed

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
backend/Arah.Modules.Assets/Domain/TerritoryAssetTypeMatch.cs (1)

48-59: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Use one representation for no normalized filter.

NormalizeFilter returns null for absent input but an empty collection when all values are blank; public methods in this codebase must not return null. A blank-only filter also behaves differently between repositories: PostgreSQL treats each empty normalized IN list as no match, while InMemory skips the class filter entirely. Return Array.Empty<string>() for absent and blank-only input, and update all callers to apply filters only when Count > 0. Add regression coverage for null, empty, and blank-only inputs.

🤖 Prompt for 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.

In `@backend/Arah.Modules.Assets/Domain/TerritoryAssetTypeMatch.cs` around lines
48 - 59, The NormalizeFilter method should use Array.Empty<string>()
consistently for null, empty, and blank-only inputs instead of returning null.
Update every caller of NormalizeFilter to apply the class filter only when the
normalized collection has Count > 0, preserving consistent behavior across
PostgreSQL and InMemory repositories. Add regression coverage for null, empty,
and blank-only inputs.

Source: Coding guidelines

backend/Arah.Modules.Assets.Infrastructure/Postgres/PostgresAssetRepository.cs (1)

158-180: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Make PostgreSQL classification filtering case-insensitive.

TerritoryAsset.Type and Subtype are stored as varchar and can contain non-normalized casing, while the Postgres filters compare lowercase filter values with raw column values. Normalize the database expressions, such as ToLowerInvariant(), or normalize values during persistence, so PostgreSQL matches TerritoryAssetTypeMatch.Matches behavior.

🤖 Prompt for 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.

In
`@backend/Arah.Modules.Assets.Infrastructure/Postgres/PostgresAssetRepository.cs`
around lines 158 - 180, Update the type and subtype predicates in the
repository’s filtering logic to compare normalized database values against the
normalized filter lists, including both the individual filters and
normalizedTypesOrSubtypes. Preserve the existing null checks and legacy
type-or-subtype matching while ensuring casing matches
TerritoryAssetTypeMatch.Matches behavior.
🧹 Nitpick comments (1)
backend/Arah.Modules.Assets.Infrastructure/Postgres/PostgresAssetRepository.cs (1)

152-184: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Split the multi-stage filter pipelines.

  • backend/Arah.Modules.Assets.Infrastructure/Postgres/PostgresAssetRepository.cs#L152-L184: Extract type, subtype, and combined classification predicates into separate helpers.
  • backend/Arah.Infrastructure/InMemory/InMemoryAssetRepository.cs#L127-L170: Extract identity, classification, status, and search stages into separate helpers.

This keeps each method below the preferred size and makes provider behavior easier to compare.

As per coding guidelines, “Cada classe ou função deve ter uma responsabilidade; prefira funções com menos de 20 linhas”.

🤖 Prompt for 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.

In
`@backend/Arah.Modules.Assets.Infrastructure/Postgres/PostgresAssetRepository.cs`
around lines 152 - 184, Split the filtering pipeline into focused helper
methods. In
backend/Arah.Modules.Assets.Infrastructure/Postgres/PostgresAssetRepository.cs:152-184,
extract the type, subtype, and combined classification predicates from
ApplyClassificationFilters into separate helpers while preserving behavior. In
backend/Arah.Infrastructure/InMemory/InMemoryAssetRepository.cs:127-170, extract
the identity, classification, status, and search stages into separate helpers,
with no direct changes required to the Postgres helpers beyond their extraction.

Source: Coding guidelines

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

Outside diff comments:
In
`@backend/Arah.Modules.Assets.Infrastructure/Postgres/PostgresAssetRepository.cs`:
- Around line 158-180: Update the type and subtype predicates in the
repository’s filtering logic to compare normalized database values against the
normalized filter lists, including both the individual filters and
normalizedTypesOrSubtypes. Preserve the existing null checks and legacy
type-or-subtype matching while ensuring casing matches
TerritoryAssetTypeMatch.Matches behavior.

In `@backend/Arah.Modules.Assets/Domain/TerritoryAssetTypeMatch.cs`:
- Around line 48-59: The NormalizeFilter method should use Array.Empty<string>()
consistently for null, empty, and blank-only inputs instead of returning null.
Update every caller of NormalizeFilter to apply the class filter only when the
normalized collection has Count > 0, preserving consistent behavior across
PostgreSQL and InMemory repositories. Add regression coverage for null, empty,
and blank-only inputs.

---

Nitpick comments:
In
`@backend/Arah.Modules.Assets.Infrastructure/Postgres/PostgresAssetRepository.cs`:
- Around line 152-184: Split the filtering pipeline into focused helper methods.
In
backend/Arah.Modules.Assets.Infrastructure/Postgres/PostgresAssetRepository.cs:152-184,
extract the type, subtype, and combined classification predicates from
ApplyClassificationFilters into separate helpers while preserving behavior. In
backend/Arah.Infrastructure/InMemory/InMemoryAssetRepository.cs:127-170, extract
the identity, classification, status, and search stages into separate helpers,
with no direct changes required to the Postgres helpers beyond their extraction.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: c567835b-c64a-48ef-9839-79401990a0c0

📥 Commits

Reviewing files that changed from the base of the PR and between a3633fc and 4a315ef.

📒 Files selected for processing (12)
  • backend/Arah.Application/Services/Map/MapPinsService.cs
  • backend/Arah.Infrastructure/InMemory/InMemoryAssetRepository.cs
  • backend/Arah.Modules.Assets.Infrastructure/Postgres/PostgresAssetRepository.cs
  • backend/Arah.Modules.Assets/Application/Interfaces/ITerritoryAssetRepository.cs
  • backend/Arah.Modules.Assets/Domain/TerritoryAssetTypeMatch.cs
  • backend/Tests/Arah.Tests/Api/ApiScenariosTests.cs
  • backend/Tests/Arah.Tests/Domain/Assets/TerritoryAssetTypeMatchTests.cs
  • docs/CHANGELOG.md
  • docs/api/60_06_API_MAPA.md
  • docs/backlog-api/CORPOS_DAGUA_TERRITORIO.md
  • frontend/arah.app/lib/features/map/data/repositories/map_repository.dart
  • frontend/arah.app/lib/features/map/presentation/providers/map_pins_provider.dart
🚧 Files skipped from review as they are similar to previous changes (7)
  • frontend/arah.app/lib/features/map/data/repositories/map_repository.dart
  • backend/Arah.Modules.Assets/Application/Interfaces/ITerritoryAssetRepository.cs
  • docs/backlog-api/CORPOS_DAGUA_TERRITORIO.md
  • backend/Tests/Arah.Tests/Api/ApiScenariosTests.cs
  • frontend/arah.app/lib/features/map/presentation/providers/map_pins_provider.dart
  • docs/api/60_06_API_MAPA.md
  • backend/Arah.Application/Services/Map/MapPinsService.cs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-for-merge PR aprovado pelo steward; merge humano

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant