Skip to content

feat(policy): apply the ADR 0055 managed policy keys on the Mac and in the core - #4497

Merged
datlechin merged 7 commits into
mainfrom
feat/managed-policy-keys
Nov 25, 2026
Merged

datlechin merged 7 commits into
mainfrom
feat/managed-policy-keys

Conversation

@datlechin

Copy link
Copy Markdown
Member

Summary

Core:

  • tablepro-account gains ManagedPolicy (read values, or a refused source) with the ADR 0055 rules: PersonalSyncProvider choices and settle (one entry forces, several allow, a server's personalSync never starts another provider), the boolean keys, and the held-to-company-server case.
  • ServerPolicy carries the launch values. Account::apply_policy takes later readings at once; when they no longer allow the server in use, every call to it stops until the next launch, rechecked after each wait (discovery, browser callback, token refresh, device pages, the session lock) and before an upload. report_stop puts account.server_managed in the status.
  • A server choice made while the values change is refused, or held, under one lock with the values.
  • fetch_shared is refused with account.server_managed before any request while AllowOtherAccountServers=false holds the app to a company server.
  • ModelCatalog::allow_refresh skips the AI catalog refresh; the kept or bundled copy serves. The FFI keeps the core's catalog in step before it touches the account.
  • FFI: AccountConfig.policy replaces managed_server_url and allow_other_servers; adds apply_policy, allows_tablepro_requests, personal_sync_choices, settled_sync_provider. Windows bindings regenerated; Windows still passes no values.

Mac:

  • ManagedPolicy reads PersonalSyncProvider (plist array), UsageDataAllowed, PluginCatalogAllowed and ICloudSyncAllowed, forced values only. A value of another type, a non-string list entry and an unknown Safe Mode floor are ignored and logged once.
  • ManagedPolicyCenter reads again when macOS writes /Library/Managed Preferences, and AccountServices passes every reading to the core in order.
  • The share-link read and the AI catalog refresh ask the core before any request to tablepro.app.
  • iCloud sync follows the core's provider rule. A forced iCloud turns the switch on, also after Reset All Settings; iCloud taken away turns it off. A stop cancels the push in flight and keeps nothing more of the run, even if iCloud is allowed again before it goes on; CloudKitSyncEngine checks cancellation before each batch and retry. The switch shows "Managed by your organization".
  • Keychain items are written device-only while the values leave iCloud out.
  • UsageDataAllowed=false turns usage data off and locks the switch.
  • PluginCatalogAllowed=false fetches no manifest, drops a kept one, refuses every registry download (retries and update passes included), and a registry driver not installed says the organization manages plugins.
  • Sparkle's Check for Updates stays ungated, as 0055 says.
  • Pure helpers and the remote profile appliers moved to SyncCoordinator extension files, keeping the coordinator under SwiftLint's type length.

Test plan

  • Core: policy::tests, including a_server_without_personal_sync_never_moves_a_device_to_icloud and a_refused_source_withholds_everything_a_key_can; values_that_stop_allowing_the_server_stop_every_call_until_the_next_launch; values_that_arrive_during_a_token_refresh_keep_its_token_from_any_request; a_held_company_server_stops_share_reads_and_uploads_before_any_request; a_refresh_that_is_not_allowed_asks_nothing_and_the_kept_copy_serves; FFI tests. cargo test -p tablepro-account -p tablepro-ai -p tablepro-ffi and clippy pass.
  • Mac: ManagedPolicyReaderTests (a value a person writes for a managed key is not policy, wrong types), SyncProviderPolicyTests, SyncCoordinatorPolicyTests, AppSettingsSyncSideEffectsTests, SyncPaneLayoutTests, AccountServicesTests, SharedLinkOpenerTests, AIModelReferenceTests, DriverUnavailabilityTests, PluginInstallerHelpersTests, KeychainItemScopeTests, TelemetryTests, TableProFFITests.
  • No UI test: a managed value needs a configuration profile, which a UI test cannot install.

@datlechin
datlechin enabled auto-merge (squash) November 25, 2026 10:27
@datlechin
datlechin merged commit c2d418a into main Nov 25, 2026
35 checks passed
datlechin added a commit that referenced this pull request Nov 25, 2026
iOS passes its managed values to the core as AccountConfig.policy, hands later ones to apply_policy, and takes iCloud's standing from the core's provider rule, as the Mac does.
@datlechin
datlechin deleted the feat/managed-policy-keys branch November 27, 2026 16:37
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