Repository navigation
refactor(macos): keep unsent Team Library edits in memory and switch sign-ins in process - #4473
Merged
datlechin merged 14 commits intoNov 24, 2026
Conversation
…n, opened and closed with the account
…d, which every bearer carries
…owner-checked store
datlechin
force-pushed
the
feat/macos-team-library-sessions
branch
from
November 24, 2026 10:42
a472897 to
c8e02c5
Compare
…restart's questions before signing out
…sign-ins in process
…d, and release every hold
…n a lost feature, and own Sign Out's hold in one flow
…n, and decide the store on a company server choice
…er the pass in flight
… builds only for its owner
…d read each file once
…' into feat/macos-team-library-sessions # Conflicts: # apple/TablePro/Core/Services/TeamLibrary/TeamLibrarySync.swift # apple/TablePro/Resources/Localizable.xcstrings # apple/TableProTests/TeamLibrary/TeamLibrarySyncTests.swift
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.
Summary
Stacked on #4470, after #4471 (merged into its branch). Team Library keeps no unsent edit on disk, so a switch of sign-in stays in process. The invariants, kept once here and on
TeamLibrarySync:I1. Unsent edits (pushes still to go, conflicts not resolved) live only in memory, for the open session. Nothing about them is written to disk.
I2. The read cache sits in
TeamLibraryCache/<digest of server and account>/. Only the open session's folder is read; every other one is deleted, best-effort, on sign-out, switch and launch. No owner record, no marker, no adoption.I3. The library 0.88 and earlier kept (
TeamLibrary/,team_library.json) is read once: a flag (com.TablePro.teamLibrary.earlierLibraryConsidered) is written, synchronized and read back first; if it does not stick nothing is read and the store is deleted. Once set, the store is only ever deleted, never read. On that launch, for the tablepro.app sign-in the core restored only, its cache is copied into that account's folder and its files are deleted. Its unsent edits are uploaded once, automatically, under that session's bearer, outside the sync queue and with no hold; what is refused or conflicts is listed once in a notice that never blocks, and dropped. Ending the session cancels the upload, and the close lists what it had not sent. Any other sign-in, with or without an entitlement, and choosing a company server, signed in or not, set the flag and delete the store unread at that moment.I4. A switch or sign-out stays in process, in two steps.
team_library, the session ends for good, synchronously on the main actor. Nothing of it shows any more (library, Welcome, Favorites, publish menus), its unsent edits are listed as discarded, and no result of it is recorded or shown after any await: sync, the 0.88 upload, publish and resolve re-check their session after every await. A returningteam_libraryopens a new session; the old one is never revived.I5. Quitting with unsent edits asks Upload, Discard or Cancel. Discard drops them only in
applicationWillTerminate, so a later quit step that fails keeps them. While edits wait, the Team Library header shows them as not uploaded; the count covers pending edits, conflicts and refused edits, and follows every change.I6. Losing
team_libraryends the session as an involuntary sign-out does, and lists what it discarded.I7. Until the restore settles, a sign-in, a server choice or a license key waits, and a restored sign-in refuses them (
AccountError.signOutFirst).Holds: a sign-out and a quit each take a
TeamLibraryHoldand release it on every path. Sign Out is one flow (AccountSettingsModel.signOut()) that owns its hold and asks with anNSAlertthat does not depend on the Settings window; an involuntary sign-out while it asks closes the question, and one during the upload ends the flow, with the discard listed once by the session's close.The core carries the session id inside
SignedIn, soAccountStatusInforeads it from the same status snapshot; the separate channel andAccount::session_id()are gone. The restore mark is read before that snapshot.Removed: the relaunch on sign-out, the delete marker, the owner record, the connection-editor move, and the per-file owner feat(macos): sign in through the core, with a company server option #4471 added.
A store file that development builds of the account move wrote names its owner; the migration reads it only for that owner, rejects an owner that is null or malformed, reads each file once, and deletes any other unread.
C# bindings regenerated for the session id; the Linux app's test statuses gain the new
SignedInfield.Stable blockers
team_libraryis lost and regained within the request: the retry checks only the core session id, which survives the flap.Follow-ups
team_libraryflap does not go out under the new store.Test plan
each_sign_in_has_its_own_session_id_which_every_bearer_carries_and_a_sign_out_ends,each_launch_restores_the_sign_in_under_a_session_id_of_its_own_that_no_file_keeps; the FFI status tests assert the id.unsentEditsStayInMemory,eachAccountReadsOnlyItsFolder,restoredCompanySignInReadsItsCache,noSignInAtLaunchLoadsNothing,earlierLibraryIsUploadedOnce,earlierUploadEndsWithTheSession,ownedEarlierStoreIsReadOnlyForItsOwner,unsavedFlagReadsNothing,signInWithoutEntitlementDiscardsTheEarlierLibrary,consideredEarlierLibraryIsNeverReadAgain,lostFeatureClosesTheSession,earlierLibraryNeverReachesAnotherSignIn,involuntarySignOutDiscards,signOutWaitsForThePushInFlight,holdWaitsForThePassThatIsOut,quitAsksAboutUnsentEdits,stoppedQuitReleasesTheHold,failedUploadAtQuitAsksAgain,refusedEditStaysUnsent,switchingWhileSignedInIsRefused,anotherSignInsBearerIsRefused,queuedPublishIsRefusedAfterTheSignInEnds,AccountServicesTests.switchingWaitsForTheRestore,AccountSettingsModelTests.uploadThenSignOut,discardThenSignOut,involuntarySignOutClosesTheQuestion,involuntarySignOutDuringUpload,signOutWithoutASessionReleasesTheHold.TeamLibrarySyncTests.serverErrorQueuesThePush: the queued edits stay in memory, so no relaunch between the failure and the push.keepTheirs: after a relaunch nothing of the conflict is on disk, rather than the choice being stored.identicalConflictIsNoConflictanddemotedWriterDropsItsEdits: edits from before a launch come from the 0.88 store, the only place they can be on disk; they are uploaded once, anddemotedWriterDropsItsEditsnow expects them listed as not taken.conflicted()helper makes its conflict with a publish whose push waits while another admin writes, since 0.88 edits no longer become conflicts to resolve.editorMadeMemberDropsItsEdits,editorKeepsItsEditsandadminMadeEditorKeepsItsEditsmake their unsent edit in memory with a failed push instead of saving it to disk and relaunching; a demoted editor's edit is now listed as refused rather than gone.pushAnsweredAfterSignOut: the store drops after the pass in flight, so the test syncs once before checking.signOutWaitsForThePushInFlightbecamesignOutEndsTheSessionAtOnce: the session ends at the sign-out, so the edit whose push is out is listed as discarded and its late answer records nothing.signOutClears,involuntarySignOutDiscards,lostFeatureClosesTheSession,lostFeatureDropsTheLibrary: the folder goes once the pass in flight drains, so they wait for it.AccountSettingsModelTests.signOutConfirmationNamesUnsentTeamChanges: Sign Out lists the edits with sync stopped;signOut()is now the whole flow and asks through an injected prompt, sosignOutForgetsLoadedDataandlateResultFromAnOldAccountIsDroppedpass one.TeamLibrarySyncTests.lostFeatureDropsTheLibrary: losingteam_librarynow closes the session.AccountSettingsModelTests.useStoredLicenseKeyandrefusedLicenseKey,TelemetryTests.licenseKeySwitchesAccount,AccountServicesTests.chooseCompanyServer: a switch while signed in is refused.