Spec revision 2: answer Fable's round 1 (2 high, 7 medium, 12 low)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 file changed,
+112
−48
docs/superpowers/specs/2026-11-22-mapa-columns-icons.md+112 −48
CI passed — run details
CI log
=== editor ===
cd editor && npm ci --no-audit --no-fund --loglevel=error
added 16 packages in 648ms
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 (2.557987ms)
✔ first words stop at five words or forty characters (0.184793ms)
✔ the field keeps one trimmed line, without brackets (0.371691ms)
✔ the field holds at most MaxAlt bytes, cut at a character (0.515979ms)
✔ days and weeks move across months and years (3.112008ms)
✔ a month keeps the day, or takes the month's last (0.339852ms)
✔ the grid is six weeks from Monday, as the month calendar draws it (0.562697ms)
✔ the grid starts the week where the locale does (0.667782ms)
✔ the keys move a day, a week, a month and a year (0.30651ms)
✔ the picked day is the chip [[ makes for a date (18.302587ms)
✔ Insert → Today's date still puts today in at once (2.071112ms)
✔ / offers Date, the picker, and Today's date beside it (0.260845ms)
✔ after a ! the chip goes in after a space, never as an embed (3.158995ms)
✔ where the Markdown would read the chip differently, it is refused (3.415631ms)
✔ over a selection the chip goes after it and the words stay (2.703057ms)
✔ today is the day in the viewer's zone (34.632288ms)
✔ every offered locale has cases (1.362483ms)
✔ dates.mjs writes every date Go writes, byte for byte (8.083534ms)
✔ a chip, the month and the week, in three locales (0.609543ms)
✔ dates.json is what ICU gives, byte for byte (988.962458ms)
✔ L1: mounting then serialising gives cleanBody(body), byte for byte (130.939455ms)
ℹ 871 bodies
✔ L1: mounting a stored body adds nothing, and saving it writes nothing new (218.165955ms)
✔ L2: one edited block changes only that block's bytes; undo gives the body back (377.408678ms)
ℹ 858 single-block edits
✔ L2: inserting or deleting a block changes bytes only at the new seams, by Join (208.263659ms)
ℹ 866 inserts, 817 deletes
✔ L3: seeded edits keep the document and its Markdown saying the same thing (7248.811002ms)
ℹ 20904 edits over 871 bodies
✔ L3: Link to a page makes exactly one chip, and changes nothing else (1658.749121ms)
ℹ 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 (1558.150821ms)
ℹ over 871 bodies: {"inserted":5158,"spaced":23,"refused":45,"unstable":9}
✔ linear: trailing spaces (58.043747ms)
✔ linear: trailing whitespace (32.096281ms)
✔ linear: unclosed web links (26.956022ms)
✔ linear: web links with no address (67.36342ms)
✔ linear: unclosed wiki links (55.060119ms)
✔ linear: unclosed embeds (71.981618ms)
✔ linear: closes only (23.145557ms)
✔ the selected words become the chip's shown text (13.036464ms)
✔ words that are the title make a plain [[Title]] (11.659253ms)
✔ spaces at the selection's edges stay outside the chip (11.304854ms)
✔ a date makes a date link, in a heading, an item and a quote (14.761262ms)
✔ bold words lose their bold: a chip carries no marks in Mapa's Markdown (1.653857ms)
✔ only the linked block's bytes change, and undo gives the body back (4.355669ms)
✔ a selection across blocks, over a chip or a break, or of brackets is refused (1.0699ms)
✔ a target the words cannot be linked to as typed is refused (0.216613ms)
✔ ⌘L: over a selection it opens Page link; with none it types [[; in code it does nothing (8.69486ms)
✔ web-linked words are refused: the address would be lost (review M4) (0.923297ms)
✔ words whose Markdown would read otherwise are refused (review M3) (5.209347ms)
✔ ⌘A then ⌘L says why, instead of doing nothing (review low 1) (0.467609ms)
✔ linkCheck says why it refuses (review low 2) (0.633589ms)
✔ golden file has bodies (0.932234ms)
✔ markup.mjs parses every body into Go's blocks, byte offsets and all (36.540596ms)
✔ markup.mjs strips and spans every block as Go does (88.928696ms)
✔ the schema's toDOM draws every body as Go renders it (115.014979ms)
✔ emphasis draws the four pinned outputs (30.913331ms)
✔ a body ends in the editor's empty paragraph (0.379906ms)
✔ the editor labels date chips as Go does, in every locale L4 holds (26.71794ms)
✔ a POST that never answers is aborted after the timeout (21.350586ms)
✔ a keepalive POST carries no signal, and an answer clears the timer (1.069909ms)
✔ autosave sends only what differs, and the tab owns the draft it wrote (17.562672ms)
✔ an offered draft never commits by itself; Save commits it (2.422896ms)
✔ reload, then close: sessionStorage says the draft is this tab's own (0.729607ms)
✔ closing carries text not yet sent, and the cap leaves it out (95.184819ms)
✔ clean rebase: applied, the caret survives, the base moves by the rebase POST (10.853105ms)
✔ the block under the caret is the teammate's too, and undo brings back yours (10.966965ms)
✔ typing mid-flight: the merge is not applied and the base does not move (2.333961ms)
✔ a merge the editor cannot represent stops after three tries (5.873904ms)
✔ a conflict is shown, locks the editor's own commits, and Resolve settles it (1.915623ms)
✔ leaving: a conflict stays with the choice; a failed flush offers Leave anyway; a stored draft leaves (2.628288ms)
✔ a stale tab shows the newer draft, offered, and never overwrites it (1.579888ms)
✔ the first scratch commit: empty creates nothing, then one page, then drafts on it (1.773459ms)
✔ noBase and gone lead to the existing choices (1.941231ms)
✔ a commit that merged is applied when nothing was typed since (1.671899ms)
✔ back from the cache: nothing unsaved reloads, unsaved text autosaves at once (24.903865ms)
✔ an own draft committed meanwhile goes on as a new draft (1.137295ms)
✔ a reload keeps a stored draft; unsent text still commits (1.278618ms)
✔ a page deleted mid-edit: what is typed is still stored as the draft, and nothing commits (H1) (1.347756ms)
✔ an offered draft committed in another tab: typing goes on as a new draft (H1) (10.916311ms)
✔ a commit reply without a revision is not a commit; an emptied day starts afresh (H2) (1.219068ms)
✔ Resolve stores what was typed first, and takes no typing until its answer is applied (M1) (6.555321ms)
✔ closing with a choice open, or commits held, still writes the text, never commits (M2) (3.831146ms)
✔ closing inside the settling window sends the loaded version with settling=1 (M3) (0.620554ms)
✔ a clean merge not applied because of typing still ends the choice on show (M4) (1.818181ms)
✔ settling finds the draft committed with a teammate's text: a close still writes (M-A) (0.736139ms)
✔ settling finds another tab's newer draft: the tab shows it before any typing (1.218586ms)
✔ a page deleted before the first autosave: the text is offered as a scratch page, and a close makes one (M-B) (0.96234ms)
✔ an autosave that never answered but landed: its 409 keeps the typing since (L3) (1.030897ms)
✔ marks: em outside strong, bold reopened around italics, edges outside (9.067844ms)
✔ marks close before code, links and atoms, and reopen after (0.499459ms)
✔ untouched blocks and atoms re-emit their source; edited atoms are written from attributes (7.580659ms)
✔ empty blocks are written as nothing (3.009106ms)
✔ an unclosed fence that is no longer last gets its closing fence (1.959205ms)
✔ the structure check puts Join's seam where a kept one would merge two blocks (2.835163ms)
✔ prepareSave adopts the parse when no seam or rewrite can save the document (4.445348ms)
✔ reparse: typed emphasis becomes a mark, "- " after a break becomes an item (10.800426ms)
✔ a trailing hard break stays on screen and is written as nothing (1.473079ms)
✔ the reparse waits while an IME is composing (2.716432ms)
✔ copied blocks paste with their bytes and seams; a cut and paste gives the body back (13.887226ms)
✔ a forged x-mapa slice is refused, and text from outside is read as Markdown (0.824904ms)
✔ rebuild changes origins only, outside undo history (1.785641ms)
✔ applyBody takes a teammate's block, keeps the caret, and ends untouched (3.497204ms)
✔ a block whose context changed is written again: a task toggled, a bullet, a quote (3.342326ms)
✔ a duplicate ^id typed above its holder never takes the id from it (5.418088ms)
✔ a copy-dragged block is reparsed, and says what its Markdown says (2.591128ms)
✔ a history command that throws is refused, never thrown (11.047015ms)
✔ an image re-emits its source, and an edited alt changes only its span (1.541848ms)
✔ a paste whose image copy is refused says why and pastes nothing (29.35923ms)
✔ a line of image openers reads in linear time (166.265863ms)
✔ a line of shared link address reads in linear time (27.223048ms)
✔ a line of shared web address reads in linear time (112.721405ms)
✔ one rename at a time, from either field (2.230318ms)
✔ an empty or unchanged title sends nothing (0.251318ms)
✔ a refusal keeps what was typed, and the title (0.2691ms)
✔ the pending state holds for the busy rule (9.341573ms)
✔ a failed POST says so and keeps the title (0.547468ms)
✔ Update links posts the confirm page's POST (0.385177ms)
✔ clean is CleanTitle's whitespace rule (1.878944ms)
✔ the saver's base follows a rename made over it, and only that (0.346996ms)
✔ closing sends the rename as one keepalive POST (4.503866ms)
✔ the port answers every shared case as typeddate.go does (7.54398ms)
✔ numbers follow the locale: 12/11 is November in en-IE, December in en-US (0.291773ms)
✔ M6: several files land in the order they were chosen (58.613326ms)
✔ M5: one Backspace before the box keeps the image where the box is (10.442942ms)
✔ M5: undoing text typed just before the box keeps the upload (18.027678ms)
✔ L12: a failed upload an undo takes away does not stall the next (16.065939ms)
✔ M4: Replace… keeps the old image until the new one is in, and its alt (17.752485ms)
✔ M3 and N1: text wins, except over a picture copied from a page (2.825034ms)
✔ N2: a JPEG over 10 MB is scaled before its size is checked (16.728551ms)
✔ a drag whose anchor the document no longer reaches selects to its end (8.769309ms)
ℹ tests 126
ℹ suites 0
ℹ pass 126
ℹ fail 0
ℹ cancelled 0
ℹ skipped 0
ℹ todo 0
ℹ duration_ms 11612.230769
=== 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 6.297s
? 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 20.836s
? 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 14f9e27..cb1d261 100644 |
| --- a/docs/superpowers/specs/2026-11-22-mapa-columns-icons.md |
| +++ b/docs/superpowers/specs/2026-11-22-mapa-columns-icons.md |
| @@ -1,6 +1,7 @@ |
| # Mapa: columns, page icons, banners, and pins from the import |
| -**Status:** revision 1, 2026-11-22, for review. Nothing is built. |
| +**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. |
| **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?"* |
| @@ -30,7 +31,7 @@ He approved all four on 2026-11-22. This spec says how. |
| It changes no trust property. §4's plaintext list is unchanged. No new table, no new plaintext column, no new network host unless Q5 says yes. |
| -**Names in this spec.** Its decisions are D1 to D16 (§0). Its gates are COL1–COL11, LOOK1–LOOK11, IN1–IN8 and I20–I25 (§9). Its questions are Q1 to Q8 (§12). |
| +**Names in this spec.** Its decisions are D1 to D17 (§0). Its gates are COL1–COL13, LOOK1–LOOK12, IN1–IN8 and I20–I25 (§9). Its questions are Q1 to Q8 (§12). |
| --- |
| @@ -38,11 +39,11 @@ It changes no trust property. §4's plaintext list is unchanged. No new table, n |
| | # | Decision | Rejected | Section | |
| |---|---|---|---| |
| -| D1 | **Columns are Pandoc's fenced divs**, in a strict form Mapa reads and writes: `:::: columns`, then two to four `::: column` … `:::`, then `::::`. Pandoc, Quarto, remark-directive and Markdig read them the same way. Everywhere else they read as text and ordinary blocks | HTML (`<div>`), which Mapa never renders; a table hack; Obsidian plugin syntaxes (`--- start-multi-column`), which nothing else reads; a `columns` code fence, which hides its blocks from search and links | §1.1 | |
| +| D1 | **Columns are Pandoc's fenced divs**, in a strict form Mapa reads and writes: `:::: columns`, then two to four `::: column` … `:::`, then `::::`. Pandoc and Quarto are the reference, and a recorded Pandoc fixture holds Mapa to them (COL12). markdown-it-container reads `::: name` containers too. remark-directive wants `:::name` with no space, so there, as in Obsidian and GitHub, the fences are text and the blocks are ordinary blocks | HTML (`<div>`), which Mapa never renders; a table hack; Obsidian plugin syntaxes (`--- start-multi-column`), which nothing else reads; a `columns` code fence, which hides its blocks from search and links | §1.1 | |
| | D2 | **A layout is recognised only when it is whole.** Anything less is today's text, byte for byte and meaning for meaning. No existing page changes, and the corpus proves it | Partial recognition (an unclosed layout running to the end, as an unclosed code fence does) | §1.2 | |
| | D3 | **Fences are blocks.** The layout's four kinds of fence line are blocks of their own kinds in Mapa's flat block list, and the blocks between them are ordinary blocks that know their column. The merge, `Replace`, `Settle`, block indices and the editor's side table keep working on one flat list | A nested block tree, which every one of those would have to learn | §1.4 | |
| | D4 | **Equal widths only. No `width=`, no nesting, 2–4 columns.** Columns stack below a container width, not a viewport width | Pandoc's `width="40%"`, until someone asks (Q2); nesting, which no phone can show | §1.1, §1.5 | |
| -| D5 | **The merge never cuts a layout in a way that breaks it.** Edits inside columns merge block by block, as now. A conflict whose hunk holds a fence widens to the whole layout. A clean merge that would not parse back is redone with layouts as units | Treating a layout as one block, which would make two people's edits to different columns conflict | §1.8 | |
| +| D5 | **The merge never cuts a layout in a way that breaks it.** Edits inside columns merge block by block, as now. A conflict whose hunk holds a fence widens to the whole layout. Whenever any side holds a fence, the settled sequence, conflicts included as opaque units, is checked; if its layouts would not be valid, the merge is redone with layouts as units | Treating a layout as one block, which would make two people's edits to different columns conflict | §1.8 | |
| | D6 | **Icons and banners are page metadata, in the sealed record**, not body text. Team pages only | A first line in the body (`icon: 🚀`), which every reader of the Markdown would see; a plaintext column | §2.1, §3.1 | |
| | D7 | **Changing the look mints a revision**, logged `styled`, holding the same body, as a rename does. History shows it, drafts are carried over it, and the importer counts it as an edit | Changing the record in place, which would let a re-run of the import undo a person's choice and leave History silent | §4.1 | |
| | D8 | **An icon is one RGI emoji or a Mapa image.** RGI is Unicode's list of emoji every platform draws, vendored at one version | Any text; Notion's own icon set, which is SVG, which Mapa refuses (images Q1) | §2.2 | |
| @@ -53,7 +54,8 @@ It changes no trust property. §4's plaintext list is unchanged. No new table, n |
| | D13 | **The arrow's state is a cookie,** like the sidebar's fold. Scriptless, it is a view POST | A row in the database; a GET that writes | §5.3 | |
| | D14 | **The importer pins the roots it creates, for the person who ran it, once.** A re-run never pins a page again | Pinning for every member; re-pinning on every run | §6.3 | |
| | D15 | **The importer carries icons, covers and columns** through the forms above, under the untouched rule it already has | Leaving them counted and lost, as now | §6 | |
| -| D16 | **Typed text never makes or breaks a layout.** The editor and the importer put U+200B before a line that starts with `:::`. Layouts come from Insert, `/`, paste and the textarea | The editor adopting the parse, which would let one typed `:::` tear a layout apart | §1.7 | |
| +| D16 | **Typed text never makes or breaks a layout.** The editor and the importer put U+200B before a line whose text starts, after any spaces, with `:::`. A code block inside a column is always written closed, and a structural reparse inside a column is confined to that column. Layouts come from Insert, `/`, paste and the textarea | The editor adopting the parse, which would let one typed `:::` or an unclosed fence tear a layout apart | §1.7 | |
| +| D17 | **The block grammar has a version.** The island carries it, and every route that posts block indices sends it back. A tab on an older bundle is refused and told to reload, so it never moves or marks blocks it counted differently | Trusting indices across a grammar change | §1.10 | |
| --- |
| @@ -91,10 +93,14 @@ 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 that starts with three colons. That rules out nesting, a stray `:::`, 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 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. |
| 6. **The layout's closer ends a block.** It is the body's last line, or the line after it is blank. |
| -**What Mapa writes.** The layout opener with four colons, columns with three, and the seams shown above (§1.4). That is Quarto's own documented form without its braces. A layout typed by hand with longer fences keeps them: a column added to it copies its siblings' fence length. |
| +**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. |
| +- **On success,** the layout's lines are taken, and the scan resumes at the line after its closer. |
| +- **On failure,** that one opener line is ordinary text, and the scan resumes at the very next line. So a later opener, including one inside the failed candidate, is tried on its own terms. A nested layout therefore gives the inner layout as columns, with the outer fence lines as text around it. |
| + |
| +**What Mapa writes.** The layout opener with four colons, columns with three, and the seams shown in §1.4. That is Quarto's own documented form without its braces. A layout typed by hand with longer fences keeps them. A column added to it copies the fence length of the column before it, or of the one after it when it is added first. |
| **Recommendations inside the grammar:** |
| - **Every column is explicit (rule 2).** Pandoc would read text between the opener and the first column as part of the outer div. Mapa has nowhere to draw it. |
| @@ -102,6 +108,7 @@ The right column's blocks. |
| - **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). |
| ### 1.2 A stray `:::` in an old page |
| @@ -137,16 +144,22 @@ The right column's blocks. |
| **`Join`'s rule for fences**, which is how Mapa writes a new layout: |
| - a blank line after the layout's opener, between a column's closer and the next opener, and before the layout's closer; |
| -- one newline after a column's opener and before its closer; |
| +- one newline after a column's opener; |
| +- **a blank line before a column's closer**, so no reader's lazy continuation can carry a quote or list item's line into it (§1.1); |
| +- an empty column's opener and closer on consecutive lines; |
| - blocks inside a column are joined by today's rule. |
| Any seam parses the same way, because the parser does not need blank lines next to fences. Seams that already exist are kept byte for byte (level-up §6.4). |
| +**`Column` and a `columns` block's `Level` are derived, not identity** (H2). They are positions, so a block keeps its source and kind when a column is added before it, but its `Column` changes. So: |
| +- **`align`** matches by source, as now; |
| +- **`sameStructure`** compares kind, source, and a content block's `Level` and `Ordered`, and **never** `Column` or a `columns` block's `Level`; |
| +- **layout validity** is a separate check, `markup.ValidLayouts(blocks)`, over the kinds of the sequence: every opener followed by two to four columns, each column's fences in order, no content block between columns, no fence outside a layout. It renumbers `Column` and `Level` as it goes. The editor's structure check uses the same pair, ported. |
| + |
| **Other consumers of blocks:** |
| -- **`Plain`** of a fence is the empty string. Search, snippets, unlinked mentions and the word index never see the word `columns`. |
| +- **`Plain` and `Words`** of a fence are empty. Search, snippets and the word index read `markup.Words` (`words.go`, `snippet.go`, `search.go`), so the word `columns` never reaches them, nor unlinked mentions. |
| - **`Replace`** and block indices count fences as blocks. Make team page's indices come from the committed body parsed by `markup.mjs` (level-up §6.7), so they agree. |
| - **`Strip`, `marker`, chips and spans** never run on a fence. |
| -- **`sameStructure`** compares `Column` as well as kind, level and source. |
| ### 1.5 Rendering |
| @@ -157,7 +170,7 @@ Any seam parses the same way, because the parser does not need blank lines next |
| </div> |
| ``` |
| -- **The server draws it, and `toDOM` draws the same** (L4). The empty column's paragraph is the editor's own empty paragraph, pinned in L4 like the trailing one. |
| +- **The server draws it, and `toDOM` draws the same** (L4). An empty column is `<div mapa-column>` holding exactly `markup.EmptyParagraph`, the editor's own empty paragraph, pinned in L4 like the trailing one. A scriptless reader sees an empty column of one line's height. |
| - **Side by side:** a CSS grid of equal tracks (`repeat(n, minmax(0, 1fr))`), top-aligned, with a column gap of `--rst-sp-5`. No rule, border or fill: a layout is a way of placing blocks, not a box. |
| - **Stacked below a container width.** A container query on the page column (`[mapa-doc]`), never the viewport, because the open sidebar and Links panel change the column's width (level-up §4.1). The columns stack below **36rem**, in column order. Stacked, the gap between columns is the body's own block gap, so they read as consecutive blocks. Q3 asks Paul about the width. |
| - **Inside a column**, the blocks keep the body's rhythm: the first block's top margin and the last block's bottom margin are zero, as in `[mapa-body]` (§8). |
| @@ -201,9 +214,13 @@ Any seam parses the same way, because the parser does not need blank lines next |
| - **Mapa's own slice** (`application/x-mapa`) carries fences as blocks, with their sources and seams. Pasted at the top level, a layout arrives whole. Pasted inside a column, the layout's blocks arrive in reading order, without their fences (no nesting). |
| - **`text/plain`** is parsed as Mapa Markdown, by the same rule. |
| - **`text/html` from outside** maps blocks in document order. A side-by-side layout from another app arrives as its blocks, one after another. |
| -- **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. |
| +- **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 (D16).** Mapa has no escapes (level-up D11), and a typed `:::` inside a column would close it. So **the settle plugin puts U+200B before any line, in any textblock, whose text starts with `:::`.** That is the importer's neutraliser (Notion import §11.4) applied to one more pattern. The line looks the same, the stored text parses as text, and no layout is ever made or broken by typing. An untouched block is never rewritten; this changes only blocks being edited. |
| +**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. |
| +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. |
| **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. |
| @@ -215,11 +232,15 @@ 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. **A clean result must parse back.** After the first pass, `Merge3` joins the settled blocks and checks the structure (`sameStructure`). If the result breaks, the merge runs again, widening every stretch that touches a fence on any side 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. |
| +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. |
| -For example, 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. |
| +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. |
| +- The same, while both also edit one paragraph at the top. The paragraph is a conflict, so the merge is not clean. Rule 2 still runs, because sides hold fences, and the layout becomes a second conflict. |
| +- Ana adds a column after column 1 while Bo edits a paragraph in column 2. Bo's paragraph is in column 3 of the result. `Column` is derived (§1.4), so the result is valid and the merge is clean, with Ana's fences and Bo's bytes both kept. |
| +- Two people each remove a different column of a three-column layout. The result has one column, which `ValidLayouts` refuses, so rule 2 makes it one conflict. |
| -**`Settle`** keeps bytes as before, and its existing fallback to `Join` still applies to seams. Rule 2 is checked before `Settle` runs, so `Settle` is never handed fences that do not balance. |
| +**`Settle`** keeps bytes as before. Its structure check is `sameStructure`, which no longer compares `Column` (§1.4), so a merge that renumbers columns keeps its bytes and never falls back to `Join` for that. Rule 2 has run before `Settle`, so `Settle` is never handed fences that do not balance, whatever the choices. |
| **The editor's rebase and inline choice** (level-up §6.5) apply the merged body and rebuild the side table against it, fences included. A widened conflict shows its hunk around the whole layout. |
| @@ -238,6 +259,11 @@ For example, Ana undoes a layout while Bo adds a column to it. Each change is cl |
| - **Search, ⌘K snippets and the text index** read content blocks. Fences add no words. |
| - **"Link to this block"** marks content blocks in columns as anywhere. Fences cannot be marked. |
| +**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`). |
| +- **`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. |
| + |
| --- |
| ## 2. Page icons |
| @@ -255,14 +281,21 @@ For example, Ana undoes a layout while Bo adds a column to it. Each change is cl |
| - **Normalised before checking:** a minimally-qualified or unqualified form from the same file (`☺` without U+FE0F) is stored in its fully-qualified form (`☺️`), so every platform draws it as an emoji. |
| - **Anything else is refused:** "Choose one emoji, or upload a picture." Two emoji, text, and a private-use character are all refused. |
| - **A newer emoji** than the vendored version is refused until the file is updated. Updating it is a one-file change with its own test. |
| +- **How the picker gets the list:** a JSON file built from `emoji-test.txt` (each emoji, its group and its English name), served as a content-hashed static file, about 25 KB gzipped, fetched the first time the picker opens and cached. It is not in the editor bundle, so L12's size budget is untouched. |
| ### 2.3 Image icons |
| - **An icon image is a Mapa image** (images spec), attached to its page (§4.2). It counts against the team's allowance. |
| -- **Limits:** PNG, JPEG, GIF or WebP; at most 512 KiB and 1,024 px a side. Refusals name the figure, written in the reader's locale (§7). |
| -- **With script,** the picker crops the picture to a centred square and scales it to 256 × 256 px on a canvas before upload, as PNG, so a phone photo fits the limits. A picture that fails to decode is sent as it is. |
| +- **Limits:** PNG, JPEG, GIF or WebP; **at most 128 KiB and 512 px a side** (M5). An icon is drawn at 16 to 40 CSS pixels, and is fetched wherever a title is, so it must be small. Refusals name the figure, written in the reader's locale (§7): "Icons can be up to 128 KB and 512 pixels a side." |
| +- **With script,** the picker crops the picture to a centred square and scales it to 256 × 256 px on a canvas before upload: PNG when the picture has transparency, otherwise JPEG at quality 0.9, and halved again if it is still over the limit. A phone photo therefore always fits. A picture that fails to decode is sent as it is, and the server's limit decides. |
| - **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. |
| + - **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. |
| ### 2.4 Where it shows, and at what size |
| @@ -293,7 +326,7 @@ Wherever a team page's title is drawn, the icon is drawn just before it. **The i |
| - **Upload a picture…**, a file input with the four types; |
| - **Remove icon**, when there is one. |
| - A typed or pasted emoji in the search field, from the system's own picker (⌃⌘Space), is offered as the first result when it is valid. |
| -- **Choosing posts** `POST /p/{id}/look` and holds the busy rule's 650ms. |
| +- **Choosing posts** `POST /p/{id}/look` and holds the busy rule's 650ms. Its reply carries the new revision and the one it was made over, as a rename's does, so the editor follows its base (§4.1). |
| **Scriptless:** Page → Icon and banner opens `/p/{id}/look`, a form page in the shell. It has an emoji field, a file input, **Remove icon**, the banner's fields (§3.3), and Save. The file is uploaded as a pending image (its own `uploaded` write) and the look is set in the same request. |
| @@ -328,7 +361,8 @@ Wherever a team page's title is drawn, the icon is drawn just before it. **The i |
| - **Who may set or remove a look:** any member, on any team page, as with renaming (base §3.4). |
| - **Who sees it:** whoever may read the page. Every team page is every member's, so scope is the page's own. |
| -- **History** (level-up §4.5): a `styled` revision's summary is one of "Added an icon", "Changed the icon", "Removed the icon", "Added a banner", "Changed the banner", "Moved the banner", "Removed the banner", or two of them joined ("Changed the icon and the banner"). Choosing it shows that revision with **its own** icon and banner, read from its record, while their images are still kept (§4.3). |
| +- **History** (level-up §4.5): a `styled` revision's summary is one of "Added an icon", "Changed the icon", "Removed the icon", "Added a banner", "Changed the banner", "Moved the banner", "Removed the banner", or two of them joined ("Changed the icon and the banner"). When the revision before has aged out, so there is nothing to compare, it reads "Changed how the page looks". Choosing it shows that revision with **its own** icon and banner, read from its record, while their images are still kept (§4.3). |
| +- **The kicker's "Edited by"** reads the current revision's actor (`lastedit.go`), as it does after a rename. So after Bo changes the icon, the kicker says "Edited by Bo". That is honest, and the same as for a rename. |
| - **Restore this version** restores the body, as it does today, and keeps the current title, icon and banner. A look is set by setting it. |
| ### 3.5 No shift: L5 |
| @@ -345,8 +379,9 @@ Wherever a team page's title is drawn, the icon is drawn just before it. **The i |
| ### 4.1 The `styled` revision (D7) |
| - `POST /p/{id}/look` changes the record's `icon` and `banner` in **one `Store.write`** that mints a revision holding **exactly the previous body**, logged `styled` (object `page`). |
| - - It is a rename's shape (`verbs.go`): `carryDrafts` moves every draft on the old revision to the new one, so nobody's editor sees a merge, and `renamedTo`'s base-following covers it. The editor follows a `styled` revision exactly as it follows a `renamed` one. |
| - - A post that changes nothing writes nothing (level-up §6.4, step 7). |
| + - It is a rename's shape (`verbs.go`): `carryDrafts` moves every draft on the old revision to the new one, so nobody's editor sees a merge. |
| + - **The editor follows it as it follows a rename.** `renamedTo` today answers only for `verb = renamed` (`verbs.go`), so a retried rename whose reply was lost can still tell the tab its new base. It is generalised to `renamed` or `styled`, so a retried look post whose reply was lost does the same (M6). LOOK9 holds it. |
| + - A post that changes nothing writes nothing (level-up §6.4, step 7), and answers with that follow, as a repeated rename does. |
| - **Why a revision:** History must be able to say who changed a page's look and when. And the importer's untouched rule (Notion import D8) reads "any later revision": a person who changes an imported page's icon has chosen it, and a re-run must not put Notion's back. |
| - **The verb, in plaintext,** says that someone changed a team page's look and when. Teammates can see that on the page and in its History, so it adds nothing. It is never logged on a private page, because private pages have no look (§2.1). |
| - **"Recently edited" does not count `styled`,** as it does not count `renamed` (level-up §3.2). |
| @@ -356,7 +391,13 @@ Wherever a team page's title is drawn, the icon is drawn just before it. **The i |
| ### 4.2 The attach rule reads the record (D9) |
| 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": |
| -- **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. Someone else's pending id, or an image attached to another page, is refused with the app's 404, as if it did not exist. |
| +- **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: |
| + - 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. |
| + |
| + An icon is also checked against §2.3's icon limits, from the image's sealed record, so a large body photo cannot become an icon. Anything else, someone else's pending image or an image attached to another page, is refused with the app's 404, exactly as an id that does not exist, and nothing is written. |
| - **`unreferenced_at`** is stamped when a new revision's body **and** record stop referencing the image, and cleared when either references it again. |
| - **The sweep** keeps an image referenced by a page's current record, as it keeps one its body references. |
| - **Restore of a deleted page** re-points icon and banner images with the rest (images §3.2, item 4). |
| @@ -381,9 +422,9 @@ The images spec's rendering rule (§3.1) draws `/i/<id>` in page P's **body** on |
| - **It is derived, in memory,** in the index, from the body, like every other link (base §3.2). No new storage, no new plaintext, nothing in §4's list. |
| - **The importer writes this line already** (Notion import §9.4), so every imported child is inside its parent from the day it was imported. |
| - **People set it the same way.** |
| - - Typing the line works, with script or without. |
| - - **Page → Put inside…** opens a `[[`-style field and writes or replaces the line as the page's first block, an ordinary attributed edit (`edited`). |
| - - **Page → Take out of <P>** removes the line. |
| + - Typing the line works, with script or without. The scriptless floor is the textarea: typing or deleting the line there. No new route. |
| + - **Page → Put inside…** (with script) opens a `[[`-style field and writes or replaces the line as the document's first block, **as an editor transaction**, saved by autosave and committed like any edit. It is never a server edit under someone's open draft. |
| + - **Page → Take out of <P>** removes the line the same way. |
| - Moving a page is an edit of the child only. The parent's text is never touched, so nobody's page changes without their edit. |
| - **Only team pages, both ways.** A daily note or a scratch page with an `In:` line is not inside anything, and a private page cannot be a parent (it has no title). So the relation lists team pages only, which every member can open, and no private first line reaches the sidebar (level-up build note 80). |
| - **Renames:** the line is typed text that resolves through the alias (base §3.2), so a parent's rename keeps its children. **Delete** makes the line pending, and the child is inside nothing until a page takes that title. |
| @@ -401,8 +442,9 @@ The images spec's rendering rule (§3.1) draws `/i/<id>` in page P's **body** on |
| - **The row grid** for Pinned becomes `16px 16px 1fr`: the arrow's cell, the icon's cell, the title. A row with no arrow keeps an empty first cell, so every icon in Pinned lines up. |
| - **Opened rows** are indented one `--rst-sp-4` per level, up to four levels. Deeper levels keep the fourth indent. |
| - **Cycles:** a page that is already one of the row's own ancestors in this sidebar is listed without an arrow, so no row opens into itself. |
| -- **Long lists:** an opened row shows at most 50 pages inside, then **All <n> pages inside**, a link to P's Links panel. `<n>` is the viewer's own count, written with `{{number L n}}`. |
| -- **State:** the cookie `mapa-open` holds the public ids of the rows the person opened, space-separated, at most 64, newest kept. |
| +- **Long lists:** an opened row shows at most 50 pages inside, then **All <n> pages inside**, a link to `/p/{id}/inside`: a GET screen in the shell listing every page inside P, in §5.2's order, scoped like the arrow. `<n>` is the viewer's own count, written with `{{number L n}}`. |
| +- **A total cap:** the sidebar draws at most 200 opened rows in all. Past that, further opened rows are drawn closed, with their arrows, so the cookie can never make a sidebar of thousands of rows. |
| +- **State:** the cookie `mapa-open` holds the public ids of the pages the person opened, space-separated, at most 64, newest kept. It is keyed by page, not by path, so a page shown in two places is open in both. Each opened list's id includes its row's position (`inside-<row>-<page>`), so `aria-controls` never repeats an id. |
| - The server renders opened rows from it, so first paint is already right. |
| - With script, the arrow toggles at once (no busy rule; level-up L11's "switch at once" list), fetches `GET /side/inside/{id}` the first time, and sets the cookie. |
| - Without script, the arrow is a `POST /view/open` form with `id`, `open` and a `return` path checked to be local, which sets the cookie and redirects back, as `POST /view/sidebar` does. |
| @@ -426,8 +468,8 @@ These change the Notion import spec. Its §10 table, §9.1, §11.4 and §15 are |
| **Page icons**, from the page object's `icon`: |
| - **`emoji`:** the record's `icon.emoji`, after §2.2's check. An emoji Mapa's list does not have is not imported and is counted (`icon`). |
| -- **`custom_emoji`:** Notion's workspace emoji, a picture. It is downloaded through the file transport and becomes an image icon (§2.3), downscaled by the server's limits only. Mapa never decodes pixels, so a custom emoji over 512 KiB or 1,024 px is refused and counted. |
| -- **`file`** (an uploaded icon): the same as `custom_emoji`. |
| +- **`custom_emoji`:** Notion's workspace emoji, a picture. It is downloaded through the file transport and becomes an image icon (§2.3). Mapa never decodes pixels, so it cannot scale one down: a custom emoji over 128 KiB or 512 px is refused and counted. |
| +- **`file`** (an uploaded icon): the same. Uploaded Notion icons are often full-size pictures, so many will be refused. The report names the reason, "too large for an icon (over 128 KB or 512 pixels)", and the person can upload a smaller one in Mapa, where the picker scales it. |
| - **`external`:** Notion's own icon set and any other address. Notion's set is SVG, which Mapa refuses (images Q1), and other hosts are never fetched (Notion import D13). Not imported, counted (`icon`). |
| **Covers**, from the page object's `cover`: |
| @@ -447,7 +489,7 @@ These change the Notion import spec. Its §10 table, §9.1, §11.4 and §15 are |
| - **A `column_list` of two to four columns** becomes a layout: `:::: columns`, each `column` as `::: column` … `:::` with its blocks inside, in order, then `::::`, written by `Join`'s rule (§1.4). |
| - **One column:** its blocks, in place. |
| - **Five or more columns:** each column's blocks in order, as today. Counted (`columns`). |
| -- **A `column_list` inside a column:** its columns' blocks in order, inside the outer column. Counted (`columns`). |
| +- **A `column_list` inside a column, at any depth** (directly, or hoisted out of a list item, toggle, quote or callout inside the column): its columns' blocks in order, inside the outer column. Counted (`columns`). |
| - **Hoisting:** a `column_list` that the import spec's rules hoist out of a list item, a quote, a callout or a toggle lands at the top level, where it is a layout like any other. |
| - **Widths:** Notion's `width_ratio` (unverified, §6.5) is not imported. Counted (`column_widths`) when the columns' ratios differ. |
| - **An empty column** is written as its two fence lines. |
| @@ -455,12 +497,16 @@ These change the Notion import spec. Its §10 table, §9.1, §11.4 and §15 are |
| ### 6.3 Auto-pins (D14) |
| -- **Which pages:** the pages **this run created** (`ImportCreate`) that are **roots**: written with no `In:` line, because their Notion parent is not imported. |
| -- **Whose sidebar:** the person who pressed Start or Resume, only. Pins are per person and sealed (level-up Q1). Nobody else's sidebar changes. |
| +- **Which pages (M4):** the import's **roots never yet offered for pinning**: mapped pages, live in Mapa (not deleted), that this run surveyed with no imported parent, so they have no `In:` line, and whose sealed coordinate has no `pin` mark. Pages created by an earlier run count. So **Paul's existing import is pinned by its next run**, with no re-import, and each root is offered once. |
| +- **The mark** is a new field in the sealed coordinate (import §15), `pin`: the run that offered it and whether it was pinned or found no free slot. It is sealed, so §4's list is unchanged, and the report reads it to say what happened. |
| +- **Whose sidebar:** the run's actor at the time of the pin write: the person who pressed Start, or Resume if someone else resumed it. Pins are per person and sealed (level-up Q1). Nobody else's sidebar changes. A root offered to one importer is not offered again to another. |
| - **In what order:** Notion's API does not give a workspace's sidebar order. The run pins roots in **survey order** (Notion's `created_time`, then id: import §9.2), which is Notion's own default sidebar order, since Notion adds a new page at the end of its section. The person's existing pins stay first. The roots follow them, in that order. |
| -- **How many:** as many as the person has free pin slots (Q4 asks to raise the limit from 12 to 20). The rest are not pinned, and the report says so: "Pinned 9 of your 14 top-level pages. Your sidebar holds 20 pins." |
| -- **When:** once, when the run reaches `done`, in one lease-checked write that logs `pins` with the member as its object (level-up §8), exactly as `POST /p/{id}/pin` does. It is a person's write, never bookkeeping. The pinned pages carry their icons because pins draw icons (§2.4). |
| -- **Never again:** a re-run creates no page that exists, so it pins nothing it pinned before, and a page the person unpinned stays unpinned. A root newly shared later is created by that later run and pinned then, if there is a free slot. |
| +- **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. |
| +- **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). |
| ### 6.4 Re-runs (import §13) |
| @@ -468,7 +514,7 @@ These change the Notion import spec. Its §10 table, §9.1, §11.4 and §15 are |
| - **`ImportUpdate`** writes up to three revisions, in this order, each only when needed: `renamed` (the title), `styled` (the icon and banner, holding the previous body), and `edited` (the body). The coordinate records the last. `styled` and `edited` pass attach. |
| - **Kept pages stay whole.** A person who changed an imported page's icon or banner made a `styled` revision, which is a later revision, so the page is kept (§4.1). The same holds for a person's edit anywhere. |
| - **The first re-run after this ships** updates every untouched page that has columns, an icon or a cover in Notion, because those now render differently. That is the intended way to bring them across. The report's "updated" count will be large once. Pages Paul has edited in Mapa keep their flattened columns and no icon, as the untouched rule says. |
| -- **Auto-pins** are never repeated (§6.3). |
| +- **Auto-pins** are never repeated for a root (§6.3), and the first run after this ships pins the existing import's roots once. |
| ### 6.5 The Notion module (`oficina/notion`) |
| @@ -484,7 +530,7 @@ The module reads three things it does not read today. Each goes in with a record |
| | `column_list`, `column`, two to four columns | a column layout (this spec §1): `:::: columns`, then each column as `::: column` … `:::` holding its blocks in order, then `::::` | the widths, when they differ (counted) | |
| | `column_list` with one column | its blocks, in place | — | |
| | `column_list` with five or more columns | each column's blocks in order, left to right | side-by-side layout (counted) | |
| -| `column_list` inside a column | its columns' blocks in order, inside the outer column | the inner layout (counted) | |
| +| `column_list` inside a column, at any depth | its columns' blocks in order, inside the outer column | the inner layout (counted) | |
| | a list item's children | as before. A `column_list` child is hoisted straight after the item, where it is a layout | as before | |
| **§9.1's bullet** "The page's icon and cover are not imported. They are counted" becomes: "The page's icon and cover are imported as its look (this spec §6.1). An icon or cover Mapa cannot hold is counted." |
| @@ -495,7 +541,7 @@ The module reads three things it does not read today. Each goes in with a record |
| |---|---|---| |
| | a fence line (`:::` at the start of a line) | 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 `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). |
| --- |
| @@ -504,7 +550,7 @@ The module reads three things it does not read today. Each goes in with a record |
| Paul's rule (2026-11-17): numbers, dates and sizes are written in the reader's locale from day one, through `locale/` and rastrillo's number formatting. Storage stays canonical. |
| - **Numbers a person reads:** "Added 3 blocks"; "All 57 pages inside"; "Pinned 9 of your 14 top-level pages"; the report's new counts; Insert → Columns' "2 columns", "3 columns", "4 columns". All through `{{number L n}}` or `dates.mjs`'s number formatter. |
| -- **Limits in refusals:** "Icons can be up to 512 KB and 1,024 pixels a side." The figures through the same formatter, with the images spec's unit wording. |
| +- **Limits in refusals:** "Icons can be up to 128 KB and 512 pixels a side." The figures through the same formatter, with the images spec's unit wording. |
| - **Dates:** History's versions and "Earlier history has aged out" already use `{{longDate}}` and `{{stamp}}`. A `styled` revision's row is drawn by the same template. |
| - **Stored canonically:** `y` as an integer; the emoji as its code points; widths and positions never as formatted text. |
| - **Names are not formats.** The emoji picker searches Unicode's English names, because Mapa's interface is English. That is a language, not a format, and the rule does not reach it. |
| @@ -536,7 +582,9 @@ 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 parses back (`sameStructure`), and Settle keeps the bytes outside mine's changes. |
| +- **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: |
| + - **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). |
| - **COL6, no shift and stacking (browser).** L5 gains a page with a two- and a four-column layout, at 1440, 1000 and 390px, light and dark, with and without a draft. At 390px the columns stack. Opening and closing the Links panel at 1000px moves a layout between side-by-side and stacked by the container rule, not the viewport. |
| - **COL7, the floor (browser).** With JavaScript off, a layout renders as columns, and Edit as Markdown saves it unchanged. |
| @@ -544,21 +592,24 @@ Paul's rule (2026-11-22): spacing comes only from Fiesta's scale (`--rst-sp-1` t |
| - **COL9, typed fences.** Typing `:::`, `::: column` and `:::: columns` in a paragraph, in a column and at the top level stores them with U+200B, never changes a layout, and parses back as text in Go and in the port. |
| - **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. |
| -- **`make mutate`** gains two mutations, each of which must be caught: the pre-pass accepts a one-column layout (COL2), and `Merge3` skips the second pass (COL4). |
| +- **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. |
| +- **`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 |
| - **LOOK1, sealed.** `plaintext_test.go` is unchanged. Gate 4's file scan, with a page whose icon is a canary emoji sequence and whose banner's public id is a canary, finds neither in plaintext anywhere on disk, WAL included. |
| - **LOOK2, events.** `POST /p/{id}/look` logs exactly one `styled` event and mints one revision with the previous body. A post that changes nothing writes nothing. Gate 8's route test covers the route. It is refused on a daily note and a scratch page with the app's 404. |
| - **LOOK3, emoji.** RGI sequences are accepted, skin tones, flags, keycaps and ZWJ families included. Unqualified forms are stored fully-qualified. Two emoji, text, a lone modifier, a private-use character and an emoji newer than the vendored list are refused. |
| -- **LOOK4, attach and scope.** An icon or banner image attaches only when the `styled` revision introduces it, it is pending, and it is the setter's own. Another person's pending id, and an image attached to another page, give the app's 404, and nothing attaches. A body on P that types Q's icon address renders "Image not available". A chip to Q shows Q's icon. |
| -- **LOOK5, retention.** A replaced or removed icon or banner image is stamped `unreferenced_at`, drawn when its revision is opened in History, and swept after the window. A current icon is never swept. "Remove from Mapa" on an icon draws the page glyph everywhere. |
| +- **LOOK4, attach and scope.** An icon or banner image attaches only when the `styled` revision introduces it, it is pending, and it is the setter's own. An image already attached to the same page is accepted as a banner, and as an icon only within the icon limits. Another person's pending id, and an image attached to another page, give the app's 404, and nothing is written. A body on P that types Q's icon address renders "Image not available". A chip to Q shows Q's icon. |
| +- **LOOK5, retention.** A replaced or removed icon or banner image is stamped `unreferenced_at`, drawn when its revision is opened in History, and swept after the window. A body edit after an icon is set leaves the icon's `unreferenced_at` null. A current icon is never swept. "Remove from Mapa" on an icon draws the page glyph everywhere and evicts it from the icon cache. |
| - **LOOK6, everywhere a title is.** The icon is drawn in the title row, sidebar rows, chips, the Links panel's lists, ⌘K, Search, All pages and the tab title. The accessible names are byte for byte those without icons. |
| - **LOOK7, no shift (browser).** §3.5's L5 run, the look row included: hovering the page head moves nothing. |
| - **LOOK8, the floor (browser).** With JavaScript off, `/p/{id}/look` sets an emoji, uploads an icon, uploads a banner, moves it to Top, and removes both. |
| -- **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. |
| +- **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. |
| ### Pages inside and the arrow |
| @@ -568,7 +619,7 @@ Paul's rule (2026-11-22): spacing comes only from Fiesta's scale (`--rst-sp-1` t |
| - **IN4, nothing written (extends L7).** `GET /side/inside/{id}` 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 and depth.** 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. |
| +- **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. |
| - **IN8, accessibility (browser).** `aria-expanded`, `aria-controls`, the arrow's name, → and ←, and exactly one `aria-current`. |
| ### The importer |
| @@ -576,7 +627,7 @@ Paul's rule (2026-11-22): spacing comes only from Fiesta's scale (`--rst-sp-1` t |
| - **I20, icons.** Emoji, custom emoji and file icons are imported. External and Notion-set icons are counted. An emoji outside the list is counted. A failed download writes the page without its icon. |
| - **I21, covers.** File covers become banners, centred. External covers are counted (and, if Q5 says yes, Notion's gallery path is fetched and nothing else is). |
| - **I22, columns.** COL11. |
| -- **I23, auto-pins.** Only the runner's pins change. Only roots this run created are pinned, in survey order, after the existing pins, up to the limit, with the report's sentence. A re-run pins nothing. A page the person unpinned stays unpinned. |
| +- **I23, auto-pins.** Only the run's actor's pins change. Roots without a `pin` mark are pinned, in survey order, after the existing pins, up to the limit, with the report's sentence; roots created by an earlier run count. A re-run pins nothing it has marked. A page the person unpinned stays unpinned. Killing the run between each pair of statements of the pin write and the `done` write, then resuming, pins each root at most once. |
| - **I24, re-runs.** An untouched page whose Notion icon changed gets one `styled` revision. A page whose icon was changed in Mapa is kept. `renamed`, `styled` and `edited` land in that order in one transaction, and a crash between any two statements leaves no partial update (extends I17). |
| - **I25, no egress beyond the pin.** The file transport refuses an icon or cover on a host it does not pin, and the run counts it. If Q5 says yes, only the cover gallery's path is added, and a test proves any other path on that host is refused. |
| @@ -625,4 +676,17 @@ The recommended answers are written in. |
| ## 13. Findings and what changed |
| -*(Each review round is recorded here.)* |
| +### Round 1: Fable on revision 1 (`4879ec7`), CHANGES REQUIRED, answered in revision 2 |
| + |
| +| Finding | What changed | |
| +|---|---| |
| +| **H1** rule 2 checked clean merges only, so a broken clean hunk beside an unrelated conflict could be stored | §1.8 rule 2 now runs whenever any side holds a fence, with conflicts as opaque units, and the second pass widens every fence-touching stretch, clean or not. D5, COL4 and a mutation say so | |
| +| **H2** comparing `Column` and the opener's `Level` failed legitimate merges and pushed `Settle` to `Join` | §1.4: both are derived. `sameStructure` no longer compares them; `ValidLayouts` renumbers and checks the sequence. COL4 gains the case | |
| +| **M1** the reparse could still break a layout (unclosed fence, adopt order, blocks moved in with raw `:::`) | §1.7's four rules: neutralise before the reparse; blocks entering a column with a `:::` line count as edited; code in a column is always written closed; a structural adopt is confined to its column. D16 updated | |
| +| **M2** the scan after a failed opener was undefined, and COL2 contradicted the rules on nesting | §1.1 "The scan, exactly": resume at the next line. A nested layout gives the inner layout. COL2 corrected | |
| +| **M3** server block-index routes were unguarded, and old bundles count blocks differently | §1.10: `MarkBlock` refuses fences, `MakeTeamPage` refuses cuts, and D17's grammar version is checked on every index route. COL13 | |
| +| **M4** auto-pins never fired for the existing import; the write's order, crash rule, count and actor were unspecified | §6.3: roots without a sealed `pin` mark are offered once, in one `Store.write` before `done`, by the run's actor; the count is read from the marks. I23 extended | |
| +| **M5** image icons would queue behind the blob semaphore | §2.3: icons capped at 128 KiB and 512 px; a 16 MiB in-memory icon cache; lazy list icons. LOOK12 | |
| +| **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 | |