| 📦 Turbo Go 3d7798b k33g 11h ago | 1 | # Handoff — 2026-08-31 — project settings, autosave, TOML colouring |
| 2 | |
| 3 | ## State |
| 4 | |
| 5 | **Ticket 0002 is done and green**, on branch `feature/project-settings`, **uncommitted**. |
| 6 | |
| 7 | A project can keep `.turbo-go/settings.toml` in its own directory, naming a theme and turning on automatic saving. **Options ▸ Create project settings** writes a commented one filled in with the theme in use and opens it; **Options ▸ Project settings…** reopens it. TOML is coloured, so the file reads properly in the editor that reads it. |
| 8 | |
| 9 | - New `internal/settings` (89.3 %), `internal/syntax` extended with a `Language` dimension and a TOML scanner (96.8 %), autosave and the menu items in `internal/app` (84.3 %, up from 82.8 %). |
| 10 | - Whole suite green under `-race`. Quality gate **PASS**: 0 errors, 0 warnings, 0 smells, complexity 1150. |
| 11 | - Docs complete in EN and FR — three new pages each, six existing pages updated each. `docs/diagrams/packages.drawio` re-checked against `go list`: matches edge for edge. |
| 12 | - **Verified end to end with the real binary in a pty**, which is the part worth trusting: the theme really comes from `settings.toml`, `-theme` really overrides it, and autosave really writes from the idle timer alone — the editor was killed without ever quitting, so no close-or-quit path could have done it. A control run with no settings file left the file untouched. |
| 13 | |
| 14 | Earlier the same day, the terminal work was merged to `main` by the user as PR #1. |
| 15 | |
| 16 | ## In flight |
| 17 | |
| 18 | Nothing. The feature is finished through Phase 8. |
| 19 | |
| 20 | ## Next steps |
| 21 | |
| 22 | 1. **Commit and open the PR.** `feature/project-settings` already exists on the remote. |
| 23 | 2. **Decide whether `autosave` should be `true` in the created file.** It is `false` today — see "Open questions" below. This is the one place where I chose and the user has not yet reacted. |
| 24 | 3. **Use autosave for a real working session.** It is verified but has never been lived with, which is where a save at an unwanted moment would show up. |
| 25 | 4. **Decide about tickets 0002 and 0007.** Both are implemented, both still `state: open`. |
| 26 | |
| 27 | ## Open questions / blockers |
| 28 | |
| 29 | - **`autosave = false` in the created file.** The request read "dire que les fichiers sont sauvegardés automatiquement", which can be read as "the file records that they are" (→ `true`) or "the file is where you say so" (→ `false`). I announced `false` in the plan, the user said "va au bout du bout" without correcting, so `false` it is. It is a one-line change in `template` in `internal/settings/create.go` plus its test in `settings_test.go` and two doc pages if that was the wrong read. |
| 30 | - **The menu entries are flat, not a submenu.** The request said "un sous-menu"; `ui.MenuItem` has no `Items` field and `ui.MenuBar` has no nesting, so building it would have been an unrequested `ui` change. Two items sit under Options instead. If real nesting is wanted, that is a `ui` feature in its own right. |
| 31 | - **`.turbo-go/` is not in `.gitignore`, and that is deliberate** — whether a project's theme is a team decision or a personal one is the user's call, not mine. The docs say so in both languages. |
| 32 | |
| 33 | ## Watch out for |
| 34 | |
| 35 | - **`emit` drops empty spans, so patching a span after the fact is unsafe.** In `internal/syntax/toml.go` I set `spans[len-1].Start` after an emit that had produced nothing, which silently rewrote the *previous* span into an invalid range. The fix is to pass the start into the function. If you extend the scanner, pass positions in; do not patch them on afterwards. |
| 36 | - **Do not assert on a screen cell while a live shell or process writes to it.** Already recorded from the terminal session; it came up again here and the test was written offline instead. |
| 37 | - **A pseudo-terminal echoes what you type.** Same trap, third appearance. In the pty smoke tests, the text typed is visible in the captured output whether or not the editor did anything with it — the file on disk is the evidence, not the screen. |
| 38 | - **`main.themeName` depends on `-theme`'s flag default being `""`.** If someone "tidies" it back to `theme.DefaultName`, precedence silently breaks: the project's theme would never apply, because the flag would always look as though it had been given. `TestThemeNameUsesTheProjectWhenNoFlagWasGiven` covers it. |
| 39 | - **`saveDueDocuments` must stay at the top of the `Run` loop**, beside `announceOpenDocuments`. Moving the saving into the `time.AfterFunc` would look tidier and would lose saves: that callback's only safe act is `wake`, whose `PostEvent` is allowed to drop. |
| 40 | - **The autosave tests inject `a.now`.** Do not "fix" them to use `time.Now` and short sleeps — they are fast and deterministic precisely because they do not. |