carlos / todomvc-bakeoff Public

Clone
git clone https://amadan.net/carlos/todomvc-bakeoff

Plain git — no account needed to clone.

Download

Download this file

1# đŸ¤– AGENTS.md: todo-swift
2
3The 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
8that posts and answers 303; JavaScript only makes the same requests
9without a page load. If a change works only with JavaScript, it's a bug.
10
11Everything else follows from `BRIEF.md` and `CONTRACT.md` at the repo
12root, which are binding. Where this file and the contract disagree, the
13contract wins.
14
15## Tenancy declaration
16
17```
18Tenancy declaration: todo-swift, 2026-10-23, the bakeoff brief
19One instance is: the whole app (person : instance = N:1)
20Why 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
23Reached 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)
26Central app: none
27Workloads and class: instance = C (host-sighted)
28Declared 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
31Keys live: n/a
32Hosting: Carloku (account bfj, app todo-swift)
33Licence class: not published yet
34Benefits claimed: replication and hibernation from the platform;
35 one static binary, one SQLite file
36Costs 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
39Waiting on: nothing
40```
41
42Class C is chosen on purpose: the bakeoff compares languages, not
43encryption, and a todo list holds nothing a visitor was promised would
44stay 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