oficina / mapa Public

Clone
git clone https://amadan.net/oficina/mapa

Plain git — no account needed to clone.

Download

Download this file

Notion import: pages into Mapa, databases into Fichas later

Status: revision 4, 2026-11-17, approved by Paul on 2026-11-17 ("Go ahead"), with the recommended answers to §23's questions. Phase 1 is built on feat/notion-import; §25 records the build. The status as reviewed: revision 4, 2026-11-17, for review. Fable reviewed revision 1 (bb9b30d, CHANGES REQUIRED: 3 high, 12 medium, 12 low) and revision 2 (fda6c12, CHANGES REQUIRED: no high, 4 medium, 11 low), then diff-checked revision 3 (68eec68, CHANGES REQUIRED: 2 medium, 8 low). §24 records what each changed. Paul approved the import on 2026-11-17, with his 2026-11-14 defaults (§1) and one overrule: images come in as real Mapa images. Everything marked Proposed in this spec is the author's recommendation and has not been ruled. Nothing is built.

Branch: design/notion-import (Mapa).

Base specs, which still bind:

  • Mapa 2026-11-12-mapa-design.md (approved): §3 model and the shared namespace, §4 the seal boundary, §5 history, §6 index, gate 8.
  • Mapa 2026-11-14-mapa-level-up.md (approved): §6.3 the editor's subset, §6.4 fidelity.
  • Mapa images, 2026-11-17-mapa-images.md on design/images, revision 4 (3af0d79, for review). §12 uses its §3.2 attach rule and its §7 hook. Revisions 1 and 2 of this spec stated assumptions in its place, before it existed.
  • memoria 2026-09-05-notion-ingest-design.md: its connector is the code this import lifts (§3) and retires (§16).
  • Fichas 2026-09-19-fichas-design.md and the type-designer draft on design/type-designer: only for §17's sketch.
  • Suite doctrine revision 11 (91affa1, as Mapa consumes it): S1–S3, for §16.

---

0. The one rule

The import reads Notion and writes Mapa. It never writes Notion. Sharing a page with the integration is the act of publishing it to the team. From then on Mapa is the app of record for what it imported (base §0), and nothing that happens in Notion afterwards can delete it from Mapa.

Three things follow, and each has a section:

  • Every imported page is a team page that every member can read (§7).
  • A page that disappears from Notion stays in Mapa (§13).
  • Mapa reaches the network only through one pinned module, only for this, only while an importer runs it (§5).

---

1. What Paul ruled

| # | Ruling | Who, when | |---|---|---| | P1 | Import from Notion. Pages go into Mapa. Databases go into Fichas, after the Fichas level-up | Paul, 2026-11-17 | | P2 | Pages become Mapa team pages | Paul, 2026-11-14 default, confirmed 2026-11-17 | | P3 | Mentions of pages become [[links]] | as P2 | | P4 | Dates become date links | as P2 | | P5 | Nesting becomes links between parent and child. Mapa has one shared namespace and no tree | as P2 | | P6 | Re-runnable until switch-over. A re-run updates pages untouched in Mapa since the last import, keeps Mapa's version where it was edited, and never deletes on absence | as P2 | | P7 | Imported pages are credited to whoever ran the import. Notion's original created and edited times are kept in history | as P2 | | P8 | The Notion API, not the export zip | as P2 | | P9 | Images come in as real Mapa images. This overrules the link-back default | Paul, 2026-11-17 | | P10 | memoria's own Notion connector retires. memoria reads Mapa through the suite contract instead of holding a copy | Paul, 2026-11-17 |

2. Decisions this spec proposes

All Proposed. The Who column of base §1 applies: none of these is a ruling until Paul says so.

| # | Decision | Rejected | Section | |---|---|---|---| | D1 | A new module, amadan.net/oficina/notion.git, in a new hub repo oficina/notion, holds the client, the traversal, a typed block tree and the recorded-fixture fake. Mapa and later Fichas import it. Each app maps the tree to its own model | The suite module, rastrillo, a copy in each app, importing from memoria | §4 | | D2 | Mapa's own tree gets no egress exemption at all. Only the module dials, through two host-pinned transports. Only Mapa's import files may import the module | memoria's shape, which exempts one directory of the app | §5 | | D3 | The token is pasted by an importer, sealed under its own purpose, never rendered, and deleted on Finish, on Disconnect and after 90 idle days | Holding it in memory only for a run; storing it unsealed in config | §6 | | D4 | Only people named in MAPA_IMPORTERS see Import. Unset means the feature is not there (404) | Every member; a role Mapa does not have | §7 | | D5 | Team pages only. Whatever the importer shares with the integration becomes a team page. No private import | Importing into the importer's scratch pages | §7 | | D6 | Two phases per run: Survey, then Write. Survey walks Notion and stages each page's blocks, sealed. Write assigns titles across the whole set, renders and commits | memoria's single pass, which cannot know a link target's final title | §8 | | D7 | The import writes through Mapa's own verbs, Store.write and the namespace checks, with the importer as actor. No side door into the tables | A bulk loader | §8, §14 | | D8 | "Untouched" means the page's revision is still the one the import last wrote. Any later revision, including a rename, keeps Mapa's version whole | A three-way merge of Notion's change into Mapa's edit | §13 | | D9 | The output is held to the editor's structure check. Every body the import writes must parse back into exactly the blocks the mapper meant | Trusting the mapper | §10, §11 | | D10 | Nothing is dropped silently. Each unsupported block becomes visible placeholder text or a counted loss, and the run report lists both | Skipping unknown blocks | §10 | | D11 | Positional links in the parent, and one In: [[Parent]] line on the child, for nesting | A "Pages inside" list appended to the parent; no back-pointer | §9 | | D12 | Title collisions take the parent's name, then a number: Week 1, Week 1 (Onboarding), Week 1 (Onboarding) 2 | Merging into an existing Mapa page with the same title | §9 | | D13 | Notion-hosted images are downloaded. External images stay links | Fetching from any host on the internet | §12 | | D14 | memoria retires its connector once it is shown to hold no Notion documents, before Mapa's producer is live if so, after it if not | Running both | §16 | | D15 | Two import-only store methods, ImportCreate and ImportUpdate, each one Store.write that checks, writes the page and writes the map together, and never merges | Calling CreateTeamPage, Retitle and CommitFrom, which merge on a stale base, mint a revision per step and cannot carry the provenance | §14.1 | | D16 | Literal text that Mapa would read as markup is neutralised, with a zero-width space at the one place that breaks the reading, and counted. A block that still fails the check is written as a fenced copy of its text | Accepting Mapa's reading; failing the page | §11.4 |

---

3. What memoria's connector teaches

memoria's connector (internal/memoria/notion/, spec 2026-09-05) was designed, reviewed twice by Fable and built. It never ran against a real workspace. Every lesson below came from reading Notion's documentation or from review, and every one of them is untested against Notion itself. §19's checklist is where that ends.

Kept, as they are:

  • Traversal from shared roots, never /v1/search as an enumerator. Notion guarantees that search returns every page directly shared with the integration, but search also returns children of shared pages, unreliably. So search only proposes candidates: a result is a root when its parent is not itself in the results, and children come from GET /v1/blocks/{id}/children, cursor by cursor (memoria §6). A fixture where search leaks children (M2) holds this.
  • Roots and orphans are separate. A page under a block_id parent looks like a root to search. Orphans are walked only after the real traversal drains (memoria §1.3, the blocker).
  • The total decoder. has_more with no cursor, a repeated cursor, or a 429/529 past the retry budget fails the run. There is no partial result (memoria §6).
  • Notion-Version pinned as a constant, with a gate. memoria pinned 2026-03-11, which is real: it replaced archived with in_trash and renamed transcription to meeting_notes. Notion's changelog (2026-10-30) announces a later version, not yet named, that makes its Markdown output the default. The build re-reads the changelog and pins the version current then, with fixtures recorded against it.
  • Never delete on absence (memoria §3). P6 makes it Paul's.
  • The token sealed under its own purpose, never rendered, verified on save with GET /v1/users/me (memoria §12).
  • Admin-triggered, resumable runs, with boot-time reclaim of a run left active and a 20-second heartbeat (memoria §9, §1.3).
  • Host and scheme pinned as separate checks, redirects refused (memoria §11, §1.2).
  • Error codes, never messages. A Notion 404 body quotes the page id and the integration's name (memoria §8).
  • A ledger row is written before the fetch, so a page that fails has somewhere to be named (memoria §9).
  • Unknown block types are counted, not swallowed (memoria §5).
  • Retry-After capped and context-aware (memoria §1.3).

Changed, and why:

  • The output. memoria's markdown.go flattens to plain_text: no emphasis, no link targets, no mention ids, captions only for images. Mapa needs all of those. The module returns a typed block tree with rich text runs, annotations and mention targets (§4). Each app renders it.
  • One pass becomes two (D6). memoria wrote each page as it was reached. Mapa's links are keyed on titles, and a title is final only once every page's title is known.
  • Databases leave phase 1. memoria turned each database row into a document. Here they wait for Fichas (§17). Phase 1 never queries a data source.
  • The fake becomes a shared, recorded fixture set (§4, §18). memoria's fake was written from the documentation by the same author as the client. Its own review found the blocker that a fixture written from the same model could not.

4. Where the code lives

Proposed (D1): a new hub repository, oficina/notion, module path amadan.net/oficina/notion.git, using the .git suffix that estilo uses so go get resolves through the hub. Amadan workflow on, as for every new Oficina repo.

Packages:

  • notion — the client, lifted from memoria: - client.go: the pinned transport, the version pin, pacing, retries, error codes; - traverse.go: roots, orphans, the walk, the total decoder; - blocks.go (new): the typed tree. A Page (id, title runs, parent, created and edited times, icon, in_trash) and its Blocks (id, type, last_edited_time, has_children, the type's payload decoded into typed fields, children). Rich text is []Run, each run with its text, its annotations (bold, italic, strikethrough, underline, code, colour), its link, and a typed mention (page, database, date, user, link preview, template, custom emoji) carrying its target id; - files.go (new): the file fetcher (§5); - verify.go: GET /v1/users/me.
  • notiontest — the fake server, exported so both apps run against it, the fixture set (§18), and the only constructor that takes a base URL, notiontest.Client(token, base). The production package exports New(token) and nothing that accepts a host. memoria's NewForTest(token, base) sat in the production package; lifted as it was, any caller could point the token at any host and no gate would notice. Both constructors share an internal package of the module, so the test client still goes through the pinned transport, pinned to the fake's host.
  • cmd/notion-record — records a real workspace's responses for fixtures, and scrubs them (§18, §19).

What does not go in the module: any mapping into an app's model, any storage, any HTML. The module knows Notion. Mapa knows Mapa. Fichas will know Fichas.

In Mapa:

  • internal/mapa/notionmd/ — the mapper: block tree to Mapa Markdown (§10, §11). Pure. It imports markup so it can check its own output (D9), and it imports nothing that dials.
  • internal/mapa/import_*.go in package mapa — the ledger, the run, the handlers and the screens. These are the only files that import the module (§5).

Why not elsewhere:

  • The suite module has no dependencies on purpose, "so the pin chain from an app is one deep", and every app imports it. A network client there would put Notion's client in Docs', Sheets' and Calendar's builds, and mix a vendor adapter into the contract's review discipline.
  • rastrillo is a public framework. Notion is one product's import.
  • A copy in each app is the drift that every Oficina AGENTS.md warns about. The second copy would miss the next fix.
  • memoria keeps its code under internal/, which nothing else may import, and the connector is retiring.

5. Egress

Mapa has no egress today other than rastrillo's sign-in mail. This adds the first, so the rule is written before the code.

Proposed (D2):

  • Mapa's own tree stays clean. A new gate, I8, walks internal/mapa/** and cmd/** and fails on http.Client, http.Transport, http.Get and its siblings, http.NewRequest, net.Dial* and net.Resolver. No directory is exempt. rastrillo's mail path lives in rastrillo.
  • Only the module dials. I8's second half reads go list -deps and fails if any package other than internal/mapa imports amadan.net/oficina/notion.git/..., an AST check fails if any file other than import_*.go does, and it fails if any non-_test.go file imports notiontest.
  • Two transports, both pinned in the module: - The API transport refuses every host but api.notion.com and every scheme but https (two checks, two gates, memoria §1.2). The base URL is a constant. It refuses every redirect. It sends only GET (to /v1/users/me, /v1/blocks/…, /v1/pages/…), and POST to /v1/search (phase 1 never queries a data source). Any other method or path is refused before it dials, so the client cannot write to Notion even if a caller asks it to. - The file transport fetches Notion-hosted files. It refuses every URL outside a constant allowlist of (host, path prefix) pairs. A host alone is not enough: Notion's documented example is https://s3.us-west-2.amazonaws.com/secure.notion-static.com/…, a path-style URL on Amazon's shared regional endpoint, where any AWS customer's bucket also lives. So the pin is that host and the /secure.notion-static.com/ prefix, plus whatever pairs §19's first run finds Notion actually sending (a virtual-hosted bucket such as prod-files-secure.s3.us-west-2.amazonaws.com would be its own pair). It refuses every redirect. It never sends the Notion token, because a signed file URL needs none and a token in a request to a storage host is a token handed to a third party. It reads at most the images spec's size cap plus one byte, and fails on the extra byte (memoria AGENTS.md's detectable cap).
  • External URLs are never fetched. An image or file whose Notion type is external stays a link (D13, §12). Fetching it would mean dialling any host a page names, which is a server-side request forgery surface, not a pin.
  • Nothing dials except two things a person asks for: the one verify call when a token is saved (§6), and an active run. The client is built for each and dropped after. Mapa does not poll Notion.
  • Both transports also pin the port (443, or none given), refuse a URL with userinfo, match the file path prefix on the escaped path, and give every request a total timeout of 60 seconds. memoria's transport compared Hostname() only.

Leak list additions (base §4 and the README):

  • Mapa holds a Notion token while a connection exists, sealed (§6).
  • Mapa dials api.notion.com and Notion's file hosts during a run. Notion and its storage provider learn the instance's egress address and when it imports. No team content goes out: content comes in.
  • The ledger's plaintext shows how many Notion pages were imported and when, and how many failed (§15).

6. The credential

Proposed (D3):

  • What it is: a Notion internal integration token, made by the importer in Notion's settings with Read content only, no insert, no update, no comments, and user information without email addresses. Notion offers three user settings: none, names without emails, names with emails. With none, every user mention reads @Anonymous (Notion's rich text reference). Names make mentions readable and phase 2's people fields possible. Emails are never asked for.
  • Who enters it: an importer (§7), on Import's connection form. The setup copy says what to create and what to share, because Mapa cannot enforce Notion's capabilities, only ask for the right ones (memoria §12).
  • Verified on save with one GET /v1/users/me, so a bad token fails at the form. The workspace name it returns is kept, sealed, for display.
  • Sealed under a new purpose, notion.token, in a one-row table, notion_connections. Never rendered, not even masked. A masked secret is still a secret in the DOM. Gate I11 checks that no 8-character run of it reaches any page.
  • Replaced by pasting a new one on the same form (memoria §1.2: rotation needs a form).
  • Deleted: - on Disconnect, its own confirm page; - on Forget the import, with the map and notion_images, where each image went (Paul's ruling on Fable's review, 2026-11-17: Forget is one of the token-deleting acts, so "Run again" after it cannot duplicate every page, and the next Connect claims its workspace afresh); - on Finish import (§8.6); - after 90 days with no run, by retention at wake, beside base build note 27's windows. An idle token is a liability with no use.
  • Revoked at Notion's end by the person. Mapa cannot revoke an internal integration. Disconnect, Finish and the retention notice all say "Now remove the integration in Notion: Settings, Connections", with the integration's name.

Rejected: Notion's own Markdown output (the changelog's "markdown v2"). It would be a second grammar to parse into Mapa's subset, and a mention in it is text, where the mapper needs the target's id to make a [[link]]. The typed block tree carries both.

Rejected: the token in memory only. No token at rest is a stronger property. But a run that a deploy or a CARLOS swap interrupts would then need the token pasted again to resume, and P6 makes re-runs routine for weeks. Sealing under its own purpose is memoria's precedent and base §4's rule.

7. Who may import, and what becomes what

Proposed (D4): MAPA_IMPORTERS, a list of addresses, each of which must be in MAPA_OWNERS (refused at boot otherwise, tested in config.go).

  • Unset: Import does not exist. Its routes 404 for everyone, and nothing links to it.
  • Set: those people see "Import from Notion…" in the File menu, after New team page and New scratch page (level-up build note 87; it was in the account menu until 2026-11-22). Everyone else gets a 404 on every import route, and no File row.
  • Why a list. Mapa has no roles: in the lone shape every admitted person is equal. memoria wrote "owners only" when its owners list was the whole admission list, and its review found that the guard guarded nothing. A named list is a real restriction and a gate can test it (I13). In the suite shape, the roster's owner role (doctrine §5.6) can replace it.

Proposed (D5): every imported page is a team page.

  • The importer chooses what to share with the integration in Notion. Sharing is the publish (§0).
  • The connection form says so before the token is entered: everything you share with this integration becomes a team page that every member of this team can read. Copy goes through the copy-review skill.
  • No private import. Mapa's private pages are daily notes and scratch pages, neither of which has a title in the namespace (base §3.3). A private Notion hierarchy imported as scratch pages would lose every link between its pages.
  • Daily notes are never written by the import. A Notion journal page is a team page (§9.3).

8. The run

8.1 Shape

A run is started by an importer's POST, mounted inside the session and CSRF group, and runs in a goroutine the request spawns. As memoria §9 says plainly: this is not a background worker. It runs until it finishes or the platform sleeps the process. The status page keeps it awake while it is open.

Proposed (D6): two phases.

  1. Survey. Walk Notion from the roots (§3). For each page: - write or update its ledger row first (memoria §9); - read its blocks, recursively, down to child pages, which are not entered from inside the body; - stage what was read: the page's title, times, parent, and its block tree, sealed under notion.staged, on the ledger row; - record the child pages found, which the walk visits next. - Database rows are not staged. A search result whose parent is a data source is a row shared directly: it is skipped and counted. Phase 1 never queries a data source, so the rows inside a database are not counted: the report says "not counted until the databases move" (§8.5's rule), and names each database found. - A page beneath a database row is not reached by the walk, which never enters a row. If search returns it, it is an orphan whose parent is not imported: it is imported without an In: line, and the report lists it. - Trashed pages and blocks (in_trash) are skipped.
  2. Write. With every page surveyed: - assign titles across the whole set (§9.2); - for each page, in survey order, render its body from the staged tree (§10, §11), fetch its new images (§12), and decide what to do (§13); - commit through ImportCreate or ImportUpdate (§14.1); - then the fix-up pass (§13.6), which renders again from the same staged trees. - Only when the run is done are the staged trees cleared, in one bookkeeping write. A run that stops for any reason keeps them, so Resume can use them.

Why two phases. A [[link]] in Mapa is the target's title as text (base decision 9). Page A, written first, may mention page B, whose final title depends on collisions decided later. Writing A then would write a link to the wrong text. memoria never had this problem because its documents did not link.

What it costs. Survey reads every block of every shared page on every run, because child pages are found only inside their parent's blocks (memoria §1.2). The staged trees sit sealed in the database until the run is done.

8.2 Rate

  • The client paces itself at one request per 350 ms, below Notion's published average of three per second for most plans (Business and Enterprise get ten). It honours Retry-After on 429 and 529, which Notion says is whole seconds and at most 60, capped and cancellable (memoria §1.3).
  • Rough size: three to five requests per page, more for deeply nested toggles and columns. 1,000 pages take about 20 to 30 minutes to survey. The first real run measures this (§19) and the build notes record it.
  • Image downloads go through the file transport, paced the same way, so one run never bursts at anyone.

8.3 Resuming

  • Single-flight, with a lease. One run at a time per instance. Starting or resuming a run draws a random lease and writes it to the run's row with a conditional update. Every write the run makes checks the lease: page transactions, and every bookkeeping write too (staging a tree, a row's state, seen_run, counters, the heartbeat), each as … WHERE lease = ? on the run row in the same transaction. A goroutine whose lease has moved therefore changes nothing at all: its next write fails and it exits. Two goroutines can never write the same ledger.
  • At boot, a run in surveying or writing becomes interrupted. No run can be live at boot (memoria §9).
  • Liveness is time and progress. A 20-second ticker writes heartbeat_at (memoria §1.3), and every page written or surveyed writes progress_at. A run may be reclaimed by Resume when its heartbeat is older than two minutes or its progress is older than ten minutes. A ticker alone would keep a wedged run alive forever.
  • The goroutine recovers its own panics and ends the run failed with internal, so a crash never leaves a run that looks alive.
  • Stop is a button while a run is active. In one write it sets the run stopped and rotates its lease, then cancels the context. So Stop takes effect at once even if the goroutine ignores its context: the goroutine's next write is refused. stopped offers Resume like interrupted.
  • Disconnect, Finish and Forget are refused while a run is active. Their pages say "Stop the run first", and Stop always works, so a stuck run never blocks them.
  • Disconnect, or replacing the token, ends any resumable run. The run becomes failed with disconnected, its staged trees are cleared, and the next run is a Start. A Resume never runs on a token other than the one its survey used.
  • One workspace per map. The connection keeps the workspace's identity, sealed: the workspace id from GET /v1/users/me if a bot token's response carries one (unverified: §19 step 5 checks the recording), otherwise its workspace name. A token for a different workspace is refused while a map exists: "This import came from another Notion workspace. Forget the import first."
  • Resume, Start over and Start. After interrupted or stopped, the page offers Resume, which continues the same run with its staged trees, and Start over, which clears them and begins a new survey (for staged trees that are old, or a workspace that has changed since). Start is offered after done or failed; a failed run's staged trees are cleared when the next run starts. Staged trees of a run nobody resumes are deleted with the token under §6's 90-day idle retention.
  • Resuming a survey walks the pages already surveyed in this run from their staged trees, with no requests, and asks Notion only for the rest. This is cheaper than memoria's resume, which repeated the whole traversal.
  • Resuming a write continues from the rows still staged. Each page's write is one transaction that also writes its map row (§14.1), so a page and its record in the map land together or not at all. A crash between two pages can never make a second copy on Resume.
  • An interrupted run says so, with Resume. It never shows as finished.

8.4 Progress, and the scriptless floor

  • /import/notion is the page: the connection, the current or last run, and its report.
  • During a run it refreshes itself with <meta http-equiv="refresh" content="5">, so it works with JavaScript off. Script only replaces the refresh with a fetch that keeps scroll position.
  • What it says: - Survey: "Reading Notion: 412 pages so far." The total is not known until the survey ends, and the page says so. It never shows a total of 0 or a percentage (memoria §1.2). - Write: "Writing pages: 120 of 1,930." Now the total is known. - Interrupted: "Stopped at 412 pages. Resume." Failed: the code's own sentence, never Notion's message.
  • Start, Resume, Stop, Disconnect and Finish are form buttons, with estilo's busy rule. Disconnect, Finish and Forget have their own confirm pages.

8.5 The report

The run's report is for importers only. It unseals titles to show them.

  • Counts: roots found (named), pages seen, created, updated, renamed, unchanged, kept because edited in Mapa (split into "edited" and "only links updated", read from the page's last event verb, so a teammate's "Update links" is visible as the reason), deleted in Mapa (not re-created), not found in Notion this time, could not be determined (pages beneath a page whose survey failed), failed (with codes), databases found, database rows shared directly, images imported, images left as links, images failed (by reason), blocks not imported (by type), blocks written as a fenced copy (§11.4), text neutralised (§11.4), links to pages not shared with the integration.
  • Lists, each title a link to the Mapa page where there is one: titles changed to fit Mapa (§9.2), pages kept, pages failed, pages not found this time, pages holding a placeholder (§10).
  • A count that could not be determined says so. It never renders as 0 (memoria AGENTS.md).

8.6 Switch-over: Finish import

Finish import is the importer saying Notion is no longer the source. On its confirm page it says what it does:

  • deletes the token (§6);
  • deletes every staged tree;
  • keeps the sealed map between Notion ids and Mapa pages, which phase 2 needs (§17). "Forget the import" on the same page deletes the map too, with its own confirm page;
  • after Finish, Import shows only the last report and Connect, which starts over as a new import.

After Finish, a new import is a new import. It has no map, so it would create a second copy of every page. It does still read notion_images, which Finish keeps: a block's image may be copied from a page the finished import wrote, and a remembered refusal holds until the block changes. The confirm page for Connect after Finish says so.

9. What a Notion page becomes

9.1 One page, one team page

  • A Notion page becomes one Mapa team page: kind page, rung team, owner the importer.
  • Its body is the mapped blocks (§10), with the parent line first (§9.4).
  • Its title is the Notion title, made to fit (§9.2).
  • Its sealed record carries the Notion times (§14).
  • The page's icon and cover are imported as its look (columns and icons spec §6.1). An icon or cover Mapa cannot hold is counted. (Amended by the columns and icons spec, 2026-11-22-mapa-columns-icons.md, §6.6.)
  • Notion returns at most 25 mentions inside a title on the page object. A title at that limit is read in full from the page property endpoint (GET /v1/pages/{id}/properties/title), which M4's path pin allows.

9.2 Titles

A Mapa title must be unique across titles and aliases after case and accent folding, at most 120 characters, free of [ ] | # ^, and not date-shaped (base §3.4, build note 8). Notion allows all of those, and duplicates are common: "Meeting notes", "Week 1", "Untitled".

Making a title fit (applied in this order, deterministic, and each change listed in the report):

  1. [ and ] become ( and ). | becomes /. # followed by a digit is removed (Issue #42 → Issue 42); any other # becomes a space. ^ is removed. Runs of spaces collapse.
  2. An empty title is Untitled.
  3. Over 120 characters: cut at the last word boundary that leaves room, then …; with no word boundary in reach, cut at a rune.
  4. Date-shaped (2024-03-05): §9.3.

Every comparison is on Fold()ed text (case and accent folded, namespace.go), as the store's title print is: "free", "planned for another page" and "date-shaped" all fold first, and the date test runs on the fitted title.

Collisions (D12). Candidates in order, the first one free in the namespace and not planned for another page in this run:

  1. the title;
  2. the title, then the parent's (fitted) title in brackets: Week 1 (Onboarding);
  3. the same, then 2, 3, and on.

A root page has no parent, so its second candidate is Week 1 (Notion). A candidate never exceeds 120 characters: the parent's title inside the bracket is cut first, to at most 40 characters with …; then the base title is cut, with …, to leave room for the bracket and the number. Cuts follow rule 3.

  • An existing Mapa page with the same title is never merged into. Mapa's Acme is somebody's page. Notion's Acme becomes Acme (Notion) and the report lists it.
  • Assignment is deterministic. Survey order is the roots sorted by Notion created_time then id, then block order inside each page. The same workspace gives the same titles.
  • Titles already assigned are kept. The map stores the Notion title as Notion last gave it, sealed (§15). On a re-run a mapped page is renamed only when Notion's title differs from that stored one (§13.3). So Acme (Notion) never flips back to Acme because Acme has since become free.
  • The namespace check is the store's. The import proposes a title and the create or rename verb decides, so a member who takes a title mid-run makes the verb refuse it, and the import takes the next candidate (§13.6).

9.3 Date-titled pages

A Notion journal often titles pages by date. Mapa reserves date-shaped text for daily notes (base §3.4), which are private to one person.

Proposed: such a page becomes a team page titled with the date and its parent's title, 2024-03-05 (Journal), or 2024-03-05 (Notion) for a root, then numbered on collision as §9.2. Its first line after the parent line is the date link [[2024-03-05]]. Every member's daily note for that day then lists it under its backlinks (base build note 14), which is where a person looking at that day would look. Q3 asks Paul.

9.4 Parent and child (D11)

Mapa has no tree. Notion's tree becomes links, both ways:

  • In the parent: Notion puts a child_page block where the child sits in the parent's body. The import writes [[Child title]] as its own paragraph in that place. A parent that lists its children at the bottom keeps them at the bottom. One nested inside a toggle or a column lands where that toggle or column is flattened to (§10). This is the "Pages inside" list, in Notion's own order.
  • In the child: the first block is In: [[Parent title]], one paragraph. A root page, or a page whose parent is not shared with the integration, has no such line.
  • Moves. When a page moves in Notion, both lines change on the next run, under §13's untouched rule.
  • The Links panel's "Linked from" also shows the parent, among every other page that links there. The In: line is what makes the parent the obvious way up.
  • The wording In: goes through the copy-review skill. Q4 asks Paul.

10. Blocks

The rule (D9, D10). Each Notion block maps to Mapa's subset (base build note 10, level-up §6.3): paragraphs, headings, list items with tasks, quotes, code fences and rules, with *, **, inline code, [[links]], and http, https and mailto links. What the subset cannot say becomes either placeholder text, which is visible, editable and listed in the report, or a counted loss. A count is shown in the report by type. Nothing is lost silently.

Placeholders are one quote block, worded in §10.2. A quote, because it reads as a note about the page, not as the page's own words.

10.1 The table

| Notion block | Mapa | What is lost | |---|---|---| | paragraph | paragraph. Line breaks in the text are hard breaks. Blank lines inside the text are collapsed, because a blank line ends a Mapa block | blank lines inside one block (counted) | | heading_1 … heading_4 | # … ####. The page title is the H1 on screen, so these draw as h2–h5 | — | | any deeper heading Notion adds | the matching # count, at most ###### | — | | toggleable heading (is_toggleable) | the heading, then its children as ordinary blocks after it | the collapse (counted as a toggle) | | bulleted_list_item | - item. Nested items indent two spaces per level | — | | numbered_list_item | 1. item, numbered in sequence within each run of items at each depth | Notion's own start number, if it has one | | to_do | - [ ] or - [x] | — | | a list item's children | nested list items and to-dos nest. A paragraph child becomes a continuation line of the item (a hard break). Every other child (code, quote, callout, heading, table, image, toggle, child_page, embed, equation, columns, anything) is written by its own row of this table straight after that item, which ends the list there; the next sibling item starts a new list. Q10 asks Paul | the nesting of those blocks (counted). Mapa draws an ordered list from 1, so a numbered list split this way shows its later steps from 1 again, though the stored numbers are right | | a paragraph's children (Notion's indented blocks) | written after it, at top level | the indent (counted) | | toggle | a paragraph of the summary in **bold**, then its children as ordinary blocks after it | the collapse (counted) | | quote | > quote, one > line per line of text. Text children (paragraphs, list items, to-dos) follow as more > lines, a list item as > - item. Every other child is written by its own row of this table straight after the quote | the children's block shapes inside the quote; hoisted children (counted) | | callout | as quote, the icon's emoji first if it is an emoji: > 💡 Remember… | the colour, a custom or file icon, hoisted children (counted) | | code | a fence: ``` ` `` plus the language (lowercased, spaces to -; plain text gives none). If the code holds a line starting `` ` `` after any leading spaces (the closing test trims them all: blocks.go, and markup.mjs's port), the fence is ~~~. If it holds both, the block is written as a placeholder with the code in it (counted). The caption, if any, follows as an italic paragraph | — | | divider | --- | — | | table, tablerow | pipe-table text, one paragraph: a header row, a \| --- \| row when Notion marks a header, then one line per row. Mapa shows it as lines of text (level-up D10); a future vault export (base decision 15, not built) would render it as a table. A cell's line breaks become spaces; a \| inside a cell becomes / | layout, column and row header styling. A table that needs sorting or typed columns belongs in Fichas | | columnlist, column, two to four columns | a column layout (columns and icons spec §1): :::: columns, each column as ::: column … ::: holding its blocks in order, then :::: | the widths, when they differ (counted) | | columnlist with one column | its blocks, in place | — | | columnlist with five or more columns | each column's blocks in order, left to right | side-by-side layout (counted) | | columnlist inside a column, at any depth | its columns' blocks in order, inside the outer column | the inner layout (counted) | | tab (a tabbed container) | each tab in order: its label as a bold paragraph, then its blocks | the tabs (counted) | | syncedblock, original | its children, in place | that it is synced (counted) | | syncedblock, copy | the original's children, in place. **Unverified:** Notion's reference says a copy's children "will be mirrored", and does not say what reading a copy's children returns. The mapper reads the copy's children, and if that is empty or 404s, reads the original's (syncedfrom.blockid). If the original is not shared, a placeholder. §19 step 3 checks against a recording | that it is synced; each copy is its own text from now on (counted) | | childpage | [[Child title]], in place (§9.4) | — | | linktopage | [[Title]] if the target is imported; otherwise a placeholder | — | | childdatabase, inline or full-page | a placeholder naming the database, in place (§10.2). Phase 2 replaces it (§17) | the database, until phase 2 | | image, Notion-hosted | a Mapa image (§12) | — | | image, external | a web link: caption, or the URL bare. Q2 asks Paul | the image is not stored | | video, audio, pdf, file, external | a web link, captioned | — | | video, audio, pdf, file, Notion-hosted | a placeholder naming the file. Notion's links to it expire in an hour, so a link would be dead tomorrow | the file (counted). Attachments are their own decision (§20) | | embed, bookmark, linkpreview | a web link, the caption as its text | the preview | | equation | a fence with info math, the expression inside | the rendering | | breadcrumb | nothing. The In: line does its job | (counted) | | tableofcontents | nothing | (counted) | | template | nothing | (counted) | | meeting_notes (transcription before 2026-03-11) | its child blocks, if the API returns any; otherwise a placeholder | the recording and its AI blocks | | unsupported`, and any type this list does not name | its text, if it has any, as a paragraph; otherwise nothing | (counted by type, as memoria §5) |

Empty blocks have no Markdown form (level-up §6.4 step 4) and are written as nothing.

A body's bytes follow markup.Join's seams: one blank line between blocks, one newline between list items. A page imported and then opened in the editor and left alone saves nothing (I1).

10.2 Placeholder wording

One quote line each, drafted here and settled through the copy-review skill:

  • > From Notion: the database “Projects” isn't here yet. It will move to Fichas.
  • > From Notion: the file “report.pdf” wasn't imported.
  • > From Notion: a linked page that wasn't shared with the import.
  • > From Notion: a synced block whose original wasn't shared with the import.

Each placeholder's Notion id is recorded, sealed, on the ledger row, so phase 2 can find it (§17).

11. Rich text

11.1 Annotations

| Notion | Mapa | Lost | |---|---|---| | bold | **…** | — | | italic | *…* | — | | bold and italic | ***…***, as the editor writes it (level-up §6.3) | — | | code | ` … . Inline code takes no other mark. A run holding a backtick is written as plain text | the code style, for a run with a backtick (counted) | | strikethrough, underline | the text alone | the mark (counted) | | colour, background colour | the text alone | the colour (counted) | | link (href`) | §11.3 | — |

*A marked run holding a literal ` is written without its mark** (counted). Mapa's strong and emphasis patterns exclude inside (markup/render.go), so 53 would show raw stars. Where bold is only partly italic, the mapper writes the editor's form, a b c**` (level-up §6.3).

Marks never cross a link, a mention or code in Mapa (level-up §6.3). The mapper closes a mark before them and reopens it after. A bold link is a link. Whitespace at a mark's edge moves outside its delimiters, because a closing * needs a non-space before it.

11.2 Mentions

| Mention | Mapa | |---|---| | page, imported and live in Mapa | [[Mapa title]], or [[Mapa title\|shown]] when Notion showed different text | | page mapped but not live: deleted in Mapa, or failed in this run | its text, plain, counted. A deleted page's title is free, and a link typed with it would bind to whatever page takes it next (base §3.4). A failed target heals on the run where it succeeds (§13.5, §13.6) | | page, not shared with the integration | Notion returns only the id, with the text Untitled. Mapa writes (a Notion page not shared with the import), plain, and counts it under "links to pages not shared". Its id is recorded sealed, so a later run can link it (§13.5) | | page that is a database row | its text, plain, counted under "database rows" (§17) | | database | its text, plain, counted. An unshared one reads Untitled from Notion and is written like an unshared page | | date, a day | [[2026-11-12]], a date link (P4) | | date with a time | [[2026-11-12]] 14:00. Times are written in the time zone Notion gives; if none, the team's (MAPA_TIME_ZONE) | | date range | [[2026-11-12]] – [[2026-11-14]], times as above | | user | @Name, plain, as Notion sends it with the capability §6 asks for. Without it Notion sends @Anonymous; §19 checks | | link preview | a web link | | template mention, custom emoji | Notion's text, plain |

Date links reach each reader's own daily note (base §3.4). A team page that says "see [[2026-11-12]]" sends Bo to his own note for that day. That is Mapa's ruled behaviour, and the import inherits it.

11.3 Links

  • A Notion page URL (notion.so/…, www.notion.so/…, a workspace's *.notion.site/…, or a bare /…), whose last 32 hex digits are the id of an imported page, becomes a [[link]] with the run's text as shown text. A link to a block inside it (#…) becomes a link to the page, counted.
  • A Notion URL to a page that is not imported stays a web link while it is https. It works for people with Notion access until switch-over, and the report lists it under "links still pointing at Notion".
  • Any other link is [text](url) when markup.SafeURL accepts it, and the text alone otherwise (counted).
  • An address over 2,048 bytes (markup.MaxAddress, past which [text](url) is text in Mapa) is written text (address): the address bare, with its scheme lower-cased and [ ] < > \ | and a final . , ; : ! ? ' " percent-encoded, so Mapa's own autolink links exactly it. A long mailto: address, which Mapa does not link bare, is text. Both are counted (long_link). Mapa never makes javascript: or data:` clickable, and the import adds no way round that.
  • A label that cleaning leaves empty is replaced by the address itself, so a link never loses its text.
  • Link syntax has limits, and the mapper writes inside them (markup/scan.go): a web link's address may hold no ) or whitespace, and its label no ] or line break; a wiki link's shown text may hold no [, ], | or line break. So the mapper always writes the [text](url) form, never a bare URL; percent-encodes (, ) and whitespace in the address; and in labels and shown text turns [ ] into ( ), | into /, and line breaks into spaces. https://en.wikipedia.org/wiki/Foo_(bar) is written …/Foo_%28bar%29.

11.4 Literal text Mapa would read as markup (D16)

Amended by the columns and icons spec §6.6: a fence line (markup.FenceLike: ::: after any spaces) is checked on every line, the first and every hard-break continuation, and written with U+200B before its first :.

Mapa has no escapes (level-up D11). The editor accepts that because a person typing *word* sees what it becomes. An import has nobody watching, and Notion text that discusses Markdown or code is ordinary. Left alone, a Notion line beginning ``` ` `` would open a fence that runs to the end of the page (markup/blocks.go: an unclosed fence has no end), and two stray backticks would pair up and swallow a link between them (markup/spans.go, codeSpan`).

"Meant" is computed first. Before writing a block, the mapper decides what it means: the block's kind and level, its task box if it is a to-do, its lines, and its inline parts (literal text, marks, links, mentions, code spans). The check (D9) compares markup.Parse, markup.Spans and the task box (render.go's taskBox) of the written block with that, part for part. Literal text must parse as literal text.

The table runs over the written line, not over literal text alone. A reading can form where literal text meets syntax the mapper generated: a literal ! before a generated [[Title]] or date link makes an embed (spans.go, the ![[ case); a literal [ before a generated [text](url), with a later literal ]], makes a wiki link. So the mapper assembles each line from its parts, then applies the table to the whole line, inserting only into literal parts or at the seam between a literal part and a generated one.

The mapper uses markup's own predicates, exported for the purpose (StartsBlock, the item, heading, fence, quote, rule and task patterns, SafeURL), never copies of their regexes. A second copy would drift from the parser it is meant to agree with.

Neutralising. Mapa has no escape character, so the mapper uses one invisible character, U+200B ZERO WIDTH SPACE, at the single place that breaks each reading, and one look-alike for backticks. Each use is counted and the report lists the pages. Go's TrimSpace and JavaScript's trim both leave U+200B alone, and Go's \s does not match it, so the parser and the editor's port agree (level-up §6.4's parity hazards; a corpus case each).

| Literal text that would be read as | Where it is checked | Written as | |---|---|---| | a block start at the beginning of any line of a block: a fence (``` ` ``, ~~~ after any spaces), a heading (# ), a list item (- , , + , 1. , 1) ), a quote (>), a rule (---, , ___) | every line, the first and every hard-break continuation | U+200B before the line's first non-space character. The line looks the same and stays inside its block | | [[ or ![[` | the written line, across run boundaries* ([[Acme in a bold run then ]] in the next is caught) | U+200B between the two [ | | a literal ! or [ immediately before a generated link ([[…]], a date link, [text](url), and the images spec's ![alt](/i/…) once built) | the seam between them | U+200B between the literal character and the generated [ | | a literal [label](address) for any address markup.SafeURL accepts (http, https, mailto), or ![alt](/i/…), which would become a web link or, once the images spec is built, an image | the written line | U+200B between ] and ( | | a to-do's box: any list item, bulleted or numbered, whose literal text starts [ ], [x] or [X] then a space or a tab (render.go's taskBox) | every list item's text | U+200B before the [. (A real to-do is generated as one, and its box is part of "meant") | | a trailing ^word (a block marker) | the block's last line | U+200B before the ^ | | a backtick | any literal text | U+02CB MODIFIER LETTER GRAVE ACCENT (ˋ), which looks like one. A code-annotated run is the only source of real code spans | | a bare http(s):// | — | left alone: Mapa links it, and Notion usually had | | ` | — | left alone. A literal a becomes emphasis, as in the editor (D11). A marked run holding *` loses its mark (§11.1) |

The images spec revisits this table once its image span exists in markup: the rows naming ![alt](/i/…) are written against its §2.1 and get fixtures in that build.

Headings with line breaks. A Mapa heading is one line. The mapper joins a heading's lines with a space.

The fallback. A block whose written form still fails the check, which means the mapper has a bug, is not dropped and does not fail the page. It is written as a placeholder line, > From Notion: this block couldn't be copied exactly. Its text follows., then a fence holding the block's plain text. The fence is ``` ` ``, or ~~~ if a line of the text starts with `` ` ``; a line starting with the chosen fence gets U+200B first, so the fence always closes. The report counts these, and I1 fails on any fixture that produces one. **A page fails with render_failed` only if the fallback itself fails the check.**

12. Images

P9: Notion-hosted images become real Mapa images.

This section follows the images spec, 2026-11-17-mapa-images.md on design/images, at revision 4 (3af0d79, for review, not yet approved). Its §7 is the hook this import uses. Revisions 1 and 2 of this spec stated assumptions (A1–A11) before that spec existed. Each is now answered from it, and where it differs, this spec follows it. If the images spec changes before approval, this section changes with it.

What the images spec gives (its section in brackets):

  • Store.AddImage(ctx, actor, data) reads, checks and strips one image, seals it, stores it in CARLOS's bucket as ciphertext, and records it as a pending image owned by actor, logging uploaded (object kind image) by that person (§7, §3.2). It is its own write, before and outside the page's transaction. It waits for the blob semaphore rather than failing (§1.4).
  • Store.CopyImage(ctx, actor, publicID) makes a new pending image from one the actor may read, with a new object (§3.2, §7).
  • Image.Markdown(alt) gives ![alt](/i/<public id>), with alt cleaned: no [, ] or line break, at most 1,000 bytes (§2.1). That form is in Mapa's subset once the images spec is built, parsed by markup and by the editor's port, with its own fidelity gates (§2.3).
  • A commit attaches, when asked to. Attaching is an explicit argument to tx.commit, passed only by a closed list of verbs that carry the person's own text (§3.2); every other caller attaches nothing. Then it attaches each pending image the new body introduces, that the committer owns, inside its seven-day window. ImportCreate, and ImportUpdate's edited revision, pass attach; its renamed revision passes nothing, since it holds the previous body. The images spec's §3.2 list and its §7 (which says the importer commits "through the ordinary verbs") must name these two methods; that is an amendment to the images spec, raised with it. I14 goes red when the argument is dropped.
  • One image, one place. An image belongs to one page; on any other page it renders as "Image not available" (§3.1). A file that appears on two pages is added once and copied for the second (§7).
  • Checks: at most 10 MiB, 50 megapixels, and 10,000 px a side; the type is sniffed from the bytes (§3.4, §5). Refusals are typed: ErrImageType, ErrImageTooLarge, ErrImageDimensions, ErrImageQuota, ErrNoImageStore (§7).
  • Quota: images on team pages count against the team's allowance, MAPA_IMAGE_QUOTA_TEAM, 10 GiB by default, checked at AddImage and CopyImage, never at commit (§3.4).
  • Lifetime: an image the body stops referencing is kept for the 90-day window, then swept at wake (§3.3). A pending image nobody commits is swept after seven days, so a failed run needs no cleanup (§7).
  • Leaks: the images table shows how many images each page holds, who uploaded each and when, and its size to within 64 KiB (§1.3). The import adds nothing to that row.

What the import does:

  • When: during Write, before the page's transaction, for each image block that is new to this page or whose file changed since its last import: its file's key (host and path, which hold the file's own id) differs from the one kept, never its last_edited_time, which Notion rounds to the minute (§25 note 17). Notion's file URLs are signed and expire after about an hour, and Survey may finish long after it read the block. So Write fetches the block again (GET /v1/blocks/{id}) for a fresh URL, downloads it through the file transport (§5), and hands the bytes to AddImage as the run's person. No network call and no AddImage happens inside a page transaction.
  • Then ImportCreate or ImportUpdate writes the body holding image.Markdown(caption) (the Notion caption as plain text; empty when there is none) and its commit attaches the image.
  • Commit as it goes (images §7). Images are downloaded and added only for the page about to be written, and that page is committed before the next page's images are added. So pending images never pile up against the runner's own allowance. *If the page's write returns kept or fails, the run deletes that page's pending images at once*, through the images spec's removal (one transaction, removed, the runner as actor, §3.2 item 3's shape), so nothing holds quota for seven days.
  • The lease is checked just before each AddImage and CopyImage. Those are their own writes, outside the page transaction. The one gap left: a lease that moves between the check and the call lets one pending image be added by a run that no longer holds it. It is never attached, and the sweep removes it after seven days. That is the named exception to §8.3's "changes nothing".
  • Reuse. notion_images maps (Notion block, Mapa page) to the Mapa image's public id, sealed. An unchanged block on the same page reuses it, after the run checks, in its own read, that the image row still exists and is attached to that page; one the sweep or a member's "Remove from Mapa" took away is fetched again. A block that moves to another page, or a synced block that shows one Notion file on several pages, is found by its block alone (block_print, §15), and gets CopyImage from the existing Mapa image where the runner may read it, and a fresh download otherwise.
  • A failure is not the page's failure. A refused or failed image becomes the images spec's text line, (Image not imported: <file name>, <reason>), the file name taken from the last segment of Notion's file URL path, decoded (or the caption when the path has none),, in its place, and the page is written. The report counts images by reason. A permanent refusal (type, size, dimensions; a host the pin refuses is transient, since §19 step 4 may yet add it: build round 3, L5) is recorded on its notion_images row with the file's key and is not downloaded again until the block shows another file (§25 note 17). A transient one (network, 429, 5xx, an expired URL, a host not allowed) is tried again on the next run.
  • Quota. Notion's block objects carry no file size, so the run cannot total the images before it starts. Instead, the Start page shows both allowances the images spec checks: the team's (MAPA_IMAGE_QUOTA_TEAM) and the runner's own (MAPA_IMAGE_QUOTA_PERSON, which counts their pending and private images). ErrImageQuota can come from either. On the first one, the run reads both figures to say which, and stops downloading for the rest of that run: every later image becomes the text line, and the report says at the top which allowance is full. Raising that allowance, or freeing the runner's own, and running again fills them in, because those pages render differently and are still untouched (§13.2). ErrNoImageStore does the same from the first image: "images aren't set up on this Mapa yet".
  • External images stay links (D13). The images spec leaves fetching them to this spec (its §7), and this spec does not propose it. Q2 asks Paul.
  • Literal image syntax. Notion text that happens to read ![…](/i/…) would become an image reference once the images spec is built. §11.4 neutralises it.

13. Re-runs and idempotency

13.1 The map

notion_pages holds one row per Notion page the import has seen, for the life of the import, not per run. Its sealed part names the Notion id and the Mapa page it became. A Notion page becomes at most one Mapa page and a Mapa page comes from at most one Notion page. The map is how a re-run finds a page and never makes a second.

13.2 Untouched (D8)

For each mapped page on a re-run:

| Mapa page | Notion page | What happens | |---|---|---| | revision is still the one the import wrote | rendered body and title equal what Mapa holds | nothing. No revision, no event | | revision is still the one the import wrote | changed | updated by ImportUpdate (§14.1), in one transaction, as the person running this run: a renamed revision if the title changed, then an edited revision if the body did | | any later revision | anything | kept. Mapa's version stays whole. Listed in the report | | deleted in Mapa | anything | not re-created. Deleting it was a decision in the app of record. Listed | | restored as a new page | anything | the map still names the old, deleted page, so it is "deleted in Mapa". The restored page is an ordinary Mapa page |

  • "Changed" is decided by the rendered output, not by Notion's edit time. Survey reads every block anyway (§8.1), so rendering again costs no requests. That makes a title change in a mentioned page, a page newly shared, a move, or a mapper fix all reach the pages they affect, which an edit-time comparison would miss (memoria §1.1: an ancestor's rename never moved a child's edit time).
  • Any later revision means edited, a rename and "Update links" included. A rename leaves the body alone, but the person chose the page's Mapa name, and an import that renamed it back would undo a choice.
  • The check and the write are one transaction. ImportUpdate reads the page's revision and gone inside its own Store.write and, if either has moved since the decision, returns kept and rolls back; a lease-checked bookkeeping write then records it (§14.1). It never merges. Mapa's ordinary commit would merge Notion's change into a teammate's save that landed in between (commit.go, merged), which this table rejects.
  • A teammate's open draft does not stop an update. Their draft's base is the import's revision, and their next commit merges against the update by base §5's block merge, as it would against a teammate's save. The import moves no draft except as a rename does: carryDrafts moves drafts on the old revision onto the renamed revision, which holds the same body (§14.1).
  • Rejected: merging Notion's change into Mapa's edit. Mapa has the three-way merge. But P6 says Mapa's version is kept where edited, and a merge that happens unseen in a run is a write nobody chose (base §5: "Nothing is committed that nobody chose").

13.3 Renames

A Notion rename on an untouched page is ImportUpdate's renamed revision, using the same namespace code the rename verb uses: the old title becomes an alias, so every link typed with it still resolves (base §3.4). The new title goes through §9.2's fitting and collision rules. Pages that link to it are re-rendered, and their links use the new title where those pages are untouched.

13.4 Absence

Never delete on absence (P6). A page that a complete survey does not find (unshared, moved out of the shared tree, trashed, deleted, or the token revoked) is left as it is in Mapa. Its row's seen_run stops moving, and the report lists it under "not found in Notion this time". Absence is reported only after a complete survey: an interrupted one proves nothing about what it did not reach. Pages beneath a page whose own survey failed are "could not be determined", never "not found".

13.5 Links that heal

A mention of a page that was not shared is plain text on the first run, and its target's id is kept sealed on the row. When a later run imports that target, the mentioning page renders differently, so §13.2 updates it if it is untouched. Sharing more pages with the integration and running again is how a person fixes "links to pages not shared".

13.6 The fix-up pass

Write commits pages one at a time while members may be using Mapa. If a member creates a page with a title the import had planned for another page, the create verb refuses it and the import takes the next candidate. Pages written earlier in the run that linked to the planned title would then point at the member's page. So after Write, the import re-renders, from the staged trees (§8.1), every page it wrote in this run that links to a page whose outcome differed from its plan (a different title, or a failure), and commits again through ImportUpdate where the page is still untouched. The report counts these. The race needs a member to type the exact title during a run, so this is expected to do nothing.

14. History and events

14.1 The two store methods (D15)

The import writes pages only through two methods in package mapa, each one Store.write:

  • ImportCreate checks the lease (§8.3), claims the title through the same namespace code CreateTeamPage uses (refusing a taken or date-shaped title exactly as it does), creates the page with its record (origin, imported), writes the map row's coordinate, and logs created. Its commit attaches the run's pending images that the body introduces (§12).
  • ImportUpdate checks the lease and re-reads the page. *If its revision is not the one the map holds, or it is gone, the method returns the outcome kept and its transaction rolls back with nothing written: Store.write refuses a transaction that logged no event (store.go, ErrUnlogged), so "write nothing" is a sentinel, the shape errNoChange and quiet already have. Otherwise, inside the one Store.write: - a title change is its own revision first, logged renamed, holding exactly the previous body, through the rename verb's namespace code (old title to alias), with carryDrafts moving drafts on the old revision to it. That keeps verbs.go's invariant that a rename's revision holds its predecessor's body, which renamedTo and the editor's base-following rely on; - a body change is a second revision, logged edited. Drafts are not carried over it: a teammate's draft merges against it on commit (§13.2); - a title-only change is the first alone, a body-only change the second alone; - the coordinate records the last* revision written. Its commit attaches the run's pending images (§12).
  • Neither merges, and neither can be called from a handler: only the run calls them, and a gate (I17) fails if anything else does.
  • Outcomes that write no page (kept, unchanged, deleted in Mapa) and seen_run are recorded afterwards by a lease-checked bookkeeping write (§14.2). A crash between the two leaves the row as it was, and the next run decides again; I17 covers it.
  • A gate kills the run between every pair of statements in both methods and in the run loop, resumes, and expects no second page, no false kept, and a map that agrees with the pages (I17).

14.2 What history records

  • Every import write is a Mapa write in one transaction with its event (gate 8). The verbs are Mapa's existing ones: created, edited, renamed, and the images spec's uploaded and removed (object kind image) for the run's images. The actor is the person who pressed Start or Resume (P7). Mapa is never an actor (base §2).
  • No new verb. An imported verb would add nothing the sealed record does not say. It would also not hide much: see §15 on what the plaintext already shows.
  • Bookkeeping is a third named exemption from gate 8, beside drafts and retention (base §5): run rows, heartbeats, progress, staging, clearing staged trees, and ledger state that changes no page. A page write is never bookkeeping. The person's own acts on the connection do log events, under a new object kind, import, naming the person: connected, token_replaced, disconnected, finished, forgotten, started, stopped. resumed and started_over too. These are routes a person posts to, so gate 8's route test (gate8_test.go) covers them like every other. S1 and the index ignore object kind import. §21 records the exemption and the object kind as amendments to base §3.1 and §5.
  • *Bookkeeping touches only `notion_ tables.** It goes through one function whose transaction may name no other model. Its callers are the run, whose writes are lease-checked (§8.3), so a run still going after Start's request has returned writes only while it holds its lease; boot's interrupted transition; Stop, Disconnect, token replacement, Finish and Forget, which log their own import events beside it; and retention's 90-day idle delete, already exempt by name. **I19 fences the exemption:** a Survey-only run changes no row outside notion*, and the bookkeeping function, mutated to touch pages, revisions, aliases, titleprints or images`, goes red.
  • The sealed record gains two optional fields (base §3.1's Record, JSON, additive): - origin: {source: "notion", created, edited}, Notion's own created and last-edited times for the page. Set by the import, and carried forward by every later commit, so a page always knows where it came from, even after its imported revision ages out of the 90-day window. Every verb already opens the record, changes it and seals it again (CommitFrom, Retitle, Revert, Restore, relink, markers), so carrying origin needs nothing. A page restored from a deleted imported page keeps origin: its text did come from Notion. The map does not follow it (§13.2). - imported: true on a revision the import wrote. tx.commit clears it on every write unless the caller is ImportCreate or ImportUpdate. The verbs carry the whole record forward by default, so without that one line a teammate's edit would read "imported from Notion". Gate I18 runs every verb on an imported page and checks it is cleared and origin kept.
  • History shows it (level-up §4.5): a revision with imported reads "Paul imported this from Notion · edited there 12 Oct 2026". The page's kicker may show "From Notion, created there 3 Mar 2024". Both read sealed fields, at render, for people who may open the page.
  • S3 does not change. S3 serves the title and body (base §8), not the record's other fields. memoria sees an imported page exactly as it sees any page.
  • Revision at is the import's time, never Notion's. The history window, retention, S1's order and "Recently edited" all count from Mapa's clock (base build note 30). Notion's times are history's content, not its clock.
  • Notion's authors are not credited. A Notion user is not a Mapa member, and P7 credits the importer. Notion's author names are not kept in history.
  • Every write in a run lands in the importer's "Recently edited". That is honest, and noisy for a day.

15. Sealing

New purposes: notion.token, notion.workspace (its name and id), notion.coordinate (a row's Notion id, its Mapa page id, the revision the import last wrote, the ids it mentioned that were not imported, its placeholders' ids, and, for a root of the import, its sealed pin mark: columns and icons spec §6.3), notion.staged (a surveyed tree), notion.image (an image block's id, its file's key (§25 note 17) and Mapa image). Print keys are derived apart, as base build note 21 does: oficina/mapa:print:notion.page and …:notion.image.

New tables and their plaintext, to be added to base §4's list and to plaintext_test.go with the build:

| Table | Plaintext | Sealed | What the plaintext leaks | |---|---|---|---| | notion_connections (one row) | id, created_by (member id), created_at, verified_at | token, workspace name | that a Notion connection exists, who made it, when it was last checked | | notion_runs | id, actor, state, lease (random, redrawn on start, resume and Stop), started_at, heartbeat_at, progress_at, finished_at, the counters, error_code | — | when imports ran, who ran them, how many pages each created, kept, failed. The lease is random and says nothing | | notion_pages (the map) | id, notion_print (unique), state, error_code, surveyed_run, seen_run | the coordinate record (Notion id, last Notion title, Mapa page id, last written revision, unresolved mention ids, placeholder ids); the staged tree | how many Notion pages exist and their states | | notion_images | id, place_print (unique: an HMAC of the Notion block id and the Notion page id together, which the map pins to one Mapa page; §25.7; and one row each for a page's icon and cover, whose place print is an HMAC in a domain of its own (look, the Notion page id and the pseudo-block icon: or cover:), and whose block_print is the same value, so a look row shares no print with any other row: columns and icons spec §6.1; the table's row count, plaintext, includes them), block_print (an HMAC of the block id alone, not unique, to find a block that moved or is shown on several pages), state (imported, refused; a transient failure keeps no row, so the next run tries again) | the image record (block id, the file's key (§25 note 17), Mapa page id, public id, refusal reason) | how many images were imported, refused and failed, and, through equal block_prints, how many Notion images appear on more than one page. The images spec's own images table holds the rest (§12) |

  • What the file still shows, said plainly. The coordinate is sealed, so no column joins a ledger row to a Mapa page. But the plaintext event log does. A run's created events, by the run's actor, inside the run's window in notion_runs, mark which team pages it made, and sequential pages.id and notion_pages.id in survey order line them up row for row. So the file shows which team pages came from a Notion import, and roughly their order in Notion. It does not show their titles, bodies or Notion ids. This goes in the leak list. notion_pages carries no updated_at, which would be a second join.
  • Prints are HMACs under the instance key, equality only, as every print in Mapa (base §4).
  • The staged tree is content, held sealed between Survey and Write, then cleared. Finish deletes any that remain.
  • Finish keeps notion_images with the map, for the same reason: phase 2 and a later import need them. Forget deletes both.
  • No Notion content in any log line, error string or metric label (gate I10, memoria N13). The fake's error bodies carry a canary title and id so the error path is exercised.

16. memoria: retiring its connector

P10: memoria stops holding Notion content and reads Mapa instead, through S1, S2 and S3.

What that depends on:

  1. The module exists (§4), with memoria's client and traversal lifted into it. memoria's code is then the old copy.
  2. Mapa's importer is built and has run against Paul's workspace (§19).
  3. Mapa's producer half is live: base slice 1 item 6 (S1, S2, S3 through server.Handler, with pinned conformance), on the team host paulca.mapa.oficina.works. Not built today.
  4. memoria is hooked up to Mapa: Paul approves the hookup (open in memoria's follow-ups), and memoria's sibling list gains Mapa with a consumer token.
  5. memoria finds an imported page: a phrase from an imported page answers in memoria's search, cited to Mapa.

What the retirement is, in this order:

  1. Check live memoria, signed in as an owner: /connectors/notion shows whether a connection exists and every run's counts. Also count documents with Source = "notion" through memoria's document list (or a one-off read-only query by the operator). Record what was found.
  2. On live, with the code still deployed: Disconnect (deletes the token row) and delete any Notion documents through memoria's own delete.
  3. Verify zero: no connection, no Notion documents.
  4. Then one commit removes /connectors/notion and its handlers, connector.go, sync.go, internal/memoria/notion/, and the "Sources" entry where it leads only there, and narrows memoria's egress gate back: the internal/memoria/notion exemption is deleted, so the provider package is the only exemption left;
  5. leave the tables (memoria's migrations are additive-only), unused;
  • mark memoria's Notion spec superseded by this one, and amend its parent's §11 (slice 3) and §4.2 to say Notion arrives through Mapa;
  • grep memoria for notion by name before calling it done (memoria AGENTS.md: "When you retire something, grep for it by name").

When (D14). Step 1 decides. Its Notion connector has never run against a real workspace, so it is expected to hold nothing.

  • If live memoria holds no Notion documents and no token: retire it as soon as the module exists (dependency 1). Nothing is lost, and the egress exemption goes sooner.
  • If it holds any: retire it only after dependency 5, so there is never a moment when that content is findable in neither app.

Until then, memoria's connector is not run. Paul's real run goes to Mapa (§19).

17. Phase 2: databases into Fichas (a sketch)

Waits on: the Fichas level-up (the type designer, folders, and "Link to …" fields, design/type-designer), Fichas on a team host, Mapa's embeds (base slice 2, S10), and this phase 1. This section is a sketch for that spec, not a design.

Shape:

  • A Notion database becomes a Fichas card type per data source, in a folder named for the database.
  • A row becomes a card. Row bodies (Notion rows are pages and often hold text) go into a Long text field, Notes, mapped by Fichas from the same block tree.
  • Properties become fields:

| Notion property | Fichas field | Notes | |---|---|---| | title | the title field | — | | rich_text | Text, or Long text over one line | annotations as Fichas' long text allows | | number | Number | format (currency, percent) needs a decision | | select | Choice, options and colours as tones | — | | status | Choice, marked as the type's status | Notion's status groups are lost | | multi_select | needs a multi-value Choice, which Fichas does not have | Text until it does | | date | Date | ranges and times need a decision | | checkbox | a Yes / No Choice | — | | url, email, phone_number | Web address, Email, Phone | — | | people | a Link to the seeded People type (type designer R5), matched by name | names come from the user-information capability §6 asks for; emails are never asked for, so matching is by name only | | relation | Link to … the type the related database became | the property endpoint returns relations past the first 25 | | formula, rollup | not imported as live values. Fichas has no formulas; a snapshot would be "a second calculator" (Fichas §2) | listed per type | | files | not imported until Fichas has attachments | listed | | created_time, last_edited_time, created_by, last_edited_by | the card's history, sealed, as §14 does for pages | — | | unique_id | Text, as a print | — | | button, verification, place | not imported | listed |

  • Views. Notion added view endpoints on 2026-03-19 (list, retrieve, query). A Notion view's filters and sorts can become a Fichas saved view (base §7.6) where each filter maps onto a field Fichas has. A view that cannot map is listed, not approximated.
  • Mapa's placeholders. Each database placeholder (§10.2) has its Notion id sealed on its page's row. Once Fichas holds the database, Fichas' import page offers a hand-off (doctrine §7.1: a redirect POST in the person's own session) that tells Mapa which Fichas view each database became. Mapa replaces each placeholder with ![[fichas:…]] on pages still untouched, under §13.2's rule, as the person's edit.
  • Relations to pages. A Notion relation targets database rows only. A row's mention of an ordinary page needs Mapa's map: Mapa's import page offers the reverse hand-off (Notion id → Mapa page URL), so Fichas can write a Mapa reference field (base §7.4: team pages only, which every imported page is).
  • Mapa keeps its map after Finish for exactly this (§8.6), until "Forget the import".

18. Gates

Base gates 1–12, level-up gates L1–L12 and make mutate keep passing. New gates are I1–I16 in Mapa and M1–M8 in the module. Each is written, broken and reverted per path, with the mutation and date in the test comment. The mutations are picked by someone who did not write the gate (memoria AGENTS.md, gate 17).

The fixtures

  • Written from the documentation: one fixture per block type in §10.1's table and per annotation and mention in §11, including the unsupported ones, a 404 on one page, a 429 with Retry-After, has_more with no cursor, a repeated cursor, a page under a block_id parent, a search result that returns only roots, a trashed page, a database row shared directly, and an image whose URL has expired.
  • Recorded, with the shape of a real workspace: cmd/notion-record records responses from a workspace, then scrubs them: every text run, title, caption, URL and file name is replaced by deterministic filler of the same length class, and every id by a stable fake. Structure, nesting, block types, annotations and counts survive. Only scrubbed recordings are committed. The raw recording stays outside every repository and is deleted after scrubbing. Its block-type counts are recorded in the build notes.
  • Why recorded fixtures. memoria's blocker was found by a reviewer reading the documentation, because every fixture was written from its author's model. A recording is the first fixture written by Notion.

In the module (M)

  • M1, the total decoder. A missing cursor, a repeated cursor, or retries past budget fail with traversal_failed, never a partial tree (memoria N1).
  • M2, search is not an enumerator. A fake whose search returns only roots still yields every child (memoria N2), and one whose search also leaks children still gives each its true parent.
  • M3, orphans after the walk. A page under a block_id parent gets its true parent, not a root's place (memoria §1.3's blocker, now with a test).
  • M4, the API pin. Another host, another scheme, another port, userinfo, any redirect, any method but GET, and any POST path but /v1/search are refused before dialling. One mutation each. The production package exports no constructor that takes a host.
  • M5, the file pin. A host outside the allowlist, any redirect and an over-cap body are refused. No request to a file host carries an Authorization header.
  • M6, one place dials. Inside the module, only client.go and files.go build a client or transport.
  • M7, the version pin. Every request carries the pinned Notion-Version.
  • M8, the tree is total. Every block type in the fixture set decodes to a typed block or to unsupported with its type name, never to nothing.

In Mapa (I)

  • I1, fidelity. For every fixture, the mapper's body equals a committed golden file, passes the structure check (D9) against the meaning computed first (§11.4), and loses nothing outside §10–§11's tables: each loss is in the counts. Fixtures include every row of §11.4's table, across run boundaries; fences and backticks in ordinary text; a heading with a line break; link addresses with (; labels with ]; a marked run holding *; and partly-italic bold. No fixture may produce the fallback. Each imported body opened in the editor and left alone serialises to the same bytes (L1's rule, run over the import goldens, which join markup/testdata/corpus/).
  • I2, an idempotent re-run. Run, then run again on the same fixtures: no revision, no event, no image download, every page unchanged.
  • I3, untouched and kept. Change two pages in the fake. Edit one of them in Mapa, rename a third in Mapa. Re-run: the untouched page updates, as the runner, in one transaction (one event, or two when the title changed too: renamed then edited); the edited and renamed pages are kept and listed. A teammate's tab holding a draft on the untouched page follows the rename's revision and merges against the edit.
  • I4, never delete on absence. Two pages imported; the fake drops one; the run is done and both pages stand. An interrupted survey reports no absence.
  • I5, links. Mentions resolve to final titles, collision-renamed ones included. An unshared target is plain text and counted; sharing it and re-running links it where the source is untouched. A Notion URL to an imported page becomes a [[link]].
  • I6, titles. Duplicates, [ ] | # ^, over-long, empty and date-shaped titles all fit by §9.2. The same fixtures give the same titles twice. An existing Mapa page with the title is never written to. A member taking a planned title mid-run is handled by the fix-up pass.
  • I7, attribution. Every import write logs an event naming the person who pressed Start or Resume, and a Resume by a second importer names the second. Mutations: name the page's owner; name the connection's creator.
  • I8, egress. No http.Client, transport, request constructor, dialler or resolver anywhere in internal/mapa/** or cmd/**; the module imported only by import_*.go. Mutations: add an http.Get to a handler; import the module from notionmd.
  • I9, plaintext. The new tables' plaintext columns are exactly §15's. The file scan runs a full import over fixtures carrying canary titles, bodies, a canary token and canary Notion ids, then reads every byte on disk, WAL included: none appears.
  • I10, no Notion content in logs, observed over a run against the fake whose error bodies carry canaries (memoria N13).
  • I11, the token is never rendered: no 8-character run of it in any response (memoria N14).
  • I12, resuming. A run left surveying becomes interrupted at boot and Resume runs. Stop ends a run stopped at once, even when the goroutine ignores its context, and that goroutine's next write of any kind, bookkeeping included, is refused. A reclaimed goroutine writes nothing after the lease moves. Disconnect, Finish and Forget are refused during a run and work after Stop. Disconnect and a replaced token end a resumable run; a token for another workspace is refused while a map exists; Start over clears staged trees. A run with a live ticker and no progress for ten minutes is reclaimable. A resumed survey makes no request for a page already surveyed in that run. A resumed write writes no page twice.
  • I13, who sees Import. With MAPA_IMPORTERS unset every import route 404s for everyone. With it set, a member not named gets 404 on every route, GET and POST. Nothing outside Import changes for them. An importer finds Import in the File menu, and the account menu never offers it (build note 18).
  • I14, images. A Notion-hosted image becomes a Mapa image through AddImage and is attached by the page's commit; an external one stays a link; an unchanged image block on the same page is not downloaded again, and one the sweep removed is; a block on a second page is copied; a refusal leaves the text line and a written page, and a permanent one is not downloaded again; the first ErrImageQuota stops downloads for the run and names which allowance; a kept page's pending images are removed at once; and dropping the attach argument from ImportCreate or ImportUpdate turns I14 red. Built with the images spec (§12).
  • I15, scriptless. make browser connects, starts, watches the meta refresh, resumes and finishes with JavaScript off, then on.
  • I16, the import never asks to write. Using a client from notiontest built, through the module's shared internal package, without M4's method pin (no build tag in production code), a whole run against the fake records every request: only GETs and POST /v1/search. With the pin in place the fake would never see a write, so this is the version that can go red for the callers.
  • I17, crash safety (§14.1). Killed between every pair of statements in ImportCreate, ImportUpdate and the run loop, then resumed: no second page, no false kept, the map agrees with the pages. And a reclaimed run's goroutine writes no page after the lease moves (§8.3). Nothing but the run calls the two methods.
  • I18, provenance. Every verb on an imported page (commit, rename, revert, restore, relink, mark) clears imported and keeps origin.
  • I19, the bookkeeping exemption is fenced (§14.2). A Survey-only run changes no row outside notion_*. Mutation: let the bookkeeping function touch pages, revisions, aliases, title_prints or images, one at a time.
  • I1's literal-text fixtures include each seam row of §11.4: a literal ! before a mention, a literal [ before a generated link with a later ]], a literal [label](https://…) and [label](mailto:…), and a bulleted and a numbered item whose text starts [ ] then a tab.

And the run is looked at in a browser, at 0%, mid-survey, mid-write, interrupted and finished, before the build is called done. A template test proves markup exists, not that a run reads sensibly at 40% (memoria §13).

19. The first real run

Against Paul's workspace. Read-only on Notion's side, owned by Paul, and a ship requirement before the import is offered on his real team (memoria §15's requirement, inherited).

Before

  1. Paul makes an internal integration, "Oficina import": Read content only; no update, no insert, no comments; user information without email addresses. He checks the capabilities page shows exactly that.
  2. He shares a small set of top-level pages with it, a few hundred pages at most for the first run, not the workspace root.
  3. cmd/notion-record records that set, from Paul's machine, into a directory outside every repository. Scrub it, commit the scrubbed fixtures to the module, delete the raw recording. Compare its block types with §10.1: any type not in the table is added to the table before the run.
  4. Check the image file URLs in the recording against the file transport's (host, path prefix) pairs. Fix the allowlist from what Notion actually sends, not from the documentation's one example. Expect a virtual-hosted bucket, for example prod-files-secure.s3.us-west-2.amazonaws.com with the workspace id as the first path segment: it is its own pair, host and prefix both, never the host alone. Done, by the first read-only run (831 objects, 158 pages): all 144 hosted files were at https://prod-files-secure.s3.us-west-2.amazonaws.com/<workspace id>/<file id>/<name>, which the documented pair refused. That host is now its own pair, prefix / (§25 note 17).
  5. Check whether Notion rounds last_edited_time to the minute. Done, by the first read-only run: it does, all 3,815 edit times ended in :00. Image reuse and copies, which compared a block's edit time, now compare the file's key; pages were already decided on the rendered body (§13.2), now gated for an edit in the same minute (§25 note 17). Still to check, before the run on paulca: the file key's two premises. Record the same set twice and diff the keys (an unchanged file's path must be the same on every read, or every run fetches every image again); then replace one image in Notion, record again, and see its key move (a replaced file must get a new file id, or the import keeps the old picture). User mentions came back @Anonymous: the integration lacked step 1's user information, which Paul turns on; with it the import writes the name (§11.2; I1's @Ana, notionmd's mentions-other). Check that user mentions carry names (§11.2), what a synced block's copy returns for its children (§10.1), and whether GET /v1/users/me carries a workspace id (§8.3). If it carries none, the map's workspace is matched by name (§25.8): two workspaces with one name pass as one, and a workspace renamed in Notion is refused as another until the import is forgotten. Record which it is in the build notes before the run on paulca.

The run, on the test team first (test.mapa.oficina.works, disposable)

  1. Connect, run, and watch the status page through to the end.
  2. Check the report: roots named as expected, page count against what Notion shows, failures with codes, blocks not imported by type, images.
  3. Side by side, ten pages chosen for variety (toggles, tables, callouts, code, images, nesting, mentions, a journal page): compare Notion and Mapa.
  4. Run again at once: nothing written (I2 on real data).
  5. Edit one page in Notion and a different one in Mapa. Run again: the first updates, the second is kept.
  6. Record the time per page and the number of requests in the build notes.

On the real team (paulca)

  1. The same run, then Finish only when Paul says Notion is no longer the source.
  2. After Finish: in Notion, Settings, Connections, delete the integration. In Mapa, check the connection row is gone.
  3. After memoria's hookup (§16 step 4): a phrase from an imported page answers in memoria, cited to Mapa.

20. Deliberately not built

| Thing | Trigger | |---|---| | A scheduled or continuous sync | Paul wants Notion and Mapa both live for a long time. The import is a migration | | Writing anything to Notion | Never (§0) | | Fetching external images | Paul says yes to Q2 | | Attachments (PDFs, files, audio, video) | Mapa gets attachments. Until then, placeholders | | Comments, page icons and covers | Someone misses them after a real import | | Private import | Mapa gets private titled pages, which base decision 7 rules out | | Merging Notion's change into a Mapa-edited page | People ask for it after living with "kept" | | Undo import (delete every untouched imported page) | The first real run on test shows a need. The test team is disposable meanwhile | | The export zip as a source | The API misses something the zip has | | Databases | Phase 2 (§17) |

21. Amendments that land with the build

Not made in this commit. Each lands in the same commit as the code it describes.

  • Mapa base spec: §12's "Import from Obsidian, Reflect, Notion" row is met for Notion; §4's plaintext list gains §15's rows; §3.1's record gains origin and imported, and its event row gains object kind import; §5 names bookkeeping as the third exemption from gate 8 (§14.2); §11 lists I1–I18; the leak list gains §5's and §15's entries.
  • Mapa AGENTS.md: "Mapa reaches the network only through amadan.net/oficina/notion.git, only from import_*.go, only during a run" joins the rules Mapa holds hard. Layout gains notionmd/ and the import files.
  • Mapa README: the leak list and MAPA_IMPORTERS.
  • memoria: §16's list, in the commit that retires the connector.

22. Build order

  1. This spec, reviewed. Then Paul's answers to §23. §12 already follows the images spec's revision 2; if that spec changes before approval, §12 changes with it.
  2. The module. The repo; memoria's client and traversal lifted with their history noted; the typed tree; the file fetcher; the fake; the recorder and scrubber; M1–M8.
  3. The mapper (notionmd), against fixtures only: §10–§11, I1, I5's resolution half, I6.
  4. The run: tables, the credential, Survey and Write, the two store methods, the screens, I2–I4, I7–I13, I15–I19.
  5. Images, once the images spec is built: I14.
  6. §19's first real run, steps 1–11 on test.
  7. memoria's retirement (§16), at the point D14 says.
  8. Steps 12–14 on paulca, when Paul says.

Each step is reviewed before the next is merged.

23. Open questions for Paul

Recommended answers are written in. None is ruled.

  1. Q1, who may import? Recommended: only the addresses in MAPA_IMPORTERS; on your teams, you. Without it, every member could connect a Notion workspace and write hundreds of team pages in their own name.
  2. Q2, external images (an image in Notion that points at another website): Recommended: keep them as links, not downloaded. Downloading means Mapa fetching from any address a page names, which is a different kind of egress from fetching Notion's own files. If many of your pages use them, say so and a stricter fetcher can be specified.
  3. Q3, date-titled pages (a Notion journal): Recommended: team pages titled 2024-03-05 (Notion), each linking its date, so your daily note for that day lists it. The alternative is importing them as your own private daily notes, which takes them away from the team.
  4. Q4, parent and child: Recommended: a link to each child where Notion shows it in the parent, and an In: [[Parent]] line at the top of each child.
  5. Q5, toggles: Recommended: opened out: the toggle's line in bold, its contents after it. Mapa has no collapsing block.
  6. Q6, switch-over: Recommended: "Finish import" deletes the Notion token and the staged copies, and keeps Mapa's private map of which Notion page became which Mapa page until the databases have moved to Fichas.
  7. Q7, the new repository oficina/notion for the shared Notion code, with the amadan workflow on. Recommended: yes.
  8. Q8, Notion user names: Recommended: the integration may read people's names, never their email addresses, so @Ana stays @Ana instead of @Anonymous.
  9. Q9, memoria's connector: Recommended: if live memoria holds no Notion content, which is expected because it never ran, remove it as soon as the shared module exists.
  1. Q10, a code block (or image, or table) inside a numbered step: Recommended: keep it right after its step, which splits the list there. Mapa then shows the later steps numbered from 1 again, though the numbers stored are right. The alternative, moving everything after the whole list, keeps the numbering and moves each code block away from its step.

24. Findings and what changed

Round 1: Fable (claude-fable-5-2) on revision 1 (bb9b30d): CHANGES REQUIRED, answered in revision 2

| Finding | Change | Where | |---|---|---| | H1 Staged trees cleared before fix-up and rename re-renders need them | Kept until the run is done; fix-up renders from them | §8.1, §13.6 | | H2 The write is not idempotent: CommitFrom merges on a stale base; the map row is outside the transaction; rename and body are two revisions; CreateTeamPage cannot carry origin | ImportCreate and ImportUpdate (D15): one Store.write each, re-check inside, never merge, title and body one revision, map row and images in the same transaction, drafts untouched; I17 kills between statements | §14.1, §13.2, §8.3, I17 | | H3 Ordinary text parses as fences, code spans, links, split blocks; §11.4 contradicted D9; no fallback | "Meant" computed first; U+200B at the breaking position for line starts, [[, ![[ and ^id, checked across runs; backticks become ˋ; headings joined; failed blocks fall back to a fenced copy; fixtures for each | §11.4, D16, I1 | | M1 Link label and address limits | [text](url) always; addresses percent-encode (, ), whitespace; labels and shown text cleaned | §11.3, I1 | | M2 Event log joins defeat the sealed coordinate | Said plainly in §15 and the leak list; updated_at dropped; §14's reason for no verb corrected | §15, §14.2 | | M3 imported carried forward by every verb | tx.commit clears it except for the two import methods; origin carried, kept on restore; I18 | §14.2, I18 | | M4 Ledger writes have no home under gate 8 | Bookkeeping named as a third exemption; the person's connection acts log events under object kind import | §14.2, §21 | | M5 No Stop; Disconnect, Finish and Forget mid-run; wedged heartbeat; two goroutines | Lease checked in every page transaction; progress staleness; Stop; those three refused during a run; panics end failed | §8.3, I12 | | M6 NewForTest in the production package | Arbitrary-base constructor only in notiontest; I8 forbids non-test imports of it | §4, §5, M4 | | M7 Over-length suffixes, folding, title flip-back, date titles with a parent | Room left for suffixes; every comparison folded; last Notion title stored; date titles take the parent | §9.2, §9.3, §15 | | M8 Links to mapped pages that are deleted or failed | Plain text, counted; failed targets heal through fix-up and later runs | §11.2, §13.6 | | M9 Non-text children of quotes, callouts and list items vanished or moved far | Every child type has a rule: hoisted straight after its block, counted; Q10 asks Paul about split lists | §10.1, Q10 | | M10 Row counts need a data source query; pages under rows | Rows inside databases "not counted until the databases move"; directly shared rows skipped and counted; pages under rows imported parentless, listed | §8.1, §8.5 | | M11 A1–A7 insufficient | A8–A11 added; download before the transaction; permanent failures recorded | §12 | | M12 Retirement deleted data after removing the code that deletes it | Check live, delete on live, verify zero, then the code commit | §16 | | L1 * inside marked runs; partial-overlap form | Mark dropped for runs holding *; editor's form cited | §11.1 | | L2 I7 duplicated gate 8 | I7 mutates the actor | I7 | | L3 I16 could not go red | Run with the method pin removed under a test build tag | I16 | | L4 Verify-on-save dials outside a run | Stated as the second thing that dials | §5 | | L5 §17 contradicted §6 on user information | Fixed | §17 | | L6 Port, userinfo, escaped path, timeout | Pinned in both transports | §5, M4 | | L7 Roots wording | Reworded; leaking-search fixture | §3, M2 | | L8 Descendants of a failed page | "Could not be determined" | §13.4, §8.5 | | L9 Titles past 25 mentions | Read from the property endpoint | §9.1 | | L10 Vault export is unbuilt | Said so | §10.1 | | L11 "Update links" freezes imported pages | Report splits kept into edited and links-only | §8.5 | | L12 Start after an interrupted run | Resume continues it; Start only after done or failed | §8.3 |

Round 2: Fable (claude-fable-5-2) on revision 2 (fda6c12): CHANGES REQUIRED, answered in revision 3

No high findings. Fable said a revision fixing N1–N4 as described needs only a diff check.

| Finding | Change | Where | |---|---|---| | N1 Readings form where literal text meets generated syntax: ! before a generated link, [ before a generated link, literal [label](url), a bullet starting [ ] | The table runs over the written line; seam rows for ! and [; rows for literal web links, image syntax and task boxes; task box part of "meant"; images spec revisits; a fixture each | §11.4, I1 | | N2 A renamed revision that also changes the body breaks verbs.go's invariant and renamedTo | Two revisions in one Store.write: renamed (previous body, carryDrafts) then edited; the map records the last; I3 updated | §14.1, I3 | | N3 ImportUpdate cannot write nothing in a Store.write | Returns a sentinel and rolls back; outcomes recorded by a lease-checked bookkeeping write | §14.1 | | N4 The lease guarded only page writes; Stop relied on the context; Resume across Disconnect, a new token, another workspace | Every run write lease-checked; Stop rotates the lease first; Disconnect and token replacement end resumable runs; one workspace per map; Start over; I12 extended | §8.3, I12 | | N5 lease, progress_at missing from plaintext | Added | §15 | | N6 No resumed event; bookkeeping by a running run after Start returns | resumed, started_over added; bookkeeping lease-checked | §14.2 | | N7 The bookkeeping exemption unfenced | One function, notion_* only; I19 | §14.2, I19 | | N8 I16's build tag in production | A notiontest client through the shared internal package | I16 | | N9 "A line starting ``" | After trimming leading spaces | §10.1 | | **N10** The mapper re-implementing regexes | Calls markup's exported predicates | §11.4 | | **N11** Truncation with no word boundary, long parents | Cut at a rune; parent cut to 40 first | §9.2 | | **N12** Empty label after cleaning | Uses the address | §11.3 | | **N13** Staged trees of runs nobody resumes | Deleted with the token under 90-day idle retention | §8.3 | | **N14** Title-only update left drafts behind | carryDrafts on the rename revision | §14.1 | | **N15** Build step 3 omitted I17, I18 | Listed, with I19 | §22 | | *(not a finding)* The images spec landed (c27a292) | §12 rewritten against its §7 hook; A1–A11 replaced by what it says; notion_images keyed by block and page; quota and ErrNoImageStore` handling | §12, §15, I14 |

Diff check: Fable (claude-fable-5-2) on revision 3 (68eec68): CHANGES REQUIRED, answered in revision 4

N1–N15 confirmed answered, checked against verbs.go, store.go and spans.go. The new findings came mostly from the images spec moving to revisions 3 and 4 while this one pinned revision 2.

| Finding | Change | Where | |---|---|---| | D1 (M) Attaching is now an explicit tx.commit argument for a closed list of verbs; imported images would stay pending | Re-pinned to images revision 4 (3af0d79); ImportCreate and ImportUpdate's edited revision pass attach, the renamed one does not; the images spec's §3.2 and §7 must name the two methods (raised as an amendment to it); I14 goes red without the argument | §12, I14 | | D2 (M) §13.2 and §13.3 still described one revision, no drafts touched, and writing nothing inside the transaction | Aligned with §14.1 | §13.2, §13.3 | | D3 (L) ErrImageQuota also fires on the runner's own allowance; pending images of kept or failed pages hold quota | Both allowances shown and named; commit as it goes; a kept or failed page's pending images removed at once | §12 | | D4 (L) Refusal line wording | The images spec's: file name, from the URL path | §12 | | D5 (L) AddImage and CopyImage are run writes outside the lease | Lease checked just before each; the one-image gap named; uploaded and removed in §14.2 | §12, §14.2 | | D6 (L) A paragraph split the §11.4 table | Moved below it | §11.4 | | D7 (L) Rows narrower than SafeURL and taskBox | Any address SafeURL accepts; any list item, space or tab; fixtures | §11.4, I1 | | D8 (L) A moved block could not be found by a (block, page) print | block_print by block alone, beside place_print; leak line | §15, §12 | | D9 (L) Bookkeeping is not only from the run | Its callers listed | §14.2 | | D10 (L) Workspace id from /v1/users/me unverified | Marked, with a fallback to the name; §19 step 5 checks | §8.3, §19 |

25. Build notes (phase 1)

Paul approved this spec on 2026-11-17 with every §23 recommendation: MAPA_IMPORTERS only; external images stay links; date-titled pages become YYYY-MM-DD (Parent) team pages linking the date; In: [[Parent]] and positional child links; toggles opened out with a bold lead; Finish deletes the token and staged copies and keeps the map; the oficina/notion repo; names, never emails; memoria's connector removed once the module exists if live memoria holds no Notion content; a code block in a numbered step stays after its step.

Where the build chose, or departed:

  1. The API version is memoria's 2026-03-11. §3 asks the build to re-read Notion's changelog and pin the version current then. The build was told never to contact Notion, so the re-read and the pin move to §19 step 3, with the recording made against the new pin.
  2. The file allowlist is the documented pair only (s3.us-west-2.amazonaws.com, /secure.notion-static.com/). §19 step 4 adds what a recording shows Notion sends. Superseded by note 17: the virtual-hosted pair is added.
  3. notionmd has its own copy of the typed tree, filled by import_convert.go. §4 has the mapper map "the block tree"; I8 forbids notionmd importing the module, so the tree the mapper reads, and the staged tree Mapa seals, are Mapa's own format.
  4. The test constructor is reached through the module's internal/seam, which notion fills at init. notiontest.Client and UnpinnedClient (I16) are the only constructors that take a base; the recorder uses the seam's record hook.
  5. §11.4's [ seam row cannot work as written. A web link's label runs to the first ] whatever it holds, so a U+200B after a literal [ does not stop it. The mapper writes such a [ as U+FF3B ([), counted as neutralised. The ! seam keeps U+200B.
  6. Mapper choices where §10 and §11 were silent: a code block holding both fence kinds is the fallback note and a ~~~ fence, counted code_fence; an inline equation is inline code, or text if it holds a backtick; a mark that would run into a link's closing * is dropped (mark_link); the meeting-notes placeholder reads "the meeting notes “X” weren't imported"; callout colour is counted.
  7. The image step is wired to Mapa images (landed on main as f9337f9, merged here). storeImages (import_images_store.go) adds through Store.AddImage and copies through Store.CopyImage, the in-process paths, as the runner; ImportCreate and ImportUpdate's edited revision commit with attachOwn(0), the renamed revision with attachNothing. Where no object store is bound (the live instance today), Ready refuses before anything is downloaded and every image is "(Image not imported: <file>, images aren't set up in Mapa yet)", as before (note 16). notion_images keys a place by the block and its Notion page, not its Mapa page as §15 says: the map pins one to the other, and the Notion page is known before a new Mapa page exists. Reuse checks the image is still held by the page; a block on another page is copied; a permanent refusal is kept until the block changes; the first quota refusal stops the run's downloads and names the allowance, at the top of the report; the Start page shows both allowances. Gate I14, with its mutations. I8 names images' two bucket files (images_bucket.go, config_images.go), which write to CARLOS's own object store: images landed after this spec said no directory is exempt.
  8. The workspace a map came from is a map row of state workspace, its identity sealed in the coordinate, so it outlives the connection row that Finish and Disconnect delete.
  9. After Finish, a new import treats the finished map's rows as unmapped, and overwrites each one it writes. §8.6 keeps the map for phase 2 and says a new import has none; this is the reading that keeps both, until a page is imported again.
  10. Bookkeeping's fence is at runtime: a GORM callback refuses any statement inside bookkeeping whose table is not notion_*. I19 tests it per table and by a Survey-only run.
  11. I17's kill is importCrash, a nil-in-production hook at named points between the run's statements and inside the two methods' transactions.
  12. The report shows only for a run that has ended (done or failed), and the connection's acts only when no run is going. Looking at the run in a browser found a report of zeros mid-survey, which §8.5 forbids. A run in progress shows its progress line instead.
  13. No script layer for the status page. §8.4's meta refresh is the whole mechanism, with scripts on or off.
  14. The run's counters are surveyed, total, written, created, updated, unchanged, kept and failed. The report's finer counts (renamed, kept by reason, losses, images) are read from the map's sealed coordinates, so no new plaintext column carries them.
  15. The fake's tab shape is a guess (a tab block with a rich-text label and children). §19 step 3 checks it.
  16. Merged with the locale and the images' copy (main a17ea28). Every count the import page shows (the run's progress, the report's, the allowances' sizes) goes through {{number L …}} or Locale.Number, and "created there" and "edited there" are dateYear in the reader's locale, still the day in UTC (level-up build note 85). locale_sweep_test.go's TestTheImportWritesDatesAndCountsInTheReadersLocale reads the report, an imported page and its History in German and en-US. The "no image store" strings take the images feature's wording, "Images aren't set up in Mapa yet.", adapted only grammatically: the reason in a page's line, the report's notice and the Start page's line (copy-review/notion-import/, its result.json note says so). The import's migration is 0007_notion_import, after the locale's 0006_alter_members.
  1. Found by the first real run (read-only, notion-record, 831 objects and 158 pages of Paul's workspace; §19 steps 4 and 5), fixed before he imports (branch fix/real-workspace, module and Mapa): - Every Notion-hosted file was refused. All 144 were at the virtual-hosted https://prod-files-secure.s3.us-west-2.amazonaws.com/ <workspace id>/<file id>/<name>?…; the allowlist held only the documented path-style pair. The module adds (prod-files-secure.s3.us-west-2.amazonaws.com, /): the host, matched exactly, names the bucket, so it pins as much as the old host and prefix did. The old pair stays, and every other pin (https, no userinfo, the port, the escaped-path prefix, no redirects, no token, the .. refusal) is unchanged. The fake builds the real shape (Host) and still the old one (PathStyle), and production's own pin is checked against both. M5 refuses look-alikes (…amazonaws.com.evil.example, evil.s3.us-west-2.amazonaws.com, another region, a trailing dot), with mutations for a suffix or prefix host match and the missing pair; I14 downloads and attaches an image at the real shape. - last_edited_time is rounded to the minute (all 3,815 ended in :00), so nothing may decide "unchanged" from it alone. Pages never did: Survey reads every page, and Write compares the rendered title and body with what Mapa holds (§13.2); there is no survey shortcut. TestI2AnEditInTheSameMinuteIsPickedUp now holds it, with a mutation that adds the edit-time shortcut. Images did: reuse (prior.Edited == block.Edited) and copies compared the block's edit time, so a file replaced in the same minute as the last run kept the old picture. notion_images now keeps the file's key, notion.FileKey (host and escaped path, the signature dropped), which changes when the file is replaced; reuse, copies and permanent refusals compare it. An unchanged image is still not downloaded again (I2). A row from before keys has none, matches nothing, and is fetched once more. Gate TestI14AnImageReplacedInTheSameMinuteIsFetched, and the copy's TestI14AChangedSharedImageIsFetchedOnce, now replace the file without moving the edit time; each has a mutation. - Fable's review of this change: CHANGES REQUIRED, answered. M1: the fake signed every file URL alike, so no gate could tell a key that kept the signature; the fake now signs every read afresh, as Notion does (module test and mutation), and Mapa's mutation "the file key is the signed URL" turns I14 red. L1: a file replaced between Survey and Write is kept under the key of what was downloaded, not the staged one (TestI14AFileReplacedMidRunIsKeyedAsDownloaded). L3: the key drops the port. L5: a permanent refusal is retried once the file is replaced, gated. L2: §19 step 5 now checks the key's premises. L6: §12's permanent refusals corrected (a refused host is transient).
  2. Import lives in File (Paul, 2026-11-22: "Why is there no 'File' menu? I would have thought File -> Import was a thing"; amends §7). The level-up's Page menu is now File, the first menu, and an importer finds "Import from Notion…" there, after New; the account menu no longer offers it. Level-up build note 87 has the whole of it; I13 now looks in File and refuses the account menu.

Fable's review of the build (2026-11-17): CHANGES REQUIRED, answered

No egress, credential, sealing or scope hole, and no path that overwrites a Mapa edit. Each high and medium finding now has a gate that is red without its fix, and a mutation in make mutate.

| Finding | Change | |---|---| | H1 65+ same-titled siblings failed the run | Candidates number on without end (D12) | | M1 a \r failed the page | Line endings normalised at the mapper's top | | M2 neutralising quadratic to cubic in [; Render had no context | One scan per rule, one rebuild per line, markup.OpensAt; Render takes a context and each page has 30 s | | M3 ImportUpdate's re-checks unheld alone | A teammate's save and a delete at the write:rendered point; a deleted page not re-created; one mutation per check | | M4 leases unheld at ImportUpdate and bookkeeping sites; token replacement; the heartbeat's stop | Each gated after Stop, each with a mutation | | M5 idle-token sweep untested, three statements | One transaction, gated at 89 and 91 days | | M6 Forget left the token | Forget deletes it (Paul's ruling, §6) | | N-M1 (module) a page under a database row dropped | Only pages the walk visits count as parents; such a page is an orphan, imported without an In: line and listed in the report | | L1, L2 bare addresses and rule-shaped items fell back | A bare address against generated syntax is written [address](address); an item shaped like a rule gets U+200B | | L4 a deleted page held a title | It plans none | | L5 | Gated; the check's marker clause has no mutation of its own (a marker changes the plain text, so it is never the only refusal) | | L6 fix-up after Resume, created flipped to updated | The fix-up re-renders every written page that links, from stored image lines; the row keeps its state | | L7 rename collision | Takes the next title, as a create does | | L8 launch failing | The run ends failed at once | | L9 finished row trashed later | Keeps no page | | L10 | §19 step 5 names the workspace-name risk | | L11 | History and the kicker show the import (§14.2) | | L12 | I8 resolves aliases and dot imports, and names TLS, DNS, smtp and exec | | L13 (module) | Gates for the proxy, the body cap, URL-free errors, trashed blocks, the depth bound, long titles | | L14 (module) | The file pin refuses .. segments, plain or encoded | | L15 | Kept and deleted pages are decided before rendering or fetching; an unchanged image reuses its line; §19 step 4 names the virtual-hosted bucket |

Two more gates found to be unable to fail alone, by make mutate: the module's escaped-path check once the .. refusal existed (it gained a URL only it refuses), and the structure check's marker clause (above).

Gates: M1 to M8 in the module, each with mutations in its make mutate (26, all caught). I1 to I13 and I15 to I19 in Mapa, with mutations in scripts/mutate/mutations_mapper.go and mutations_import.go; I16 has none, because it goes red only if the module gains a write, which M4 forbids. make mutate found two gates that could not fail as first written: M4's scheme check (plain http:// is port 80, so the port check refused it first) and I3 (ImportUpdate re-reads the revision inside its own write, so the run's check alone going is not observable). Both now fail as they should. I14 waits for images.

Fable's round 2 (2026-11-17): module APPROVED; Mapa CHANGES REQUIRED, answered

No High; nothing overwrites, leaks or dials. M1 and M2 fixed with gates red without them; every Low fixed or held. The two notes this build made that a check "could not be held alone" were both wrong (the run's untouched check, the structure check's marker clause): each now has its own gate and mutation.

| Finding | Change | |---|---| | M1 shared long link addresses still quadratic; no deadline inside a block; renderBudget ungated | markup.LinkAddress and the editor's linkAddress: at most 2,048 bytes and a scheme prefix before url.Parse, corpus cases either side; the mapper uses it; the context is checked per line; a slow page fails alone, gated | | M2 the run's untouched check unheld | Gated by a kept page's title for links and a kept page's image; TestL15 changes the image block; early()'s kept case mutated | | Low 1 | A bare address is rewritten only where the autolink runs into the generated part, Mapa links it, and it has no backtick | | Low 2 | Single-line names lose their line breaks | | Low 3 | The marker clause gated alone | | Low 4 | A page found gone stops being live | | Low 5 | Deleted pages' images discarded; reuse's edit-time and refusal rules, the held check and the fix-up's stored lines gated (with I14) | | Low 6 | Gone not kept after a refusal; Forget ending a resumable run; idle from the run's last activity; the fix-up passes a crash on; renames stay counted | | module Low | Mutations for the body cap, URL-free errors and the long-title re-read |

Fable's narrow check, round 3 (2026-11-17): M2 APPROVED; M1 and I14 CHANGES REQUIRED, answered

| Finding | Change | |---|---| | M1 generated links still tested with SafeURL: past 2,048 bytes the block fell back and lost its address | webLink uses markup.LinkAddress; past the bound it writes the label, then the bare address, which Mapa links, counted long_link; fixtures either side of the bound in bytes, accents and an external image included | | M2 a copy ignored the block's edit time, so a changed image on two pages never healed | A copy is made only from a place of the block as it is now; gated with exactly one fetch | | M3 Forget left notion_images | Forget deletes them in its transaction; Finish keeps them with the map; §15's place print is the Notion page's | | L1 image places outside the page's write | Kept in placeRow, in the page's transaction; a crash after the write neither fetches again nor writes twice | | L2 one block twice on a page | One image | | L3 "Images stopped" from an earlier run | A page decided before its images carries no counts | | L4 no store bound | Said on the Start page and at the top of the report | | L5 host not allowed was permanent | Transient: §19 step 4 may add the host | | L6 I8's bucket exemption | The two files keep the import rules and may use only http.Client and NewRequestWithContext | | L7 checks that could be removed green | Gated: the copy source's held check, each lease check before a copy and an add, the team's allowance named, the deadline inside a block; the JS byte bound by a corpus case only bytes get right | | L8 the editor's imageSpan quadratic (also on main) | Refused before slicing; a JS timing test for it and round 2's link shapes |

Fable's narrow check, round 4 (2026-11-17): M2, M3 APPROVED; M1 CHANGES REQUIRED, answered

| Finding | Change | |---|---| | M1 the bare long-address form was unbounded: following text swallowed, the address cut or altered by neutralising, the check accepting any literal autolink | The address is a generated part of its own (bare), untouched by neutralising, and the check demands one autolink whose address is it, byte for byte; written text (address) so the autolink starts and ends where it should; [ ] < > \ | and a final .,;:!?'" percent-encoded; fixtures for letters, quotes, ellipses, marks, code and a second long link after it, and brackets, angles, backticks, pipes and punctuation in it, each with one link span equal to the address | | L1 | The scheme is lower-cased; a long mailto: is text (§11.3); the bracketed form answers "see:" before a long link | | L2 | The label-is-the-address branch gated, with a mutation | | L3 | Finish keeping notionimages gated, with a mutation | | L4 | §15's states corrected; §8.6 says a new import after Finish reads notionimages`; §19 step 5 checks Notion's edit-time precision |

Fable's narrow check, round 5 (2026-11-17): M1 holds in every shape; one Medium and two Lows, answered

| Finding | Change | |---|---| | M1a a label equal to the raw address (holding (, ) or a space) was written again as text, and its own autolink cut | webLink clears a label whose encoding is the address; longLink's own comparison, now dead, is removed; both shapes in the test, which counts exactly one link span per long link | | L1 the test's oracle was the encoder | Link spans are compared decoded with the address itself; the encodings are pinned in their own test | | L2 a final ? became %3F, another address | A final ? that starts an empty query is dropped; any other is encoded |