Skip to content

ENG-1461 Use full Rid instead of just spaceUri as marker of import#808

Merged
maparent merged 13 commits into
mainfrom
eng-1461-use-full-rid-instead-of-just-spaceuri-as-marker-of-import
Feb 23, 2026
Merged

ENG-1461 Use full Rid instead of just spaceUri as marker of import#808
maparent merged 13 commits into
mainfrom
eng-1461-use-full-rid-instead-of-just-spaceuri-as-marker-of-import

Conversation

@maparent

@maparent maparent commented Feb 21, 2026

Copy link
Copy Markdown
Collaborator

https://linear.app/discourse-graphs/issue/ENG-1461/use-full-rid-instead-of-just-spaceuri-as-marker-of-import

This PR migrates imported node frontmatter from using importedFromSpaceUri to using importedFromRid, which contains both the original node's spaceUri and the original sourceLocalId, in the form of a koi-compliant Rid.
(See Rid specs

Previously imported nodes are migrated accordingly.

Also, the sourceRid is added to the schema types, so we have provenance for schemas.

https://www.loom.com/share/b5dc1662b79e4b56a7ff0e3bf74b7039


Open with Devin

@linear

linear Bot commented Feb 21, 2026

Copy link
Copy Markdown

@supabase

supabase Bot commented Feb 21, 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[bot]

This comment was marked as resolved.

devin-ai-integration[bot]

This comment was marked as resolved.

devin-ai-integration[bot]

This comment was marked as resolved.

graphite-app[bot]

This comment was marked as resolved.

devin-ai-integration[bot]

This comment was marked as resolved.

devin-ai-integration[bot]

This comment was marked as resolved.

devin-ai-integration[bot]

This comment was marked as resolved.

graphite-app[bot]

This comment was marked as resolved.

devin-ai-integration[bot]

This comment was marked as resolved.

@trangdoan982 trangdoan982 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

beside the unnecessary migration i think this is good to go

}
};

const migrateImportedFromFrontMatter = async (plugin: DiscourseGraphPlugin) => {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

i don't think we need this function. because the first "actual" use case will be from Holehouse which has no initial data. This is only if you care about our testing data being migration but for production I don't think this is necessary.

@@ -0,0 +1,29 @@
export const spaceUriAndLocalIdToRid = (

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

nit: maybe here is a good place to document the structure/ link to the RID structure https://github.com/BlockScience/rid-lib

@maparent maparent force-pushed the eng-1461-use-full-rid-instead-of-just-spaceuri-as-marker-of-import branch from 6983308 to 5699c31 Compare February 23, 2026 16:30

@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 found 1 new potential issue.

View 18 additional findings in Devin Review.

Open in Devin Review

...[
"nodeTypeId",
"importedFromSpaceUri",
"importedFromRid",

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.

🟡 updateFrontmatterStyles doesn't hide legacy importedFromSpaceUri field

The updateFrontmatterStyles method hides importedFromRid from frontmatter display when showIdsInFrontmatter is false, but does not hide the legacy importedFromSpaceUri field. Before migration completes (or if migration fails for a node), the legacy field will be visible in the frontmatter UI.

Impact

This is a UI inconsistency: the old importedFromSpaceUri field will be visible in the Obsidian properties view for files that haven't been migrated yet, even when the user has configured frontmatter IDs to be hidden.

Suggested change
"importedFromRid",
"importedFromRid",
"importedFromSpaceUri",
Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

@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 found 2 new potential issues.

View 16 additional findings in Devin Review.

Open in Devin Review

return;
}
const isImported = !!frontmatter.importedFromSpaceUri;
const isImported = !!frontmatter.importedFromRid;

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.

🔴 DiscourseContextView isImported check misses legacy importedFromSpaceUri, showing Publish button for imported nodes

Both isImported checks in DiscourseContextView.tsx (lines 40 and 128) only check for importedFromRid, not the legacy importedFromSpaceUri. For previously imported files that haven't been migrated, isImported will be false.

Root Cause and Impact

At line 40:

const isImported = !!frontmatter.importedFromRid;

And at line 128:

const isImported = !!frontmatter.importedFromRid;

For legacy imported files, this means:

  1. The "Refresh" button will not be shown (since isImported is false)
  2. The "Publish" button may be shown instead (since canPublish checks !isImported)
  3. Source dates (created/modified in source) won't be displayed

Publishing an imported file could cause unintended data changes in the user's lab space.

Suggested change
const isImported = !!frontmatter.importedFromRid;
const isImported = !!frontmatter.importedFromRid || !!frontmatter.importedFromSpaceUri;
Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

const cache = plugin.app.metadataCache.getFileCache(file);
const frontmatter = cache?.frontmatter;
if (frontmatter?.importedFromSpaceUri && frontmatter?.nodeInstanceId) {
if (frontmatter?.importedFromRid && frontmatter?.nodeInstanceId) {

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.

🔴 refreshAllImportedFiles skips legacy imported files that only have importedFromSpaceUri

The refreshAllImportedFiles function at importNodes.ts:1431 only finds files with importedFromRid in their frontmatter, silently skipping any legacy imported files that still have importedFromSpaceUri.

Root Cause and Impact

At line 1431:

if (frontmatter?.importedFromRid && frontmatter?.nodeInstanceId) {
  importedFiles.push(file);
}

Legacy files with only importedFromSpaceUri will be excluded. When the user triggers "refresh all imported files", these files will simply be skipped with no error or indication, leaving them stale.

Impact: Users who upgrade to this version and try to refresh all imported files will find that previously imported files are silently skipped. Those files will never get refreshed unless manually re-imported.

Suggested change
if (frontmatter?.importedFromRid && frontmatter?.nodeInstanceId) {
if ((frontmatter?.importedFromRid || frontmatter?.importedFromSpaceUri) && frontmatter?.nodeInstanceId) {
Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

@maparent maparent merged commit 263be02 into main Feb 23, 2026
8 checks passed
@maparent maparent deleted the eng-1461-use-full-rid-instead-of-just-spaceuri-as-marker-of-import branch February 23, 2026 18:59
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.

2 participants