From 93d22ffd168dfef0fa31b92ad8df9a3159f708f4 Mon Sep 17 00:00:00 2001 From: aarroyo Date: Mon, 13 Jul 2026 11:08:00 -0500 Subject: [PATCH 1/4] =?UTF-8?q?fix(infra):=20wire=20tracker-api=20?= =?UTF-8?q?=E2=86=92=20real=20Core=20+=20MasterDataDb=20on=20local=20kind?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Deploying the Tracker onto the same kind cluster as the Evolith Core, wired to the REAL stateless Core (not the default stub), verified end-to-end. - values-local: coreApi/agentRuntime baseUrl → the real in-cluster services in the evolith-local namespace (cross-namespace FQDN); existingSecretName supplies the API key the Core requires (401 otherwise). - deployment: wire ConnectionStrings__MasterDataDb (the tenant-projection context, DS-07). It was unset, so TenantProjectionMigrator defaulted to localhost:5432 and crashlooped; now it shares the local Tracker Postgres (a dedicated DB is a prod concern). Verified on kind: POST /api/core/evaluate → real POST core-api /api/v1/evaluate (SecurityAudit 200 ALLOW, from the tracker pod) → CoreEvaluationTransaction persisted (status=completed) in tracker_governance.core_evaluation_transactions. Co-Authored-By: Claude Opus 4.8 --- .../evolith-tracker-api/templates/deployment.yaml | 8 ++++++++ .../infra/helm/evolith-tracker-api/values-local.yaml | 11 +++++++++-- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/product/infra/helm/evolith-tracker-api/templates/deployment.yaml b/product/infra/helm/evolith-tracker-api/templates/deployment.yaml index f88b26a5..a5717da8 100644 --- a/product/infra/helm/evolith-tracker-api/templates/deployment.yaml +++ b/product/infra/helm/evolith-tracker-api/templates/deployment.yaml @@ -47,6 +47,14 @@ spec: secretKeyRef: name: {{ include "evolith-tracker-api.fullname" . }}-db key: ConnectionStrings__DefaultConnection + # MasterData/tenant-projection context (DS-07). Without this it defaults to + # localhost and the TenantProjectionMigrator crashloops. In-cluster (broker-less + # local) it shares the Tracker Postgres; a dedicated DB is a prod concern. + - name: ConnectionStrings__MasterDataDb + valueFrom: + secretKeyRef: + name: {{ include "evolith-tracker-api.fullname" . }}-db + key: ConnectionStrings__DefaultConnection {{- if .Values.coreApi.existingSecretName }} - name: CoreApi__ApiKey valueFrom: diff --git a/product/infra/helm/evolith-tracker-api/values-local.yaml b/product/infra/helm/evolith-tracker-api/values-local.yaml index 89c3cd38..b817f91a 100644 --- a/product/infra/helm/evolith-tracker-api/values-local.yaml +++ b/product/infra/helm/evolith-tracker-api/values-local.yaml @@ -12,10 +12,17 @@ replicaCount: 1 # Point at the local in-cluster upstreams. These default to unreachable stubs # for a standalone Tracker deploy; the BFF still starts and /health is green. +# Point at the REAL Core services running in the evolith-local namespace (same kind +# cluster, cross-namespace via FQDN). The Core requires the API key (401 otherwise), +# supplied from a secret in this namespace. coreApi: - baseUrl: http://evolith-core-api/api/v1 + baseUrl: http://evolith-core-api-evolith-core-api.evolith-local.svc.cluster.local/api/v1 + existingSecretName: tracker-core-auth + apiKeyKey: EVOLITH_API_KEY agentRuntime: - baseUrl: http://evolith-agent-runtime/v1 + baseUrl: http://evolith-runtime-evolith-agent-runtime.evolith-local.svc.cluster.local/v1 + existingSecretName: tracker-runtime-auth + apiKeyKey: AGENT_RUNTIME_API_KEY auth: provider: dev-bypass From 72016c2a1007919d0c808374e9aadb9fa7633b04 Mon Sep 17 00:00:00 2001 From: aarroyo Date: Mon, 13 Jul 2026 11:27:53 -0500 Subject: [PATCH 2/4] ci(backend): disambiguate EF migrate step per DbContext (fixes pre-existing break) DS-07 introduced a second DbContext (TenantProjectionDbContext for the MasterData tenant-projection schema) alongside TrackerDbContext, but the 'Apply EF Core migrations' step still ran 'dotnet ef database update' with no --context. dotnet-ef aborts with 'More than one DbContext was found', which was red on main for every PR. Apply each context explicitly against the CI DB. Co-Authored-By: Claude Opus 4.8 --- .github/workflows/ci.yml | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5163b725..f483d0e0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -69,10 +69,16 @@ jobs: run: | dotnet tool install --global dotnet-ef export PATH="$PATH:$HOME/.dotnet/tools" - dotnet ef database update \ - --project Tracker.Infrastructure \ - --startup-project Tracker.Presentation \ - --configuration Release + # Two DbContexts exist (DS-07 added TenantProjectionDbContext for the + # MasterData tenant-projection schema). `database update` is ambiguous + # without --context, so apply each explicitly against the same DB. + for ctx in TrackerDbContext TenantProjectionDbContext; do + dotnet ef database update \ + --context "$ctx" \ + --project Tracker.Infrastructure \ + --startup-project Tracker.Presentation \ + --configuration Release + done - name: Test run: dotnet test Tracker.sln --no-build -c Release --logger "trx;LogFileName=test-results.trx" From 219700e862f1055421b63ec82d6b834ffc123ec9 Mon Sep 17 00:00:00 2001 From: aarroyo Date: Mon, 13 Jul 2026 11:30:30 -0500 Subject: [PATCH 3/4] ci(backend): supply MasterDataDb connection for TenantProjectionDbContext MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit After disambiguating the EF migrate step, TenantProjectionDbContext (DS-07) failed with 28P01 auth against user 'postgres' because ConnectionStrings__MasterDataDb was unset and defaulted to localhost/postgres. Point it at the same CI Postgres (as DefaultConnection) — the CI analog of the local-kind Helm wiring in this PR. Co-Authored-By: Claude Opus 4.8 --- .github/workflows/ci.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f483d0e0..0360ed64 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -43,6 +43,9 @@ jobs: # so the DB-availability probe passes and the integration tests run for real. EVOLITH_TRACKER_DB: "Host=localhost;Port=5432;Database=evolith_tracker;Username=evolith;Password=localdev" ConnectionStrings__DefaultConnection: "Host=localhost;Port=5432;Database=evolith_tracker;Username=evolith;Password=localdev" + # TenantProjectionDbContext (DS-07) reads MasterDataDb; unset it defaults to + # localhost/user "postgres" and auth fails. Share the CI Postgres like local. + ConnectionStrings__MasterDataDb: "Host=localhost;Port=5432;Database=evolith_tracker;Username=evolith;Password=localdev" DOTNET_NOLOGO: "true" DOTNET_CLI_TELEMETRY_OPTOUT: "true" From 4fd5781a7b910dee7d447f536795674ef117e0d0 Mon Sep 17 00:00:00 2001 From: aarroyo Date: Mon, 13 Jul 2026 11:34:26 -0500 Subject: [PATCH 4/4] ci(backend): pass --connection to EF migrate so TenantProjection targets CI DB Setting ConnectionStrings__MasterDataDb env was insufficient: at design time GetConnectionString("MasterDataDb") still resolves null and the context falls back to localhost/postgres (28P01). Pass --connection explicitly to dotnet ef so both contexts apply against the CI Postgres deterministically. Co-Authored-By: Claude Opus 4.8 --- .github/workflows/ci.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0360ed64..9e326fc5 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -74,10 +74,14 @@ jobs: export PATH="$PATH:$HOME/.dotnet/tools" # Two DbContexts exist (DS-07 added TenantProjectionDbContext for the # MasterData tenant-projection schema). `database update` is ambiguous - # without --context, so apply each explicitly against the same DB. + # without --context. Pass --connection explicitly so both apply against + # the CI Postgres regardless of design-time config resolution (the + # TenantProjection context otherwise falls back to localhost/postgres). + CI_CONN="Host=localhost;Port=5432;Database=evolith_tracker;Username=evolith;Password=localdev" for ctx in TrackerDbContext TenantProjectionDbContext; do dotnet ef database update \ --context "$ctx" \ + --connection "$CI_CONN" \ --project Tracker.Infrastructure \ --startup-project Tracker.Presentation \ --configuration Release