Repository navigation
feat(import): import the Noveum workspace from Plane - #20
Conversation
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.
|
Warning Review limit reachedYou’ve reached a temporary PR review limit under our Fair Usage Limits Policy. Next review available in: 31 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the 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 configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughAdds 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. ChangesPlane import pipeline
Issue list and developer-user presentation
Estimated code review effort: 5 (Critical) | ~120 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
Reconciliation against Plane
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
Bugs this surfaced, all pre-existing
|
There was a problem hiding this comment.
Actionable comments posted: 6
🧹 Nitpick comments (3)
apps/web/src/features/issues/issue-row.tsx (1)
67-73: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick winMake the full identifier discoverable on keyboard focus.
titleis 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 winRemove 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’senv.🤖 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 | 🔵 TrivialConsider wrapping reset + writes in a single transaction.
reset()truncates all tables, thenwriteRowsinserts 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, runningresetandwriteRowsinside onedb.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
📒 Files selected for processing (18)
.env.exampleapps/web/src/features/issues/issue-card.tsxapps/web/src/features/issues/issue-row.tsxapps/web/src/lib/api/dev-users.tsapps/web/src/lib/query/use-issues.tspackage.jsonpackages/db/package.jsonpackages/db/src/import/assets.tspackages/db/src/import/build-project.tspackages/db/src/import/index.tspackages/db/src/import/markdown.tspackages/db/src/import/plane-mapping.test.tspackages/db/src/import/plane-mapping.tspackages/db/src/import/plane-source.tspackages/db/src/import/rows.tspackages/db/src/import/verify.tsscripts/fetch-plane.mjsturbo.json
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.
|
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. |
There was a problem hiding this comment.
Actionable comments posted: 1
♻️ Duplicate comments (1)
packages/db/src/import/assets.ts (1)
104-105: 🎯 Functional Correctness | 🟡 MinorEscape the complete HTML attribute value.
entry.fileNameis 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, '"'); + 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
📒 Files selected for processing (10)
apps/web/src/lib/query/use-issues.tspackages/db/src/import/assets.tspackages/db/src/import/build-project.tspackages/db/src/import/importable.tspackages/db/src/import/index.tspackages/db/src/import/plane-mapping.test.tspackages/db/src/import/plane-source.test.tspackages/db/src/import/plane-source.tspackages/db/src/import/verify.tsscripts/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
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.
There was a problem hiding this comment.
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
📒 Files selected for processing (3)
packages/db/src/import/assets.tspackages/db/src/import/importable.tspackages/db/src/import/plane-source.test.ts
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.