Skip to content

feat(import): import the Noveum workspace from Plane - #20

Merged
pulkitxm merged 9 commits into
mainfrom
feat/plane-import
Jul 23, 2026
Merged

pulkitxm merged 9 commits into
mainfrom
feat/plane-import

Conversation

@pulkitxm

Copy link
Copy Markdown
Member

Exports every accessible Plane project, work item, comment, page and embedded image into a local cache, maps it onto the Orbit schema preserving work item numbers, and reconciles the two sides.

pulkitxm added 6 commits July 23, 2026 11:23
Caches every project, state, label, cycle, module, work item, comment and
page under a local directory as json plus readable markdown. Plane allows
60 requests a minute, so the exporter holds a token bucket at 55, honours
retry-after, and skips any project it has already cached.
Plane projects become teams with their own key, workflow states and issue
numbering, and an orbit project that groups them. Work item sequence ids are
preserved, so a Plane identifier and an Orbit identifier point at the same
item. Descriptions, comments and pages are converted from html to markdown.
The list was the twelve oldest users, which the plane import broke because
every imported user shares one timestamp. It now joins membership, ranks by
role and name, and the importer no longer makes a workspace member out of a
plane bot: a bot authors work items but is not a person on the team.
Counts work items per project, work items assigned per person, and open,
completed and cancelled totals on both sides, and exits non zero on any
difference. The point of the import is that the two dashboards agree.
…ndred

The api has paged with a cursor since the start and the client ignored it,
so a team with more than two hundred issues silently showed a prefix. The
list now follows nextCursor to the end, which keeps the cache a flat array
and leaves every optimistic update working unchanged.
Plane embeds images as an image-component tag whose src is an asset id, so
stripping html left five comments with an empty body and no way to see what
they showed. The exporter now downloads each referenced asset through its
presigned url, and the importer copies it into local storage, registers an
attachment row, and rewrites the tag to point at it.
@coderabbitai

coderabbitai Bot commented Jul 23, 2026 •

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

You’ve reached a temporary PR review limit under our Fair Usage Limits Policy.

Your recent review volume is higher than typical usage, so adaptive limits are currently applied.

Next review available in: 31 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 671a6151-8a8f-4f15-a83e-d9b9807b3af4

📥 Commits

Reviewing files that changed from the base of the PR and between 80bf504 and d3db6f3.

📒 Files selected for processing (2)
  • packages/db/src/import/assets.ts
  • packages/db/src/import/plane-source.test.ts
📝 Walkthrough

Walkthrough

Adds a Plane workspace export and database import pipeline with asset handling, Markdown conversion, mapping helpers, verification scripts, and tests. It also updates issue pagination, developer-user ordering, and issue identifier truncation in the web application.

Changes

Plane import pipeline

Layer / File(s) Summary
Plane export contracts and fetch pipeline
.env.example, package.json, packages/db/package.json, scripts/fetch-plane.mjs, turbo.json, packages/db/src/import/plane-source.ts
Defines Plane configuration, validated export schemas, fetch retries and pagination, asset downloads, project files, Markdown output, and summaries.
Normalization, Markdown, and asset primitives
packages/db/src/import/plane-mapping.ts, packages/db/src/import/rows.ts, packages/db/src/import/markdown.ts, packages/db/src/import/importable.ts, packages/db/src/import/assets.ts
Maps Plane entities, creates import row containers, converts HTML to Markdown, filters comments, and stores or inlines assets.
Project and document row construction
packages/db/src/import/build-project.ts
Builds teams, projects, states, labels, cycles, milestones, issues, comments, and documents from Plane exports.
Database import orchestration
packages/db/src/import/index.ts
Adds CLI-driven import execution, database reset and chunked insertion, user deduplication, asset persistence, and project orchestration.
Import verification and mapping validation
packages/db/src/import/plane-mapping.test.ts, packages/db/src/import/plane-source.test.ts, packages/db/src/import/verify.ts
Tests mapping, Markdown, asset, export-reading, and comment-filtering behavior and compares imported database totals with Plane export totals.

Issue list and developer-user presentation

Layer / File(s) Summary
Issue pagination and developer-user ordering
apps/web/src/lib/query/use-issues.ts, apps/web/src/lib/api/dev-users.ts
Fetches all cursor-paginated issue pages up to the configured limit and orders developer users by role priority and name.
Identifier overflow rendering
apps/web/src/features/issues/issue-card.tsx, apps/web/src/features/issues/issue-row.tsx
Adds nowrap and truncation styling to issue identifiers, with a full identifier tooltip in rows.

Estimated code review effort: 5 (Critical) | ~120 minutes

Possibly related PRs

  • Noveum/orbit#4: Its issue service provides the cursor-paginated results consumed by this change.
  • Noveum/orbit#11: Both changes modify the issue list query and identifier presentation paths.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: importing a workspace from Plane into Orbit.
Description check ✅ Passed The description matches the changeset and mentions export, mapping, and reconciliation of Plane data.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/plane-import

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

@pulkitxm

pulkitxm commented Jul 23, 2026 •

Copy link
Copy Markdown
Member Author

Reconciliation against Plane

pnpm db:verify-plane counts both sides and exits non zero on any difference.

Work items per project
  ok   Sales (SALES)                 plane   180  orbit   180
  ok   Marketing (MKT)               plane   381  orbit   381
  ok   Customer Issues (CUST)        plane     5  orbit     5
  ok   Noveum AI (NOVEUM)            plane   280  orbit   280
  ok   API.market Engineering (ENG)  plane   432  orbit   432
  ok   Noveum.ai V1 Plan (V1)        plane     0  orbit     0

Work items assigned, by person
  ok   aditi     plane   404  orbit   404
  ok   tanzeela  plane   216  orbit   216
  ok   pulkit    plane   111  orbit   111
  ok   shivam    plane    99  orbit    99
  ok   shashank  plane    98  orbit    98
  ok   koushik   plane    73  orbit    73
  ok   harkirat  plane    55  orbit    55
  ok   pragati   plane    39  orbit    39
  ok   vidushi   plane    31  orbit    31

Work item state
  ok   open       plane   308  orbit   308
  ok   completed  plane   866  orbit   866
  ok   cancelled  plane   104  orbit   104

Documents
  ok   pages  plane    57  orbit    57

Comments  plane 120  orbit 120

Every counted total matches Plane.

pnpm verify: Tasks: 8 successful, 8 total for lint, comment policy, typecheck and tests. Playwright: 7 passed.

Screenshots are deliberately not attached to this pull request. This repository is public and the imported workspace is real internal work, so the only images that belong here are of demo data.

Two projects could not be read

API.Market SEO Sprint and API Market LinkedIn return 403 You don't have permission to view this project for the workspace API key, and the Plane MCP bot gets the same. They are listed but not readable. Adding the key's account as a project member in Plane and re-running pnpm plane:fetch && pnpm db:import-plane picks them up.

Bugs this surfaced, all pre-existing

  • the issue list only ever fetched the first 200 issues even though the API has paged with a cursor since the start, so ENG would have shown 200 of 432
  • the dev login listed the twelve oldest users, which breaks when every imported user shares one timestamp
  • a six character team key made a ten character identifier, which wrapped onto a second line in the fixed width column

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 6

🧹 Nitpick comments (3)
apps/web/src/features/issues/issue-row.tsx (1)

67-73: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win

Make the full identifier discoverable on keyboard focus.

title is hover-only here because the element is a non-focusable <span>. After truncation, keyboard users cannot reveal the full identifier visually. Use a focus-accessible Radix tooltip or another semantic focusable presentation.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@apps/web/src/features/issues/issue-row.tsx` around lines 67 - 73, Update the
identifier presentation in the issue row around issue.identifier so the full
value is available through a keyboard-focusable tooltip or equivalent semantic
focusable UI, rather than relying on the non-focusable span’s title attribute.
Preserve the existing truncation and styling while ensuring keyboard users can
reveal the complete identifier.

Source: Coding guidelines

turbo.json (1)

42-47: 🚀 Performance & Scalability | 🔵 Trivial | ⚡ Quick win

Remove the Plane vars from globalEnv.
Only the Plane import/fetch scripts use these values; keeping them here makes every Turbo task hash depend on them and exposes them to all tasks in strict mode. If a Turbo task actually needs them, add only that task’s env.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@turbo.json` around lines 42 - 47, Remove PLANE_API_KEY, PLANE_WORKSPACE,
PLANE_OUT, PLANE_RATE, PLANE_LINKS, and PLANE_FORCE from the turbo.json
globalEnv configuration. If any Plane import or fetch task requires these
variables, declare only the required variables in that task’s env configuration
instead.
packages/db/src/import/index.ts (1)

80-83: 🗄️ Data Integrity & Integration | 🔵 Trivial

Consider wrapping reset + writes in a single transaction.

reset() truncates all tables, then writeRows inserts separately with no enclosing transaction. A failure mid-import (e.g. the FK ordering concern above) leaves the database truncated and partially populated. For this importer, running reset and writeRows inside one db.transaction(...) would make the import all-or-nothing.

Also applies to: 220-220

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/db/src/import/index.ts` around lines 80 - 83, Wrap the importer’s
reset and writeRows operations in a single db.transaction(...) so truncation,
sequence reset, and all inserts commit or roll back together. Update reset and
the import entry point as needed to use the transaction-scoped database handle,
preserving the existing reset and write ordering.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@apps/web/src/lib/query/use-issues.ts`:
- Around line 53-71: Update fetchAllIssues so exhausting MAX_PAGES while
result.nextCursor remains set does not return the accumulated issues as a
successful result. Continue pagination beyond the current limit or throw an
explicit limit error after the loop, ensuring incomplete issue data is reported
as a query failure.

In `@packages/db/src/import/assets.ts`:
- Around line 100-105: Update the image tag construction in the IMAGE_TAG
replacement callback to emit the alt attribute before src, and escape
entry.fileName for safe HTML attribute usage so quotes and special characters
cannot break the markup. Preserve the existing fallback behavior when key or
entry is unavailable.

In `@packages/db/src/import/index.ts`:
- Around line 175-193: Make the organization insertion in the import flow
idempotent when values.keep is true: avoid inserting ORGANIZATION_ID if the
organization already exists, while preserving creation during reset or
first-time imports. Update the logic surrounding the
db.insert(schema.organization) call without changing the existing organization
fields.

In `@packages/db/src/import/plane-source.ts`:
- Around line 179-181: Update the project discovery logic around the projects
mapping in the import source to validate that every project listed in
projects.json has a corresponding directory, and fail the import before
returning the source when any are missing instead of filtering them out.
Preserve successful imports for complete exports, and add a fixture test
covering a projects.json entry with no directory.

In `@packages/db/src/import/verify.ts`:
- Around line 146-148: Update the verification flow around the comment logging
and report() call so comment mismatches contribute to failures instead of being
informational only. Add a comments row using the importer’s existing eligibility
predicate, preserving the empty-after-HTML-stripping behavior, and extend
verification tests to assert that a comment-only mismatch exits nonzero.

In `@scripts/fetch-plane.mjs`:
- Around line 244-249: The Plane export/import flow skips embedded images in
page HTML. In scripts/fetch-plane.mjs lines 244-249, extend the referenced-asset
scan to include each page’s description_html and workspace pages similarly
before downloadAsset; in packages/db/src/import/build-project.ts lines 384-402,
pass each page body through inlineAssets with a 'doc' parent before
htmlToMarkdown so page image references are rewritten during import.

---

Nitpick comments:
In `@apps/web/src/features/issues/issue-row.tsx`:
- Around line 67-73: Update the identifier presentation in the issue row around
issue.identifier so the full value is available through a keyboard-focusable
tooltip or equivalent semantic focusable UI, rather than relying on the
non-focusable span’s title attribute. Preserve the existing truncation and
styling while ensuring keyboard users can reveal the complete identifier.

In `@packages/db/src/import/index.ts`:
- Around line 80-83: Wrap the importer’s reset and writeRows operations in a
single db.transaction(...) so truncation, sequence reset, and all inserts commit
or roll back together. Update reset and the import entry point as needed to use
the transaction-scoped database handle, preserving the existing reset and write
ordering.

In `@turbo.json`:
- Around line 42-47: Remove PLANE_API_KEY, PLANE_WORKSPACE, PLANE_OUT,
PLANE_RATE, PLANE_LINKS, and PLANE_FORCE from the turbo.json globalEnv
configuration. If any Plane import or fetch task requires these variables,
declare only the required variables in that task’s env configuration instead.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: c00c77af-bbb1-486a-bc03-0963fe2cc5de

📥 Commits

Reviewing files that changed from the base of the PR and between 0896d6c and e127ff0.

📒 Files selected for processing (18)
  • .env.example
  • apps/web/src/features/issues/issue-card.tsx
  • apps/web/src/features/issues/issue-row.tsx
  • apps/web/src/lib/api/dev-users.ts
  • apps/web/src/lib/query/use-issues.ts
  • package.json
  • packages/db/package.json
  • packages/db/src/import/assets.ts
  • packages/db/src/import/build-project.ts
  • packages/db/src/import/index.ts
  • packages/db/src/import/markdown.ts
  • packages/db/src/import/plane-mapping.test.ts
  • packages/db/src/import/plane-mapping.ts
  • packages/db/src/import/plane-source.ts
  • packages/db/src/import/rows.ts
  • packages/db/src/import/verify.ts
  • scripts/fetch-plane.mjs
  • turbo.json

Comment thread apps/web/src/lib/query/use-issues.ts Resolved
Comment thread packages/db/src/import/assets.ts Resolved
Comment thread packages/db/src/import/index.ts Resolved
Comment thread packages/db/src/import/plane-source.ts Resolved
Comment thread packages/db/src/import/verify.ts Resolved
Comment thread scripts/fetch-plane.mjs Resolved
Six issues, each of which turns a mistake into silence: the issue list
returned a partial page set as success, the image tag emitted src before alt
so the alt text was dropped and an unescaped quote broke the attribute, a
second run with --keep collided on the organization row, a missing project
directory silently shrank the import, a comment count mismatch did not fail
verification, and images inside pages were neither downloaded nor rewritten.
@pulkitxm

Copy link
Copy Markdown
Member Author

All six findings fixed in f3b23f2, each with a test that fails without the fix (33 tests in @orbit/db, was 24). The page-image path had no data exercising it in this export, so the fix is covered by unit tests over inlineAssets rather than by the reconciliation totals.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

♻️ Duplicate comments (1)
packages/db/src/import/assets.ts (1)

104-105: 🎯 Functional Correctness | 🟡 Minor

Escape the complete HTML attribute value.

entry.fileName is external manifest data, but only " is escaped. Characters such as & can be decoded as entities and alter the displayed filename, while leaving the implementation dependent on this exact HTML context. Use a vetted HTML attribute encoder and add a regression test covering &, <, >, ", and '.

🔧 Proposed direction
-    const alt = entry.fileName.replace(/"/g, '&quot;');
+    const alt = escapeHtmlAttribute(entry.fileName);
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/db/src/import/assets.ts` around lines 104 - 105, Update the asset
HTML generation around the entry.fileName escaping in the relevant import
function to use a vetted encoder for the complete alt attribute value rather
than replacing only double quotes. Ensure the encoded value safely handles &, <,
>, ", and ', and add a regression test covering all five characters while
preserving the existing image markup behavior.

Sources: Coding guidelines, Linters/SAST tools

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@packages/db/src/import/importable.ts`:
- Line 5: Update the image-component detection regex in the importable HTML
check to require the exact image-component tag boundary and a canonical UUID
format, excluding image-component-extra and malformed UUIDs. Add regression
tests covering both the prefixed tag case and invalid UUID variants.

---

Duplicate comments:
In `@packages/db/src/import/assets.ts`:
- Around line 104-105: Update the asset HTML generation around the
entry.fileName escaping in the relevant import function to use a vetted encoder
for the complete alt attribute value rather than replacing only double quotes.
Ensure the encoded value safely handles &, <, >, ", and ', and add a regression
test covering all five characters while preserving the existing image markup
behavior.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: ac0626a9-4a8e-4ae7-b9cd-4f951eeafa49

📥 Commits

Reviewing files that changed from the base of the PR and between e127ff0 and f3b23f2.

📒 Files selected for processing (10)
  • apps/web/src/lib/query/use-issues.ts
  • packages/db/src/import/assets.ts
  • packages/db/src/import/build-project.ts
  • packages/db/src/import/importable.ts
  • packages/db/src/import/index.ts
  • packages/db/src/import/plane-mapping.test.ts
  • packages/db/src/import/plane-source.test.ts
  • packages/db/src/import/plane-source.ts
  • packages/db/src/import/verify.ts
  • scripts/fetch-plane.mjs
🚧 Files skipped from review as they are similar to previous changes (6)
  • packages/db/src/import/plane-source.ts
  • apps/web/src/lib/query/use-issues.ts
  • packages/db/src/import/verify.ts
  • packages/db/src/import/index.ts
  • packages/db/src/import/build-project.ts
  • scripts/fetch-plane.mjs

Comment thread packages/db/src/import/importable.ts Resolved
The pattern also matched image-component-extra and accepted any thirty six
hex or dash characters as an asset id. One shared source now backs both the
rewriter and the is-this-comment-worth-keeping check.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@packages/db/src/import/assets.ts`:
- Line 9: The IMAGE_TAG_SOURCE pattern currently allows data-src to satisfy the
src attribute match. Update the regex in IMAGE_TAG_SOURCE to require whitespace
before src, and add a regression test covering an image-component with data-src
that must not be classified or rewritten as an image.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 43a38ec4-d48a-4479-ab95-715cc4040896

📥 Commits

Reviewing files that changed from the base of the PR and between f3b23f2 and 80bf504.

📒 Files selected for processing (3)
  • packages/db/src/import/assets.ts
  • packages/db/src/import/importable.ts
  • packages/db/src/import/plane-source.test.ts

Comment thread packages/db/src/import/assets.ts Resolved
@pulkitxm
pulkitxm merged commit 2143e11 into main Jul 23, 2026
4 checks passed
@pulkitxm
pulkitxm deleted the feat/plane-import branch July 23, 2026 06:52
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