| index 09c5f57..d9d9f14 100644 |
| --- a/docs/superpowers/specs/2026-11-14-mapa-level-up.md |
| +++ b/docs/superpowers/specs/2026-11-14-mapa-level-up.md |
| @@ -1068,6 +1068,21 @@ Phase 1's choices where this spec was silent, or where the build chose different |
| 20. **The gate-7 walk had a race,** which the level-up's slower pages exposed: ⌘K could show the answer to "Acm" before "Acme". The walk now waits for the whole word's Create row, and so does the new palette test. |
| 21. **Help has no Colophon yet.** Paul's rule asks every app for one; it waits for Phase 2, when the bundle is loaded and its packages are what the page runs. |
| |
| +**Phase 2, the server's half** (steps 2 to 5 and 7's server changes, §8): |
| + |
| +22. **`Settle`'s seams** (§6.4, D13). Two blocks that were neighbours in mine keep mine's bytes between them, as theirs' do; only a seam where the sides meet follows `Join`. Theirs' leading bytes are kept when its first block comes first. A block both sides changed the same way is taken from theirs. The structure check compares each block's kind, level, list kind and source. |
| +23. **The autosave reply** is `{version, revision, merge?}`, every revision and version as text (they are int63s). `merge` is `{against, body}`, `{against, conflict: true, hunks: [{at, count, base, mine, theirs}]}`, `{noBase: true}` or `{gone: true}`; `at` and `count` are block positions in the text the request carried, and `base`, `mine` and `theirs` each side's exact bytes from the hunk's first block to its last. `revision` is left out for an unwritten day and a deleted page. |
| +24. **`rebase=R`** writes the request's `body` as the draft too. With no draft, to a revision of another page, past the window, or on a deleted page it answers 422 `{refused: "rebase"}`; a stale version is the existing 409. Nothing moves. Every draft write is now compare-and-swap on the version it read, so two tabs racing cannot both win. |
| +25. **`commit=1`** answers as Save does. Version 0 with a body is a tab that never autosaved: its text becomes the draft and is committed. Version 0 with no body is refused (409). |
| +26. **A save that changes nothing** reports the outcome it computed: a `Merged` result equal to the current body still answers `merged` with the body, so the tab takes the teammate's text. From a stale tab it is `Kept`. The draft is dropped only if it is still the version the tab held. Restore still mints a revision: it is its own verb. |
| +27. **Resolve's JSON** `outcome` is `saved`, `merged`, `conflicted`, `noBase` or `kept`. A choice that no longer fits (another revision landed, the draft changed, a choice missing) answers `conflicted` with the current `revision` and `body`; no draft at all is the 404 it was. |
| +28. **Make team page's `revision`** is required: none is stale. The refusal asks the person to choose again. |
| +29. **The first scratch commit (D12) is keyed by a token**, `first=<16–64 of [A-Za-z0-9_-]>` on `POST /scratch`, which the tab draws once for the new page and sends until it learns the page's address. The server keeps (person, token) → page in memory only, for 10 minutes and at most 4,096 at once, and runs the whole create-or-look-up under one lock. So the first request creates the page and answers `{href, page, revision}`; any later one with the token is an autosave of a draft on that page, answered like any autosave plus `{href, page}`; an empty body is 422 `{empty: true}` and creates nothing. Nothing new is stored, so §4 is unchanged. The version check could not key it, because no draft row exists before the page. A token forgotten (past 10 minutes, or across a restart or a CARLOS swap) makes a second page; only a tab still sending its first token that late meets it. |
| +30. **The island** is on `/p/{id}` (and `/p/{id}/history`, the current page with the panel), `/` and `/d/{date}` written or not, and `/scratch/new`. Its `base` is the page's current revision, `"0"` for a day or page not written yet; `draft.base` is the draft's own. Link keys are the target as typed, with `#^id` for a block. A date's `title` is the day in words; a pending link's is empty. `?saved=1` and a day re-shown after a refused Save carry none: neither is the text the draft continues. |
| +31. **`POST /links/resolve`** takes form fields `target`, each a link key (anything after `|` is ignored). Over 32 is 422 `{refused: "too many"}`. The answer is keyed by each key as sent; a key with no target is left out. |
| +32. **The draft bar** says "You're seeing the saved version" under `?saved=1`, with "Show your unsaved version". "Show the saved version" is left off where nothing is saved yet (an unwritten day) and in the Markdown editor. |
| +33. **Gate 1 compares the island's revisions as one value.** Revisions are random in both worlds (doctrine §6.6), so they cannot say anything about Ana's notes; the history scope test already did the same for history links. |
| + |
| ## 14. Findings and what changed |
| |
| ### Round 1: Fable on revision 1 (`4027e10`), answered in revision 2 |