Skip to content

ENG-2084 Add schema import UI for Obsidian - #1265

Open
trangdoan982 wants to merge 14 commits into
eng-1977-add-schema-import-command-to-obsidianfrom
eng-2084-add-schema-import-ui-for-obsidian
Open

ENG-2084 Add schema import UI for Obsidian#1265
trangdoan982 wants to merge 14 commits into
eng-1977-add-schema-import-command-to-obsidianfrom
eng-2084-add-schema-import-ui-for-obsidian

Conversation

@trangdoan982

@trangdoan982 trangdoan982 commented Jul 29, 2026

Copy link
Copy Markdown
Member

https://www.loom.com/share/477c5ed1d52442139ea4f6c99af47936

Summary

Adds the import modal UI and wires it into the command palette and settings.

  • ImportSchemaPreviewSummary.tsx — per-category new/existing counts shown before the user applies the import
  • ImportSpecsModal.tsx — two-screen modal: file picker screen → preview + selection screen (reuses SchemaSelectionModalBody + SchemaSelectionPanel from ENG-2083); delegates apply logic to applySchemaImportSelection from ENG-1977
  • GeneralSettings.tsx — adds "Import discourse graph schema" entry to the settings UI
  • registerCommands.ts — registers import-dg-schema command in the command palette

Stack

PR 5 of 5 for FEE-840. Stacks on #1264.

  1. Shared foundation — ENG-1975 (ENG-1975 Define schema file contract and shared foundation for Obsidian export/import #1180)
  2. Schema selection panel UI — ENG-2083 (ENG-2083 Add schema selection panel UI for Obsidian export/import #1262)
  3. Schema export command — ENG-1976 (ENG-1976 Add schema export to Obsidian #1263)
  4. Schema import data layer — ENG-1977 (ENG-1977 Add schema import data layer for Obsidian #1264)
  5. This PR — schema import UI (ENG-2084)

Test plan

  • pnpm --filter @discourse-graphs/obsidian check-types passes
  • Command palette: Import discourse graph schema opens the import modal
  • Settings entry opens the import modal
  • Picking a non-schema JSON or wrong-version file shows a clear error notice
  • Preview summary shows correct new/existing counts per category
  • Selection panel enforces dependency constraints
  • Import applies correctly and creates new items as provisional
  • Re-importing the same file creates no duplicates

Open in Devin Review

@linear-code

linear-code Bot commented Jul 29, 2026

Copy link
Copy Markdown

ENG-2084

@vercel

vercel Bot commented Jul 29, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
discourse-graph Skipped Skipped Aug 24, 2026 8:21pm

Request Review

@supabase

supabase Bot commented Jul 29, 2026

Copy link
Copy Markdown

This pull request has been ignored for the connected project zytfjzqyijgagqxrzbmz because there are no changes detected in packages/database/supabase directory. You can change this behaviour in Project Integrations Settings ↗︎.


Preview Branches by Supabase.
Learn more about Supabase Branching ↗︎.

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no bugs or issues to report.

Open in Devin Review

@trangdoan982
trangdoan982 force-pushed the eng-1977-add-schema-import-command-to-obsidian branch from 23c69c1 to d417d43 Compare July 29, 2026 02:59
@trangdoan982
trangdoan982 force-pushed the eng-2084-add-schema-import-ui-for-obsidian branch from 11d1480 to 5f5edc0 Compare July 29, 2026 02:59
@trangdoan982
trangdoan982 force-pushed the eng-1977-add-schema-import-command-to-obsidian branch from d417d43 to bc0e07d Compare July 29, 2026 19:45
@trangdoan982
trangdoan982 force-pushed the eng-2084-add-schema-import-ui-for-obsidian branch from 5f5edc0 to ce3af53 Compare July 29, 2026 19:45
@trangdoan982
trangdoan982 force-pushed the eng-2084-add-schema-import-ui-for-obsidian branch from 2db3e8e to 1fc3e89 Compare July 30, 2026 02:17
@trangdoan982
trangdoan982 force-pushed the eng-1977-add-schema-import-command-to-obsidian branch from bc0e07d to 34254ad Compare July 30, 2026 02:17
Comment thread apps/obsidian/src/components/ImportSpecsModal.tsx
@trangdoan982
trangdoan982 force-pushed the eng-1977-add-schema-import-command-to-obsidian branch from 34254ad to 9073b20 Compare July 30, 2026 03:18
@trangdoan982
trangdoan982 force-pushed the eng-2084-add-schema-import-ui-for-obsidian branch from 1fc3e89 to c731999 Compare July 30, 2026 03:18
@trangdoan982
trangdoan982 force-pushed the eng-1977-add-schema-import-command-to-obsidian branch from 9073b20 to 26d1ad2 Compare July 30, 2026 17:01
@trangdoan982
trangdoan982 force-pushed the eng-2084-add-schema-import-ui-for-obsidian branch from c731999 to f8c8b70 Compare July 30, 2026 17:01
@trangdoan982
trangdoan982 force-pushed the eng-2084-add-schema-import-ui-for-obsidian branch from f8c8b70 to 20506b2 Compare July 30, 2026 17:06
@trangdoan982
trangdoan982 force-pushed the eng-1977-add-schema-import-command-to-obsidian branch from 26d1ad2 to 6b684dc Compare July 30, 2026 17:06
@trangdoan982
trangdoan982 force-pushed the eng-2084-add-schema-import-ui-for-obsidian branch from 20506b2 to ab0552c Compare July 30, 2026 17:18
@trangdoan982
trangdoan982 force-pushed the eng-1977-add-schema-import-command-to-obsidian branch from b0abbd4 to 2a39a08 Compare July 30, 2026 17:55
@trangdoan982
trangdoan982 force-pushed the eng-2084-add-schema-import-ui-for-obsidian branch from 6de77ff to 69deb70 Compare July 30, 2026 18:37
@trangdoan982
trangdoan982 force-pushed the eng-2084-add-schema-import-ui-for-obsidian branch from b75cbd1 to 473201c Compare August 6, 2026 02:48
@trangdoan982
trangdoan982 force-pushed the eng-2084-add-schema-import-ui-for-obsidian branch from 473201c to aef517e Compare August 6, 2026 03:08
@trangdoan982
trangdoan982 force-pushed the eng-2084-add-schema-import-ui-for-obsidian branch from aef517e to f0dc76d Compare August 6, 2026 03:13
@trangdoan982
trangdoan982 force-pushed the eng-2084-add-schema-import-ui-for-obsidian branch from f0dc76d to 8197207 Compare August 6, 2026 03:47
trangdoan982 and others added 14 commits August 24, 2026 16:20
…hemaPreviewSummary as sibling

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…chemaSelection directly, batch warnings

- Constructor takes only plugin (extracts app internally), matching ExportSpecsModal pattern
- Pass payload directly to applySchemaImportSelection (no intermediate field mapping)
- Batch import warnings into one Notice

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…nent lifetime

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Import stays reachable through the import-dg-schema command in the palette;
the settings entry duplicated it.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The success path calls onClose() and unmounts, so the finally block was
setting state on an unmounted component. Harmless — React removed that
warning in 18.0 and it is a silent no-op — but the ordering read as if the
reset mattered after close. Only the catch stays mounted, so only it resets.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Holds which values the user chose to take from the imported file for
items that already exist in the vault. Nothing is selected initially, so
an untouched item keeps every local value — the state the apply path
already treats an absent entry as.

Kept out of useSchemaSelection deliberately. The two have different
lifecycles: a choice only means anything for an item that is still
selected, so this resets whenever the set of selected overlapping items
changes, while the selection itself persists. It is also import-only —
the export flow has nothing to choose between.

Keyed by schema-file id rather than local id, matching the diff: the
match plan collapses schema types that collide by normalized name, so
two schema ids can share one local id.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
One table per overlapping item: a row per differing field, with the
local value and the imported value side by side and a radio pair to
pick between them. The chosen cell is highlighted, so the default reads
as "keeping mine" rather than as an undecided checkbox.

Per-item header buttons apply a whole side at once. They are buttons
with a pressed state rather than a third radio pair, so a bulk action
does not look like another per-field choice, and they fall out of the
pressed state as soon as one field differs.

Grouped by category, since that is the one axis on which every item has
exactly one home — a template can be referenced by several node types,
so nesting items under node types would either duplicate a row or pick
an arbitrary owner.

Values wrap rather than truncate. Colors render as swatches, covering
both node types' hex and relation types' tldraw names. Templates show
their size and the name the copy will land under, taken from the same
helper the apply path uses so the two cannot drift.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Two optional props so the import flow can mark, during selection, which
items the vault already has and how many of their fields differ. The
export flow has nothing to compare against and passes neither, so both
default to undefined and its rendering is unchanged.

useSchemaSelection and SchemaSelectionModalBody are deliberately
untouched.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Adds a step between selection and apply, entered only when selected
items actually overlap with the vault; with nothing overlapping the
import applies straight from selection as before. The resulting merge
plan is passed to applySchemaImportSelection, which has accepted one
since the data layer landed but never received one.

The preview step now renders SchemaSelectionPanel directly rather than
through SchemaSelectionModalBody. The shared body is fixed at a
two-button footer and cannot forward the new note props, and the import
flow now needs footer labels that vary by step.

Overlaps are computed for the whole file, so they are filtered to the
current selection before being offered — and the completion notice
reports merged counts alongside created ones.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@trangdoan982
trangdoan982 force-pushed the eng-2084-add-schema-import-ui-for-obsidian branch from 8197207 to 33cb043 Compare August 24, 2026 20:21
@graphite-app

graphite-app Bot commented Aug 24, 2026

Copy link
Copy Markdown
Contributor

PR size/scope check

This PR is over our review-size guideline.

  • Recommended: ~200 lines changed
  • Acceptable limit: up to 400 lines when well-scoped/self-contained
  • Preferred file count: fewer than 5 files

Please split this into smaller PRs unless there is a clear reason the changes need to land together.

If keeping it as one PR, please add a brief justification covering:

  • What single problem this PR solves
  • Why the files/changes are coupled

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