Skip to content

fix: use full element names in workspace reset#2125

Open
kotborealis wants to merge 1 commit into
apache:masterfrom
kotborealis:fix/workspace-reset-nested-name
Open

fix: use full element names in workspace reset#2125
kotborealis wants to merge 1 commit into
apache:masterfrom
kotborealis:fix/workspace-reset-nested-name

Conversation

@kotborealis
Copy link
Copy Markdown
Contributor

Fixes a bug where workspace reset did not work for junctions.

For example, we have a project with struct like this:

nested.bst:hello.bst

So the root project has one element nested.bst, which is a junction to another project, and the junction has one element hello.bst.

If we try to open this element as workspace, it works:

bst workspace open nested.bst:hello.bst

If we try to close this workspace, it works:

bst workspace close nested.bst:hello.bst

However, if we try bst workspace reset command on it, it fails with error Workspace does not exist.
The error is that workspace_reset method called workspace_exists with element.name, which was resolved to just hello.bst. In comparsion, a few lines down, it uses get_workspace with element._get_full_name(), which is nested.bst:hello.bst.

This patch updates workspace_reset function to check existence using element full name to support junctions.

@abderrahim
Copy link
Copy Markdown
Contributor

Thanks for the patch, I'll try to make some time to review it.

Can you please add a tests for this?

Fixes a bug where `workspace reset` did not work for junctions.

For example, we have a project with struct like this:
```
nested.bst:hello.bst
```

So the root project has one element `nested.bst`, which is a junction to
another project, and the junction has one element `hello.bst`.

If we try to open this element as workspace, it works:
```
bst workspace open nested.bst:hello.bst
```

If we try to close this workspace, it works:
```
bst workspace close nested.bst:hello.bst
```

However, if we try `bst workspace reset` command on it, it fails with
error `Workspace does not exist`.
The error is that `workspace_reset` method called `workspace_exists`
with `element.name`, which was resolved to just `hello.bst`.
In comparsion, a few lines down, it uses `get_workspace` with
`element._get_full_name()`, which is `nested.bst:hello.bst`.

This patch updates `workspace_reset` function to check existence using
element full name to support junctions.
@kotborealis kotborealis force-pushed the fix/workspace-reset-nested-name branch from ed224ed to 641451e Compare May 20, 2026 18:09
@kotborealis
Copy link
Copy Markdown
Contributor Author

@abderrahim added one test for this exact case

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.

2 participants