Skip to content

fix: import pipeline in v2 should navigate to a proper file#2109

Open
maxy-shpfy wants to merge 1 commit into04-21-fix_restore_auto-scaling_for_collapsed_nodes_in_v2from
04-21-fix_import_pipeline_in_v2_should_navigate_to_a_proper_file
Open

fix: import pipeline in v2 should navigate to a proper file#2109
maxy-shpfy wants to merge 1 commit into04-21-fix_restore_auto-scaling_for_collapsed_nodes_in_v2from
04-21-fix_import_pipeline_in_v2_should_navigate_to_a_proper_file

Conversation

@maxy-shpfy
Copy link
Copy Markdown
Collaborator

@maxy-shpfy maxy-shpfy commented Apr 22, 2026

Description

After importing a pipeline, the editor now navigates using both the pipeline name and its file ID (via PipelineRef). This ensures the editor can reliably locate the correct file rather than relying solely on the name.

An onImportComplete callback has been added to ImportPipeline, allowing callers to override the default post-import navigation behavior. The FileMenu in the v2 editor uses this callback to navigate with the full PipelineRef, including the fileId as a search parameter.

A backfill path has also been introduced in useLoadSpec so that pipelines stored in the legacy RootFolderDbStorageDriver are automatically migrated to the new storage layer when accessed by name, preventing "pipeline not found" errors for existing pipelines that haven't yet been assigned a file ID.

Related Issue and Pull requests

Type of Change

  • Bug fix
  • New feature
  • Improvement
  • Cleanup/Refactor
  • Breaking change
  • Documentation update

Checklist

  • I have tested this does not break current pipelines / runs functionality
  • I have tested the changes on staging

Screenshots (if applicable)

Test Instructions

  1. Import a pipeline using the File menu in the v2 editor.
  2. Confirm the editor navigates to the imported pipeline and the URL includes the fileId search parameter.
  3. Open a pipeline that was previously saved under the legacy storage driver (no fileId) and confirm it loads correctly without a "not found" error.
  4. Verify that renaming during import still shows the appropriate success message.

Additional Comments

The backfill logic in useLoadSpec is a compatibility shim for pipelines that exist in the legacy store but have not yet been assigned a file ID in the new storage layer. It assigns the file on first access, so subsequent loads will resolve by ID.

@github-actions
Copy link
Copy Markdown

🎩 Preview

A preview build has been created at: 04-21-fix_import_pipeline_in_v2_should_navigate_to_a_proper_file/392c008

@@ -33,14 +35,30 @@ function deserializeSpec(data: unknown, idGen?: IdGenerator): ComponentSpec {
return spec;
}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

🤖 This is an AI-generated code review comment.

backfillFromLegacyStore directly instantiates RootFolderDbStorageDriver, creating a concrete dependency in a module that otherwise works against the PipelineStorageService abstraction.

This works today because legacy pipelines are always in IndexDB, but if the root folder's driver ever changes, this backfill would silently check the wrong store.

Consider either:

  • Checking via storage.rootFolder.findFile(name) (which uses the folder's configured driver)
  • Or adding a comment clarifying this coupling is intentional since legacy data lives exclusively in IndexDB

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

That's ok for now

Copy link
Copy Markdown
Collaborator

@camielvs camielvs left a comment

Choose a reason for hiding this comment

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

I understand the problem this is solving, but want to question if this is the best solution.

Importing a pipeline will append a fileId to the url whilst manually navigating to a pipeline will not.

import:
image.png

navigate:
image.png

Both cases work fine and load the pipeline but the discrepancy in the url is a bit of a smell to me. we could end up with diverging pipeline state in the future depending on whether fileId was included.

Have you looked into trying to make this work without having to append fileId to the url?

Copy link
Copy Markdown
Collaborator

camielvs commented Apr 22, 2026

^ Claude seems to suggest fileId is not necessary

It's redundant. The assignFile in handleImportResult fix already creates the registry entry before navigation happens. After that, resolvePipelineByName(name) finds it just fine — no fileId needed.

Copy link
Copy Markdown
Collaborator Author

I believe in fileId more than in $pipelineName - since multiple sources of pipelines can be used (localStorage, API, GDrive) - name clashes is highly likely. That's why having "id" is more desirable

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.

3 participants