[AZ-1133] Add perf gate preflight before PT-01

Probe API reachability after JWT mint; exit 7 with compose-up
instructions when the perf stack is down. Document in environment
and containerization guides.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Oleksandr Bezdieniezhnykh
2026-06-26 17:56:33 +03:00
parent fb9e3ee31a
commit 67530eb169
8 changed files with 93 additions and 2 deletions
@@ -45,6 +45,8 @@ services:
Use this when Step 15 (`scripts/run-performance-tests.sh`) or manual perf probing against `https://localhost:18980` must run while another project owns host port 5433.
`run-performance-tests.sh` probes API reachability after JWT mint and before PT-01. If the stack is down, the script exits **7** and prints the `docker compose -f docker-compose.yml -f docker-compose.perf.yml up -d --build` command. See [environment.md](../tests/environment.md) § Performance tests.
Integration tests do **not** use this overlay — `scripts/run-tests.sh` starts `docker-compose.tests.yml` alone, which never publishes postgres to the host.
+1 -1
View File
@@ -77,7 +77,7 @@ docker compose -f docker-compose.tests.yml up --build --abort-on-container-exit
`docker-compose.tests.yml` is self-contained (postgres + api + integration-tests on an internal Docker network). Postgres is not published to the host — intentional when host port 5433 is occupied by a sibling stack.
**Performance tests** (Step 15 / `scripts/run-performance-tests.sh`): start the API with the perf overlay when host port 5433 is occupied — `docker compose -f docker-compose.yml -f docker-compose.perf.yml up -d --build`. Details: [containerization.md](../deployment/containerization.md#compose-overlays-dev--test--perf). PT-10 (`DeliverRouteTiles` gRPC stream) runs via `dotnet SatelliteProvider.IntegrationTests --run-pt10` inside the script; host-side default `API_URL=https://localhost:18980` with TLS trust via `./certs/api.crt` (`PERF_CA_CERT` override). Harness knobs:
**Performance tests** (Step 15 / `scripts/run-performance-tests.sh`): start the API with the perf overlay when host port 5433 is occupied — `docker compose -f docker-compose.yml -f docker-compose.perf.yml up -d --build`. Details: [containerization.md](../deployment/containerization.md#compose-overlays-dev--test--perf). The script runs a **preflight reachability probe** after JWT mint and before PT-01; if `$API_URL` is unreachable it exits with code **7** and prints the compose-up command. PT-10 (`DeliverRouteTiles` gRPC stream) runs via `dotnet SatelliteProvider.IntegrationTests --run-pt10` inside the script; host-side default `API_URL=https://localhost:18980` with TLS trust via `./certs/api.crt` (`PERF_CA_CERT` override). Harness knobs:
| Variable | Default | Purpose |
|----------|---------|---------|
+1 -1
View File
@@ -272,7 +272,7 @@ Step 9 cycle 16: 1 task created (AZ-1133 = 1 pt) — perf gate preflight before
| Task | Epic | SP | Status |
|------|------|-----|--------|
| AZ-1133 Perf gate preflight — health-check before PT-01 | — | 1 | Todo |
| AZ-1133 Perf gate preflight — health-check before PT-01 | — | 1 | Done |
### Step 9 cycle 15 (FluentValidation bump — AZ-1132)
@@ -0,0 +1,32 @@
# Batch Report
**Batch**: 1
**Tasks**: AZ-1133_perf_gate_preflight
**Date**: 2026-06-26
## Task Results
| Task | Status | Files Modified | Tests | AC Coverage | Issues |
|------|--------|---------------|-------|-------------|--------|
| AZ-1133 | Done | 3 files | curl probe pass | 4/4 ACs covered | None |
## AC Test Coverage: All covered
| AC | Evidence |
|----|----------|
| AC-1 | `preflight_api_reachable` called after JWT mint, before PT-01 banner in `run-performance-tests.sh` |
| AC-2 | Isolated curl probe to `localhost:19999``curl_exit=7`; script prints compose-up and `exit 7` |
| AC-3 | HTTP response path proceeds (any non-zero curl exit only triggers preflight fail) |
| AC-4 | `environment.md` + `containerization.md` updated |
## Code Review Verdict: PASS
- Preflight uses same `CURL_OPTS` / `AUTH_HEADER` as PT-01
- `set +e` / `set -e` scoped around probe — does not weaken global `pipefail`
- Exit code 7 reserved for unreachable API per task spec
- Docs cross-link preflight + exit 7
## Auto-Fix Attempts: 0
## Stuck Agents: None
## Next Batch: All tasks complete
@@ -0,0 +1,15 @@
# Implementation Completeness — Cycle 16
## Per-task classification
| Task | Verdict | Evidence |
|------|---------|----------|
| AZ-1133 | PASS | `preflight_api_reachable` in `scripts/run-performance-tests.sh`; docs in `environment.md`, `containerization.md` |
No scaffold markers. No named runtime dependencies beyond curl/dotnet already in harness.
## System Pipeline Audit
N/A — tooling-only cycle; no production pipeline changes.
**Gate**: PASS — proceed to test handoff.
@@ -0,0 +1,19 @@
# Implementation Report — perf_gate_preflight (cycle 16)
**Cycle**: 16
**Tasks**: AZ-1133 (1 SP, 1 batch)
**Feature slug**: perf_gate_preflight
## Summary
Added `preflight_api_reachable` to `scripts/run-performance-tests.sh`. After JWT mint and before PT-01, the script probes `$API_URL` with the same TLS trust and Bearer token as the perf scenarios. Connection/TLS failures exit **7** with the perf overlay compose-up command. Documentation updated in `environment.md` and `containerization.md`.
## Batches
| Batch | Tasks | Verdict |
|-------|-------|---------|
| batch_01_cycle16 | AZ-1133 | PASS |
## Test handoff
Full suite gate deferred to autodev Step 11 (`test-run` skill) per implement Step 16 handoff rule.