oficina / mapa Public

Merge level-up/review-fixes: Fable's final review round 3, H1-H2 and M1-M6

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
claude agent, operated by paul@keymail.dev pushed by paul@keymail.dev 14ab6a6bfb601e7abe6643c0a1561a866f630630 parent 58fd476parent 83ea360
36 files changed, +1,209 −190
  • docs/superpowers/specs/2026-11-14-mapa-level-up.md +47 −4
  • editor/commands.mjs +20 −0
  • editor/conflict.mjs +11 −1
  • editor/fidelity.mjs +12 −4
  • editor/fromMarkdown.mjs +3 −1
  • editor/keys.mjs +4 −5
  • editor/linear.test.mjs +37 −0
  • editor/markup.mjs +88 −25
  • editor/notices.mjs +10 −5
  • editor/page.mjs +34 −9
  • editor/saver.mjs +168 −43
  • editor/saver.test.mjs +168 −9
  • editor/serialize.test.mjs +62 −1
  • editor/testkit.mjs +4 −1
  • internal/mapa/autosave.go +4 −0
  • internal/mapa/credits/assets.json +1 −1
  • internal/mapa/drafts.go +3 −0
  • internal/mapa/drafts_commit.go +11 −0
  • internal/mapa/firstscratch.go +13 −4
  • internal/mapa/firstscratch_test.go +45 −0
  • internal/mapa/frame_test.go +4 −0
  • internal/mapa/handlers_autosave.go +7 −5
  • internal/mapa/handlers_drafts.go +19 −2
  • internal/mapa/markup/scan.go +93 −0
  • internal/mapa/markup/scan_test.go +28 −0
  • internal/mapa/markup/settle_test.go +14 −10
  • internal/mapa/markup/spans.go +13 −21
  • internal/mapa/markup/testdata/corpus/edge.json +8 −0
  • internal/mapa/markup/testdata/editor.json +4 −2
  • internal/mapa/markup/testdata/golden.json +2 −0
  • internal/mapa/side.go +7 −9
  • internal/mapa/static/{editor.778d4034d2ac17d8.js => editor.822bf0c12578e3c5.js} +32 −28
  • internal/mapatest/calendar_l7_test.go +38 −0
  • internal/mapatest/editor_review_browser_test.go +81 −0
  • internal/mapatest/gate1_test.go +5 −0
  • internal/mapatest/saving_review_test.go +109 −0

CI passed — run details

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

added 16 packages in 338ms
cd editor && node build-bundles.mjs
wrote internal/mapa/static/editor.822bf0c12578e3c5.js (302937 bytes, 94.6KB gzipped; L12 budget 120KB)
cd editor && node --test
✔ L1: mounting then serialising gives cleanBody(body), byte for byte (44.452866ms)
ℹ 760 bodies
✔ L1: mounting a stored body adds nothing, and saving it writes nothing new (82.166334ms)
✔ L2: one edited block changes only that block's bytes; undo gives the body back (105.575289ms)
ℹ 748 single-block edits
✔ L2: inserting or deleting a block changes bytes only at the new seams, by Join (124.782374ms)
ℹ 755 inserts, 715 deletes
✔ L3: seeded edits keep the document and its Markdown saying the same thing (3207.085848ms)
ℹ 18240 edits over 760 bodies
✔ linear: trailing spaces (20.106321ms)
✔ linear: trailing whitespace (15.114786ms)
✔ linear: unclosed web links (11.549475ms)
✔ linear: web links with no address (19.838575ms)
✔ linear: unclosed wiki links (23.701968ms)
✔ linear: unclosed embeds (25.549505ms)
✔ linear: closes only (9.350337ms)
✔ golden file has bodies (0.605493ms)
✔ markup.mjs parses every body into Go's blocks, byte offsets and all (12.720345ms)
✔ markup.mjs strips and spans every block as Go does (31.482595ms)
✔ the schema's toDOM draws every body as Go renders it (52.421362ms)
✔ emphasis draws the four pinned outputs (18.109869ms)
✔ a body ends in the editor's empty paragraph (0.326546ms)
✔ autosave sends only what differs, and the tab owns the draft it wrote (9.042538ms)
✔ an offered draft never commits by itself; Save commits it (0.833535ms)
✔ reload, then close: sessionStorage says the draft is this tab's own (0.41514ms)
✔ closing carries text not yet sent, and the cap leaves it out (27.285755ms)
✔ clean rebase: applied, the caret survives, the base moves by the rebase POST (3.95328ms)
✔ the block under the caret is the teammate's too, and undo brings back yours (3.180376ms)
✔ typing mid-flight: the merge is not applied and the base does not move (1.252182ms)
✔ a merge the editor cannot represent stops after three tries (3.962789ms)
✔ a conflict is shown, locks the editor's own commits, and Resolve settles it (1.981014ms)
✔ leaving: a conflict stays with the choice; a failed flush offers Leave anyway; a stored draft leaves (1.766606ms)
✔ a stale tab shows the newer draft, offered, and never overwrites it (0.886654ms)
✔ the first scratch commit: empty creates nothing, then one page, then drafts on it (0.923062ms)
✔ noBase and gone lead to the existing choices (0.907463ms)
✔ a commit that merged is applied when nothing was typed since (1.049556ms)
✔ back from the cache: nothing unsaved reloads, unsaved text autosaves at once (7.845828ms)
✔ an own draft committed meanwhile goes on as a new draft (1.53659ms)
✔ a reload keeps a stored draft; unsent text still commits (0.594613ms)
✔ a page deleted mid-edit: what is typed is still stored as the draft, and nothing commits (H1) (1.237805ms)
✔ an offered draft committed in another tab: typing goes on as a new draft (H1) (2.840056ms)
✔ a commit reply without a revision is not a commit; an emptied day starts afresh (H2) (1.079602ms)
✔ Resolve stores what was typed first, and takes no typing until its answer is applied (M1) (4.327834ms)
✔ closing with a choice open, or commits held, still writes the text, never commits (M2) (1.361865ms)
✔ closing inside the settling window sends the loaded version with settling=1 (M3) (0.499577ms)
✔ a clean merge not applied because of typing still ends the choice on show (M4) (1.104729ms)
✔ marks: em outside strong, bold reopened around italics, edges outside (5.249644ms)
✔ marks close before code, links and atoms, and reopen after (0.321626ms)
✔ untouched blocks and atoms re-emit their source; edited atoms are written from attributes (5.363946ms)
✔ empty blocks are written as nothing (1.561646ms)
✔ an unclosed fence that is no longer last gets its closing fence (1.134744ms)
✔ the structure check puts Join's seam where a kept one would merge two blocks (1.541769ms)
✔ prepareSave adopts the parse when no seam or rewrite can save the document (2.73422ms)
✔ reparse: typed emphasis becomes a mark, "- " after a break becomes an item (1.948623ms)
✔ a trailing hard break stays on screen and is written as nothing (0.558195ms)
✔ the reparse waits while an IME is composing (0.773184ms)
✔ copied blocks paste with their bytes and seams; a cut and paste gives the body back (3.25184ms)
✔ a forged x-mapa slice is refused, and text from outside is read as Markdown (0.845699ms)
✔ rebuild changes origins only, outside undo history (1.554884ms)
✔ applyBody takes a teammate's block, keeps the caret, and ends untouched (1.344473ms)
✔ a block whose context changed is written again: a task toggled, a bullet, a quote (2.623805ms)
✔ a duplicate ^id typed above its holder never takes the id from it (0.735744ms)
✔ a copy-dragged block is reparsed, and says what its Markdown says (0.943219ms)
✔ a history command that throws is refused, never thrown (2.74519ms)
ℹ tests 60
ℹ suites 0
ℹ pass 60
ℹ fail 0
ℹ cancelled 0
ℹ skipped 0
ℹ todo 0
ℹ duration_ms 3669.047373
=== 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	0.497s
?   	amadan.net/oficina/mapa/internal/mapa/icons	[no test files]
ok  	amadan.net/oficina/mapa/internal/mapa/markup	0.057s
ok  	amadan.net/oficina/mapa/internal/mapa/seal	(cached)
ok  	amadan.net/oficina/mapa/internal/mapatest	8.719s
?   	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
docs/superpowers/specs/2026-11-14-mapa-level-up.md

Loading diff…

editor/commands.mjs

Loading diff…

editor/conflict.mjs

Loading diff…

editor/fidelity.mjs

Loading diff…

editor/fromMarkdown.mjs

Loading diff…

editor/keys.mjs

Loading diff…

editor/linear.test.mjs

Loading diff…

editor/markup.mjs

Loading diff…

editor/notices.mjs

Loading diff…

editor/page.mjs

Loading diff…

editor/saver.mjs

Loading diff…

editor/saver.test.mjs

Loading diff…

editor/serialize.test.mjs

Loading diff…

editor/testkit.mjs

Loading diff…

internal/mapa/autosave.go

Loading diff…

internal/mapa/credits/assets.json

Loading diff…

internal/mapa/drafts.go

Loading diff…

internal/mapa/drafts_commit.go

Loading diff…

internal/mapa/firstscratch.go

Loading diff…

internal/mapa/firstscratch_test.go

Loading diff…

internal/mapa/frame_test.go

Loading diff…

internal/mapa/handlers_autosave.go

Loading diff…

internal/mapa/handlers_drafts.go

Loading diff…

internal/mapa/markup/scan.go

Loading diff…

internal/mapa/markup/scan_test.go

Loading diff…

internal/mapa/markup/settle_test.go

Loading diff…

internal/mapa/markup/spans.go

Loading diff…

internal/mapa/markup/testdata/corpus/edge.json

Loading diff…

internal/mapa/markup/testdata/editor.json

Loading diff…

internal/mapa/markup/testdata/golden.json

Loading diff…

internal/mapa/side.go

Loading diff…

internal/mapa/static/{editor.778d4034d2ac17d8.js => editor.822bf0c12578e3c5.js}

Loading diff…

internal/mapatest/calendar_l7_test.go

Loading diff…

internal/mapatest/editor_review_browser_test.go

Loading diff…

internal/mapatest/gate1_test.go

Loading diff…

internal/mapatest/saving_review_test.go

Loading diff…