Skip to content

fix md to json#1699

Merged
yujonglee merged 2 commits intomainfrom
yl-branch-10
Nov 18, 2025
Merged

fix md to json#1699
yujonglee merged 2 commits intomainfrom
yl-branch-10

Conversation

@yujonglee
Copy link
Contributor

No description provided.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 18, 2025

📝 Walkthrough

Walkthrough

Removed the debug seed implementation and its exports from the desktop devtool seed module. Bumped TipTap and related type/package versions. Reworked TipTap utils: json2md now uses MarkdownManager with stricter typing; md2json gains try/catch and a fallback document on parse failure.

Changes

Cohort / File(s) Summary
Debug seed removal
apps/desktop/src/devtool/seed/versions/debug.ts, apps/desktop/src/devtool/seed/versions/index.ts, apps/desktop/src/devtool/seed/index.ts
Deleted debug.ts; removed debugSeed re-export from versions/index.ts; removed debugSeed from the exported seeds array (seeds = [emptySeed, randomSeed, curatedSeed]).
TipTap dependency updates
packages/tiptap/package.json, apps/web/package.json, apps/desktop/package.json, packages/ui/package.json, packages/codemirror/package.json, packages/utils/package.json, packages/obsidian/package.json, packages/db/package.json, package.json, apps/api/package.json, apps/pro/package.json
Multiple dependency and type bumps: TipTap packages to ^3.10.7, TanStack packages to newer patch/minor versions, various @types/* updates, and other package version updates across apps and packages (no code/API signature changes).
TipTap utils refactor
packages/tiptap/src/shared/utils.ts
json2md signature tightened to accept JSONContent only and now renders via renderToMarkdown(getExtensions()) using MarkdownManager; md2json now parses through MarkdownManager with try/catch and returns a fallback minimal document on parse error (logs error).

Sequence Diagram(s)

sequenceDiagram
    participant Caller as caller
    participant Utils as packages/tiptap/src/shared/utils.ts
    participant Manager as MarkdownManager

    Caller->>Utils: md2json(markdown)
    Utils->>Manager: new MarkdownManager({ extensions: getExtensions() }).parse(markdown)
    alt parse success
        Manager-->>Utils: JSONContent
        Utils-->>Caller: JSONContent
    else parse failure
        Manager-->>Utils: throws error
        Utils-->>Utils: console.error(error)
        Utils-->>Caller: fallback JSONContent (paragraph with original markdown)
    end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

  • Reasoning: mix of a file deletion with store-seeding implications and a localized refactor that changes parsing control flow; multiple dependency bumps but homogeneous.
  • Areas to pay attention to:
    • Verify no references elsewhere expect debugSeed export or the deleted file.
    • Confirm seed ordering change (empty/random/curated) matches any devtool UI assumptions.
    • Review packages/tiptap/src/shared/utils.ts for correct MarkdownManager usage, extension set, and tests covering fallback behavior.
    • Run relevant builds/tests after dependency bumps for potential type/peer issues.

Possibly related PRs

Pre-merge checks and finishing touches

❌ Failed checks (1 warning, 2 inconclusive)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
Title check ❓ Inconclusive The title 'fix md to json' is vague and generic, using non-descriptive abbreviations that don't clearly convey what was actually changed in the changeset. Provide a more descriptive title that clearly explains the fix, such as 'Improve markdown to JSON conversion with error handling' or similar.
Description check ❓ Inconclusive No pull request description was provided by the author, making it impossible to assess relevance to the changeset. Add a pull request description explaining the purpose and scope of the changes, including why the debug seed was removed and how the markdown conversion was improved.
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch yl-branch-10

📜 Recent review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between d36a22b and b714a69.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (10)
  • apps/api/package.json (1 hunks)
  • apps/desktop/package.json (5 hunks)
  • apps/pro/package.json (1 hunks)
  • apps/web/package.json (2 hunks)
  • package.json (1 hunks)
  • packages/codemirror/package.json (1 hunks)
  • packages/db/package.json (1 hunks)
  • packages/obsidian/package.json (1 hunks)
  • packages/ui/package.json (1 hunks)
  • packages/utils/package.json (2 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: ci (macos, macos-14)
  • GitHub Check: fmt
🔇 Additional comments (13)
package.json (1)

11-11: Routine patch update.

The turbo devDependency is updated to a patch version, which typically contains bug fixes only. No breaking changes expected.

packages/db/package.json (1)

23-24: Routine patch updates for dev tooling.

Both @types/node and drizzle-kit are updated to patch versions, which are typically safe maintenance releases.

apps/api/package.json (2)

11-14: Verify Hono version compatibility.

The hono dependency is updated from 4.6.9 to 4.10.6, which spans 4 minor versions. While minor versions are typically backward-compatible, please verify that this larger update doesn't introduce any breaking changes or require code updates in the API implementation.


11-11: Supabase and Stripe updates are routine.

Both @supabase/supabase-js and stripe are updated to newer minor/patch versions, which are typically safe maintenance releases.

Also applies to: 14-14

packages/obsidian/package.json (1)

20-20: Routine patch update aligned across workspace.

The @tanstack/react-query patch bump to 5.90.10 is consistent with updates in other packages and is a low-risk maintenance release.

apps/pro/package.json (1)

13-14: Routine maintenance updates.

Minor and patch version bumps across @modelcontextprotocol/sdk, hono, and @types/node are typically safe maintenance releases.

Also applies to: 22-22

packages/ui/package.json (1)

47-47: Routine patch and type definition updates.

All dependency updates in this file are patch-level bumps or minor type refinement updates. These are safe maintenance releases with no anticipated breaking changes.

Also applies to: 54-58

apps/desktop/package.json (1)

18-25: Verify Tanstack Router compatibility with large version jump.

The apps/desktop package includes substantial updates across many dependencies. Most are routine patch/minor bumps, but @tanstack/react-router is updated from ~1.x to 1.136.8, which is a significant jump within the major version. Please verify this doesn't require code updates for routing patterns or configuration.

Also applies to: 42-56, 108-115, 118-118, 121-121

packages/utils/package.json (1)

7-7: Routine maintenance updates.

All three dependency updates (AI SDK, ai core library, and React types) are patch-level releases, which are safe maintenance updates.

Also applies to: 14-14, 25-25

apps/web/package.json (3)

16-34: Coordinated dependency updates appear well-integrated but code context missing.

The PR title "fix md to json" doesn't clearly relate to these dependency updates. The AI summary mentions reworked TipTap utils (json2md with MarkdownManager, md2json with try/catch), but no code changes to TipTap or markdown conversion logic are provided for review.

To properly validate this PR, please ensure:

  1. The actual markdown-to-JSON conversion code changes are included (packages/tiptap or related utils)
  2. Zod 4 breaking changes are compatible with any schema validation in those utilities
  3. The coordinated TanStack upgrades don't introduce router/SSR incompatibilities

Also applies to: 40-40, 47-47, 50-50, 61-68


30-34: All @tanstack/react-router family packages are compatible and properly aligned.

Verification confirms:

  • All five packages consistently pinned to ^1.136.8
  • SSR integration properly configured in apps/web/src/router.tsx via setupRouterSsrQueryIntegration
  • No breaking changes in v1.136.8 (minor version bump from 1.134.13)
  • 80+ usages across codebase show correct API compatibility
  • Router context correctly passes queryClient for SSR query integration

52-52: No actionable issues found—md2json/json2md do not use Zod validation.

The concern in the original review comment is based on an incorrect premise. The md2json() and json2md() functions in packages/tiptap/src/shared/utils.ts are pure utility functions that convert between markdown and JSONContent formats using TipTap's MarkdownManager and renderToMarkdown APIs. They contain no Zod schema validation and therefore cannot be affected by Zod 4 breaking changes.

Codebase analysis reveals existing Zod usage is compatible with Zod 4: all z.record() calls include both key and value schemas, z.default() patterns follow standard syntax, and no unsafe number validation (Infinity) patterns were detected.

Likely an incorrect or invalid review comment.

packages/codemirror/package.json (1)

17-17: Dependency updates are safe patch/minor bumps.

The updated versions (@codemirror/view@^6.38.8, @types/node@^22.19.1, @types/react@^19.2.6, @types/react-dom@^19.2.3) are patch/minor releases with no breaking changes. @codemirror/view 6.38.8 introduces only bug fixes from 6.38.6, and all updates maintain compatibility with existing peer dependencies (react@^19.2, react-dom@^19.2).

Also applies to: 22-24


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.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
packages/tiptap/src/shared/utils.ts (1)

1-3: md2json robustness improved; minor optional refinements

Using MarkdownManager with getExtensions() inside a try/catch and falling back to a doc containing the original markdown as a single paragraph is a solid way to prevent crashes when parsing bad or unexpected Markdown. The behavior change (returning “raw markdown as text” instead of throwing) is reasonable for a shared utility.

Two optional thoughts you might consider (not blockers):

  • If MarkdownManager construction is relatively expensive or used in hot paths, you could cache a single instance at module scope and reuse it instead of creating a new one per call.
  • If downstream consumers need to distinguish “parsed successfully” vs “fallback used”, you might in the future surface that via a wrapper return type (e.g., { doc, hadParseError }) or a dedicated logging hook instead of console.error.

If you want, I can sketch a small refactor that caches a manager instance while preserving the current API shape.

Also applies to: 74-86

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between d3810b6 and d36a22b.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (5)
  • apps/desktop/src/devtool/seed/index.ts (1 hunks)
  • apps/desktop/src/devtool/seed/versions/debug.ts (0 hunks)
  • apps/desktop/src/devtool/seed/versions/index.ts (0 hunks)
  • packages/tiptap/package.json (2 hunks)
  • packages/tiptap/src/shared/utils.ts (2 hunks)
💤 Files with no reviewable changes (2)
  • apps/desktop/src/devtool/seed/versions/index.ts
  • apps/desktop/src/devtool/seed/versions/debug.ts
🧰 Additional context used
🧬 Code graph analysis (2)
packages/tiptap/src/shared/utils.ts (1)
packages/tiptap/src/shared/extensions/index.ts (1)
  • getExtensions (19-89)
apps/desktop/src/devtool/seed/index.ts (4)
apps/desktop/src/devtool/seed/shared/index.ts (1)
  • SeedDefinition (22-26)
apps/desktop/src/devtool/seed/versions/empty.ts (1)
  • emptySeed (4-12)
apps/desktop/src/devtool/seed/versions/random.ts (1)
  • randomSeed (118-127)
apps/desktop/src/devtool/seed/versions/curated.ts (1)
  • curatedSeed (6-17)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: fmt
🔇 Additional comments (3)
apps/desktop/src/devtool/seed/index.ts (1)

2-6: Seed list update (debug seed removal) looks good

Importing only emptySeed, randomSeed, and curatedSeed and exporting them in [emptySeed, randomSeed, curatedSeed] keeps the public seeds surface clean and production‑friendly. No issues from this change on its own.

packages/tiptap/package.json (1)

20-39: Tiptap & TanStack version bumps look internally consistent

All @tiptap/* packages used here are aligned on ^3.10.7, and the TanStack + React type bumps are coherent with the existing peer ranges. Nothing stands out as incorrect in this manifest alone, but dependency issues often show up only at install/runtime.

Please run your usual install + test workflow on this branch and double‑check there are no new peer‑dependency warnings or regressions around the editor (especially Markdown/seed flows) before merging.

Also applies to: 50-52

packages/tiptap/src/shared/utils.ts (1)

66-71: No internal callers found—the stricter json2md typing is safe

My search of the codebase found that json2md has zero call sites internally. The function is exported but not used anywhere within the repository, which means the stricter JSONContent typing poses no risk to existing internal code.

The change is functionally correct and is actually an improvement: it eliminates the ambiguity of the old signature and makes the API contract explicit. If json2md is part of a public package API, external consumers would need to ensure they pass JSONContent, but that's a reasonable contract clarification rather than a breaking change caused by the implementation—it's a documentation of intended behavior.

@yujonglee yujonglee merged commit 8f94f2b into main Nov 18, 2025
5 checks passed
@ComputelessComputer ComputelessComputer deleted the yl-branch-10 branch December 14, 2025 15:21
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

Comments