Skip to content

Fix absolute path to current project in lockfile#100

Merged
victor-linroth-sensmetry merged 1 commit intomainfrom
fix/lockfile-current-project-path
Nov 7, 2025
Merged

Fix absolute path to current project in lockfile#100
victor-linroth-sensmetry merged 1 commit intomainfrom
fix/lockfile-current-project-path

Conversation

@victor-linroth-sensmetry
Copy link
Copy Markdown
Collaborator

Fixes the lockfiles path to current project from an absolute path to being simply ".".

@tilowiklundSensmetry
Copy link
Copy Markdown
Member

Looks good, do we need to add an assertion that . is actually the correct path (so as to avoid accidentally making this assumption in the future, where these may be sub-paths of the project)?

@victor-linroth-sensmetry
Copy link
Copy Markdown
Collaborator Author

Looks good, do we need to add an assertion that . is actually the correct path (so as to avoid accidentally making this assumption in the future, where these may be sub-paths of the project)?

If we want to do something like workspaces later, I feel like command_lock will probably need quite a lot of reworking, and I'm not sure there would even be something like a "current project". In a way "current project" is "." by definition?

@tilowiklundSensmetry
Copy link
Copy Markdown
Member

tilowiklundSensmetry commented Nov 6, 2025

Looks good, do we need to add an assertion that . is actually the correct path (so as to avoid accidentally making this assumption in the future, where these may be sub-paths of the project)?

If we want to do something like workspaces later, I feel like command_lock will probably need quite a lot of reworking, and I'm not sure there would even be something like a "current project". In a way "current project" is "." by definition?

In my min . is always some form of "working directory". I know @vytautas-astrauskas-sensmetry wants to push towards supporting some type of workspace functionality, where a workspace may contain multiple projects. If something like this happens, I think it not unlikely that lockfiles will exist at a workspace, rather than a project level. In this case . would probably be implicitly interpreted as the directory containing the workspace. In case additional functionality is implemented by someone other than us (or we simply forgot what we wrote here), I suspect this may lead to bugs.

I'd be totally fine with just panic!-ing here though, just to make the failure loud and clear and easy to debug.

EDIT: Specifically, we should panic if . is not the same as the directory sync would look in.

@victor-linroth-sensmetry
Copy link
Copy Markdown
Collaborator Author

In my min . is always some form of "working directory". I know @vytautas-astrauskas-sensmetry wants to push towards supporting some type of workspace functionality, where a workspace may contain multiple projects. If something like this happens, I think it not unlikely that lockfiles will exist at a workspace, rather than a project level. In this case . would probably be implicitly interpreted as the directory containing the workspace. In case additional functionality is implemented by someone other than us (or we simply forgot what we wrote here), I suspect this may lead to bugs.

I'd be totally fine with just panic!-ing here though, just to make the failure loud and clear and easy to debug.

EDIT: Specifically, we should panic if . is not the same as the directory sync would look in.

I don't really know what check for though. As far as I'm concerned . should always be interpreted as project_root (we may want to rename this if introducing workspaces, and we need to adapt project discovery to be a form of workspace discovery instead). Right now this is where we assume the current project to be. There's no way to assert that this is where the project is because we don't keep track of it any other way.

@tilowiklundSensmetry
Copy link
Copy Markdown
Member

I don't really know what check for though. As far as I'm concerned . should always be interpreted as project_root (we may want to rename this if introducing workspaces, and we need to adapt project discovery to be a form of workspace discovery instead). Right now this is where we assume the current project to be. There's no way to assert that this is where the project is because we don't keep track of it any other way.

Right, my bad, I thought at least some of this logic happened further down the call stack (a not all inside run_cli).

@tilowiklundSensmetry
Copy link
Copy Markdown
Member

Could we add an (integration) test case to ensure the correct editable entry and path is set?

@tilowiklundSensmetry
Copy link
Copy Markdown
Member

Could we add an (integration) test case to ensure the correct editable entry and path is set?

Just found this too #102. I propose we get these two merged quickly and then we prioritise to have a good test suite for lock and sync.

Copy link
Copy Markdown
Collaborator

@andrius-puksta-sensmetry andrius-puksta-sensmetry left a comment

Choose a reason for hiding this comment

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

LGTM

@victor-linroth-sensmetry
Copy link
Copy Markdown
Collaborator Author

Could we add an (integration) test case to ensure the correct editable entry and path is set?

lock_trivial in cli_lock.rs runs sysand lock on a fresh init and checks that there is a editable with path .. Is there anything more you think would be good to check?

@andrius-puksta-sensmetry
Copy link
Copy Markdown
Collaborator

Does this fix #85 or is there something else to do?

@tilowiklundSensmetry tilowiklundSensmetry linked an issue Nov 7, 2025 that may be closed by this pull request
@tilowiklundSensmetry
Copy link
Copy Markdown
Member

Could we add an (integration) test case to ensure the correct editable entry and path is set?

lock_trivial in cli_lock.rs runs sysand lock on a fresh init and checks that there is a editable with path .. Is there anything more you think would be good to check?

Then why did we not catch the bug fixed by this MR?

@victor-linroth-sensmetry
Copy link
Copy Markdown
Collaborator Author

Then why did we not catch the bug fixed by this MR?

Because it used to check for the absolute path. It's changed as part of this PR.

Signed-off-by: victor.linroth.sensmetry <victor.linroth@sensmetry.com>
@victor-linroth-sensmetry victor-linroth-sensmetry force-pushed the fix/lockfile-current-project-path branch from 333e606 to 36eb396 Compare November 7, 2025 08:16
@tilowiklundSensmetry
Copy link
Copy Markdown
Member

Then why did we not catch the bug fixed by this MR?

Because it used to check for the absolute path. It's changed as part of this PR.

🤦 I'm either too tired or there is something funky with GitHub's interface, I was sure I checked the list of filenames

@victor-linroth-sensmetry victor-linroth-sensmetry merged commit 81322ff into main Nov 7, 2025
37 checks passed
@victor-linroth-sensmetry victor-linroth-sensmetry deleted the fix/lockfile-current-project-path branch November 7, 2025 08:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Lockfile uses absolute path for editable entries.

3 participants