Skip to content

fix: enhance page import - #1570

Merged
Philipinho merged 6 commits into
mainfrom
fix/import-pattern
Sep 17, 2025
Merged

Philipinho merged 6 commits into
mainfrom
fix/import-pattern

Conversation

@Philipinho

@Philipinho Philipinho commented Sep 17, 2025 •

Copy link
Copy Markdown
Member

Summary by CodeRabbit

  • New Features

    • Cleaner imported page titles (Notion IDs removed).
    • Table cell/header background colors now honored from data-background-color attributes.
  • Bug Fixes

    • More reliable imports for large, nested structures with correct backlink creation.
    • Reduced storage bloat by cleaning up import files after successful completion.
  • Chores

    • Increased parallel attachment uploads for faster imports.
    • Updated internal enterprise module reference.

@coderabbitai

coderabbitai Bot commented Sep 17, 2025 •

Copy link
Copy Markdown

Caution

Review failed

The pull request is closed.

Walkthrough

Updates the EE submodule pointer. Replaces stalled-event handling with completed-event cleanup in the file-task processor. Refactors the import pipeline to level-based, transactional processing, adds Notion ID stripping, increases attachment upload concurrency, and broadens table backgroundColor parsing in editor extensions.

Changes

Cohort / File(s) Summary
EE submodule update
apps/server/src/ee
Submodule gitlink updated to a new commit; no parent repo code changes.
Import job event handling
apps/server/src/integrations/import/processors/file-task.processor.ts
Removed stalled-event failure path; added a single completed-event handler to log and delete the imported zip via storageService; retains onFailed path for real failures.
Import pipeline and utilities
apps/server/src/integrations/import/services/file-import-task.service.ts, apps/server/src/integrations/import/utils/import.utils.ts, apps/server/src/integrations/import/services/import-attachment.service.ts
Import refactored to level-based (BFS) transactional insertion with batched backlinks and on-demand content generation; added stripNotionID utility for page names; increased CONCURRENT_UPLOADS from 1 to 3.
Editor table backgroundColor parsing
packages/editor-ext/src/lib/table/cell.ts, packages/editor-ext/src/lib/table/header.ts
Parse backgroundColor from inline style or data-background-color; minor formatting/quoting adjustments without API changes.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  actor W as Worker
  participant P as FileTaskProcessor
  participant S as StorageService

  rect rgba(230,245,255,0.5)
    Note over W,P: Job lifecycle (modified)
    W->>P: WorkerEvent 'completed' (job)
    P->>P: Load fileTaskId from job data
    P->>S: delete(filePath)
    S-->>P: result / error
    P-->>W: Log completion and cleanup outcome
  end

  Note over W,P: 'stalled' handler removed
Loading
sequenceDiagram
  autonumber
  actor W as Worker
  participant F as FileImportTaskService
  participant FS as FileSystem
  participant M as Markdown→HTML
  participant H as HTML Formatter
  participant PM as ProseMirror
  participant DB as Database

  W->>F: processGenericImport(zip, metadata)
  F->>FS: Discover pages/files
  F->>F: Build graph, compute levels (BFS)
  rect rgba(240,255,240,0.5)
    Note over F,DB: Single transaction
    loop For level = 0..n
      loop For each page in level (ordered)
        F->>FS: read(file)
        F->>M: md → htmlContent
        F->>H: formatImportHtml(htmlContent)
        H-->>F: html, backlinks, pageIcon
        F->>PM: html → ProseMirror JSON
        PM-->>F: doc, title
        F->>DB: insert Page (parent already inserted)
        DB-->>F: pageId
        F->>F: collect validIds, backlinks
      end
    end
    F->>DB: insert Backlinks in batches (filtered to validIds)
  end
  F-->>W: Success summary / throw on error
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Possibly related PRs

  • fix: confluence drawio import #1518 — Touches the same attachment import service, adding Draw.io handling and altering attachment processing; overlaps in import pipeline area.
  • fix: page import task #1551 — Modifies the same import pipeline files (task processor, import service, attachments, utils/formatter), indicating closely related control-flow changes.

Poem

I nibble on diffs with whiskers keen,
Threads weave levels—BFS green.
Zip cleaned at job’s bright end,
Three uploads race, attachments send.
Tables blush with colors anew—
IDs trimmed, fresh titles grew.
Hippity-hop, imports through! 🐇✨

✨ Finishing touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/import-pattern

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 46669fe and e9d29f1.

📒 Files selected for processing (7)
  • apps/server/src/ee (1 hunks)
  • apps/server/src/integrations/import/processors/file-task.processor.ts (1 hunks)
  • apps/server/src/integrations/import/services/file-import-task.service.ts (3 hunks)
  • apps/server/src/integrations/import/services/import-attachment.service.ts (1 hunks)
  • apps/server/src/integrations/import/utils/import.utils.ts (1 hunks)
  • packages/editor-ext/src/lib/table/cell.ts (1 hunks)
  • packages/editor-ext/src/lib/table/header.ts (1 hunks)

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

Comment @coderabbitai help to get the list of available commands and usage tips.

@Philipinho
Philipinho merged commit 9ac180f into main Sep 17, 2025
github-actions Bot added a commit to antiagingrecord/docmost that referenced this pull request Oct 9, 2025
4231ba9 Merge commit '042836cb6d7cc1f71af3ce44c7957f8abbbf8f25' into feat/aar_edition
042836c sync
4f1f0ba fix
3164b69 feat: api keys management (EE) (docmost#1665)
16c1e86 fix comment space
c9b1cad sync
bf8cf62 feat: Typesense search driver (EE) (docmost#1664)
5a2e16a Merge commit '31350303760163384113bf49d07127e886f94907' into feat/aar_edition
3bc710d Adds CLAUDE.md documentation
16914f1 Block search for non-indexed shares
ca75e29 Set default page mode to Read
3135030 fix editor converter (docmost#1647)
3fae41a fix: editor performance improvements (docmost#1648)
b50e256 sync
1f3b0c7 cloud fix
3c4cab0 v0.23.2
4de25a8 invalidate queries on space deletion
cf5bbb1 fix import html processing
ac17521 sync
9ac180f fix: enhance page import (docmost#1570)
46669fe (cloud) disable page sharing in trial mode
fe6ecdf fix: update combobox props in SpaceSelect component (docmost#1564)
04ae1d7 Allow lastColumnResizable in table
1280f96 feat: implement space and workspace icons (docmost#1558)
61d1cf8 fix: reset file inputs after import
f413720 - sync - reinstantiate S3 client to fix file upload errors during import - delete import zip file after use
8e16ad9 v0.23.1
7ada3cb fix: page import task (docmost#1551)
47c5417 sync
dc06502 sync
091e790 fix attachment search in cloud
ae24ea2 v0.23.0
9df6061 lock file
31053e2 update mermaid
eb8e850 use debug
c99bfb8 make print better
26ea04e sync
6cc58c5 sync
7d2ff34 UI fixes
b08d37f fix
d43ee77 remove debug log
5d91eb4 feat: queue imported attachments for indexing
3e9f6b1 Remove version from docker-compose.yml [deprecated] (docmost#1011)
db55de9 feat: progressive web app (docmost#614)
1919eba New Crowdin updates (docmost#1522)
7951b2e New Crowdin updates (docmost#1509)
73b78f6 more translations
cf7534d fix version display
adec36d fix: adjust margins - use default browser highlight background
f9e1080 sync
00e499b Fixing extra page bug on print (docmost#1478)
5ee6e46 checkbox aligned to text (docmost#1486)
1f797c3 fix: confluence drawio import (docmost#1518)
f12866c feat(EE): full-text search in attachments (docmost#1502)
dcbb65d feat(EE): LDAP integration (docmost#1515)
5968764 feat: emoji callout icon (docmost#1323)
242fb6b fix: set mermaid theme based on computed color scheme (docmost#1438)
74cd890 feat(EE): implement SSO group sync for SAML and OIDC (docmost#1452)
509622a ignore type error
937386e fix: hide table handles in readonly mode
60a373f fix: readonly editor table responsiveness
73ee6ee feat: subpages (child pages) list node (docmost#1462)
7d1e5bc feat: table row/column drag and drop (docmost#1467)
aa58e27 fix: exclude deleted pages (docmost#1494)
08135a2 sync
d92a942 sync
5012a68 sync
5a33777 feat: debug mode env variable (docmost#1450)
3b85f4b fix: enforce C collation for page position ordering to ensure consistent behavior in Postgres 17+ (docmost#1446)
cb2a039 fix: invalidate trashed page from tree state
95b7be6 fix: hide trash from can view permission (docmost#1445)
b0c5572 fix nested taskList in markdown export (docmost#1443)
dddfd48 feat: add attachments support for single page exports (docmost#1440)
aa6eec7 fix: exclude trashed pages from position generation
97a7701 fix local storage copy function (docmost#1442)
b97eb85 sync

git-subtree-dir: vendor/app
git-subtree-split: 4231ba9
@coderabbitai coderabbitai Bot mentioned this pull request Oct 12, 2025
@Philipinho
Philipinho deleted the fix/import-pattern branch December 14, 2025 19:06
nulluserid pushed a commit to N2con-Inc/docmost that referenced this pull request Dec 17, 2025
* change import process

* fix processor

* fix page name in notion import

* preserve confluence table bg color

* sync
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant