|
| 1 | +# Slice 010: NOTES |
| 2 | + |
| 3 | +## G1 plan, 2026-09-20 |
| 4 | + |
| 5 | +Tree at `68000bc` on `main`; branch `slice/010-core-domain-persistence`; ROADMAP row set to `in_progress` in |
| 6 | +this commit (docs/04 lifecycle, plan_check rule 11). Machine: Ryzen AI Max+ 395, OTP 28.5.0.5, Elixir 1.20.4, |
| 7 | +ecto_sqlite3 and exqlite as locked. Every line below names its test or command; the order is the build order. |
| 8 | + |
| 9 | +1. **Gate follow-up first, its own commit:** `plan_check` rule 12 parses every `.github/**/*.yml` and |
| 10 | + `.github/dependabot.yml` with the Python YAML module the ubuntu runner and this machine both carry |
| 11 | + (pyyaml 6.0.1 here); red demonstrated on a planted bare colon (the defect PR #7 fixed), then green. |
| 12 | +2. Repo config: `journal_mode: :wal`, `synchronous: :normal`, `busy_timeout`, `wal_auto_check_point` named in |
| 13 | + config; write pool of size 1 (`Trinity.Repo`) and a read pool; `Trinity.Repo.Receipts` declared with the same |
| 14 | + adapter and not started (the slot the 2026-09-20 amendment reserves). Test: the pragmas read back from a |
| 15 | + connection (`PRAGMA journal_mode`, `PRAGMA synchronous`). |
| 16 | +3. `TRINITY_DB=postgres` branch in `config/runtime.exs` with `postgrex` as an optional dependency; a CI matrix |
| 17 | + job with a Postgres service running `mix ecto.reset` and the suite. Test on both: the migrations apply. |
| 18 | +4. Data-dir lock: `Trinity.DataDir.Lock` writes `<data_dir>/LOCK` carrying pid, mode (`desktop | headless`) and |
| 19 | + a monotonic token, taken with `:file.open` exclusive create plus a liveness check on the recorded pid; a |
| 20 | + second boot against a held dir refuses to start naming holder pid and mode and touches no database file. |
| 21 | + Test: two applications in one VM cannot both own the dir; the refusal message names the holder (AC6). |
| 22 | +5. Migrations: `personas` (name unique, soul, model, settings), `sessions`, `messages` per docs/05, UUIDv7 ids |
| 23 | + from a small generator in `Trinity.UUID` (no new dependency; tested against RFC 9562's version and variant |
| 24 | + bits and for monotonic ordering within a millisecond). |
| 25 | +6. `Trinity.Sessions.Store` (queries) behind `Trinity.Sessions` (`create_session/1`, `get_session/1`, |
| 26 | + `list_sessions/1`, `append_message/2`, `history/2`, `archive/1`); `boundary` on `Trinity.Sessions` with |
| 27 | + `exports: [Trinity.Sessions]` so `Store` is internal. Test for AC5: a module under `test/support` that calls |
| 28 | + `Store` from `TrinityWeb` fails `mix compile --warnings-as-errors` (output pasted). |
| 29 | +7. `append_message/2`: one transaction reading `max(seq)` and inserting; on Postgres `SELECT ... FOR UPDATE` on |
| 30 | + the session row. Changeset refuses unknown roles and empty content (AC3). `history/2` ordered by `seq` with |
| 31 | + `limit` and `offset` (AC4). |
| 32 | +8. Factories in `test/support/factory.ex` (no `ex_machina`; plain functions). |
| 33 | +9. Stress test (AC2): 20 processes, 200 appends each, 5 sessions; gapless `seq` per session; no `SQLITE_BUSY` |
| 34 | + surfaced; `PRAGMA integrity_check` returns `ok`; run on both adapters; the `-wal` file size reported after |
| 35 | + the run (the 2026-09-20 risk line). |
| 36 | +10. `mix ecto.reset` on SQLite and on Postgres in CI (AC1), log excerpts in PROOF.md. |
| 37 | +11. Coverage line and `mix gate` (AC7); docs/05 synced with any column the migrations add. |
| 38 | +12. PROOF.md from the template; ROADMAP row to `done`; final commit and tag per CLAUDE.md section 4, through a |
| 39 | + pull request as the ruleset requires. |
| 40 | + |
| 41 | +Manual verification queue: none. Every criterion is `[auto]`. |
| 42 | + |
| 43 | +Deviations from SLICE.md, stated before building: line 3 adds `postgrex` as `optional: true` rather than a |
| 44 | +default dependency, so the standalone desktop build carries no Postgres driver; line 5 writes the UUIDv7 |
| 45 | +generator in-tree rather than adding `uniq`, and proposes nothing new for VERSIONS.md. |
0 commit comments