Commit Graph

11 Commits

Author SHA1 Message Date
54c1eefb6c feat(bdd): parallel-safe schema-per-package isolation (T12 stage 2/2)
Re-enables BDD_SCHEMA_ISOLATION=true with the foundation from PR #34
(NewPostgresRepositoryFromDSN). Achieves ~2.85x speedup on the BDD
test suite by running feature packages in parallel.

ARCHITECTURE

When BDD_SCHEMA_ISOLATION=true, each test package (process) gets its
own isolated PostgreSQL schema:
  1. testserver.Start() generates a deterministic schema name per FEATURE
  2. CREATE SCHEMA <name>
  3. Open a per-package gorm.DB with DSN search_path=<name>
  4. AutoMigrate runs in the isolated schema (creates users table)
  5. Build a per-package server.Server with this isolated repo via
     server.NewServerWithUserRepo
  6. Stop() drops the schema + closes the per-package pool

Packages then run in parallel (default Go test parallelism) without
contention because each has its own schema + connection pool.

CHANGES

- pkg/server/server.go : NEW factory NewServerWithUserRepo(cfg, ctx,
  userRepo, userService) that injects a per-test repo. Existing NewServer
  becomes a thin wrapper.
- pkg/bdd/testserver/server.go : Start() chooses isolated mode based on
  BDD_SCHEMA_ISOLATION env var. Stop() drops schema + closes pool.
- pkg/user/postgres_repository.go : Exec(sql) helper for the schema
  lifecycle (CREATE/DROP) used by testserver.
- scripts/run-bdd-tests.sh : -p 1 only when BDD_SCHEMA_ISOLATION!=true.
  When true, default Go parallelism (~ NumCPU packages concurrent).
- .gitea/workflows/ci-cd.yaml : exports BDD_SCHEMA_ISOLATION=true.
- adr/0025-bdd-scenario-isolation-strategies.md : Status to "Implemented".

VALIDATION

5x AuthBDD with isolation: 5/5 PASS, public.users count=0 after runs.

Local benchmark on the full features/... suite:
- Sequential -p 1 (no isolation):     12.87s
- Parallel + isolation (this PR):      4.51s
- Speedup: 2.85x

🤖 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-03 19:41:20 +02:00
17130082c6 🐛 fix(ci): version-bump fallback for workflow_dispatch trigger (#31)
workflow_dispatch event has no head_commit, so version-bump script was getting empty input and failing the whole workflow. Fall back to git log -1 when event context is empty.

Co-authored-by: Gabriel Radureau <arcodange@gmail.com>
Co-committed-by: Gabriel Radureau <arcodange@gmail.com>
2026-05-03 16:42:24 +02:00
93bd384ca8 🐛 fix(bdd): revert PR #26 schema isolation + cache flush + sequential CI tests (#28)
Some checks failed
CI/CD Pipeline / Build Docker Cache (push) Successful in 11s
CI/CD Pipeline / Trigger Docker Push (push) Has been cancelled
CI/CD Pipeline / CI Pipeline (push) Has been cancelled
Reverts PR #26 (BDD_SCHEMA_ISOLATION caused empty schemas with no tables, 500 errors). Adds sequential package execution (-p 1) + cache flush AfterScenario. AuthBDD goes from 0/5 PASS to 5/5 PASS deterministically. Parallel BDD deferred as architectural follow-up (requires per-schema migrations + dedicated connection pools).

Co-authored-by: Gabriel Radureau <arcodange@gmail.com>
Co-committed-by: Gabriel Radureau <arcodange@gmail.com>
2026-05-03 16:28:57 +02:00
9b6c384eb2 🐛 fix(ci): enable BDD_SCHEMA_ISOLATION to prevent flaky AuthBDD failures (#26)
Single line: export BDD_SCHEMA_ISOLATION=true before run-bdd-tests.sh. Activates the per-scenario schema isolation already implemented per ADR-0025. Should resolve the AuthBDD flakiness observed across multiple CI runs today.

Co-authored-by: Gabriel Radureau <arcodange@gmail.com>
Co-committed-by: Gabriel Radureau <arcodange@gmail.com>
2026-05-03 13:52:03 +02:00
5eec64e5e8 🧪 test: add JWT secret rotation BDD scenarios and step implementations (#12)
All checks were successful
CI/CD Pipeline / Build Docker Cache (push) Successful in 9s
CI/CD Pipeline / CI Pipeline (push) Successful in 4m15s
CI/CD Pipeline / Trigger Docker Push (push) Has been skipped
 merge: implement JWT secret rotation with BDD scenario isolation

- Implement JWT secret rotation mechanism (closes #8)
- Add per-scenario state isolation for BDD tests (closes #14)
- Validate password reset workflow via BDD tests (closes #7)
- Fix port conflicts in test validation
- Add state tracer for debugging test execution
- Document BDD isolation strategies in ADR 0025
- Fix PostgreSQL configuration environment variables

Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
Co-authored-by: Gabriel Radureau <arcodange@gmail.com>
Co-committed-by: Gabriel Radureau <arcodange@gmail.com>
2026-04-11 17:56:45 +02:00
be0a31a525 🤖 ci: separate docker push job
All checks were successful
CI/CD Pipeline / Build Docker Cache (push) Successful in 8s
CI/CD Pipeline / CI Pipeline (push) Successful in 4m17s
CI/CD Pipeline / Trigger Docker Push (push) Has been skipped
2026-04-09 13:03:08 +02:00
10f25c23e0 🤖 feat: enhance CI/CD workflow with Swagger caching and badge automation
CI/CD Improvements:
- Added Swagger Docs caching with actions/cache@v5
- Dependency-based cache invalidation
- GNU tar compatibility for Gitea runners
- Template-based Dockerfile generation
- Automated coverage badge updates
- Version bump automation

Workflow Features:
- Multi-stage build with caching
- BDD and unit test coverage tracking
- Separate badges for BDD vs unit tests
- Cross-platform compatibility
- Automatic badge updates on main branch

Files Modified:
- .gitea/workflows/ci-cd.yaml - Main workflow with caching
- scripts/ci-update-coverage-badge.sh - Badge automation
- scripts/ci-version-bump.sh - Version management
- scripts/update-all-badges.sh - Comprehensive badge updates

Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
2026-04-09 00:25:59 +02:00
c8b0dbd0a1 feat: automated version badge updates and CI/CD improvements
Some checks failed
CI/CD Pipeline / CI Pipeline (push) Failing after 16m21s
2026-04-06 19:07:02 +02:00
cddd270cce 🔧 chore: update ci-cd workflow to use kebab-case repository name
- Changed GITEA_REPO from 'DanceLessonsCoach' to 'dance-lessons-coach'
- Updated workflow comment to use kebab-case
- Aligns with module name changes from previous commits

This ensures the CI/CD workflow correctly references the repository
using the new kebab-case naming convention.

Refs: #ci-cd, #kebab-case, #repository-naming
2026-04-06 18:40:36 +02:00
89f17cba7d 🔧 chore: fix skill naming and gitea actions compatibility (related to #2)
Some checks failed
CI/CD Pipeline / CI Pipeline (push) Failing after 7m12s
2026-04-06 16:56:11 +02:00
a5f652fa64 🔧 refactor: replace 4 workflows with single optimized ci-cd.yaml (closes #2)
Some checks failed
CI/CD Pipeline / CI Pipeline (push) Failing after 4m11s
2026-04-06 16:30:49 +02:00