eng-1344 f10b upload obsidian relations and their schemas#721
Conversation
|
This pull request has been ignored for the connected project Preview Branches by Supabase. |
6bfab2f to
408ef40
Compare
f966a5b to
7f0a45d
Compare
5fdb70d to
0b3d0cb
Compare
3d49688 to
3b0a73a
Compare
3fb53ae to
f661f0f
Compare
3b0a73a to
6c48b9f
Compare
f661f0f to
df19c3c
Compare
ea45b20 to
9e74420
Compare
9e74420 to
63c0832
Compare
63c0832 to
982652f
Compare
#722) * eng-1344 f10b upload obsidian relations and their schemas * current progress * feature finished * address PR comments * address PR comments * remove local test file * curr progress * revert what is handled in #721 * Use SpaceURI rather than spaceId in frontmatter * address PR comments * address PR comments * cleanup * Update apps/obsidian/src/utils/importNodes.ts Co-authored-by: devin-ai-integration[bot] <158243242+devin-ai-integration[bot]@users.noreply.github.com> * normalize on using numbers for dates * correction * apply ctime, mtime to assets * spurious log * Preserve ctime, mtime in processFrontMatter. Also timezone correction * add lastModified in frontMatter * make sure import image works * add recursive folder creation * modify the fetchNodeContent flow; simplify the pathMapping * WIP: shuffle the filePath around * send originalPathDepth * actually send path itself * clarify var name * make sure fileImport works for all possible settings * store relative path when rewrite the wikilink instead of default to fileToLinkText * cleanup logs * nit * AI corrections * Update apps/obsidian/src/utils/importNodes.ts Co-authored-by: devin-ai-integration[bot] <158243242+devin-ai-integration[bot]@users.noreply.github.com> * address PR comments --------- Co-authored-by: Marc-Antoine Parent <maparent@acm.org> Co-authored-by: devin-ai-integration[bot] <158243242+devin-ai-integration[bot]@users.noreply.github.com>
e82b16b to
376b1a4
Compare
d406e78 to
0f8912b
Compare
595e8a2 to
30e40b2
Compare
There was a problem hiding this comment.
Devin Review found 2 new potential issues.
🐛 1 issue in files not directly in the diff
🐛 Missing legacy importedFromSpaceUri check in shouldSyncFile allows imported file changes to be queued (apps/obsidian/src/utils/fileChangeListener.ts:101-103)
The FileChangeListener.shouldSyncFile gating function only checks importedFromRid but not the legacy importedFromSpaceUri frontmatter key.
Root Cause and Impact
At apps/obsidian/src/utils/fileChangeListener.ts:101, only importedFromRid is checked:
if (frontmatter?.importedFromRid) {
return false;
}But the shared collectDiscourseNodesFromVault at apps/obsidian/src/utils/getDiscourseNodes.ts:32-38 correctly checks both:
(frontmatter.importedFromRid || frontmatter.importedFromSpaceUri)The FileChangeListener is initialized immediately at apps/obsidian/src/index.ts:56-58, while the migration from importedFromSpaceUri to importedFromRid runs asynchronously in a fire-and-forget initializeSupabaseSync call at line 47. If a user modifies an imported file (still bearing importedFromSpaceUri) before migration completes, shouldSyncFile returns true and the change is queued for sync as if it were a locally-authored node.
Impact: Imported files could be incorrectly identified as needing sync, leading to them being treated as local nodes in the sync pipeline.
View 19 additional findings in Devin Review.
There was a problem hiding this comment.
🔴 Missing legacy importedFromSpaceUri check in collectDiscourseNodesFromPaths allows imported nodes to sync as local
When checking whether to skip imported files during sync, collectDiscourseNodesFromPaths only checks for importedFromRid but not the legacy importedFromSpaceUri frontmatter key.
Root Cause and Impact
The shared collectDiscourseNodesFromVault in apps/obsidian/src/utils/getDiscourseNodes.ts:32-38 correctly checks both keys:
if (
(frontmatter.importedFromRid || frontmatter.importedFromSpaceUri) &&
includeImported !== true
) { continue; }But collectDiscourseNodesFromPaths at apps/obsidian/src/utils/syncDgNodesToSupabase.ts:717 only checks the new key:
if (frontmatter.importedFromRid) {
continue;
}The migration from importedFromSpaceUri → importedFromRid runs inside initializeSupabaseSync which is fire-and-forget (void) at apps/obsidian/src/index.ts:47. The FileChangeListener starts immediately after and calls syncDiscourseNodeChanges → collectDiscourseNodesFromPaths. If migration hasn't completed yet, or if it fails (the error is caught and only logged at apps/obsidian/src/syncDgNodesToSupabase.ts:916-918), files with the legacy importedFromSpaceUri would pass this check and be incorrectly synced to Supabase as locally-authored nodes.
Impact: Imported nodes could be re-uploaded to Supabase as new local concepts/content, causing duplicate data in the user's space.
(Refers to lines 717-720)
Was this helpful? React with 👍 or 👎 to provide feedback.
30e40b2 to
bb38514
Compare
6983308 to
5699c31
Compare
bb38514 to
6784bf7
Compare
There was a problem hiding this comment.
Devin Review found 1 new potential issue.
🐛 1 issue in files not directly in the diff
🐛 Missing legacy importedFromSpaceUri check in shouldSyncFile allows imported file changes to be queued (apps/obsidian/src/utils/fileChangeListener.ts:101-103)
The FileChangeListener.shouldSyncFile gating function only checks importedFromRid but not the legacy importedFromSpaceUri frontmatter key.
Root Cause and Impact
At apps/obsidian/src/utils/fileChangeListener.ts:101, only importedFromRid is checked:
if (frontmatter?.importedFromRid) {
return false;
}But the shared collectDiscourseNodesFromVault at apps/obsidian/src/utils/getDiscourseNodes.ts:32-38 correctly checks both:
(frontmatter.importedFromRid || frontmatter.importedFromSpaceUri)The FileChangeListener is initialized immediately at apps/obsidian/src/index.ts:56-58, while the migration from importedFromSpaceUri to importedFromRid runs asynchronously in a fire-and-forget initializeSupabaseSync call at line 47. If a user modifies an imported file (still bearing importedFromSpaceUri) before migration completes, shouldSyncFile returns true and the change is queued for sync as if it were a locally-authored node.
Impact: Imported files could be incorrectly identified as needing sync, leading to them being treated as local nodes in the sync pipeline.
View 21 additional findings in Devin Review.
| ...otherData | ||
| } = node; | ||
| /* eslint-disable @typescript-eslint/naming-convention */ | ||
| const literal_content: Record<string, Json> = { |
There was a problem hiding this comment.
I'm thinking maybe we should have a stronger type system for Concepts.literal_content and Content.metadata. We already use metadata for Wikilink import (we store the full path of the file there). with different types that we upload here (Node, Relation, schemas), it might get messy really soon if we don't enforce the type and still read data from these json columns. It's not blocking for now, we can make this a separate ticket and create the corresponding literal_content type for each Node/Relation Instance-schema separately. or if you prefer to just add the Type in this PR for relation instance and schema that works too
There was a problem hiding this comment.
This one I want to address later, it requires thought.
There was a problem hiding this comment.
yes non blocking for now
6784bf7 to
91b4992
Compare
There was a problem hiding this comment.
Devin Review found 1 new potential issue.
🐛 1 issue in files not directly in the diff
🐛 Missing legacy importedFromSpaceUri check in shouldSyncFile allows imported file changes to be queued (apps/obsidian/src/utils/fileChangeListener.ts:101-103)
The FileChangeListener.shouldSyncFile gating function only checks importedFromRid but not the legacy importedFromSpaceUri frontmatter key.
Root Cause and Impact
At apps/obsidian/src/utils/fileChangeListener.ts:101, only importedFromRid is checked:
if (frontmatter?.importedFromRid) {
return false;
}But the shared collectDiscourseNodesFromVault at apps/obsidian/src/utils/getDiscourseNodes.ts:32-38 correctly checks both:
(frontmatter.importedFromRid || frontmatter.importedFromSpaceUri)The FileChangeListener is initialized immediately at apps/obsidian/src/index.ts:56-58, while the migration from importedFromSpaceUri to importedFromRid runs asynchronously in a fire-and-forget initializeSupabaseSync call at line 47. If a user modifies an imported file (still bearing importedFromSpaceUri) before migration completes, shouldSyncFile returns true and the change is queued for sync as if it were a locally-authored node.
Impact: Imported files could be incorrectly identified as needing sync, leading to them being treated as local nodes in the sync pipeline.
View 22 additional findings in Devin Review.
There was a problem hiding this comment.
Devin Review found 1 new potential issue.
🐛 1 issue in files not directly in the diff
🐛 Missing legacy importedFromSpaceUri check in shouldSyncFile allows imported file changes to be queued (apps/obsidian/src/utils/fileChangeListener.ts:101-103)
The FileChangeListener.shouldSyncFile gating function only checks importedFromRid but not the legacy importedFromSpaceUri frontmatter key.
Root Cause and Impact
At apps/obsidian/src/utils/fileChangeListener.ts:101, only importedFromRid is checked:
if (frontmatter?.importedFromRid) {
return false;
}But the shared collectDiscourseNodesFromVault at apps/obsidian/src/utils/getDiscourseNodes.ts:32-38 correctly checks both:
(frontmatter.importedFromRid || frontmatter.importedFromSpaceUri)The FileChangeListener is initialized immediately at apps/obsidian/src/index.ts:56-58, while the migration from importedFromSpaceUri to importedFromRid runs asynchronously in a fire-and-forget initializeSupabaseSync call at line 47. If a user modifies an imported file (still bearing importedFromSpaceUri) before migration completes, shouldSyncFile returns true and the change is queued for sync as if it were a locally-authored node.
Impact: Imported files could be incorrectly identified as needing sync, leading to them being treated as local nodes in the sync pipeline.
View 20 additional findings in Devin Review.
| @@ -470,29 +490,103 @@ const convertDgToSupabaseConcepts = async ({ | |||
| const lastSchemaSync = ( | |||
There was a problem hiding this comment.
ok so on my local test there's a problem with using this lastSchemaSync to fetch relationType to sync:
- all the instances were uploaded but not the relation schemas
- i think the reason is that lastSchema sync is for node type. and since the local relation types were modified before we uploaded the node types, this isn't picked up by the system.
- this could be the consequence of us shipping the publish nodes before shipping publishing relations in our dev flow. but since Holehouse lab will also use the publish nodes first we should use a different way to get lastSchemaSync separately for node vs relation schema.
| @@ -470,29 +490,103 @@ const convertDgToSupabaseConcepts = async ({ | |||
| const lastSchemaSync = ( | |||
cc52d2f to
a6f2d9e
Compare
There was a problem hiding this comment.
Devin Review found 1 new potential issue.
🐛 1 issue in files not directly in the diff
🐛 Missing legacy importedFromSpaceUri check in shouldSyncFile allows imported file changes to be queued (apps/obsidian/src/utils/fileChangeListener.ts:101-103)
The FileChangeListener.shouldSyncFile gating function only checks importedFromRid but not the legacy importedFromSpaceUri frontmatter key.
Root Cause and Impact
At apps/obsidian/src/utils/fileChangeListener.ts:101, only importedFromRid is checked:
if (frontmatter?.importedFromRid) {
return false;
}But the shared collectDiscourseNodesFromVault at apps/obsidian/src/utils/getDiscourseNodes.ts:32-38 correctly checks both:
(frontmatter.importedFromRid || frontmatter.importedFromSpaceUri)The FileChangeListener is initialized immediately at apps/obsidian/src/index.ts:56-58, while the migration from importedFromSpaceUri to importedFromRid runs asynchronously in a fire-and-forget initializeSupabaseSync call at line 47. If a user modifies an imported file (still bearing importedFromSpaceUri) before migration completes, shouldSyncFile returns true and the change is queued for sync as if it were a locally-authored node.
Impact: Imported files could be incorrectly identified as needing sync, leading to them being treated as local nodes in the sync pipeline.
View 21 additional findings in Devin Review.
… roam. Also destructure
There was a problem hiding this comment.
Devin Review found 1 new potential issue.
🐛 1 issue in files not directly in the diff
🐛 Missing legacy importedFromSpaceUri check in shouldSyncFile allows imported file changes to be queued (apps/obsidian/src/utils/fileChangeListener.ts:101-103)
The FileChangeListener.shouldSyncFile gating function only checks importedFromRid but not the legacy importedFromSpaceUri frontmatter key.
Root Cause and Impact
At apps/obsidian/src/utils/fileChangeListener.ts:101, only importedFromRid is checked:
if (frontmatter?.importedFromRid) {
return false;
}But the shared collectDiscourseNodesFromVault at apps/obsidian/src/utils/getDiscourseNodes.ts:32-38 correctly checks both:
(frontmatter.importedFromRid || frontmatter.importedFromSpaceUri)The FileChangeListener is initialized immediately at apps/obsidian/src/index.ts:56-58, while the migration from importedFromSpaceUri to importedFromRid runs asynchronously in a fire-and-forget initializeSupabaseSync call at line 47. If a user modifies an imported file (still bearing importedFromSpaceUri) before migration completes, shouldSyncFile returns true and the change is queued for sync as if it were a locally-authored node.
Impact: Imported files could be incorrectly identified as needing sync, leading to them being treated as local nodes in the sync pipeline.
View 21 additional findings in Devin Review.

This uploads relationship schemas to supabase.
https://www.loom.com/share/ce2382d45c6741838fa6cf6b6f7e3d97