refactor(cloud): unify session scope resolution - #773
Closed
beruro wants to merge 1 commit into
Closed
Conversation
Collaborator
Author
|
Superseded by #780, which preserves this change as an independent commit and has passed the consolidated CI suite. The source branch is retained for recovery. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The cloud share dialog duplicated the sync engine’s session-to-repository-scope resolution. Both copies currently followed the same persisted-import fallback, repo-path check, resolver-cache peek, and cache-prime sequence, but they could drift and make UI eligibility disagree with synchronization.
Solution
Reuse the sync engine’s exported
getSessionScopeKeysfunction from the share-dialog hook and remove the local copy. The shared invariant remains: prefer persisted imported-session scope keys, returnnullwithout a repository path, otherwise read the bounded resolver cache and prime exactly once on a miss. The existinguseSyncExternalStoresubscription remains the UI change signal.Potential risks
The main risk is an import cycle between the dialog and sync engine modules. The shared resolver lives in the lower-level repo-scope sync module and does not import the dialog, so the dependency remains one-way. Runtime cache ownership, async work, subscriptions, and rendering triggers are unchanged. Rollback is a single-commit revert.
Architecture and performance
Verification
pnpm exec vitest run src/features/TeamCollaboration/repoScopeResolver.test.ts src/features/Org2Cloud/org2CloudSyncEngine.sessions.test.ts src/features/Org2Cloud/org2CloudSyncEngine.scopeConfirmation.test.ts src/features/Org2Cloud/CloudSessionShareDialog/shareEligibility.test.ts— 4 files, 93 tests passed after rebasing onto the latestdevelop.pnpm exec eslint src/features/Org2Cloud/CloudSessionShareDialog/useCloudSessionShareDialog.ts— passed.pnpm typecheck— full TypeScript check executed and passed after the rebase.git diff --check origin/develop...HEAD— passed.verify:quickorverify:final, so the equivalent focused tests/lint and full typecheck entry point were used.