# Working on this repository (for agents and people) visa.buildfor.life holds passport data of real people. Read this file and [docs/PLAN.md](docs/PLAN.md) before changing anything. ## Rules - **No real personal data** in the repo, in tests, in demo data or in screenshots. Demo people are invented (`src/seed.rs`) and carry the note "Demo record, invented for development." Test passports use invented numbers such as `C01X00T47`. - **No secrets** in the repo. Secrets reach the app as files or systemd credentials (`src/config.rs`); the pre-commit hook and CI run gitleaks. - **The audit log stays complete.** Every handler that shows a person's record writes a `view` row, and every change writes a row with the names of the changed fields (`changed_fields!` in `src/people.rs`), never their values. The table refuses `UPDATE` and `DELETE` (`migrations/0001_init.sql`). - **Every POST** goes through the same-site check and the form token (`src/web/mod.rs`); forms carry ``. - **No inline script or style.** The Content Security Policy refuses them; `tests/pages.rs` checks the templates. - **Migrations** are never edited once they are on `main`; add a new file. - **Dates** are shown as "Nov 17, 2026" in Chiang Mai time (`src/dates.rs`); countries are ISO 3166-1 alpha-3 codes as in the passport's zone (`src/countries.rs`, generated by `scripts/gen_countries.py`). - **Writing** for people (pages, docs) follows the house style: plain American English in whole sentences, no em dashes, "Nov 17, 2026" in tables. ## Checks before a push ```sh eval "$(bash scripts/dev-db.sh)" cargo fmt --all --check cargo clippy --all-targets -- -D warnings cargo test ``` CI (`.gitea/workflows/ci.yml`) runs the same against PostgreSQL 18, plus the secret scan over the whole history. For a page change, look at it in light and dark, at desktop and phone width, with `scripts/dev.sh` running. ## Layout | Path | What | | --------------------- | --------------------------------------------------------------------- | | `src/main.rs` | the commands `serve`, `migrate`, `seed-demo` | | `src/config.rs` | settings from the environment and credentials | | `src/oidc.rs` | OpenID Connect against Kanidm (PKCE, nonce, ES256), from the fleet overview | | `src/session.rs` | sessions in PostgreSQL, keyed by the SHA-256 of the cookie | | `src/audit.rs` | the activity log | | `src/people.rs` | people, passports, addresses: validation and SQL | | `src/mrz.rs` | reading the passport's machine-readable zone (ICAO 9303, TD3) | | `src/web/` | routes, the login gate, pages | | `templates/` | minijinja templates, compiled in by `build.rs` | | `static/` | CSS and JavaScript, compiled in; the URL carries a content hash | | `migrations/` | SQL migrations, compiled in | | `tests/` | integration tests, one binary (`tests/main.rs` declares each file) |