Skip to content

Make sure TC sync completes before select book in reload (BL-16327)#7931

Merged
andrew-polk merged 1 commit into
Version6.4from
renameSelectOrder
Jun 10, 2026
Merged

Make sure TC sync completes before select book in reload (BL-16327)#7931
andrew-polk merged 1 commit into
Version6.4from
renameSelectOrder

Conversation

@JohnThomson

@JohnThomson JohnThomson commented May 26, 2026

Copy link
Copy Markdown
Contributor

This change is Reviewable

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

Copy link
Copy Markdown
Contributor

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

Re-trigger cubic

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

Copy link
Copy Markdown
Contributor

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

Re-trigger cubic

@andrew-polk andrew-polk left a comment

Copy link
Copy Markdown
Contributor

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, and made 1 comment.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on JohnThomson).


src/BloomExe/Workspace/WorkspaceView.cs line 221 at r1 (raw file):

        // If we're loading a team collection, we need to do that...with its progress dialog...
        // before anything else, and we'll need to close the splash screen to make room for
        // that dialog.
        // Note, this not put into _startupActions...it should never be disabled.

I'm not sure how much of this comment is even meaningful anymore, but it is at least misplaced now.

@JohnThomson JohnThomson left a comment

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.

@JohnThomson made 1 comment.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on andrew-polk).


src/BloomExe/Workspace/WorkspaceView.cs line 221 at r1 (raw file):

Previously, andrew-polk wrote…
        // If we're loading a team collection, we need to do that...with its progress dialog...
        // before anything else, and we'll need to close the splash screen to make room for
        // that dialog.
        // Note, this not put into _startupActions...it should never be disabled.

I'm not sure how much of this comment is even meaningful anymore, but it is at least misplaced now.

Done.

@greptile-apps

greptile-apps Bot commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR ensures that, for Team Collection workspaces, book selection at startup does not proceed until TC sync has finished — fixing a bug where a remotely renamed book could be selected before its local files were fully updated. It introduces a derived milestone "startupBookSelectionReady" that is only set once both "teamSyncCompleted" and "collectionButtonsDrawn" have been reached, and adds a _milestoneLock to guard the milestone HashSet from concurrent mutation.

  • StartupScreenManager gains ClearStartupMilestone, StartupMilestoneHasBeenReached, a private EnsureDependentMilestonesAreSet, and a _milestoneLock protecting all _milestones accesses.
  • TeamCollection.SynchronizeRepoAndLocal signals "teamSyncCompleted" after its try/catch so the milestone is always set regardless of sync outcome.
  • WorkspaceView.OnLoad clears the three relevant milestones at the start of each load, immediately sets "teamSyncCompleted" for non-TC collections, and waits on "startupBookSelectionReady" instead of the old "collectionButtonsDrawn".

Important Files Changed

Filename Overview
src/BloomExe/MiscUI/StartupScreenManager.cs Adds thread-safe milestone locking, a new derived "startupBookSelectionReady" milestone, ClearStartupMilestone, and a public StartupMilestoneHasBeenReached check. Logic is correct; minor undocumented invariant in EnsureDependentMilestonesAreSet.
src/BloomExe/TeamCollection/TeamCollection.cs Adds StartupMilestoneReached("teamSyncCompleted") after the try/catch block so it fires regardless of sync success or failure — correct placement.
src/BloomExe/Workspace/WorkspaceView.cs Switches SelectBookAtStartup wait milestone to "startupBookSelectionReady", clears milestones at start of OnLoad, and immediately sets "teamSyncCompleted" for non-TC collections. The third ClearStartupMilestone("startupBookSelectionReady") call is redundant but harmless.

Reviews (1): Last reviewed commit: "Make sure TC sync completes before selec..." | Re-trigger Greptile

Comment on lines +120 to +129
private static void EnsureDependentMilestonesAreSet()
{
if (
_milestones.Contains("teamSyncCompleted")
&& _milestones.Contains("collectionButtonsDrawn")
)
{
_milestones.Add("startupBookSelectionReady");
}
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P2 EnsureDependentMilestonesAreSet only fires on addition, never on re-check

startupBookSelectionReady is derived from two prerequisites, but EnsureDependentMilestonesAreSet is only invoked inside StartupMilestoneReached. If both prerequisites are already set when a caller invokes ClearStartupMilestone("startupBookSelectionReady") directly (without clearing either prerequisite), startupBookSelectionReady is removed and no code path re-derives it until the next StartupMilestoneReached call. The current OnLoad flow is safe, but a brief comment on this invariant would help future maintainers.

@andrew-polk andrew-polk left a comment

Copy link
Copy Markdown
Contributor

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, and resolved 1 discussion.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on JohnThomson).

@andrew-polk andrew-polk merged commit 62aa9cd into Version6.4 Jun 10, 2026
1 of 2 checks passed
@andrew-polk andrew-polk deleted the renameSelectOrder branch June 10, 2026 17:10
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