Quality gates
What runs on every pull request, what blocks a merge, and the real results on today's code.
ci.yml runs on every pull request into main. Branch protection requires one check: ci-ok.
The gates
| Gate | Tool | Runs when the PR changes | Blocks merge |
|---|---|---|---|
| Client lint and build | npm ci, npm run lint (ESLint, zero warnings), npm run build (tsc and Vite) |
client/ |
Yes |
| Server lint and tests | ruff check (rules in server/pyproject.toml), pytest |
server/ |
Yes |
| Image build and scan | docker build --target production, Trivy 0.76.2 |
server/ |
Yes: CRITICAL or HIGH with a fixed version |
| Dependency audit | pip-audit on server/requirements.txt; npm audit --audit-level=high |
server/ or client/ |
Yes: pip-audit on any finding; npm on high or critical |
| Secret scan | gitleaks 8.30.1 over every commit in the PR | Always | Yes |
| Terraform | terraform fmt -check, validate on every stack, tflint --recursive |
infrastructure/ |
Yes |
| Workflows | actionlint 1.7.12 (with shellcheck on run: blocks), shellcheck on scripts/ci/*.sh |
.github/ or scripts/ci/ |
Yes |
| Observability | Collector validate (contrib 0.165.0) on local.yaml and datadog.yaml; the ADOT image started with aws.yaml until it is ready (ADOT has no validate); promtool check config, check rules and test rules; docker compose config with and without the observability profile |
observability/ or docker-compose* |
Yes |
| Terraform plan | terraform.yml, read-only plan role, all three environments |
infrastructure/ or observability/collector/aws.yaml |
No. The plan is in the job summary for the reviewer. |
The server tests make no network call. server/tests/test_smoke.py covers GET /healthz, one document read, and one WebSocket round trip with a fake AI injected through app.dependency_overrides. server/tests/test_telemetry.py covers the four outcomes, the spans and log lines, and the privacy rule.
One required check
scripts/ci/changed-paths.sh is the path filter. On a pull request, GitHub checks out a merge commit whose first parent is the tip of main, so git diff HEAD^1 HEAD is exactly what the PR changes. A client-only change runs no server job. observability/collector/aws.yaml counts as an infrastructure change too, because the service module reads it with file().
Blocking policy and accepted findings
Image (Trivy)
Blocks on CRITICAL and HIGH that have a fixed version. An accepted finding goes in .trivyignore.yaml with a reason and an expiry date; when it expires, the scan fails again.
Python (pip-audit)
pip-audit reports no severity, so any finding blocks. An exception would be an --ignore-vuln <ID> argument in ci.yml, with a comment, reviewed in its PR. None exists.
Client (npm audit)
Blocks on high and critical. npm has no ignore list: the fix is an upgrade or an overrides entry in package.json.
Results on today’s code
These are real local runs of the commands that CI runs, last on 2026-11-23 after Task 3. Nothing was hidden or ignored to make a gate pass.
| Gate | Result | Notes |
|---|---|---|
pytest |
35 passed | Python 3.10.22; 3 smoke tests and 32 telemetry tests |
ruff check . |
passed | |
npm ci, npm run lint, npm run build |
passed | Lint and tsc failed on the original code; fixed with the smallest change (below) |
docker build (production) |
passed | Runs as UID 10001 with a read-only root file system; /healthz and /api/document/1 answer 200 |
| gitleaks | no leaks | 7 commits; after Task 3, the changed files (server/.env excluded, it is not committed) |
terraform fmt, validate, tflint |
passed | bootstrap, github, envs/dev, staging, prod |
| actionlint, shellcheck | passed | |
| Observability job | passed | Both collector configs valid, ADOT ready, 5 rule tests pass, compose config in both modes |
| pip-audit | 30 advisories, 7 packages | starlette 0.36.3, anyio 4.3.0, certifi 2024.2.2, h11 0.14.0, idna 3.6, python-dotenv 1.0.1, tqdm 4.66.2. 15 at first; the advisory database grew. Identical to the pre-Task-3 pins on the same day: the OpenTelemetry packages add no finding. |
| Trivy | 13 CRITICAL/HIGH | CRITICAL: anyio, certifi, h11. HIGH: starlette (3), wheel, jaraco.context, apt, libapt-pkg, zlib. No finding in a Task 3 package. |
| npm audit | 2 critical, 23 high | Includes axios, lodash, vite, rollup, tar, form-data |
Fixes to existing code
The client failed its own gates before this change. Each fix is the smallest one that makes the gate pass:
| File | Failure | Fix |
|---|---|---|
client/src/App.tsx |
useMutation and useQuery imported, never used (ESLint, tsc) |
Import removed |
client/src/Document.tsx |
messageHistory never read (tsc) |
const [, setMessageHistory] |
client/src/Document.tsx |
_closeEvent unused (ESLint) |
shouldReconnect: () => true |
client/src/Document.tsx |
useCallback(debounce(…)): dependencies unknown (ESLint warning, and warnings fail the lint) |
useMemo(() => debounce(…), [sendMessage]) |
Run the gates locally
# Server
cd server && pip install -r requirements-dev.txt && ruff check . && pytest
pip-audit --requirement requirements.txt
# Client
cd client && npm ci && npm run lint && npm run build && npm audit --audit-level=high
# Image
docker build --target production --tag server:ci server
# Workflows and scripts
docker run --rm -v "$PWD:/repo" -w /repo rhysd/actionlint:1.7.12
docker run --rm -v "$PWD:/mnt" -w /mnt koalaman/shellcheck:v0.11.0 scripts/ci/*.sh