| 1 | # đŸ¤– AGENTS.md: todo-swift |
| 2 | |
| 3 | The CARLOS bakeoff's TodoMVC, written in Swift. |
| 4 | |
| 5 | ## The one rule |
| 6 | |
| 7 | **The page works with JavaScript off.** Every action is a plain HTML form |
| 8 | that posts and answers 303; JavaScript only makes the same requests |
| 9 | without a page load. If a change works only with JavaScript, it's a bug. |
| 10 | |
| 11 | Everything else follows from `BRIEF.md` and `CONTRACT.md` at the repo |
| 12 | root, which are binding. Where this file and the contract disagree, the |
| 13 | contract wins. |
| 14 | |
| 15 | ## Tenancy declaration |
| 16 | |
| 17 | ``` |
| 18 | Tenancy declaration: todo-swift, 2026-10-23, the bakeoff brief |
| 19 | One instance is: the whole app (person : instance = N:1) |
| 20 | Why this unit: a todo list is tiny and anonymous; nothing is gained |
| 21 | by an instance per visitor, and the bakeoff measures |
| 22 | one process |
| 23 | Reached through: model A (one instance), no sign-in; each visitor's |
| 24 | list is kept apart by an anonymous random cookie |
| 25 | (128 bits, HttpOnly, SameSite=Lax, Secure on https) |
| 26 | Central app: none |
| 27 | Workloads and class: instance = C (host-sighted) |
| 28 | Declared residue: everything: todo titles and completed flags are |
| 29 | stored as plain text in SQLite, alongside each list's |
| 30 | cookie value and creation time |
| 31 | Keys live: n/a |
| 32 | Hosting: Carloku (account bfj, app todo-swift) |
| 33 | Licence class: not published yet |
| 34 | Benefits claimed: replication and hibernation from the platform; |
| 35 | one static binary, one SQLite file |
| 36 | Costs accepted: the host (and anyone holding a replica) can read every |
| 37 | list; a lost cookie is a lost list, and there's no |
| 38 | recovery; lists are not erased when abandoned |
| 39 | Waiting on: nothing |
| 40 | ``` |
| 41 | |
| 42 | Class C is chosen on purpose: the bakeoff compares languages, not |
| 43 | encryption, and a todo list holds nothing a visitor was promised would |
| 44 | stay private. The page says nothing to suggest otherwise. |
| 45 | |
| 46 | ## Working rules |
| 47 | |
| 48 | - Work only in `apps/swift/`. The rest of the repo is read-only. |
| 49 | - One static linux-arm64 binary: `make build-arm64`. No shared library |
| 50 | beyond libc (the Static Linux SDK links musl in). |
| 51 | - SQLite in WAL mode at `--db`. Migrations only add; never drop or |
| 52 | rewrite data. They're numbered in `Store.swift` and tracked with |
| 53 | `PRAGMA user_version`. |
| 54 | - Every database write is a single SQL statement, so requests that share |
| 55 | the one connection can't interleave half a change. |
| 56 | - Bind `127.0.0.1` only when listening on TCP. Scratch goes in |
| 57 | `mktemp -d -p "$TMPDIR"`. Stop what you start. |
| 58 | - `make test` and the shared suite (`scripts/test-app.sh`) pass before a |
| 59 | deploy. |
| 60 | - Commits end with a `Co-Authored-By:` trailer naming the model. |
| 61 | |