Skip to content

feat(project): migrate a project folder when it is opened - #215

Draft
ehennestad wants to merge 1 commit into
move-project-paths-into-projectfrom
migrate-project-folders
Draft

ehennestad wants to merge 1 commit into
move-project-paths-into-projectfrom
migrate-project-folders

Conversation

@ehennestad

Copy link
Copy Markdown
Collaborator

Problem

A project folder has a layout of its own. It can be on a drive that is not connected when a session starts, so it cannot be migrated together with the user data directory.

Change

nansen.config.project.ProjectFolderLayout holds the layout version of a project folder, in the LayoutVersion field of project.nansen.json. A project without that field holds FIRST_VERSION. The first time a session opens a project, ProjectManager.getProjectObject calls ProjectFolderLayout.migrate, which runs the numbered steps above the stored version with applyMigrationSteps and the migration lock. A folder without project.nansen.json is left for upgradeProjects.

A project that a newer version of NANSEN organised is refused with NANSEN:Project:LayoutNewer. A step that fails stops the project from opening with NANSEN:Migration:StepFailed. A version that cannot be stored only warns, so a project in a read only location can still be opened when a step had nothing to change there.

The first open of every project writes LayoutVersion to project.nansen.json. This is a one-time change to a file that some projects keep under version control.

First step

getProjectCatalogPath defaulted to Configurations, while everything else uses configurations. On a case sensitive file system those are two folders, so the session methods catalog that uiCreatePipeline and uiEditPipeline use was kept apart from the other configurations. Step 2 renames Configurations, or moves its files into configurations when both exist. A file that both folders hold stays in both. On a case insensitive file system there is nothing to do. The default is now Project.CONFIG_FOLDER_NAME.

The tests of the two folder case run only on a case sensitive file system, so they run on the Linux CI runner and are filtered on macOS and Windows.

nansen.internal.migration.tryAcquireLock now holds the rule that only a timeout is an error when taking the lock, which NansenUserSession had on its own.

🤖 Generated with Claude Code

A project folder has a layout of its own, and it can be on a drive that
is not connected when a session starts, so it can not be migrated with
the user data directory.

The first time a session opens a project, ProjectManager brings it to
the current layout with the same numbered steps and lock as the user
data directory. The version is the LayoutVersion field of
project.nansen.json. A project that a newer version of NANSEN organised
is refused. A step that has nothing to do does not stop a project in a
read only location from opening.

The first step moves the Configurations folder into configurations.
getProjectCatalogPath saved there while everything else used
configurations, which are two folders on a case sensitive file system.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@ehennestad
ehennestad added this pull request to stack #212 November 9, 2026 09:09
@github-actions

github-actions Bot commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

Test Results

811 tests  +15   809 ✅ +14   1m 47s ⏱️ -3s
 62 suites + 1     2 💤 + 1 
  1 files   ± 0     0 ❌ ± 0 

Results for commit 44bf03c. ± Comparison against base commit 4c8c738.

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