oficina / mapa Public

Mapa title follow-ups: Fable's review gates, no rename on window blur, rename-safe autosave, Android Enter

Gates for the draft carry and the title's input guards. A window blur no longer renames a half-typed title. An in-flight autosave keeps a rename's carried base. A retried rename whose reply was lost reports success. Android's Enter renames.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

Squashed from fix/title-followups into main.
Paul Campbell pushed by claude agent, operated by paul@keymail.dev 510eaa5555b044d7a9772837a525c35d680be1a6 parent 60bb4d3
16 files changed, +828 −58
  • AGENTS.md +2 −1
  • Makefile +3 −2
  • docs/superpowers/specs/2026-11-14-mapa-level-up.md +39 −0
  • editor/title.mjs +47 −3
  • editor/title.test.mjs +12 −0
  • internal/mapa/credits/assets.json +1 −1
  • internal/mapa/drafts.go +49 −21
  • internal/mapa/drafts_carry_test.go +83 −0
  • internal/mapa/static/{editor.ac16df7e5105d46b.js => editor.f5f21bd14571d621.js} +24 −24
  • internal/mapa/verbs.go +33 −2
  • internal/mapatest/pages_test.go +32 −0
  • internal/mapatest/title_away_browser_test.go +164 −0
  • internal/mapatest/title_drafts_test.go +91 −0
  • internal/mapatest/title_guards_browser_test.go +210 −0
  • internal/mapatest/title_test.go +31 −4
  • scripts/mutate/mutations.go +7 −0

CI passed — run details

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

added 16 packages in 356ms
cd editor && node build-bundles.mjs
wrote internal/mapa/static/editor.f5f21bd14571d621.js (312399 bytes, 97.4KB gzipped; L12 budget 120KB)
cd editor && node --test
✔ L1: mounting then serialising gives cleanBody(body), byte for byte (52.115678ms)
ℹ 760 bodies
✔ L1: mounting a stored body adds nothing, and saving it writes nothing new (73.814086ms)
✔ L2: one edited block changes only that block's bytes; undo gives the body back (107.689812ms)
ℹ 748 single-block edits
✔ L2: inserting or deleting a block changes bytes only at the new seams, by Join (117.218063ms)
ℹ 755 inserts, 715 deletes
✔ L3: seeded edits keep the document and its Markdown saying the same thing (3775.709218ms)
ℹ 18240 edits over 760 bodies
✔ linear: trailing spaces (26.23796ms)
✔ linear: trailing whitespace (14.430618ms)
✔ linear: unclosed web links (16.46341ms)
✔ linear: web links with no address (21.535163ms)
✔ linear: unclosed wiki links (30.967357ms)
✔ linear: unclosed embeds (18.057324ms)
✔ linear: closes only (10.252169ms)
✔ golden file has bodies (0.761526ms)
✔ markup.mjs parses every body into Go's blocks, byte offsets and all (17.814643ms)
✔ markup.mjs strips and spans every block as Go does (26.841331ms)
✔ the schema's toDOM draws every body as Go renders it (51.00887ms)
✔ emphasis draws the four pinned outputs (17.577103ms)
✔ a body ends in the editor's empty paragraph (0.296562ms)
✔ a POST that never answers is aborted after the timeout (23.794385ms)
✔ a keepalive POST carries no signal, and an answer clears the timer (0.869637ms)
✔ autosave sends only what differs, and the tab owns the draft it wrote (10.480253ms)
✔ an offered draft never commits by itself; Save commits it (1.303224ms)
✔ reload, then close: sessionStorage says the draft is this tab's own (0.646993ms)
✔ closing carries text not yet sent, and the cap leaves it out (23.993384ms)
✔ clean rebase: applied, the caret survives, the base moves by the rebase POST (3.266856ms)
✔ the block under the caret is the teammate's too, and undo brings back yours (2.648346ms)
✔ typing mid-flight: the merge is not applied and the base does not move (1.12325ms)
✔ a merge the editor cannot represent stops after three tries (3.572625ms)
✔ a conflict is shown, locks the editor's own commits, and Resolve settles it (1.148617ms)
✔ leaving: a conflict stays with the choice; a failed flush offers Leave anyway; a stored draft leaves (1.457992ms)
✔ a stale tab shows the newer draft, offered, and never overwrites it (0.993267ms)
✔ the first scratch commit: empty creates nothing, then one page, then drafts on it (0.743082ms)
✔ noBase and gone lead to the existing choices (0.772877ms)
✔ a commit that merged is applied when nothing was typed since (0.979983ms)
✔ back from the cache: nothing unsaved reloads, unsaved text autosaves at once (7.192746ms)
✔ an own draft committed meanwhile goes on as a new draft (1.486875ms)
✔ a reload keeps a stored draft; unsent text still commits (0.585148ms)
✔ a page deleted mid-edit: what is typed is still stored as the draft, and nothing commits (H1) (1.136825ms)
✔ an offered draft committed in another tab: typing goes on as a new draft (H1) (2.893662ms)
✔ a commit reply without a revision is not a commit; an emptied day starts afresh (H2) (1.292213ms)
✔ Resolve stores what was typed first, and takes no typing until its answer is applied (M1) (4.52657ms)
✔ closing with a choice open, or commits held, still writes the text, never commits (M2) (1.063498ms)
✔ closing inside the settling window sends the loaded version with settling=1 (M3) (0.364888ms)
✔ a clean merge not applied because of typing still ends the choice on show (M4) (0.927816ms)
✔ settling finds the draft committed with a teammate's text: a close still writes (M-A) (0.498086ms)
✔ settling finds another tab's newer draft: the tab shows it before any typing (0.585949ms)
✔ a page deleted before the first autosave: the text is offered as a scratch page, and a close makes one (M-B) (0.584768ms)
✔ an autosave that never answered but landed: its 409 keeps the typing since (L3) (0.632156ms)
✔ marks: em outside strong, bold reopened around italics, edges outside (5.154778ms)
✔ marks close before code, links and atoms, and reopen after (0.438465ms)
✔ untouched blocks and atoms re-emit their source; edited atoms are written from attributes (4.937051ms)
✔ empty blocks are written as nothing (1.693259ms)
✔ an unclosed fence that is no longer last gets its closing fence (1.024345ms)
✔ the structure check puts Join's seam where a kept one would merge two blocks (1.521079ms)
✔ prepareSave adopts the parse when no seam or rewrite can save the document (3.291271ms)
✔ reparse: typed emphasis becomes a mark, "- " after a break becomes an item (2.108933ms)
✔ a trailing hard break stays on screen and is written as nothing (0.4568ms)
✔ the reparse waits while an IME is composing (0.963031ms)
✔ copied blocks paste with their bytes and seams; a cut and paste gives the body back (3.066633ms)
✔ a forged x-mapa slice is refused, and text from outside is read as Markdown (0.835805ms)
✔ rebuild changes origins only, outside undo history (1.636063ms)
✔ applyBody takes a teammate's block, keeps the caret, and ends untouched (1.152914ms)
✔ a block whose context changed is written again: a task toggled, a bullet, a quote (2.264732ms)
✔ a duplicate ^id typed above its holder never takes the id from it (0.704961ms)
✔ a copy-dragged block is reparsed, and says what its Markdown says (0.993357ms)
✔ a history command that throws is refused, never thrown (2.770793ms)
✔ one rename at a time, from either field (2.734035ms)
✔ an empty or unchanged title sends nothing (0.265955ms)
✔ a refusal keeps what was typed, and the title (0.32287ms)
✔ the pending state holds for the busy rule (6.952902ms)
✔ a failed POST says so and keeps the title (0.410914ms)
✔ Update links posts the confirm page's POST (0.285561ms)
✔ clean is CleanTitle's whitespace rule (0.111237ms)
✔ the saver's base follows a rename made over it, and only that (0.330254ms)
✔ closing sends the rename as one keepalive POST (2.490362ms)
ℹ tests 75
ℹ suites 0
ℹ pass 75
ℹ fail 0
ℹ cancelled 0
ℹ skipped 0
ℹ todo 0
ℹ duration_ms 4235.689281
=== 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.513s
?   	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.953s
?   	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
AGENTS.md

Loading diff…

Makefile

Loading diff…

docs/superpowers/specs/2026-11-14-mapa-level-up.md

Loading diff…

editor/title.mjs

Loading diff…

editor/title.test.mjs

Loading diff…

internal/mapa/credits/assets.json

Loading diff…

internal/mapa/drafts.go

Loading diff…

internal/mapa/drafts_carry_test.go

Loading diff…

internal/mapa/static/{editor.ac16df7e5105d46b.js => editor.f5f21bd14571d621.js}

Loading diff…

internal/mapa/verbs.go

Loading diff…

internal/mapatest/pages_test.go

Loading diff…

internal/mapatest/title_away_browser_test.go

Loading diff…

internal/mapatest/title_drafts_test.go

Loading diff…

internal/mapatest/title_guards_browser_test.go

Loading diff…

internal/mapatest/title_test.go

Loading diff…

scripts/mutate/mutations.go

Loading diff…