--- phase: 1 slug: infrastructure-foundation status: draft nyquist_compliant: false wave_0_complete: false created: 2026-05-21 --- # Phase 1 — Validation Strategy > Per-phase validation contract for feedback sampling during execution. --- ## Test Infrastructure | Property | Value | |----------|-------| | **Framework** | pytest 7.x (asyncio_mode = auto) | | **Config file** | `backend/pytest.ini` | | **Quick run command** | `cd backend && pytest tests/test_health.py -v` | | **Full suite command** | `cd backend && pytest -v` | | **Estimated runtime** | ~30 seconds | --- ## Sampling Rate - **After every task commit:** Run `cd backend && pytest tests/test_health.py -v` - **After every plan wave:** Run `cd backend && pytest -v` - **Before `/gsd:verify-work`:** Full suite must be green - **Max feedback latency:** 30 seconds --- ## Per-Task Verification Map | Task ID | Plan | Wave | Requirement | Threat Ref | Secure Behavior | Test Type | Automated Command | File Exists | Status | |---------|------|------|-------------|------------|-----------------|-----------|-------------------|-------------|--------| | 1-01-01 | 01 | 1 | STORE-01 | — | N/A | unit | `cd backend && pytest tests/test_health.py -v` | ❌ W0 | ⬜ pending | | 1-01-02 | 01 | 1 | STORE-01 | — | MinIO key never contains human filename | unit | `cd backend && pytest tests/test_storage.py::test_object_key_format -v` | ❌ W0 | ⬜ pending | | 1-02-01 | 02 | 1 | STORE-01 | — | N/A | unit | `cd backend && pytest tests/test_alembic.py -v` | ❌ W0 | ⬜ pending | | 1-02-02 | 02 | 1 | STORE-02 | — | Object key is UUID-based, not filename | unit | `cd backend && pytest tests/test_storage.py::test_minio_key_schema -v` | ❌ W0 | ⬜ pending | | 1-03-01 | 03 | 2 | STORE-07 | — | No file locks; multiple workers can run | integration | `cd backend && pytest tests/test_documents.py -v` | ❌ W0 | ⬜ pending | | 1-03-02 | 03 | 2 | STORE-01 | — | End-to-end upload works with new storage layer | integration | `cd backend && pytest tests/test_documents.py::test_upload_end_to_end -v` | ❌ W0 | ⬜ pending | *Status: ⬜ pending · ✅ green · ❌ red · ⚠️ flaky* --- ## Wave 0 Requirements - [ ] `tests/test_health.py` — rewrite to probe PostgreSQL + MinIO endpoints (not just `{"status": "ok"}`) - [ ] `tests/test_storage.py` — new file: unit tests for `StorageBackend` ABC, MinIO key schema (STORE-02), and object CRUD - [ ] `tests/test_alembic.py` — new file: verify migration applies cleanly, all tables exist, columns match schema - [ ] `tests/test_documents.py` — rewrite to use PostgreSQL + MinIO storage layer (existing tests are coupled to flat-file storage) - [ ] `tests/conftest.py` — add async SQLAlchemy test engine fixture (in-memory SQLite for unit tests, real PostgreSQL for integration) --- ## Manual-Only Verifications | Behavior | Requirement | Why Manual | Test Instructions | |----------|-------------|------------|-------------------| | `docker compose up` starts all services cleanly | STORE-01 | Requires Docker daemon | Run `docker compose up --build` and confirm all health checks pass in the `docker ps` output | | `alembic upgrade head` completes with no errors | STORE-01 | Requires live PostgreSQL | Run `cd backend && alembic upgrade head` against the Docker PostgreSQL instance; confirm zero errors and all tables created | | Celery worker starts and processes a task | STORE-07 | Requires running Redis + worker | Trigger a document upload; confirm extraction + classification completes via Celery (check worker logs) | | Existing document upload workflow works end-to-end | STORE-01 | Full integration | Upload a PDF through the UI; confirm it appears in the document list with extracted text and AI classification | --- ## Validation Sign-Off - [ ] All tasks have `` verify or Wave 0 dependencies - [ ] Sampling continuity: no 3 consecutive tasks without automated verify - [ ] Wave 0 covers all MISSING references - [ ] No watch-mode flags - [ ] Feedback latency < 30s - [ ] `nyquist_compliant: true` set in frontmatter **Approval:** pending