The importer's looks: Fable's re-check lows; the module pinned to its main
A passing failure keeps the look's notion_images row; a test that a look's prints meet no block's. go.mod pins notion.git at its main, b8398e7, where the module's change landed.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
5 files changed,
+51
−5
docs/superpowers/specs/2026-11-22-mapa-columns-icons.md+2 −1go.mod+1 −1go.sum+2 −0internal/mapa/import_looks.go+13 −2internal/mapa/import_looks_test.go+33 −1
diff --git a/docs/superpowers/specs/2026-11-22-mapa-columns-icons.md b/docs/superpowers/specs/2026-11-22-mapa-columns-icons.md| index d8f4eec..a147b60 100644 |
| --- a/docs/superpowers/specs/2026-11-22-mapa-columns-icons.md |
| +++ b/docs/superpowers/specs/2026-11-22-mapa-columns-icons.md |
| @@ -800,5 +800,6 @@ Fable found every round-1 finding answered in substance, and five mediums and si |
| - **F4, the writes.** `ImportCreate` writes the record with its icon and banner (centred, `Y: 50`), and its commit attaches them. `ImportUpdate` writes renamed, styled, edited, each only when needed, in one transaction (`update:styled` is a new crash point); the styled revision carries drafts as a rename's does. "Unchanged" compares the look too. A page this run prepared no look for (a fix-up after a Resume) keeps its own. |
| - **F5, the report.** "Icons imported", "Icons not imported" by reason, "Banners imported" and "Banners not imported" (Luna: Mapa's word for what Notion calls a cover), and "Column widths" among the losses; the old "Page icons" and "Page covers" losses are gone (an old run's report shows them by key). Luna's wording applied (`copy-review/import-looks`). |
| - **F6, gates.** I20 and I25 (`TestI20IconsAreImported`: emoji, custom emoji and uploaded icons imported; Notion's set, an emoji Mapa lacks, an icon too wide, a download that fails and a custom emoji on an unpinned host counted, the page written each time); I21 (`TestI21CoversAreImportedFromThePinOnly`); I22 is COL11 plus the width goldens; I24 (`TestI24ALookChangedInNotionIsStyled`, `TestI24RenamedStyledEditedInOrder`, and I17's re-run crash case now renaming, restyling and editing at every crash point). Seven mutations, all caught. The import spec's §9.1, §10, §11.4 and §15 say what this spec changed. |
| -- **F7, Fable on the build (`bd3ee46`, module `d36f6e0`): APPROVE, no High, two Mediums, answered.** M1: the gallery pin let an encoded `/` or `\` follow its prefix; it is now a leaf pair. M2: an imported styled revision read "Updated from Notion · edited there <date>", a stale date; it now reads the look's own words with "(from Notion)". Lows: the redirect check added to the first-run list (L1); `Files.Gallery` for covers (L2); the fresh object's types checked (L3); look prints in their own domain (L4); width ratios compared with each other (L5); mutations for the 512-pixel discard, the 128 KiB cap and a fix-up keeping its look, with a Resume test (L6); a passing failure keeps the look (L7); the page object read once (L8); the module landed first and Mapa pinned to its main (L9). I24 gains the fix-up and passing-failure tests; I20 a 128 KiB icon. |
| +- **F7, Fable on the build (`bd3ee46`, module `d36f6e0`): APPROVE, no High, two Mediums, answered.** M1: the gallery pin let an encoded `/` or `\` follow its prefix; it is now a leaf pair. M2: an imported styled revision read "Updated from Notion · edited there <date>", a stale date; it now reads the look's own words with "(from Notion)". Lows: the redirect check added to the first-run list (L1); `Files.Gallery` for covers (L2); the fresh object's types checked (L3); look prints in their own domain (L4); width ratios compared with each other (L5); mutations for the 512-pixel discard, the 128 KiB cap and a fix-up keeping its look, with a Resume test (L6); a passing failure keeps the look (L7); the page object read once (L8); the module lands first and Mapa is pinned to its main before landing (L9). I24 gains the fix-up and passing-failure tests; I20 a 128 KiB icon. |
| +- **F8, Fable's re-check (`4a63cc3`, module `9de0941`): APPROVE, no High or Medium.** Its lows answered: a passing failure keeps the look's `notion_images` row as it was, so a Notion that goes back to that file reuses it; a gallery name starts with a letter or digit; a test that a look's prints meet no block's. F7's L9 is the landing order. |
diff --git a/go.mod b/go.mod| index 7556485..f0a52c5 100644 |
| --- a/go.mod |
| +++ b/go.mod |
| @@ -6,7 +6,7 @@ toolchain go1.26.11 |
| require ( |
| amadan.net/oficina/estilo.git v0.0.0-20261118055615-d004805f40f2 |
| - amadan.net/oficina/notion.git v0.0.0-20261122203529-9de09416b0e5 |
| + amadan.net/oficina/notion.git v0.0.0-20261122204613-b8398e79991e |
| amadan.net/rastrillo/rastrillo v0.35.1-0.20261116213651-96812beacacc |
| github.com/chromedp/cdproto v0.158.6 |
| github.com/chromedp/chromedp v0.21.0 |
diff --git a/go.sum b/go.sum| index a8f96c8..76bf4e1 100644 |
| --- a/go.sum |
| +++ b/go.sum |
| @@ -6,6 +6,8 @@ amadan.net/oficina/notion.git v0.0.0-20261122193726-d36f6e0f6101 h1:EdCkiWKC2PrZ |
| amadan.net/oficina/notion.git v0.0.0-20261122193726-d36f6e0f6101/go.mod h1:2WuyjBTLHwurTGri00zfPxSKc9b3pomdT6wSs/UIvA4= |
| amadan.net/oficina/notion.git v0.0.0-20261122203529-9de09416b0e5 h1:vtl6aPel2HbTNoUnigTlUjymI5T6HTfzPBHN/mqXKQc= |
| amadan.net/oficina/notion.git v0.0.0-20261122203529-9de09416b0e5/go.mod h1:2WuyjBTLHwurTGri00zfPxSKc9b3pomdT6wSs/UIvA4= |
| +amadan.net/oficina/notion.git v0.0.0-20261122204613-b8398e79991e h1:p2wjp4sf2tnBn9HQjdRlAxGJpkyCXhcCOZggInenvYc= |
| +amadan.net/oficina/notion.git v0.0.0-20261122204613-b8398e79991e/go.mod h1:2WuyjBTLHwurTGri00zfPxSKc9b3pomdT6wSs/UIvA4= |
| amadan.net/rastrillo/fiesta v1.3.0 h1:7SsHw4aeWPLStR3RHFEEtX4CwqKu+Ig3PgNX8FvD8WM= |
| amadan.net/rastrillo/fiesta v1.3.0/go.mod h1:LpO391W1dIRUxOIKklHm+bGyWXtlFyBRRPQCysb9LjY= |
| amadan.net/rastrillo/rastrillo v0.35.1-0.20261116213651-96812beacacc h1:QakboVkj9nqA6ZaKXeDVXWLPobQSVvd80ic521aA8/U= |
diff --git a/internal/mapa/import_looks.go b/internal/mapa/import_looks.go| index 64cef4b..3ba57d5 100644 |
| --- a/internal/mapa/import_looks.go |
| +++ b/internal/mapa/import_looks.go |
| @@ -168,8 +168,7 @@ func (job *importJob) lookImage(ctx context.Context, entry *importEntry, |
| placed.key = key |
| } |
| if why.text != "" { |
| - placed.reason, placed.permanent = why.text, why.permanent |
| - look.placed = append(look.placed, placed) |
| + look.placed = append(look.placed, refused(placed, why, prior)) |
| return lookOutcome{reason: why.text, permanent: why.permanent}, nil |
| } |
| placed.publicID = added.PublicID() |
| @@ -178,6 +177,18 @@ func (job *importJob) lookImage(ctx context.Context, entry *importEntry, |
| return lookOutcome{public: placed.publicID}, nil |
| } |
| +// refused is a refused look's place. A passing failure leaves the page |
| +// its look, so the row stays as it was: a Notion that goes back to that |
| +// file reuses it (Fable's re-check of phase 4, low 2). |
| +func refused(placed placedImage, why refusal, prior imagePlace) placedImage { |
| + if !why.permanent && prior.PublicID != "" { |
| + return placedImage{page: placed.page, block: placed.block, |
| + look: true, key: prior.Key, publicID: prior.PublicID} |
| + } |
| + placed.reason, placed.permanent = why.text, why.permanent |
| + return placed |
| +} |
| + |
| // addLook downloads an icon or a cover and adds it, and answers the key |
| // of the file it downloaded. An icon over 512 pixels a side is taken |
| // away again at once: Mapa never decodes pixels, so it cannot scale one |
diff --git a/internal/mapa/import_looks_test.go b/internal/mapa/import_looks_test.go| index 3a5f5e1..4d7a33f 100644 |
| --- a/internal/mapa/import_looks_test.go |
| +++ b/internal/mapa/import_looks_test.go |
| @@ -317,7 +317,8 @@ func TestI24AFixUpAfterAResumeKeepsTheIcon(t *testing.T) { |
| func TestI24APassingFailureKeepsTheIcon(t *testing.T) { |
| ws := notiontest.NewWorkspace("passing") |
| page := ws.Page("", notiontest.Text("Iconic")) |
| - ws.SetIcon(page, notiontest.FileIcon(ws.Host("one.png", picture(t, 1)))) |
| + first := ws.Host("one.png", picture(t, 1)) |
| + ws.SetIcon(page, notiontest.FileIcon(first)) |
| world := newImportWorld(t, ws) |
| world.useImages() |
| world.connect(ana) |
| @@ -335,4 +336,35 @@ func TestI24APassingFailureKeepsTheIcon(t *testing.T) { |
| t.Errorf("the icon went from %+v to %+v", before.Icon, after.Icon) |
| } |
| world.expectVerbs(mine.ID, VerbCreated) |
| + // Notion goes back to the first file: its row was kept, so nothing |
| + // is downloaded and nothing written (Fable's re-check, low 2). |
| + ws.SetIcon(page, notiontest.FileIcon(first)) |
| + world.server.Reset() |
| + if run := world.importAs(ana); run.Unchanged != 1 || |
| + world.fileRequests() != 0 { |
| + t.Fatalf("back to the first file: %+v, %d fetched", run, |
| + world.fileRequests()) |
| + } |
| + world.expectVerbs(mine.ID, VerbCreated) |
| +} |
| + |
| +// A look's prints are in a domain of their own: an icon's row shares no |
| +// print with a block named "icon:" on the same page, nor any block's |
| +// block print, so no copy is ever taken from it (Fable's re-check of |
| +// phase 4, low 4). |
| +func TestI20LookPrintsAreTheirOwn(t *testing.T) { |
| + world, _ := looksWorld(t) |
| + page := notiontest.ID(7) |
| + lookPlace, lookAlone, err := world.store.lookPrints(page, iconPlace) |
| + if err != nil { |
| + t.Fatal(err) |
| + } |
| + blockPlace, blockAlone, err := world.store.imagePrints(page, iconPlace) |
| + if err != nil { |
| + t.Fatal(err) |
| + } |
| + if lookPlace == blockPlace || lookAlone == blockAlone || |
| + lookAlone != lookPlace { |
| + t.Error("a look's prints meet a block's") |
| + } |
| } |