ENG-1652 Add .dg.metadata for stable import folder identification#970
Open
trangdoan982 wants to merge 4 commits intomainfrom
Open
ENG-1652 Add .dg.metadata for stable import folder identification#970trangdoan982 wants to merge 4 commits intomainfrom
trangdoan982 wants to merge 4 commits intomainfrom
Conversation
Replace vault-name-based folder matching with spaceUri-based matching to
handle vault renames and name collisions. Each imported folder now gets a
.dg.metadata file with spaceUri, spaceName, and optional userName fields.
- New importFolderMetadata.ts utility: read/write .dg.metadata, build
spaceUri→folderPath map, resolve folders by spaceUri with name-based
fallback and collision-safe folder creation
- Migration on onLoad backfills .dg.metadata for existing folders using
plugin.settings.spaceNames as the source of truth
- importSelectedNodes uses resolveFolderForSpaceUri instead of naive
import/${sanitizedSpaceName} path construction
- Stop writing to plugin.settings.spaceNames (reads kept for migration)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
This pull request has been ignored for the connected project Preview Branches by Supabase. |
UI components (NodeTypeSettings, RelationshipTypeSettings, etc.) read plugin.settings.spaceNames via formatImportSource() to display human-readable vault names. Restore the write so new imports don't show truncated vault IDs. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-authored-by: devin-ai-integration[bot] <158243242+devin-ai-integration[bot]@users.noreply.github.com>
maparent
requested changes
Apr 24, 2026
Collaborator
maparent
left a comment
There was a problem hiding this comment.
Overall look goods, two small changes.
| if (!folderExists) { | ||
| await plugin.app.vault.createFolder(importFolderPath); | ||
| } | ||
| const spaceName = await getSpaceNameFromId(client, spaceId); |
Collaborator
There was a problem hiding this comment.
Realizing that this is another case of a database call within a loop. Can you use getSpaceNameFromIds instead?
| if (!metadata) continue; | ||
|
|
||
| if (map.has(metadata.spaceUri)) { | ||
| console.warn( |
Collaborator
There was a problem hiding this comment.
Let's think of a resolution step here. I would say delete the older metadata file of the two?
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.
https://www.loom.com/share/eb8d0f513e0148bda7ee6bef730735cc
Summary
spaceUri-based matching, fixing issues with vault renames and vault name collisions.dg.metadatafile containingspaceUri,spaceName, and optionaluserNameonLoadto backfill.dg.metadatafor existing import folders usingplugin.settings.spaceNamesChanges
importFolderMetadata.ts: utility functions to read/write.dg.metadata, build aspaceUri → folderPathmap by scanningimport/, and resolve folders byspaceUriwith name-based fallback and collision-safe folder creation (import/MyVault-{shortId}/)importSelectedNodes: usesresolveFolderForSpaceUriinstead of constructingimport/${sanitizedSpaceName}directly; handles folder creation and metadata writingimportAssetsForNode: accepts already-resolvedimportBasePathinstead of recomputing fromspaceNameindex.ts: callsmigrateImportFolderMetadatainonLoadImportNodesModal.tsx: stops writing new entries toplugin.settings.spaceNames(reads kept for migration path)Test plan
.dg.metadatais written insideimport/<vaultName>/spaceUriCloses ENG-1652
🤖 Generated with Claude Code