🐛 fix(bdd): revert PR #26 schema isolation + add cache flush + sequential CI tests #28
Reference in New Issue
Block a user
Delete Branch "fix/bdd-cache-flush-and-revert-schema-isolation"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
PR #26 added
BDD_SCHEMA_ISOLATION=trueto CI, but this creates per-scenario schemas WITHOUT running table migrations on them, causing HTTP 500 errors on user registration. This PR reverts that and adopts a simpler approach.Root cause analysis
Investigation locally:
BDD_SCHEMA_ISOLATION=true(PR #26 mode): 0/5 runs PASS, 9 scenarios fail per run with 500 errorsSetupScenarioSchemacreates a fresh PostgreSQL schema and setssearch_path, but the production server'sPostgresRepositoryruns migrations once at startup (against the public schema). The new per-scenario schemas have NO tables.Fix
.gitea/workflows/ci-cd.yaml(removeexport BDD_SCHEMA_ISOLATION=true)scripts/run-bdd-tests.sh(-p 1) — prevents DB contention when multiple feature packages run their tests concurrently against the same Postgres DBpkg/server/server.go: exposeGetCacheService()pkg/bdd/testserver/server.go: store cacheService, addFlushCache()methodpkg/bdd/testserver/state_tracer.go:TraceStateCacheOperation()pkg/bdd/suite.go: AfterScenario hook callsFlushCache()afterResetJWTSecrets()Validation
features/viarun-bdd-tests.sh: ALL packages PASS (auth, config, greet, health, jwt, root)Trade-off
This forces sequential package execution. Parallel BDD is deferred as architectural follow-up (T12) because it requires:
SET search_path)This PR's goal is CI green TODAY. Parallel scaling is the next architectural step.
Files modified
.gitea/workflows/ci-cd.yaml: revert BDD_SCHEMA_ISOLATION exportpkg/server/server.go: +GetCacheServicepkg/bdd/testserver/server.go: +cacheService, +FlushCachepkg/bdd/testserver/state_tracer.go: +TraceStateCacheOperationpkg/bdd/suite.go: +FlushCache callscripts/run-bdd-tests.sh: +-p 1🤖 Diagnosed and fixed during the 2026-05-03 autonomous trainer day. Mistral Vibe ICM workspace:
~/Work/Vibe/workspaces/bdd-flakiness-deep-fix/. Trainer (Claude) revised the approach after Mistral's initial fix proved insufficient.