Skip to content

feat(asc): automate CloudKit schema deploy via cktool (Dev→Production) #337

Closed

Description

@wei18

Make the CloudKit schema Development→Production deploy a commit-trackable, Leader-orderable step (like ASCRegister did for metadata/leaderboards), instead of the current user-owned CK Dashboard manual action.

Feasibility — VERIFIED (2026-06-05)

xcrun cktool is available with full schema support:

  • export-schema --environment development --output-file <app>.ckdb — pull the dev schema as the committed source of truth.
  • validate-schema — pre-flight check.
  • import-schema --team-id <id> --container-id <id> --environment production --file <app>.ckdb --validate — deploy schema to Production (replaces the manual CK Dashboard promote).
  • Auth: save-token --type management — a CloudKit management token (user generates once in CK Dashboard → Tokens; mirrors the ASC API .p8).

Proposed workflow (commit-trackable)

  1. (one-time, user) Generate a CK management token → store in secrets/.env (e.g. CK_MANAGEMENT_TOKEN).
  2. Seed: run each app once so it writes to its Development container → export-schema → commit <app>.ckdb to the repo (or hand-author — MS's schema is just the MonetizationState record type; Sudoku adds SavedGame + PersonalRecord).
  3. Deploy: import-schema --environment production per app (iCloud.com.wei18.sudoku / iCloud.com.wei18.minesweeper).
  4. Wrap as a mise task or a small CLI alongside ASCRegister.

Prereq checklist

  • cktool + import-schema→production — ✓ Verified
  • export-schema seeds .ckdb — ✓ Verified
  • management-token auth mechanism — ✓ Verified
  • team-id / container-ids — ✓ (secrets / known)
  • CK management token itself — ? user must generate (one-time)
  • .ckdb schema files — ? export-from-dev (needs app to have written) or hand-author

Context

Replaces the user-owned items: docs/app-store/review/sudoku-v2.5.md "CloudKit schema deployed to Production" + minesweeper-v1.md:92 (same for iCloud.com.wei18.minesweeper). MS currently writes only MonetizationState (Remove-Ads mirror); no SavedGame (no save flow). Consistent with the ASC metadata/GC-leaderboard automation shipped 2026-06-04/05. apply/import remains user-authorized.

Metadata

Metadata

Assignees

No one assigned

    Labels

    backlogtooling

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions