oficina / mapa Public

Merge level-up/review-fixes-2: Fable's round 4, M-A, M-B and L2-L4

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
claude agent, operated by paul@keymail.dev pushed by paul@keymail.dev 41c15052b24a18b7de21790cd0ea62f93361bf29 parent 8c65d76parent 6f1ec3b
12 files changed, +418 −93
  • docs/superpowers/specs/2026-11-14-mapa-level-up.md +26 −4
  • editor/notices.mjs +16 −1
  • editor/page.mjs +37 −20
  • editor/post.mjs +34 −0
  • editor/post.test.mjs +26 −0
  • editor/saver.mjs +94 −10
  • editor/saver.test.mjs +60 −0
  • internal/mapa/credits/assets.json +1 −1
  • internal/mapa/firstscratch.go +35 −21
  • internal/mapa/firstscratch_test.go +19 −7
  • internal/mapa/static/{editor.5f267ecf504ce2a9.js => editor.1969c5f18c953d0a.js} +29 −29
  • internal/mapatest/editor_round4_browser_test.go +41 −0

CI passed — run details

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

added 16 packages in 323ms
cd editor && node build-bundles.mjs
wrote internal/mapa/static/editor.1969c5f18c953d0a.js (305206 bytes, 95.3KB gzipped; L12 budget 120KB)
cd editor && node --test
✔ L1: mounting then serialising gives cleanBody(body), byte for byte (46.386478ms)
ℹ 760 bodies
✔ L1: mounting a stored body adds nothing, and saving it writes nothing new (59.772918ms)
✔ L2: one edited block changes only that block's bytes; undo gives the body back (93.735429ms)
ℹ 748 single-block edits
✔ L2: inserting or deleting a block changes bytes only at the new seams, by Join (110.545243ms)
ℹ 755 inserts, 715 deletes
✔ L3: seeded edits keep the document and its Markdown saying the same thing (2985.776164ms)
ℹ 18240 edits over 760 bodies
✔ linear: trailing spaces (22.093275ms)
✔ linear: trailing whitespace (13.910551ms)
✔ linear: unclosed web links (13.276174ms)
✔ linear: web links with no address (17.945819ms)
✔ linear: unclosed wiki links (26.254126ms)
✔ linear: unclosed embeds (20.532172ms)
✔ linear: closes only (6.174243ms)
✔ golden file has bodies (0.82569ms)
✔ markup.mjs parses every body into Go's blocks, byte offsets and all (15.673228ms)
✔ markup.mjs strips and spans every block as Go does (25.343258ms)
✔ the schema's toDOM draws every body as Go renders it (39.987929ms)
✔ emphasis draws the four pinned outputs (16.230009ms)
✔ a body ends in the editor's empty paragraph (0.272395ms)
✔ a POST that never answers is aborted after the timeout (20.945779ms)
✔ a keepalive POST carries no signal, and an answer clears the timer (0.828655ms)
✔ autosave sends only what differs, and the tab owns the draft it wrote (7.604302ms)
✔ an offered draft never commits by itself; Save commits it (0.928751ms)
✔ reload, then close: sessionStorage says the draft is this tab's own (0.450685ms)
✔ closing carries text not yet sent, and the cap leaves it out (20.580021ms)
✔ clean rebase: applied, the caret survives, the base moves by the rebase POST (4.064784ms)
✔ the block under the caret is the teammate's too, and undo brings back yours (6.525303ms)
✔ typing mid-flight: the merge is not applied and the base does not move (1.379025ms)
✔ a merge the editor cannot represent stops after three tries (4.092504ms)
✔ a conflict is shown, locks the editor's own commits, and Resolve settles it (1.385458ms)
✔ leaving: a conflict stays with the choice; a failed flush offers Leave anyway; a stored draft leaves (1.722633ms)
✔ a stale tab shows the newer draft, offered, and never overwrites it (1.064333ms)
✔ the first scratch commit: empty creates nothing, then one page, then drafts on it (0.881574ms)
✔ noBase and gone lead to the existing choices (0.925745ms)
✔ a commit that merged is applied when nothing was typed since (1.178714ms)
✔ back from the cache: nothing unsaved reloads, unsaved text autosaves at once (8.848007ms)
✔ an own draft committed meanwhile goes on as a new draft (1.276887ms)
✔ a reload keeps a stored draft; unsent text still commits (0.470362ms)
✔ a page deleted mid-edit: what is typed is still stored as the draft, and nothing commits (H1) (0.921077ms)
✔ an offered draft committed in another tab: typing goes on as a new draft (H1) (2.157639ms)
✔ a commit reply without a revision is not a commit; an emptied day starts afresh (H2) (1.071966ms)
✔ Resolve stores what was typed first, and takes no typing until its answer is applied (M1) (4.198531ms)
✔ closing with a choice open, or commits held, still writes the text, never commits (M2) (1.2519ms)
✔ closing inside the settling window sends the loaded version with settling=1 (M3) (0.285379ms)
✔ a clean merge not applied because of typing still ends the choice on show (M4) (0.850816ms)
✔ settling finds the draft committed with a teammate's text: a close still writes (M-A) (0.508913ms)
✔ settling finds another tab's newer draft: the tab shows it before any typing (0.699416ms)
✔ a page deleted before the first autosave: the text is offered as a scratch page, and a close makes one (M-B) (0.570407ms)
✔ an autosave that never answered but landed: its 409 keeps the typing since (L3) (0.498173ms)
✔ marks: em outside strong, bold reopened around italics, edges outside (4.760943ms)
✔ marks close before code, links and atoms, and reopen after (0.335562ms)
✔ untouched blocks and atoms re-emit their source; edited atoms are written from attributes (4.649777ms)
✔ empty blocks are written as nothing (1.81828ms)
✔ an unclosed fence that is no longer last gets its closing fence (1.389576ms)
✔ the structure check puts Join's seam where a kept one would merge two blocks (1.894973ms)
✔ prepareSave adopts the parse when no seam or rewrite can save the document (3.201764ms)
✔ reparse: typed emphasis becomes a mark, "- " after a break becomes an item (2.177155ms)
✔ a trailing hard break stays on screen and is written as nothing (0.516708ms)
✔ the reparse waits while an IME is composing (0.726326ms)
✔ copied blocks paste with their bytes and seams; a cut and paste gives the body back (3.29731ms)
✔ a forged x-mapa slice is refused, and text from outside is read as Markdown (0.865364ms)
✔ rebuild changes origins only, outside undo history (1.50515ms)
✔ applyBody takes a teammate's block, keeps the caret, and ends untouched (1.292325ms)
✔ a block whose context changed is written again: a task toggled, a bullet, a quote (2.705144ms)
✔ a duplicate ^id typed above its holder never takes the id from it (0.73404ms)
✔ a copy-dragged block is reparsed, and says what its Markdown says (0.947616ms)
✔ a history command that throws is refused, never thrown (3.285518ms)
ℹ tests 66
ℹ suites 0
ℹ pass 66
ℹ fail 0
ℹ cancelled 0
ℹ skipped 0
ℹ todo 0
ℹ duration_ms 3395.171475
=== 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.479s
?   	amadan.net/oficina/mapa/internal/mapa/icons	[no test files]
ok  	amadan.net/oficina/mapa/internal/mapa/markup	(cached)
ok  	amadan.net/oficina/mapa/internal/mapa/seal	(cached)
ok  	amadan.net/oficina/mapa/internal/mapatest	8.167s
?   	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/notices.mjs

Loading diff…

editor/page.mjs

Loading diff…

editor/post.mjs

Loading diff…

editor/post.test.mjs

Loading diff…

editor/saver.mjs

Loading diff…

editor/saver.test.mjs

Loading diff…

internal/mapa/credits/assets.json

Loading diff…

internal/mapa/firstscratch.go

Loading diff…

internal/mapa/firstscratch_test.go

Loading diff…

internal/mapa/static/{editor.5f267ecf504ce2a9.js => editor.1969c5f18c953d0a.js}

Loading diff…

internal/mapatest/editor_round4_browser_test.go

Loading diff…