Skip to content

Select correct book properly after remote rename (BL-16327)#7915

Merged
andrew-polk merged 2 commits into
Version6.4from
selectAfterRename
May 19, 2026
Merged

Select correct book properly after remote rename (BL-16327)#7915
andrew-polk merged 2 commits into
Version6.4from
selectAfterRename

Conversation

@JohnThomson
Copy link
Copy Markdown
Contributor

@JohnThomson JohnThomson commented May 14, 2026

This change is Reviewable

Copy link
Copy Markdown

@greptile-apps greptile-apps Bot left a comment

Choose a reason for hiding this comment

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

Your free trial has ended. If you'd like to continue receiving code reviews, you can add a payment method here.

Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

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

No issues found across 3 files

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR aims to preserve the selected Team Collection book across a reload when the book has been renamed remotely, by resolving the selected book’s ID against the repo before reopening the project.

Changes:

  • Adds a TeamCollection helper to resolve a book ID to the local path implied by current repo state.
  • Updates workspace reload handling to save that resolved path before reopening.
  • Adds a regression test for resolving a remotely renamed repo book.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
src/BloomExe/TeamCollection/TeamCollection.cs Adds GetLikelyLocalPathForBookId() using repo metadata.
src/BloomExe/Workspace/WorkspaceView.cs Updates saved current book path before Team Collection reload.
src/BloomTests/TeamCollection/TeamCollectionTests.cs Adds coverage for resolving a remotely renamed book path.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/BloomExe/Workspace/WorkspaceView.cs Outdated
if (selectedBook == null || teamCollection == null)
return;

var resolvedPath = teamCollection.GetLikelyLocalPathForBookId(selectedBook.ID);
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Toss up whether it's better to fail fast here. Since we're just trying to keep a book selected, I went ahead and made it safer.

Comment thread src/BloomExe/Workspace/WorkspaceView.cs Outdated
if (string.IsNullOrEmpty(resolvedPath))
return;

Settings.Default.CurrentBookPath = resolvedPath;
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Good point. Done.

Copy link
Copy Markdown
Contributor

@andrew-polk andrew-polk left a comment

Choose a reason for hiding this comment

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

@andrew-polk reviewed 3 files and all commit messages.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on JohnThomson).

Copy link
Copy Markdown

@greptile-apps greptile-apps Bot left a comment

Choose a reason for hiding this comment

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

Your free trial has ended. If you'd like to continue receiving code reviews, you can add a payment method here.

Copy link
Copy Markdown
Contributor Author

@JohnThomson JohnThomson left a comment

Choose a reason for hiding this comment

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

@JohnThomson made 2 comments.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on JohnThomson).

Comment thread src/BloomExe/Workspace/WorkspaceView.cs Outdated
if (selectedBook == null || teamCollection == null)
return;

var resolvedPath = teamCollection.GetLikelyLocalPathForBookId(selectedBook.ID);
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Toss up whether it's better to fail fast here. Since we're just trying to keep a book selected, I went ahead and made it safer.

Comment thread src/BloomExe/Workspace/WorkspaceView.cs Outdated
if (string.IsNullOrEmpty(resolvedPath))
return;

Settings.Default.CurrentBookPath = resolvedPath;
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Good point. Done.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

Comment thread src/BloomExe/Workspace/WorkspaceView.cs Outdated
// same book stays selected. Minimally, it makes sure that we are not left with
// a selected book record pointing at something that doesn't exist, which can cause
// problems (e.g. BL-16327).
// It's a bit questionable that this method makes use of the current bookselection,
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

done

Comment thread src/BloomExe/Workspace/WorkspaceView.cs Outdated
bookId = BookMetaData.FromFolder(folderPath)?.Id;
return !string.IsNullOrEmpty(bookId);
}
catch (Exception e) when (e is IOException || e is UnauthorizedAccessException)
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Added

Copy link
Copy Markdown

@greptile-apps greptile-apps Bot left a comment

Choose a reason for hiding this comment

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

Your free trial has ended. If you'd like to continue receiving code reviews, you can add a payment method here.

Copy link
Copy Markdown
Contributor Author

@JohnThomson JohnThomson left a comment

Choose a reason for hiding this comment

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

@JohnThomson made 2 comments and resolved 1 discussion.
Reviewable status: 2 of 3 files reviewed, 3 unresolved discussions (waiting on andrew-polk).

Comment thread src/BloomExe/Workspace/WorkspaceView.cs Outdated
bookId = BookMetaData.FromFolder(folderPath)?.Id;
return !string.IsNullOrEmpty(bookId);
}
catch (Exception e) when (e is IOException || e is UnauthorizedAccessException)
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Added

Comment thread src/BloomExe/Workspace/WorkspaceView.cs Outdated
// same book stays selected. Minimally, it makes sure that we are not left with
// a selected book record pointing at something that doesn't exist, which can cause
// problems (e.g. BL-16327).
// It's a bit questionable that this method makes use of the current bookselection,
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

done

Copy link
Copy Markdown
Contributor

@andrew-polk andrew-polk left a comment

Choose a reason for hiding this comment

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

@andrew-polk reviewed 1 file and all commit messages.
Reviewable status: all files reviewed, 3 unresolved discussions (waiting on JohnThomson).

@andrew-polk andrew-polk merged commit 1b759b7 into Version6.4 May 19, 2026
1 of 2 checks passed
@andrew-polk andrew-polk deleted the selectAfterRename branch May 19, 2026 21:22
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