Skip to content

feat(macos): sign in through the core, with a company server option - #4471

Merged
datlechin merged 15 commits into
feat/core-account-company-serverfrom
feat/macos-account-on-core
Nov 24, 2026
Merged

datlechin merged 15 commits into
feat/core-account-company-serverfrom
feat/macos-account-on-core

Conversation

@datlechin

@datlechin datlechin commented Nov 24, 2026 •

Copy link
Copy Markdown
Member

Summary

Stacked on #4470: merge after it. Docs: TableProApp/docs#283.

  • The app links TableProFFI and signs in through the core's AccountService (core ADR 0047). CoreAccountBackend opens it at launch; AccountServices adapts it for the app and FeatureAccess publishes the core's per-feature gate.
  • Nothing acts on the account before the core has restored the last run's sign-in: launch intents and startup connections, the Linked Folders watcher, the stored key exchange, Team Library and the telemetry identity wait for it.
  • The core reads and writes the account's refresh tokens through KeychainHostSecrets, in the Keychain items earlier builds used (com.TablePro.account.refreshToken, a company server's under its own key). No other secret goes to the core yet.
  • Migration: the core adopts that refresh token and Account/entitlement.jwt, so a signed-in Mac stays signed in with no device registration. A stored license key is exchanged once through the core, retried hourly while offline, recovered from the cached license payload when the key item is gone, and deleted only once the Keychain holds the new sign-in.
  • Deleted the Swift account stack: AccountSession, OAuthTokenClient, EntitlementStore, EntitlementVerifier, DeviceRegistry, AccountConfiguration, and the old offline license (LegacyLicenseStore, LegacyLicensePayload, LicenseSignatureVerifier, license_public.pem).
  • Use a Company Server in the sign-in window: one address field, then the core's discovery and license check, then the browser sign-in. A sign-in stands when what follows it fails (the device limit, the device registration, the first entitlement), and a refusal other than declining is worded. Settings > Account shows the server's host, whether the organization manages it, and its license with seats and grace.
  • Managed policy: com.TablePro.policy.AccountServerURL and AllowOtherAccountServers count only when a configuration profile forces them, and minimumSafeModeLevel now does too. Use TablePro's Server Instead leaves a profile's default server.
  • On a company server: no share commands (File menu, editor, grid, saved queries), no billing, plans, Use License Key, offline file or support ask, and no telemetry identity. The gate is published again at the license's end and at its grace end.
  • Shares are pinned to tablepro.app: their clients send nothing while signed in elsewhere, and an open share sheet reads a company sign-in as signed out. Shared links are always read from tablepro.app.
  • Team Library and the other Swift clients take the bearer and the API base from the core together; a 401 retry stays on the server that issued the token. Each team's file records the server and account it came from, so another's copy, a leftover a failed delete left included, is dropped before it shows or syncs, and nothing shows until the restored account vouches for it. Each pass is pinned to one server, a publish to the team and server the person picked, and a bearer the core cannot renew keeps the edits for a retry. It keeps pulling and holds edits when the server refuses a push with license_expired.
  • FFI: AccountStatusInfo.offline_file, so a signed-in Mac that imported an offline file still shows it as one. C# bindings regenerated.
  • Build: the core links the system SQLite on Apple targets, and build-core.sh fails when it would bundle its own or call a function newer than macOS 13. CI and release build the core (prepare-build, per-arch release legs, both arches nightly); verify.sh builds it when stale; the macos and release suites watch the core.
  • Third-party notices for the Rust crates the app now links (update-core-licenses.sh, checked in core.yml).
  • The local-stack probe drives the core adapter. It needs a core built with CARGO_PROFILE_RELEASE_DEBUG_ASSERTIONS=true, since a release core refuses a development stack; TABLEPRO_API_URL stays an origin and the app adds /v2; a Debug run's development stack reads as tablepro.app.

Test plan

  • New: CoreAccountMappingTests, KeychainHostSecretsTests, AccountCoreSetupTests, AccountServicesTests (adapter against a fake core, restore wait, hourly key retry, key kept when the Keychain refuses, license grace wake, shares pinned to tablepro.app), CompanyServerAddressTests, SharingMenuGroupTests, forced-value cases in ManagedPolicyReaderTests, company-server cases in SignInModelTests and AccountSettingsContentTests, an offline file imported while signed in in AccountSettingsModelTests, Team Library license_expired, server change, restored company sign-in, another server's copy, a leftover file, a signed-out launch, a failed bearer, a queued publish and a confirmation across a switch, telemetry on a company server and after a late restore, routingWaitsForTheRestoredAccount in AppLaunchCoordinatorTests, an_offline_file_a_signed_in_machine_imported_says_so in the FFI, CompanyServerSignInUITests.
  • Changed on purpose: ManagedPolicyReaderTests.readsSetValues (an unforced value is no longer policy); the detector tests that said macos skips the core; AccountSettingsContentTests, LicensePresentationTests, FeatureAccessTests, AccountSettingsModelTests and TelemetryTests build state the way the core publishes it; TelemetryFixture.start publishes the restored account after telemetry starts, as AppDelegate does; MachineIdentityTests loses its AccountConfiguration case.
  • Deleted with their code: AccountSessionTests, EntitlementVerifierTests (and entitlement_vectors.json), LegacyLicenseStoreTests, AccountConfigurationTests, LicenseTests.
  • TeamLibrarySyncTests existing cases unchanged.
  • Migration: KeychainHostSecretsTests reads a refresh token an earlier build wrote; AccountCoreSetupTests pins Account/entitlement.jwt; the adoption itself is the core's, tested there.
  • nm -gU libtablepro_ffi.a | grep -c ' T _sqlite3_open_v2' prints 0; otool -L on the app shows /usr/lib/libsqlite3.dylib.
  • A live run against a host that is not a TablePro server shows "This address does not answer as a TablePro server."

Screenshots

Before After
Sign-in, light Sign-in window before Sign-in window with Use a Company Server
Sign-in, dark Sign-in window before, dark Sign-in window with Use a Company Server, dark
Settings > Account, light Account settings before Account settings with the company server row
Settings > Account, dark Account settings before, dark Account settings with the company server row, dark
Company server address
Company server address form Company server address form, dark
Server set by a configuration profile Light Dark
Sign-in Sign-in window for a managed company server Sign-in window for a managed company server, dark
Settings > Account Account settings signed in to a managed company server Account settings signed in to a managed company server, dark

…keep an offline file's label while signed in
…rver, and keep a sign-in past the device limit
…ed key until its sign-in is remembered, and check a library's owner before it shows
…ord a refused sign-in, and wait for the restore without a timeout
…cked, and keep edits when the bearer cannot be renewed
@datlechin
datlechin force-pushed the feat/macos-account-on-core branch from 6cf082c to 47f0942 Compare November 24, 2026 08:05
@datlechin
datlechin merged commit c3bd486 into feat/core-account-company-server Nov 24, 2026
1 check passed
@datlechin
datlechin deleted the feat/macos-account-on-core branch November 24, 2026 08:08
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.

1 participant