ENG-1975 Define schema file contract and shared foundation for Obsidian export/import - #1180
Open
trangdoan982 wants to merge 8 commits into
Open
ENG-1975 Define schema file contract and shared foundation for Obsidian export/import#1180trangdoan982 wants to merge 8 commits into
trangdoan982 wants to merge 8 commits into
Conversation
…export/import. Adds DiscourseSchemaFile and DiscourseSchemaTemplate type definitions, plus getDgSchemaFileName and DG_SCHEMA_EXPORT_VERSION — the minimal shared primitives needed by both the schema export (ENG-1976) and import (ENG-1977) features. Co-authored-by: Cursor <cursoragent@cursor.com>
|
This pull request has been ignored for the connected project Preview Branches by Supabase. |
|
The latest updates on your projects. Learn more about Vercel for GitHub. 1 Skipped Deployment
|
This was referenced Jul 29, 2026
…h export and import)
… types - Delete ReactRootModal.tsx (no callers yet; DRY savings too small to justify the abstraction layer) - Annotate each sub-schema with z.ZodType<T> so TypeScript verifies schema coverage against the authoritative types in types.ts at compile time - Drop the `as DiscourseSchemaFile` cast from parseDgSchemaFile — no longer needed once dgSchemaFileSchema is typed Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…panel UI, not foundation)
…port) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
vaultName is not unique — two vaults can share a name — so it cannot identify the source space. Recording vaultId (the Obsidian appId) lets an importer rebuild the source RID as orn:obsidian.schema:<appId>/<localId>, which is what the existing Supabase import path already generates. Schema imported from a file and content imported from that same vault over Supabase then resolve to the same importedFromRid. Required rather than optional: the export command that produces these files has not shipped, so no version 1 files exist to stay compatible with. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview of all 5 PRs:
https://www.loom.com/share/4374b7ddce4c4b7c99c73b292b752d9e
Walk through of this PR:
https://www.loom.com/share/73e448a429ef4f75b76ae8172e2508d6
Summary
Ships the shared foundation that the schema selection panel, export, and import PRs all stack on top of.
types.ts— addsDiscourseSchemaFileandDiscourseSchemaTemplatetype definitions for the exported JSON file format, plusSchemaSelection(reused by both export and import)specValidation.ts— addsdgSchemaFileSchema(Zod),parseDgSchemaFile,getDgSchemaFileName(vaultName?)(kebab-cases vault name →dg-schema-<vault>.json), andDG_SCHEMA_EXPORT_VERSION = 1nativeJsonFileDialogs.ts— Electron save/open dialogs for reading and writing JSON outside the vaultIdentifying the source vault:
vaultIdThe file records
vaultId— the ObsidianappId— alongside the human-readablevaultName.vaultNamecannot identify a source space: two vaults can share a name, so it is not unique.vaultIdlets an importer rebuild the source RID as:This is byte-identical to what the existing Supabase import path already generates for schema items (
mapNodeTypeIdToLocal/mapRelationTypeToLocalinimportNodes.ts/importRelations.ts). Schema imported from a file and content imported from that same vault over Supabase therefore resolve to the sameimportedFromRid, instead of the file-import path producing untraceable items.The Zod field is required, not optional. The export command that produces these files ships in #1263 and has not merged, so no
version: 1files exist in the wild and there is nothing to stay backward-compatible with. A field added after this stack merges would need the optional treatment.This field lives here rather than in #1263 because it is part of the file contract, which is this PR's scope. #1263 only populates it.
Stack
This is PR 1 of 5 for FEE-840. Stack order:
Test plan
pnpm --filter @discourse-graphs/obsidian check-typespassesvaultIdfrom aDiscourseSchemaFileliteral is a compile error (verified againstspecExport.ts:TS2741: Property 'vaultId' is missing)ridToSpaceUriAndLocalId(spaceUriAndLocalIdToRid("obsidian:<appId>", localId, "schema"))recovers the original pairvaultIdmatching the vault'sappId