test: postgres harness no longer provisions at the live stage Prüfwerk #108

Merged
sharang merged 1 commits from fix/tests-no-stage-calls into main 2026-10-30 07:58:35 +00:00
Owner

Side finding (29 Oct): pruefwerk-agent-stage logged platform token rejected: failed to decode JWT header: InvalidToken about 12 times per burst.

Diagnosis (SigNoz):

  • The 401s were root spans (no traceparent), always 5× POST /api/v1/platform/tenants/{id}/provision and then 1× GET …/targets, spread over ~4 minutes, at irregular times.
  • They matched the registry test runs: CI on #106 at 17:15 UTC, and my local suite run at 17:33 UTC.

Cause:

  • The migrations seed the real catalog URLs (0005: https://pruefwerk-stage.breakpilot.com/api/v1/platform/tenants/{id}/provision).
  • The test config's Env: "dev" reads as stage in Server.env().
  • So every postgres test that activates Prüfwerk for a tenant provisioned at the live stage Prüfwerk, using the Keycloak mock's non-JWT token. The memory store has no provision URLs, so its half of the tests never did.

Fix: newPostgresHarness clears provision_urls after migrating, so both stores behave the same, and tests that need a URL set it themselves. The tests no longer depend on the network, and they no longer send fictitious test tenants to stage.

Checked: the full suite passes (memory + postgres via testcontainers), and that local run left no request in pruefwerk-agent-stage's traces (before: 6 per run).

🤖 Generated with Claude Code

https://claude.ai/code/session_01KYcAAeTw22GE9QPzDM8yc4

Side finding (29 Oct): `pruefwerk-agent-stage` logged `platform token rejected: failed to decode JWT header: InvalidToken` about 12 times per burst. **Diagnosis (SigNoz):** - The 401s were root spans (no traceparent), always 5× `POST /api/v1/platform/tenants/{id}/provision` and then 1× `GET …/targets`, spread over ~4 minutes, at irregular times. - They matched the registry test runs: CI on #106 at 17:15 UTC, and my local suite run at 17:33 UTC. **Cause:** - The migrations seed the real catalog URLs (0005: `https://pruefwerk-stage.breakpilot.com/api/v1/platform/tenants/{id}/provision`). - The test config's `Env: "dev"` reads as `stage` in `Server.env()`. - So every **postgres** test that activates Prüfwerk for a tenant provisioned at the live stage Prüfwerk, using the Keycloak mock's non-JWT token. The memory store has no provision URLs, so its half of the tests never did. **Fix:** `newPostgresHarness` clears `provision_urls` after migrating, so both stores behave the same, and tests that need a URL set it themselves. The tests no longer depend on the network, and they no longer send fictitious test tenants to stage. **Checked:** the full suite passes (memory + postgres via testcontainers), and that local run left **no** request in pruefwerk-agent-stage's traces (before: 6 per run). 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01KYcAAeTw22GE9QPzDM8yc4
sharang added 1 commit 2026-10-30 07:31:06 +00:00
test: postgres harness no longer provisions at the live stage Prüfwerk
ci / shared (pull_request) Successful in 16s
ci / test (pull_request) Successful in 26m58s
ci / image (pull_request) Skipped
e8fc5c4293
pruefwerk-agent-stage logged 'platform token rejected: failed to decode
JWT header' in bursts of five provisions and one targets read, each time
the registry's tests ran (CI and local). The migrations seed the real
provision URLs (0005: pruefwerk-stage), a test config's env 'dev' reads
as 'stage', so every postgres test that provisioned a tenant called the
live endpoint with the Keycloak mock's non-JWT token and got 401.

The postgres harness clears provision_urls after migrating, as the
memory store has none; tests that need one set it themselves. Checked:
a full local run with postgres left no request in Prüfwerk's traces.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KYcAAeTw22GE9QPzDM8yc4
sharang force-pushed fix/tests-no-stage-calls from 1442355a52 to e8fc5c4293 2026-10-30 07:31:06 +00:00 Compare
sharang changed title from test: the postgres harness no longer provisions at the live stage Prüfwerk to test: postgres harness no longer provisions at the live stage Prüfwerk 2026-10-30 07:31:12 +00:00
sharang merged commit 1691bf1be3 into main 2026-10-30 07:58:35 +00:00
Sign in to join this conversation.