oficina / mapa Public

Spec revision 3: answer Fable's round 2 (no high, 5 medium, 6 low)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Paul Campbell pushed by paul@keymail.dev c3f08863c13f6a3301e5fb8b7cc13c7fc71c50de parent 933e5a3
1 file changed, +60 −21
  • docs/superpowers/specs/2026-11-22-mapa-columns-icons.md +60 −21

CI passed — run details

CI log
=== editor ===
cd editor && npm ci --no-audit --no-fund --loglevel=error

added 16 packages in 343ms
cd editor && node build-bundles.mjs
wrote internal/mapa/static/editor.115ddee5d3f54787.js (354112 bytes, 111.2KB gzipped; L12 budget 120KB)
cd editor && node --test
✔ a badge is named for what it does, starting with its visible word (1.063678ms)
✔ first words stop at five words or forty characters (0.171018ms)
✔ the field keeps one trimmed line, without brackets (0.384525ms)
✔ the field holds at most MaxAlt bytes, cut at a character (0.488217ms)
✔ days and weeks move across months and years (1.147103ms)
✔ a month keeps the day, or takes the month's last (0.332619ms)
✔ the grid is six weeks from Monday, as the month calendar draws it (0.571272ms)
✔ the grid starts the week where the locale does (1.011501ms)
✔ the keys move a day, a week, a month and a year (0.238694ms)
✔ the picked day is the chip [[ makes for a date (14.391141ms)
✔ Insert → Today's date still puts today in at once (1.415782ms)
✔ / offers Date, the picker, and Today's date beside it (0.19925ms)
✔ after a ! the chip goes in after a space, never as an embed (2.080949ms)
✔ where the Markdown would read the chip differently, it is refused (2.819603ms)
✔ over a selection the chip goes after it and the words stay (3.2857ms)
✔ today is the day in the viewer's zone (12.428301ms)
✔ every offered locale has cases (1.265634ms)
✔ dates.mjs writes every date Go writes, byte for byte (3.615874ms)
✔ a chip, the month and the week, in three locales (0.590528ms)
✔ dates.json is what ICU gives, byte for byte (567.641176ms)
✔ L1: mounting then serialising gives cleanBody(body), byte for byte (94.702422ms)
ℹ 871 bodies
✔ L1: mounting a stored body adds nothing, and saving it writes nothing new (100.041691ms)
✔ L2: one edited block changes only that block's bytes; undo gives the body back (147.059804ms)
ℹ 858 single-block edits
✔ L2: inserting or deleting a block changes bytes only at the new seams, by Join (146.099466ms)
ℹ 866 inserts, 817 deletes
✔ L3: seeded edits keep the document and its Markdown saying the same thing (5100.749203ms)
ℹ 20904 edits over 871 bodies
✔ L3: Link to a page makes exactly one chip, and changes nothing else (1180.407694ms)
ℹ 4532 links over 871 bodies; refused: {"A page link can’t hold another link or a line break. Select plain words.":918,"A page link can’t show [ or ]]. Select words without them.":404,"Select some words to link them to a page.":174,"Linked here, the Markdown around these words would read differently: a ! before them makes an embed, and a stray ` or * pairs up. Select other words.":18}
✔ L3: a picked date is one more date chip, or refused where a letter would be too (1187.387931ms)
ℹ over 871 bodies: {"inserted":5158,"spaced":23,"refused":45,"unstable":9}
✔ linear: trailing spaces (46.936889ms)
✔ linear: trailing whitespace (29.263838ms)
✔ linear: unclosed web links (32.728199ms)
✔ linear: web links with no address (39.774501ms)
✔ linear: unclosed wiki links (29.155417ms)
✔ linear: unclosed embeds (32.767151ms)
✔ linear: closes only (10.182023ms)
✔ the selected words become the chip's shown text (11.77233ms)
✔ words that are the title make a plain [[Title]] (4.79121ms)
✔ spaces at the selection's edges stay outside the chip (3.333739ms)
✔ a date makes a date link, in a heading, an item and a quote (12.437919ms)
✔ bold words lose their bold: a chip carries no marks in Mapa's Markdown (1.48982ms)
✔ only the linked block's bytes change, and undo gives the body back (2.756626ms)
✔ a selection across blocks, over a chip or a break, or of brackets is refused (1.912166ms)
✔ a target the words cannot be linked to as typed is refused (0.524996ms)
✔ ⌘L: over a selection it opens Page link; with none it types [[; in code it does nothing (4.627535ms)
✔ web-linked words are refused: the address would be lost (review M4) (1.948363ms)
✔ words whose Markdown would read otherwise are refused (review M3) (2.108941ms)
✔ ⌘A then ⌘L says why, instead of doing nothing (review low 1) (0.396808ms)
✔ linkCheck says why it refuses (review low 2) (1.53274ms)
✔ golden file has bodies (0.940349ms)
✔ markup.mjs parses every body into Go's blocks, byte offsets and all (29.087118ms)
✔ markup.mjs strips and spans every block as Go does (86.161781ms)
✔ the schema's toDOM draws every body as Go renders it (77.013249ms)
✔ emphasis draws the four pinned outputs (23.881428ms)
✔ a body ends in the editor's empty paragraph (0.271364ms)
✔ the editor labels date chips as Go does, in every locale L4 holds (11.993502ms)
✔ a POST that never answers is aborted after the timeout (22.045534ms)
✔ a keepalive POST carries no signal, and an answer clears the timer (1.325494ms)
✔ autosave sends only what differs, and the tab owns the draft it wrote (11.306285ms)
✔ an offered draft never commits by itself; Save commits it (1.870438ms)
✔ reload, then close: sessionStorage says the draft is this tab's own (0.72044ms)
✔ closing carries text not yet sent, and the cap leaves it out (44.54844ms)
✔ clean rebase: applied, the caret survives, the base moves by the rebase POST (4.89391ms)
✔ the block under the caret is the teammate's too, and undo brings back yours (4.35036ms)
✔ typing mid-flight: the merge is not applied and the base does not move (1.925761ms)
✔ a merge the editor cannot represent stops after three tries (5.446218ms)
✔ a conflict is shown, locks the editor's own commits, and Resolve settles it (2.087121ms)
✔ leaving: a conflict stays with the choice; a failed flush offers Leave anyway; a stored draft leaves (2.530285ms)
✔ a stale tab shows the newer draft, offered, and never overwrites it (1.259442ms)
✔ the first scratch commit: empty creates nothing, then one page, then drafts on it (1.504588ms)
✔ noBase and gone lead to the existing choices (1.680605ms)
✔ a commit that merged is applied when nothing was typed since (1.323571ms)
✔ back from the cache: nothing unsaved reloads, unsaved text autosaves at once (8.086627ms)
✔ an own draft committed meanwhile goes on as a new draft (1.617027ms)
✔ a reload keeps a stored draft; unsent text still commits (0.480143ms)
✔ a page deleted mid-edit: what is typed is still stored as the draft, and nothing commits (H1) (1.141563ms)
✔ an offered draft committed in another tab: typing goes on as a new draft (H1) (6.976583ms)
✔ a commit reply without a revision is not a commit; an emptied day starts afresh (H2) (1.062797ms)
✔ Resolve stores what was typed first, and takes no typing until its answer is applied (M1) (3.636252ms)
✔ closing with a choice open, or commits held, still writes the text, never commits (M2) (1.116386ms)
✔ closing inside the settling window sends the loaded version with settling=1 (M3) (0.346695ms)
✔ a clean merge not applied because of typing still ends the choice on show (M4) (1.224337ms)
✔ settling finds the draft committed with a teammate's text: a close still writes (M-A) (0.55381ms)
✔ settling finds another tab's newer draft: the tab shows it before any typing (0.678522ms)
✔ a page deleted before the first autosave: the text is offered as a scratch page, and a close makes one (M-B) (1.525947ms)
✔ an autosave that never answered but landed: its 409 keeps the typing since (L3) (0.636534ms)
✔ marks: em outside strong, bold reopened around italics, edges outside (14.051329ms)
✔ marks close before code, links and atoms, and reopen after (0.356363ms)
✔ untouched blocks and atoms re-emit their source; edited atoms are written from attributes (7.399159ms)
✔ empty blocks are written as nothing (2.855811ms)
✔ an unclosed fence that is no longer last gets its closing fence (2.010548ms)
✔ the structure check puts Join's seam where a kept one would merge two blocks (2.978749ms)
✔ prepareSave adopts the parse when no seam or rewrite can save the document (4.056202ms)
✔ reparse: typed emphasis becomes a mark, "- " after a break becomes an item (2.699931ms)
✔ a trailing hard break stays on screen and is written as nothing (1.08593ms)
✔ the reparse waits while an IME is composing (1.00574ms)
✔ copied blocks paste with their bytes and seams; a cut and paste gives the body back (5.031897ms)
✔ a forged x-mapa slice is refused, and text from outside is read as Markdown (0.810617ms)
✔ rebuild changes origins only, outside undo history (1.601277ms)
✔ applyBody takes a teammate's block, keeps the caret, and ends untouched (7.308101ms)
✔ a block whose context changed is written again: a task toggled, a bullet, a quote (5.51766ms)
✔ a duplicate ^id typed above its holder never takes the id from it (1.649077ms)
✔ a copy-dragged block is reparsed, and says what its Markdown says (1.205381ms)
✔ a history command that throws is refused, never thrown (11.409686ms)
✔ an image re-emits its source, and an edited alt changes only its span (1.760835ms)
✔ a paste whose image copy is refused says why and pastes nothing (23.727331ms)
✔ a line of image openers reads in linear time (122.250088ms)
✔ a line of shared link address reads in linear time (16.819766ms)
✔ a line of shared web address reads in linear time (54.170934ms)
✔ one rename at a time, from either field (2.645819ms)
✔ an empty or unchanged title sends nothing (0.229918ms)
✔ a refusal keeps what was typed, and the title (0.283918ms)
✔ the pending state holds for the busy rule (7.401844ms)
✔ a failed POST says so and keeps the title (0.873034ms)
✔ Update links posts the confirm page's POST (0.301791ms)
✔ clean is CleanTitle's whitespace rule (0.264672ms)
✔ the saver's base follows a rename made over it, and only that (0.293807ms)
✔ closing sends the rename as one keepalive POST (2.408769ms)
✔ the port answers every shared case as typeddate.go does (7.515565ms)
✔ numbers follow the locale: 12/11 is November in en-IE, December in en-US (0.315206ms)
✔ M6: several files land in the order they were chosen (48.288884ms)
✔ M5: one Backspace before the box keeps the image where the box is (11.09383ms)
✔ M5: undoing text typed just before the box keeps the upload (12.789383ms)
✔ L12: a failed upload an undo takes away does not stall the next (14.202971ms)
✔ M4: Replace… keeps the old image until the new one is in, and its alt (14.399907ms)
✔ M3 and N1: text wins, except over a picture copied from a page (1.693228ms)
✔ N2: a JPEG over 10 MB is scaled before its size is checked (5.448221ms)
✔ a drag whose anchor the document no longer reaches selects to its end (7.81917ms)
ℹ tests 126
ℹ suites 0
ℹ pass 126
ℹ fail 0
ℹ cancelled 0
ℹ skipped 0
ℹ todo 0
ℹ duration_ms 8147.789424
=== vet ===
go vet ./...
go vet -tags browser ./internal/mapatest/
=== fmt ===
=== code ===
go tool rastrillo budget code
The base has no .rastrillo/code.txt: skipping the check that records only go down.
budget code: within the limits.
=== test ===
CGO_ENABLED=0 go test ./...
?   	amadan.net/oficina/mapa/cmd/mapa	[no test files]
ok  	amadan.net/oficina/mapa/internal/mapa	3.522s
?   	amadan.net/oficina/mapa/internal/mapa/icons	[no test files]
ok  	amadan.net/oficina/mapa/internal/mapa/imagefile	(cached)
ok  	amadan.net/oficina/mapa/internal/mapa/locale	(cached)
ok  	amadan.net/oficina/mapa/internal/mapa/markup	(cached)
ok  	amadan.net/oficina/mapa/internal/mapa/notionmd	(cached)
ok  	amadan.net/oficina/mapa/internal/mapa/seal	(cached)
ok  	amadan.net/oficina/mapa/internal/mapatest	13.906s
?   	amadan.net/oficina/mapa/scripts/mutate	[no test files]
?   	amadan.net/oficina/mapa/scripts/preview	[no test files]
=== migration-check ===
go tool rastrillo migration check
rastrillo migration check: models and migrations agree
=== credits-check ===
python3 scripts/credits.py --check
credits: checked
diff --git a/docs/superpowers/specs/2026-11-22-mapa-columns-icons.md b/docs/superpowers/specs/2026-11-22-mapa-columns-icons.md
index cb1d261..d260c37 100644
--- a/docs/superpowers/specs/2026-11-22-mapa-columns-icons.md
+++ b/docs/superpowers/specs/2026-11-22-mapa-columns-icons.md
@@ -1,7 +1,8 @@
# Mapa: columns, page icons, banners, and pins from the import
-**Status:** revision 2, 2026-11-22, for review. Nothing is built.
-- Fable reviewed revision 1 (`4879ec7`) and found CHANGES REQUIRED: 2 high, 7 medium and 12 low findings. Revision 2 answers every one; §13 maps each to its change.
+**Status:** revision 3, 2026-11-22, for review. Nothing is built.
+- Fable reviewed revision 1 (`4879ec7`) and found CHANGES REQUIRED: 2 high, 7 medium and 12 low findings. Revision 2 (`933e5a3`) answered every one.
+- Fable re-reviewed revision 2 and found **no high**: five mediums and six lows, all in revision 2's own answers. Revision 3 answers them. §13 maps every finding to its change.
**Asked for by Paul, 2026-11-22,** while moving his Notion workspace into Mapa:
- *"can we figure out a way to make multi column work? Is there a Markdown extension we can use?"*
@@ -70,10 +71,12 @@ It changes no trust property. §4's plaintext list is unchanged. No new table, n
The left column's blocks.
- Any ordinary block.
+
:::
::: column
The right column's blocks.
+
:::
::::
@@ -81,6 +84,8 @@ The right column's blocks.
**The four fence lines.** Each is a whole line. None may be indented, and trailing spaces and tabs are allowed.
+**One predicate for "looks like a fence"** (`markup.FenceLike`, ported): a line whose text, after any spaces and tabs, starts with `:::`. §1.1's rule 5, the editor's neutraliser (§1.7), its "entering a column" rule and the importer's §11.4 row all use this one predicate, so no two of them can disagree about a line.
+
| Line | Form | Mapa kind |
|---|---|---|
| the layout's opener | four or more colons, then one or more spaces or tabs, then the word `columns` | `columns` |
@@ -93,7 +98,7 @@ The right column's blocks.
2. **Columns are explicit.** Between the opener and the first column, between a column's closer and the next column's opener, and between the last closer and the layout's closer, there are only blank lines.
3. **There are two, three or four columns.** One column, or five, is not a layout.
4. **Each column closes.** A column ends at the first line, outside a code fence, that is exactly its closer. The code fences inside a column are found by the same rule `Parse` uses at the top level, so a `:::` inside a fenced code block is code.
-5. **Nothing inside a column looks like a fence.** Outside a code fence, a column may hold no other line whose text starts, after up to three spaces, with three colons. That rules out nesting, a stray `:::`, an indented fence Pandoc might read, and any closer of another length. An unclosed code fence in a column never lets the column close, so it fails rule 4.
+5. **Nothing inside a column looks like a fence.** Outside a code fence, a column may hold no other line that is `FenceLike`. That rules out nesting, a stray `:::`, an indented fence another reader might take, and any closer of another length. An unclosed code fence in a column never lets the column close, so it fails rule 4.
6. **The layout's closer ends a block.** It is the body's last line, or the line after it is blank.
**The scan, exactly,** so Go and the port agree (M2). The pre-pass reads the body's lines top to bottom, tracking code fences as `Parse` does. At a line outside a code fence that matches the layout opener and meets rule 1, it tries to read a whole layout by rules 2 to 6.
@@ -107,8 +112,8 @@ The right column's blocks.
- **Empty columns are allowed** (`::: column` then `:::`). They render as an empty column holding the editor's empty paragraph, so there is somewhere to type, exactly as the trailing paragraph works (level-up §6.2). They serialise back to the two fence lines.
- **Widths: equal only (Q2).** A column opener with anything after `column` (`::: column width="40%"`, `::: {.column}`) is not a column, so a Quarto layout with widths reads as text. Mapa never writes one.
- **The bare word only**, never Pandoc's `{.columns}` brace form. One spelling keeps the grammar, the port and the neutraliser (D16) small. Q2 covers both.
-- **Why the outer fence must be longer.** It is Quarto's convention, it makes the structure visible in the textarea, and with exact-length closers Pandoc's own rule (a bare fence closes the innermost div) reads every layout Mapa recognises exactly as Mapa does.
-- **Checked against real Pandoc and Quarto at build** (COL12). Neither is on this machine, so the claim is not yet tested. The build installs Pandoc, renders every positive and negative COL2 case to its AST, and commits the result as a fixture. Cases where Pandoc might differ are named in it: a quote or a list item directly before a closer (lazy continuation), a line indented one to three spaces then `:::` inside a column, `::: column :::`, and an empty column. **Where Pandoc reads Mapa's written form differently, Mapa's writer changes**, not the fixture. Mapa always writes a blank line before a column's closer for this reason (§1.4).
+- **Why the outer fence must be longer.** It is Quarto's convention, and it makes the structure visible in the textarea. With exact-length closers, Pandoc's own rule (a bare fence closes the innermost div) gives the same divs for **the form Mapa writes**. A layout typed by hand in another shape Mapa still recognises is expected to read the same, and COL12 records what Pandoc makes of each case, but only the written form is promised.
+- **Checked against real Pandoc at build** (COL12). Pandoc is not on this machine, so the claim is not yet tested. The build installs Pandoc, renders every positive and negative COL2 case to its AST, and commits the result as a fixture. The test asserts agreement for the positive cases and for `Join`'s output, and records the negatives without asserting, since Mapa refuses some of them on purpose (one column, five, `{.column}`, nesting). Cases where Pandoc might differ are named in it: a quote or a list item directly before a closer (lazy continuation), a line indented one to three spaces then `:::` inside a column, `::: column :::`, and an empty column. **Where Pandoc reads Mapa's written form differently, Mapa's writer changes**, not the fixture. Mapa always writes a blank line before a column's closer for this reason (§1.4).
### 1.2 A stray `:::` in an old page
@@ -217,10 +222,10 @@ Any seam parses the same way, because the parser does not need blank lines next
- **Make team page** (level-up §6.7) widens a selection that crosses a column, or touches a fence, to the whole layout. A selection inside one column moves just those blocks, and the link chip takes their place in that column. The server holds the same rule (§1.10).
**Typed fences and the reparse (D16, M1).** Mapa has no escapes (level-up D11), and a typed `:::` inside a column would close it. Four rules keep typing from breaking a layout:
-1. **The settle plugin puts U+200B before the first `:` of any line, in any textblock, whose text starts, after any spaces, with `:::`.** That is the importer's neutraliser (Notion import §11.4) applied to one more pattern. The line looks the same and the stored text parses as text. It runs **before** the reparse rule in the same plugin pass, so no reparse ever sees a raw fence.
-2. **A block that enters a column counts as edited** when any of its lines starts with `:::`, so rule 1 reaches it. That covers a block moved in by Insert → Columns, by paste or by a drag. Every other block keeps its source.
+1. **The settle plugin puts U+200B before the first `:` of any `FenceLike` line (§1.1) in a changed textblock, code blocks excepted.** Code is safe by rule 3, and a U+200B inside code would change it. This is the importer's neutraliser (Notion import §11.4) applied to one more pattern. The line looks the same and the stored text parses as text. It runs **before** the reparse rule in the same plugin pass, so no reparse ever sees a raw fence, **and again over whatever a reparse adopts**, until nothing changes. L3's idempotence covers that fixed point. As before, it reaches only blocks being edited: an untouched block keeps its source, so L2 holds.
+2. **A block that enters a column counts as edited** when any of its lines is `FenceLike`, so rule 1 reaches it. That covers a block moved in by Insert → Columns, by paste or by a drag. Every other block keeps its source.
3. **A code block inside a column is always written closed.** Level-up §6.4 step 5 re-serialises an unclosed fence once it is no longer last; inside a column it is never last, so its closing fence is always written. A reparse that would open an unclosed fence (a typed ```` ``` ```` after a hard break) gives a closed code block inside the column.
-4. **A structural reparse inside a column is confined to that column.** When step 6 adopts a parse, it parses the column's own lines, as the grammar does (§1.4), and replaces that column's content. The layout's fences are never part of an adopted parse.
+4. **No adopt ever turns a layout into text.** When step 6 adopts a parse for a block in a column, it parses that column's own lines, as the grammar does (§1.4), and replaces that column's content only. Step 5's last resort, the whole-body adopt (`fidelity.mjs`, `serialize.mjs`), first re-serialises every column's content neutralised (rule 1) and with its code closed (rule 3). Those two rules make every column's text unable to close it early, so the body's parse keeps every layout the document holds. COL3 runs both adopts over layouts and asserts the layouts survive.
**Edit as Markdown** shows the fences as text. The textarea has no neutraliser: a person typing a whole layout there gets one, and Help's "Markdown in Mapa" documents the syntax. **Scriptless,** a page with columns reads as columns, and the textarea round-trips them.
@@ -232,7 +237,12 @@ Any seam parses the same way, because the parser does not need blank lines next
**Two rules keep every result a valid body:**
1. **A conflict never cuts a layout.** When any side of a conflicting stretch holds a fence block, the stretch widens on all three sides to the nearest stable blocks that lie outside every layout it touches, or to the body's start or end. Every choice then yields whole layouts. Both gives two layouts, mine first (base build note 24).
-2. **Every result must hold valid layouts, conflicts or not** (H1). When any of the three sides holds a fence, `Merge3` checks the first pass's hunks with `ValidLayouts` (§1.4): the settled blocks in order, with each conflict hunk standing for an opaque unit that rule 1 has already made either fence-free or whole layouts, so any choice inside it is valid. If the check fails, the merge runs again, widening **every** stretch that touches a fence on any side, clean or not, by rule 1's widening, and resolving each by diff3's rule. A layout one side reshaped and the other left alone is then taken whole from the side that changed it. A layout both sides changed, where at least one changed its shape, is one conflict. The second pass's result always passes the check, because every layout in it comes whole from one side.
+2. **Every result must hold valid layouts, conflicts or not** (H1). When any of the three sides holds a fence, `Merge3` checks the first pass's hunks. Each conflict hunk is an opaque unit that rule 1 has made either fence-free or whole layouts, and the check places it exactly (round 2, M1):
+ - **A fence-free unit** counts as one content block, and the check must also pass with it empty, since Keep theirs may choose nothing. So a fence-free conflict between a column's closer and the next opener fails: one of its choices would put content between columns.
+ - **A unit holding layouts** counts as one top-level layout, so it fails anywhere but the top level.
+ - **The parse agrees.** `align` matches by source, so a side whose layout was broken text can align its `:::: columns` paragraph with a real fence. So the check also joins the result, with each conflict taken as mine and then as theirs, and requires `Parse` of each to give the settled blocks' kinds and order.
+
+ If any of this fails, the merge runs again, widening **every** stretch that touches a fence on any side, clean or not, by rule 1's widening, and resolving each by diff3's rule. A layout one side reshaped and the other left alone is then taken whole from the side that changed it. A layout both sides changed, where at least one changed its shape, is one conflict. The second pass's result always passes the check, because every layout in it comes whole from one side.
Examples:
- Ana undoes a layout while Bo adds a column to it. Each change is clean on its own, and together they leave a column with no layout. Rule 2 makes the whole layout one conflict.
@@ -261,8 +271,18 @@ Examples:
**The server holds these rules too (M3).** The editor is not the only caller of a block-index route.
- **`MarkBlock`** refuses the four fence kinds, as it refuses code and rules (`markers.go`).
+- **`LinkMention`** ("Link it") refuses them too. Fences hold no words, so the index never offers one, but a forged or stale post must not turn a `::: column` line into a link and break the layout.
- **`MakeTeamPage`** (`share.go`'s `splitBlocks`) refuses indices that cut a layout: the chosen blocks must be whole layouts, or lie within one column. The editor widens first, so a refusal means a stale or foreign client.
-- **The grammar version (D17).** `markup.Grammar` is an integer, 2 from this change. The island carries it, and every route that posts block indices (Make team page, Link to this block, and the History and conflict routes that post hunk indices) sends it back. A post with another version, or none, is refused with 409 and the bar "Mapa has been updated. Reload to keep editing." Its draft is kept. Autosave sends text, not indices, so it is not refused; a tab on the old bundle simply cannot make a layout, because the old editor has no command for one.
+- **The grammar version (D17).** `markup.Grammar` is an integer, 2 from this change. Every route that posts a block index sends it back, as a field named `grammar`:
+
+ | Route | Handler | Where `grammar` comes from |
+ |---|---|---|
+ | `POST /p/{id}/share` (Make team page) | `private.go`, `share.go` | the island, in the editor's post; the scriptless form's hidden field |
+ | `POST /p/{id}/blocks` (Link to this block) | `handlers_history.go` | the ¶ handle's post, from the island; the server-rendered form's hidden field |
+ | `POST /p/{id}/mentions` (Link it) | `handlers_edit.go` | the Links panel's server-rendered form, a hidden field |
+ | `POST /p/{id}/resolve` (the inline choice and the conflict page) | `handlers_edit.go` | the island; the conflict page's hidden field |
+
+ The build checks this list against every handler that reads a block or hunk index, and COL13 fails on one that does not check `grammar`. A post with another version, or none, is refused with 409. Its draft is kept. **The reply's `error` carries the sentence** "Mapa has been updated. Reload the page to keep editing.", because the tabs this refusal is for run the old bundle, which shows a reply's `error` (`maketeam.mjs`) and has no new bar. A scriptless form shows the sentence on the page it returns to. Autosave sends text, not indices, so it is not refused; a tab on the old bundle simply cannot make a layout, because the old editor has no command for one.
---
@@ -291,11 +311,13 @@ Examples:
- **Scriptless,** the file goes as it is, within the limits.
- **Drawn as** a square, `object-fit: cover`, with Fiesta's small radius (`--rst-radius-sm`, 4px).
- **Serving them cheaply (M5).** `GET /i/{id}` reads the bucket and unseals under the blob semaphore (images §1.4). A sidebar, All pages and ⌘K can ask for dozens of icons at once. So:
- - **An icon cache:** opened icon bytes, at most 128 KiB each, are kept in a bounded in-memory LRU of 16 MiB, keyed by public id, and served from it without the semaphore. "Remove from Mapa" and the sweep evict the entry in the same step that deletes the row. Memory is not rest, so the seal's rule is unchanged; the index already holds titles and bodies in memory.
- - **A cache miss** takes the semaphore like any image.
+ - **A small-image cache:** `GET /i/{id}` keeps the opened bytes and content type of **any** image within the icon limits (§2.3), in a bounded in-memory LRU of 16 MiB keyed by public id. The handler cannot tell an icon from a small body picture, and need not.
+ - **Scope first, always.** A hit is served only after images §1.4 step 1 has passed against the row, in the database, on every request: the row exists, and the viewer may read it (its page live and in scope, or the viewer's own pending image). The cache replaces only the bucket read and the unseal, never the read rule. So a deleted page, a removed image or a removed member answers 404 whether or not the bytes are cached. Eviction on removal and sweep is tidiness, not correctness.
+ - Memory is not rest, so the seal's rule is unchanged; the index already holds titles and bodies in memory.
+ - **A miss** takes the semaphore like any image.
- **Lists draw `loading="lazy"`** for icons below the first screen.
- The browser's own cache (`private, max-age=3600, immutable`) covers repeat views.
- - LOOK12 times All pages with 200 image icons against the bucket fake's latency.
+ - LOOK12 times All pages with 200 image icons against the bucket fake.
### 2.4 Where it shows, and at what size
@@ -393,7 +415,7 @@ Wherever a team page's title is drawn, the icon is drawn just before it. **The i
The images spec's §3.2 gains one clause. **A page's references are its body's `/i/` addresses and its record's `icon.image` and `banner.image`.** Everywhere the attach rule and the retention rule say "referenced by the body", they now say "referenced by the body or the record":
- **In code (M6):** `settleImages`, `stampImages` and `heldImages` (`images_attach.go`) take the page's references, `markup.ImageIDs(body)` joined with the record's two, instead of the body. Every `tx.commit` caller and `repointImages` pass the record they write. A body edit after an icon is set must leave the icon's `unreferenced_at` null (LOOK5).
- **Attaching:** `styled` is added to the verbs that pass attach. It attaches an icon or banner image that it introduces, that is pending, and that is owned by the person setting it.
-- **Which images a look may name, checked before the write** (M6). Today's attach skips a foreign pending id silently. `styled` checks first, and accepts exactly two cases:
+- **Which images a look may name, checked inside the write** (M6), in the same `Store.write` as the commit, before it. Today's attach skips a foreign pending id silently. `styled` checks first, and accepts exactly two cases:
- the setter's own pending image, which the write attaches;
- an image **already attached to this page**: a picture in its body, or its previous icon or banner still inside the window.
@@ -456,7 +478,7 @@ The images spec's rendering rule (§3.1) draws `/i/<id>` in page P's **body** on
- **Every list, every arrow and every count** come from the index through the **one scoped accessor** (level-up §8). The pages inside P are team pages, which every member may open, so in practice every member sees the same lists. The accessor is still the only path, so a future rung cannot leak through this one.
- **The arrow's presence** says only that at least one page the viewer may open is inside. "All <n> pages inside" counts only those.
-- `GET /side/inside/{id}` answers 404 for a page the viewer may not open, and for a private page, exactly as for one that does not exist.
+- `GET /side/inside/{id}` and `GET /p/{id}/inside` answer 404 for a page the viewer may not open, and for a private page, exactly as for one that does not exist. Both go through the accessor and write nothing.
---
@@ -504,6 +526,9 @@ These change the Notion import spec. Its §10 table, §9.1, §11.4 and §15 are
- **How many:** as many as the person has free pin slots (Q4 asks to raise the limit from 12 to 20). The rest are marked as offered without a slot, and the report lists them by title, each a link to its page, where Page → Pin is one click: "Pinned 9 of your 14 top-level pages. Your sidebar holds 20 pins."
- **When and how (M4):** after the fix-up pass (import §13.6) and **before** the run's `done` bookkeeping, in **one `Store.write`**: it checks the lease, writes the member's sealed pins, writes the `pin` mark on each offered root's coordinate, and logs one `pins` event with the member as its object (level-up §8), exactly as `POST /p/{id}/pin` does. It is a person's write, never bookkeeping. `ImportCreate` already writes coordinates inside a `Store.write`, so this is the same shape, and I19's fence on the bookkeeping function is untouched.
- **Crashes:** a crash before the write leaves no mark, so Resume (or the next run) offers the same roots. A crash after it leaves the marks, so nothing is pinned twice. The `done` write that follows is the import's ordinary bookkeeping. I23 kills the run between each pair of statements, as I17 does.
+- **When nothing is offered** (every root already marked), the pin write does not run at all.
+- **When there are offered roots but no free slot,** the write still writes their marks and logs `pins`, though no pin changed. That is accepted: the event says only that the person's pins were considered, and it keeps the marks and the event in one transaction, which a bookkeeping write could not.
+- **Start over** (`started_over`) clears staged trees, not the map, so it keeps the marks. Only Forget clears them.
- **The report's count** is read from the marks with this run's id, unsealed for importers as the report's titles are. No plaintext counter is added to `notion_runs`.
- **Never again:** a root carries its mark for the life of the map, so a page the person unpinned stays unpinned. A root newly shared later is offered by the run that first surveys it. "Forget the import" deletes the marks with the map, so a new import offers its roots afresh.
- The pinned pages carry their icons because pins draw icons (§2.4).
@@ -539,7 +564,7 @@ The module reads three things it does not read today. Each goes in with a record
| Literal text that would be read as | Where it is checked | Written as |
|---|---|---|
-| a fence line (`:::` at the start of a line) | every line, the first and every hard-break continuation | U+200B before the first `:` |
+| a fence line (`markup.FenceLike`: `:::` after any spaces) | every line, the first and every hard-break continuation | U+200B before the first `:` |
**§15's `notion_images` row** gains: "and one row each for a page's icon and cover, whose place print is of the pseudo-block `icon:` or `cover:` and the Notion page id". **§15's coordinate record** gains the sealed `pin` mark (§6.3).
@@ -582,7 +607,7 @@ Paul's rule (2026-11-22): spacing comes only from Fiesta's scale (`--rst-sp-1` t
- `:::` inside a fenced code block in a column; a layout inside a code fence;
- **not layouts, each parsing exactly as today:** 1 and 5 columns; text before the first column; text between columns; an unclosed column; a closer of the wrong length; a nested layout; an indented fence; `::: column width="40%"`; `::: {.column}`; an opener with no blank line before it; a closer with text straight after it; a fence line inside a quote or a list item; a layout whose column holds an unclosed code fence.
- **COL3, fidelity L1–L3 over layouts.** L1: untouched layouts round-trip byte for byte. L2: editing a block in a column changes only that block's bytes. L3's seeded edits gain: making a layout from a block and from a selection; adding and removing columns; Undo columns; Backspace in an empty column; deleting across columns; typing `:::` in a column; pasting a layout at the top level and inside a column; undo after each. The structure check and the reparse rule hold, and no layout is ever left unbalanced.
-- **COL4, the merge.** Edits to different columns merge cleanly. The same block in both sides conflicts inside its column. A shape change on one side, with the other untouched, is clean. Undo columns against Add a column is one conflict over the whole layout. Both gives two whole layouts. Every result, and every choice of every conflict, passes `ValidLayouts`, and Settle keeps the bytes outside mine's changes. And the two cases review round 1 found:
+- **COL4, the merge.** Edits to different columns merge cleanly. A fence-free conflict placed between two columns, and a layout-holding conflict inside a column, each fail the first check and become whole-layout conflicts. A side whose layout is broken text, aligned against a real layout, is caught by the parse check. The same block in both sides conflicts inside its column. A shape change on one side, with the other untouched, is clean. Undo columns against Add a column is one conflict over the whole layout. Both gives two whole layouts. Every result, and every choice of every conflict, passes `ValidLayouts`, and Settle keeps the bytes outside mine's changes. And the two cases review round 1 found:
- **a broken clean hunk beside an unrelated conflict** (H1): one side splits a column in the textarea, the other undoes the layout, and both edit one top paragraph. The layout is a conflict, whichever choice is made;
- **renumbered columns** (H2): one side adds or removes a column, the other edits a block in a later column. Clean, with both sides' bytes kept and no fallback to `Join`.
- **COL5, rendering.** Go's `Render` and the editor's `toDOM` agree on every layout, the empty column's paragraph included (L4).
@@ -593,7 +618,7 @@ Paul's rule (2026-11-22): spacing comes only from Fiesta's scale (`--rst-sp-1` t
- **COL10, accessibility (browser).** Reading order is source order. ⌥⌘→ and ⌥⌘← move between columns. Insert → Columns, Add a column, Remove this column and Undo columns work from the keyboard. axe-core finds nothing serious.
- **COL11, the importer** (with §6.2's fixtures): 1, 2, 4 and 5 columns; nested; hoisted from a list item; a child page in a column; an empty column; unequal widths counted. The D9 check passes on every fixture. Re-rendering an untouched page with columns writes an `edited` revision once, then nothing.
- **COL12, Pandoc (recorded).** Every positive and negative COL2 case, and Mapa's own `Join` output for each editor command, rendered by a pinned Pandoc to its AST and committed as a fixture. A test asserts Mapa's recognition agrees with Pandoc's divs for each. The fixture is regenerated only by `make pandoc-fixture`, which CI does not need.
-- **COL13, the server's block routes.** `MarkBlock` refuses each fence kind. `MakeTeamPage` refuses indices that cut a layout and accepts whole layouts or one column's blocks. Every index-posting route refuses a missing or old `grammar`, with the draft kept.
+- **COL13, the server's block routes.** `MarkBlock` and `LinkMention` refuse each fence kind. `MakeTeamPage` refuses indices that cut a layout and accepts whole layouts or one column's blocks. Every route in §1.10's table refuses a missing or old `grammar` with the sentence in its reply's `error`, the draft kept; the scriptless forms carry the field and succeed. A test lists every handler that reads a block or hunk index and fails on one missing from the table.
- **`make mutate`** gains four mutations, each of which must be caught: the pre-pass accepts a one-column layout (COL2); `Merge3` skips the second pass (COL4); `Merge3` runs the second pass only when clean (COL4, H1's case); `MarkBlock` accepts a fence (COL13).
### Icons and banners
@@ -609,14 +634,14 @@ Paul's rule (2026-11-22): spacing comes only from Fiesta's scale (`--rst-sp-1` t
- **LOOK9, carried forward.** Every verb (commit, Revert, relink, markers, Restore of a deleted page, the importer's) keeps `icon` and `banner`. Restore this version keeps the current look. A draft open during a `styled` revision commits as Saved, not Merged. A look post repeated after a lost reply answers with the follow, and the tab's base moves to it.
- **LOOK10, accessibility (browser).** The picker's listbox, its search and its Esc, Change and Remove from the keyboard, focus returning each time. The banner's controls by keyboard. axe-core finds nothing serious.
- **LOOK11, the busy rule.** Setting and removing a look hold their spinner for 650ms.
-- **LOOK12, icons at scale.** All pages with 200 image icons, against the bucket fake with a fixed latency, completes inside the budget the build records, and a second view is served from the icon cache without the semaphore.
+- **LOOK12, icons at scale, and the cache's scope.** All pages with 200 image icons, against the bucket fake with 50ms per read, fetches every icon within 10 seconds cold, and a second view is served from the cache without the semaphore within 1 second. A cached icon answers 404 after its page is deleted, after "Remove from Mapa", and to a viewer outside its scope; a cached small picture on Ana's private page answers 404 to Bo.
### Pages inside and the arrow
- **IN1, the relation.** `In: [[P]]`, `In: [[P|shown]]`, through an alias, and with a marker count. A second-block `In:` line, a date link, a self-link, a pending link, a daily note or a scratch page with the line, and a private "parent" do not.
- **IN2, order.** Linked children in P's body order, then the rest in All pages' order.
-- **IN3, scope (extends L6).** Every list and count is read through the scoped accessor. Bo's sidebar is byte for byte the same whether or not Ana's private notes hold `In:` lines. `make mutate` gains a mutation that lists children without the accessor's scope, and it must be caught.
-- **IN4, nothing written (extends L7).** `GET /side/inside/{id}` and `POST /view/open` leave every table's hash unchanged. `return` accepts local paths only.
+- **IN3, scope (extends L6).** Every list and count, on the sidebar, `/side/inside/{id}` and `/p/{id}/inside`, is read through the scoped accessor. Bo's sidebar is byte for byte the same whether or not Ana's private notes hold `In:` lines. `make mutate` gains a mutation that lists children without the accessor's scope, and it must be caught.
+- **IN4, nothing written (extends L7).** `GET /side/inside/{id}`, `GET /p/{id}/inside` and `POST /view/open` leave every table's hash unchanged. `return` accepts local paths only.
- **IN5, first paint (browser).** With `mapa-open` set, opened rows are on the server's HTML, and mounting moves nothing.
- **IN6, the floor (browser).** With JavaScript off, the arrow opens and closes rows through `POST /view/open`.
- **IN7, cycles, depth and caps.** A pair of pages inside each other opens one level each way and no further. Indents stop at four levels. 51 children show 50 rows and the link to `/p/{id}/inside`, which lists all 51. A cookie opening more than 200 rows draws the rest closed. A page shown twice gives distinct `aria-controls` ids.
@@ -690,3 +715,17 @@ The recommended answers are written in.
| **M6** `renamedTo`, `settleImages`/`heldImages` and attach's silent skip disagreed with the spec; same-page images unspecified | §4.1 generalises `renamedTo`; §4.2 names the code changes and the explicit pre-write check, and allows same-page images within the icon limits. LOOK4, LOOK5, LOOK9 |
| **M7** remark-directive's form differs; Pandoc claims untested | D1 drops remark-directive; §1.1 adds the Pandoc fixture (COL12) and its named cases, and rule 5 covers indented fences |
| Lows | `Words` empty for fences (§1.4); fence length copies the column before (§1.1); the empty column's HTML (§1.5); Put inside is an editor transaction with the textarea as its floor (§5.1); "All pages inside" goes to `/p/{id}/inside` (§5.3); the cookie is per page with unique ids and a 200-row cap (§5.3); the aged-out summary (§3.4); the kicker after a look change (§3.4); the report's wording for large Notion icons (§6.1); `column_list` at any depth (§6.2); how the emoji list reaches the picker (§2.2); COL4, COL13 and LOOK4 gain the cases |
+
+### Round 2: Fable on revision 2 (`933e5a3`), CHANGES REQUIRED with no high, answered in revision 3
+
+Fable found every round-1 finding answered in substance, and five mediums and six lows in revision 2's own answers.
+
+| Finding | What changed |
+|---|---|
+| **M1** the opaque conflict unit's placement was undefined, and `align` could pair a broken layout's text with a real fence | §1.8 rule 2: a fence-free unit counts as one content block and must also pass empty; a layout-holding unit counts as a top-level layout; the joined result, each conflict taken both ways, must parse to the settled kinds. COL4 gains the placements |
+| **M2** the neutraliser reached code, ran only before the reparse, and step 5's whole-body adopt could still lose a layout | §1.7 rule 1 excludes code, runs again over adopted blocks to a fixed point, and touches changed blocks only; rule 4 covers step 5's adopt too. COL3 |
+| **M3** the grammar version missed Link it, the server-rendered forms, and the old bundle's way of showing a refusal; `LinkMention` could link a fence | §1.10's table of every index route and where `grammar` comes from; the sentence goes in the reply's `error`; `LinkMention` refuses fences. COL13 checks the table against the handlers |
+| **M4** the icon cache had no scope rule and no admission rule | §2.3: any image within the icon limits is cached; the read rule runs against the database on every request before a hit is served. LOOK12 gains the 404 cases and figures |
+| **M5** COL12 asserted agreement on negatives Mapa refuses on purpose | COL12 asserts the positives and `Join`'s output only, and records the negatives. §1.1 promises only the written form |
+| Lows | one `FenceLike` predicate everywhere (§1.1); the example shows the blank line before a closer; the look's image check is inside the write (§4.2); the pin write's empty and full cases, and Start over keeping the marks (§6.3); `/p/{id}/inside` in §5.4, IN3 and IN4 |
+