Skip to content

ENG-1986 Refactor Obsidian sync to use the new cross-app schemas (2/6) - #1630

Open
sid597 wants to merge 2 commits into
eng-1986-refactor-obsidian-sync-to-use-the-new-cross-appfrom
eng-1986-send-obsidian-schemas-through-the-cross-app-converters
Open

sid597 wants to merge 2 commits into
eng-1986-refactor-obsidian-sync-to-use-the-new-cross-appfrom
eng-1986-send-obsidian-schemas-through-the-cross-app-converters

Conversation

@sid597

@sid597 sid597 commented Nov 16, 2026 •

Copy link
Copy Markdown
Collaborator

Reviewer brief

ENG-1986 moves Obsidian sync off its own converters and onto the shared CrossApp converters, without loss of functionality. It ships as six PRs. PRs 1 to 4 and 6 are stacked on #1575 (ENG-1823). PR 5 targets main:

  1. ENG-1986 Refactor Obsidian sync to use the new cross-app schemas (1/6) #1620: tests that pin exactly what Obsidian sync sends to upsert_concepts today. No production change.
  2. This PR. Node type, relation type and relation triple schemas go through the shared converters.
  3. ENG-1986 Refactor Obsidian sync to use the new cross-app schemas (3/6) #1631: nodes and their Content go through the shared converters.
  4. ENG-1986 Refactor Obsidian sync to use the new cross-app schemas (4/6) #1632: relation instances go through the shared converters.
  5. ENG-1986 Refactor Obsidian sync to use the new cross-app schemas (5/6) #1634: color becomes a CrossApp field on node types and relation types, in packages/database. It doesn't depend on PRs 1 to 4.
  6. ENG-1986 Refactor Obsidian sync to use the new cross-app schemas (6/6) #1633: Obsidian sync sends color through the shared converters. It needs PR 5, and its branch carries PR 5's change until that merges.

Why six and not one: each step changes one kind of row, and #1620's tests show whether a stored value changed. PR 5 changes the shared contract, so it goes first in its own PR and needs its own review. Together the steps are well over the 400-line guideline.

  • Result: Obsidian sync builds node type, relation type and relation triple rows with the shared converters (crossAppNodeSchemaToDbConcept, crossAppRelationTypeSchemaToDbConcept, crossAppRelationTripleSchemaToDbConcept). The new obsidianToCrossAppConverters.ts is Obsidian's counterpart to Roam's roamToCrossAppConverters.ts.
  • Result: No stored value changes. Of the rows ENG-1986 Refactor Obsidian sync to use the new cross-app schemas (1/6) #1620 pins, the seven schema rows change in two fields: space_id is no longer sent, and author_id becomes author_local_id. upsert_concepts sets space_id from v_space_id (concept.sql:476) and resolves author_local_id to the account sync created for the same accountLocalId (concept.sql:403-405, supabaseContext.ts:83-108). This comes from reading the SQL. The unit tests mock the RPC.
  • Review focus: conceptConversion.ts sets five values after the shared converters, because the CrossApp types have no field for them: description, a null template_content for a type with no template, source_data, importedFromRid, and the triple's name.
  • Review focus: the null template_content has to stay. A full sync sends a node type again when its row lacks the key (syncDgNodesToSupabase.ts:744-773).
  • Review focus: three as Record<string, Json> casts in conceptConversion.ts. Each shared converter builds literal_content as an object literal, but LocalConceptDataInput types it as Json. Narrowing that type is a packages/database change outside this PR.
  • Risk or follow-up: Roam sync still builds node type rows with its own converter (apps/roam/src/utils/syncDgNodesToSupabase.ts:692). No ticket covers moving it yet.
Before After Stored value
space_id: context.spaceId not sent same, from v_space_id
author_id: context.userId author_local_id same account
name, source_local_id, is_schema, created, last_modified from the shared converter same
literal_content label, format, template, roles, complement from the shared converter same
literal_content.template_content converter for a template's text, null set after same
triple name, description, source_data, importedFromRid set after the converter same
discourseRelationTypeToLocalConcept(context, relationType) ({ accountLocalId, relationType }) signature only

Verification

  • From apps/obsidian on this head: vitest run passes (258 tests), tsc --noEmit --skipLibCheck passes, and prettier is clean on the changed files.
  • Mutation check: removing || undefined from templateTitle in nodeTypeToCrossApp fails "sends template_content null for a node type with no template".
  • eslint --max-warnings 0 on the changed files reports two no-unnecessary-type-assertion warnings, at syncDgNodesToSupabase.ts:1155 and :1160. Both lines date from [ENG-1178] Automatic local remote sync nodes relations #706 and this PR doesn't touch them.
  • Not run on this head: pnpm ci:validate for the whole repository, and a sync against a database.

Loom video

Not recorded yet.

Scope check

  • Ran $scope-check against ENG-1986 and the final diff.
  • Scope beyond Done When: None.

Standards check

  • Ran $dg-pr-adherence-check against the final diff and PR metadata.

Local delegated full review

  • Ran a comprehensive review of the entire final diff in a subagent with a fresh context. Use $dg-delegated-full-review when no other full-review workflow is available.

- Set only the null template_content after crossAppNodeSchemaToDbConcept;
  CrossAppNodeSchema.template already carries a template's text.
- Make the comment on the values set after the converters self-contained.
- Give the Source fixture the empty template a new node type starts with.
- concept_design.md: Obsidian now builds schema rows through the converter.
@vercel

vercel Bot commented Nov 16, 2026 •

Copy link
Copy Markdown

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

Project Deployment Actions Updated
discourse-graph Ready Ready Preview Nov 16, 2026 7:54am UTC

Request Review

@linear-code

linear-code Bot commented Nov 16, 2026

Copy link
Copy Markdown

ENG-1986

@supabase

supabase Bot commented Nov 16, 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 ↗︎.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 16, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-16T13:35:15.638214Z f11a520 Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@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.

Devin Review

@sid597

sid597 commented Nov 16, 2026

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. You're on a roll.

Reviewed commit: f11a5207eb

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

This branch was successfully deployed

1 active deployment
Preview — f11a5207 Deployed Nov 16, 2026 by vercel[bot]
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