Skip to content

feat(id): Notion importer slice 2 — page/block core, link rewriting, files (#13522) - #13631

Merged
dezren39 merged 4 commits into
mainfrom
felix/6513-notion-slice-2
Nov 23, 2026
Merged

dezren39 merged 4 commits into
mainfrom
felix/6513-notion-slice-2

Conversation

@developing-today-fleet

@developing-today-fleet developing-today-fleet Bot commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

Closes #13522. Part of #6513 (the Notion importer programme under the #6436 design, doc/2026-11-10_design_id6436.md); slices 3–5 are filed as #13523, #13524, #13525.

What landed

Slice 2 of the importer design — page/block core + link rewriting + files — in pkgs/id/crates/id-import-notion, following slice 1's architecture (#8419: injected boundaries, offline recorded fixtures, no credentials persisted):

  • Identity pass (Manifest::assign_page_identities, design §3/§6.1): assigns a destination note ID to every inventoried page before any content converts, so forward references resolve. Recorded assignments never change; an empty or duplicate minted ID fails the pass.
  • Page/block core (§2.1, §2.5): each page's block tree is fetched fresh (sibling order preserved, children embedded, repeated block IDs fail closed) and converted to the revision content form for the clean classes — paragraphs, headings, lists, to-dos (checked state), quote, code (language), divider, bookmark, media, child pages/databases. A child page becomes a typed reference to its own note, never inlined content. Every block is classified clean / degraded / unsupported; degraded and unsupported blocks are preserved verbatim (children embedded, file URLs stripped) — nothing is silently dropped, and slice 4 (id: implement Notion importer slice 4: comments + degradation completion + export reader (design #6436) #13524) can upgrade their conversion without identity changes.
  • Link rewriting (§3): text links and page mentions resolve through the manifest identity map to typed references (SpanLink::Note + the page's reference list); block links (#<block-uuid>) carry the block selector when the block is inventoried under the linked page. A link or mention whose target is outside the import set stays verbatim and is counted in externalised for the fidelity report.
  • Files (§4): file-bearing blocks are fetched during the run through an injected FileFetcher; blobs are keyed by BLAKE3-256 (the model's raw-blake3-256 profile), duplicate bytes are stored once, and the manifest gains a file_blobs map (source block ↔ blob, #[serde(default)] so slice-1 manifests still load). An unfetchable file degrades its page with a named reason (expiring URL stripped from it) and never aborts the import. Staged progress advances Files → Content → References without rewinding (§6.3).

Deliberately out of this slice

Tests

Remote dispatch only: cargo fmt --manifest-path pkgs/id/Cargo.toml -p id-import-notion -- --check && cargo test --manifest-path pkgs/id/Cargo.toml -p id-import-notion — the "Execute target command" step of run 45240072029 (developing-today/fleet fleet-command, ref felix/6513-notion-slice-2 @ 45dab3a) completed success: the full crate suite is green — 15 unit tests (11 slice-1 + 4 new) and 3 integration tests (1 slice-1 + 2 new). Earlier runs on the way: 45231569263 (fmt diffs, fixed), 45232462022 (one Outcome move error, fixed).

  • tests/recorded_content.rs (new): recorded-fixture conversion of two pages exercising nested lists, to-do/code/bookmark payloads, a child page, internal + mention + block links, an externalised link, duplicate file bytes (one blob, two manifest entries), an unfetchable file (page degraded, import not aborted), a degraded toggle and an unknown block type (both verbatim). Asserts the §8 check 2/6 subsets, no file URL or secret in the persisted manifest or content (§6.5), and check 3 at conversion level: re-running assignment + conversion over the unchanged corpus assigns nothing and reproduces identical content, references, and manifest maps.
  • Unit tests: the §2.5 classification table and Notion URL extraction (dashed/dashless, block fragments, non-Notion URLs).

New dependency

blake3 = "1" for id-import-notion — blob identity must be the model's raw-blake3-256 content digest. blake3 is already in the workspace lock (via iroh); the lock change is the one dependency line on this crate. No other new dependencies; no schedules touched.

{
  "direct_parent": null,
  "links": [],
  "lineage": {
    "design": null,
    "roadmap_item": null,
    "priority": null
  },
  "pm_meta": 1,
  "provenance": {
    "queue_id": null,
    "scheduled_start": null,
    "picked_up_at": null,
    "work_started_at": null,
    "created_at": "2026-11-23T18:53:57Z",
    "session_id": null,
    "lane": null,
    "host": "htch-runtime",
    "worktree": "/home/hatch",
    "model": null,
    "lane_start_issues": [],
    "workspace_ref": {
      "kind": "worktree",
      "id": "/home/hatch",
      "repo": "developing-today/code",
      "branch": "main",
      "sha": "76bbec72135cee7bd837984b0cd283ae295766e0"
    },
    "auth_subject": "felix",
    "stamped_by": "fleet 0.1.0 (native)"
  }
}

See it in action
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

felix added 4 commits November 23, 2026 17:47
…files

Design #6436 slice 2 (#13522), building on slice 1's manifest +
inventory (#8419) in id-import-notion:

- Identity pass (Manifest::assign_page_identities): assigns note IDs
  to every inventoried page before any content converts (design §3
  two-pass rule); recorded assignments never change (§6.1).
- Page/block core (§2.1, §2.5): block trees are fetched fresh with
  sibling order preserved and converted to the revision content form
  for the clean classes; child pages become typed references, never
  inlined content. Every block is classified clean/degraded/
  unsupported; degraded and unsupported blocks are preserved verbatim
  with children embedded — nothing is dropped.
- Link rewriting (§3): page links, mentions, and block links resolve
  through the manifest identity map to typed references; links
  outside the import set stay verbatim and are counted externalised.
- Files (§4): file blocks are fetched during the run through an
  injected FileFetcher, stored as BLAKE3-256 content-addressed blobs
  (duplicate bytes stored once), recorded in the manifest's new
  file_blobs map; an unfetchable file degrades its page with a named
  reason and never aborts the import. Expiring file URLs are never
  persisted (§6.5).

New dependency: blake3 1 (already in the workspace lock via iroh) —
blob identity must match the model's raw-blake3-256 profile.

Tests: tests/recorded_content.rs over recorded API fixtures (§8
checks 2 and 6 subset, check 3 at conversion level) plus unit tests
for block classification and Notion URL extraction.
@coderabbitai

coderabbitai Bot commented Nov 23, 2026

Copy link
Copy Markdown

Important

Review skipped

Bot user detected.

To trigger a single review, invoke the @coderabbitai review command.

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 27d5a65e-c32e-40db-a85c-d2e9d5530d1e

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@dezren39
dezren39 merged commit ea5aee7 into main Nov 23, 2026
2 checks passed
@dezren39
dezren39 deleted the felix/6513-notion-slice-2 branch November 23, 2026 19:01
@dezren39 dezren39 added the audit:complete PR fully implemented spawning issue label Nov 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

audit:complete PR fully implemented spawning issue

Projects

None yet

Development

Successfully merging this pull request may close these issues.

id: implement Notion importer slice 2: page/block core + link rewriting + files (design #6436)

1 participant