Skip to content

Choose iOS slim categories per lease #1326

Closed
5 of 5 issues completed
Closed

Description

@V3RON

Request: #1244

Problem

In the reporter's words: "A lease can only choose slim or full, and the slim categories are fixed per host in ios.slim.categories. So a test that needs one slimmed capability has to take a full simulator, and on our farm that costs a great deal." Their PassKit tests take a full lease only for Wallet, at 5.7 GB, 4.5× one of their slim leases.

Also, MobAI-App/simslim#66 (merged, in simslim v0.14.0) adds a mdm category and moves com.apple.accessibility.axassetsd and com.apple.ClipServices.clipserviced into other. Simlock's category list is still at v0.13.0.

Who it is for

An agent or CI job that leases iOS simulators from a slim farm and needs one slimmed capability, such as Wallet/PassKit, running. Also the operator of that farm, who wants such leases to cost close to a slim one and does not want more kinds of warm devices.

Outcome

  • A slim lease can name categories to keep running. It gets a slim simulator with those categories on, and is told which categories it kept.
  • A client that asks for categories a worker cannot keep gets a clear refusal, never a device that is not as asked.
  • Through a gateway, such a lease goes only to a worker that can serve it.
  • Through the agent-device front, the same choice is made with deviceExcept.
  • Simlock's category list matches simslim v0.14.0, with mdm.

How it works for the user

sequenceDiagram
  participant C as Client
  participant S as Simlock worker
  participant D as Simulator
  C->>S: lease --mode slim --except store,other
  alt a name is unknown, or not in the worker's slim set
    S-->>C: BAD_REQUEST
  else
    S->>D: pick a slim device (warm: shut it down)
    S->>D: write the slim list without store, other; boot
    S->>D: read back: store, other enabled?
    alt yes
      S-->>C: granted, mode slim, except [store, other]
    else no, or the boot failed
      S->>D: delete it, try once more
      S-->>C: PROVISION_FAILED (after the second failure)
    end
  end
Loading

Before:

$ simlock lease --platform ios --mode slim --except store,other
error: unknown option '--except'

After: the lease's JSON reply carries "mode": "slim", "except": ["store", "other"] on its device. A refusal prints the BAD_REQUEST message; the exact messages are fixed in #1330.

Examples

Request Worker Today After
--mode slim --except store,other slim set unset (every category) unknown option granted slim, except store, other
--except store (no --mode) ios.defaultMode: slim unknown option granted slim, except store
--except store (no --mode) ios.defaultMode: full unknown option BAD_REQUEST
--baseline b --except store, baseline slim, no --mode ios.defaultMode: full unknown option granted slim, except store (the baseline's mode wins)
--mode full --except store any unknown option BAD_REQUEST
--mode slim --except wallet any unknown option BAD_REQUEST (unknown name)
--mode slim --except mdm ios.slim.categories: [store] unknown option BAD_REQUEST (not in the worker's slim set)
--mode slim --except store,store any unknown option BAD_REQUEST (a name twice)
--mode slim --except Store any unknown option BAD_REQUEST (not a-z0-9-)
--mode slim --except store on iOS 18.4 any unknown option granted full, no except (everything runs)
--baseline b --except store, baseline full any unknown option BAD_REQUEST
--physical --except store any unknown option BAD_REQUEST
Android --except store any unknown option BAD_REQUEST
--mode slim slim set unset slims 15 categories slims 16 (with mdm)
gateway, --except store, no --mode worker A default full, worker B default slim unknown option granted on B

What could go wrong

  • A kept category is reported kept but one of its services is off. The readback after the boot checks every kept label is enabled before the grant, so this is unlikely.
  • A lease with --except granted a warm device takes one reboot longer, about 9 s on an idle Mac.
  • Slimming mdm on hosts that leave ios.slim.categories unset turns off device-management services a test may need. Such a test can pass --except mdm.

Words used

  • category: a named group of iOS background services Simlock can turn off on a slim simulator, from simslim's list, e.g. store (App Store, StoreKit) or other (Wallet, App Clips, business services).
  • slim set: the categories a worker turns off, ios.slim.categories, every category when unset.
  • except list: the categories a slim lease asks to keep running, e.g. --except store,other.
  • smaller list: the slim set minus the except list, written into the device's launchd overrides file before its boot.

Non-goals

  • Android. Android has no slim categories.
  • Keeping single services (labels). Only whole categories.
  • Different warm devices per except list. Every slim device serves every except list.
  • Turning categories on or off live, without a boot.
  • Turning categories off on a full device.
  • The agent-device side of --device-except (callstack/agent-device); this feature reads the key once agent-device sends it.

Completion conditions

  • On a Mac with an iOS 18.5 runtime, and again with the newest 26.x: a lease with --mode slim --except store,other is granted slim with except [store, other], and launchctl print-disabled system on it shows every store and other label enabled (slow lane, one lease per runtime).
  • On a Mac with the newest 26.x runtime: a lease excepting each category in turn is granted with every label of that category enabled (slow lane).
  • A warm slim device serves a lease with --except: it is shut down, booted with the smaller list and granted (slow lane).
  • A request with an unknown name, a name outside the worker's slim set, mode: full, a full baseline, a physical device or Android is refused BAD_REQUEST, on the socket, HTTP and MCP.
  • A device whose kept labels do not read back enabled is never granted; after two failures the request is PROVISION_FAILED.
  • Through a gateway, a lease excepting a category only one worker slims, or naming no mode where only one worker defaults to slim, is granted on that worker; one no worker can serve is refused BAD_REQUEST at the gateway.
  • An agent-device allocate with deviceExcept gets the same lease as --except.
  • slim-labels.ts matches simslim v0.14.0's profiles.go, mdm included.

Open questions

none

Decisions

Shared values

Value or state Rule Written by Read by Source
Category names SLIM_CATEGORIES names, 16 after the re-sync (simslim v0.14.0) #1328 #1329, #1330, #1331 ADR 0066 §6
except (request) 1 to 16 distinct names, each 1 to 32 characters of a-z, 0-9, -, starting with a letter; known-name and slim-set checks by the worker's iOS driver #1330 #1330, #1331, #1332 ADR 0066 §1
Smaller list slim set minus except; kept labels written false even when a slimmed category lists them #1329 #1329, #1330 ADR 0066 §2
except (device) names kept on, in request order; absent when none or granted full #1330 #1330, #1331, #1332 ADR 0066 §4
Effective mode the baseline's when named, else mode, else the worker's ios.defaultMode; except needs it slim #1330 (worker), #1331 (gateway) #1330, #1331 ADR 0066 §1, §5
Refusals BAD_REQUEST; contract-level (physical, non-iOS, mode: full; messages in #1330), effective mode full (messages in #1330), unknown name and outside slim set (messages in #1329) #1329, #1330 #1331, #1332 ADR 0066 §1
defaultMode (catalog, iOS) the worker's ios.defaultMode #1331 #1331 ADR 0066 §5
Waiting reason cannot-keep-except a gateway worker the except stage dropped #1331 #1331 (CLI, console) ADR 0066 §5
Failure count one per request across provision and the except boot; the second rejects PROVISION_FAILED #1330 #1330 ADR 0066 §3
slimCategories (catalog, iOS) names the worker's slim set resolves to #1331 #1331 ADR 0066 §5
Protocol version +1 in #1330 and in #1331, each after #1261 merges #1330, #1331 every client contract manual, "Protocol version"

Behaviours

Behaviour (invoker, action, what it sees) Seam Cases Task
An operator slims with the unset slim set and gets every v0.14.0 category, mdm and the two new other labels included src/drivers/ios/slim-labels.ts unset set; set naming mdm #1328
The iOS driver boots a slim device with an except list and grants only when every kept label reads back enabled iOS driver makeReady with a fake simctl kept labels enabled; a kept label also in a slimmed category; a kept label read back disabled; write fails; readback fails; a non-kept label mismatched (→ full, no except); except naming the whole slim set (→ full); device.slimmed fields #1329
The iOS driver refuses an except list it cannot serve at resolve iOS driver resolveSpec unknown name; name outside the slim set; set unset accepts every known name #1329
A client leases slim with except and is granted a device reporting it lease.request through the daemon dispatcher, fake driver warm device (rebooted); new device; runtime below 18.5 (full, no except); reported in reply, list.get, status.get, lease.requested #1330
A client's except request is refused lease.request on socket, HTTP, MCP duplicate; bad characters; mode: full; no mode, no baseline, default full; full baseline; slim baseline with default full (granted); physical; Android; the driver's refusal reaches the client #1330
A failed except boot is never granted leasing with a failing fake boot warm reboot's prepare fails then ok; warm reboot's shutdown fails; shut-down device boot ok and fails; provision failure then except boot failure → PROVISION_FAILED; replay with another except #1330
A gateway routes except by each worker's slim set and default mode gateway fleet request with two fake workers one worker has the set; mixed default modes, no mode; slim baseline on a default-full worker; full baseline → BAD_REQUEST; none can → BAD_REQUEST; dropped worker's reason; worker receives except #1331
A client reads catalog.get and sees the iOS slim set and default mode worker catalog.get; gateway aggregateCatalog set unset; set [store]; default slim and full; fleet union #1331
An agent-device allocate with deviceExcept leases with except agent-device front device-mode.test.ts valid list; invalid name refused #1332

Tasks

flowchart LR
  T1["#1328 re-sync labels"] --> T2["#1329 driver except boot"] --> T3["#1330 lease except"]
  T3 --> T4["#1331 gateway routing"]
  T3 --> T5["#1332 agent-device front"]
Loading

Completion conditions → tasks: label list → #1328; kept labels enabled, warm device, never granted when not enabled → #1329 and #1330; refusals → #1330; gateway → #1331; agent-device → #1332.

Open work in the same area:

Written by an agent.

Activity

  1. added
    feature:specSpec in progress, business and technical together.
    on Nov 5, 2026
  2. V3RON commented on Nov 5, 2026

    @V3RON
    ContributorAuthor

    Spec updated: all sections written; ADR 0066 (PR #1327) switched to a boot with the smaller list; tasks #1328–#1332 posted as task:draft.

    Written by an agent.

  3. added
    feature:plannedSplit into tasks. Never picked up itself.
    and removed
    feature:specSpec in progress, business and technical together.
    on Nov 5, 2026
  4. V3RON commented on Nov 5, 2026

    @V3RON
    ContributorAuthor

    Delivery run

    Merged: none. The stack #1327 → #1333 is ready and waits for the rest of the feature.
    Parked: none
    Waiting: #1329 — on #1288 (feature #1282), #1330 — on #1261 (feature #1257), #1331 — on #1261 (feature #1257), #1332 — on #1330 and #1331
    Decided: #1327 — what a gateway's own catalog.get reports → the union of its workers' slimCategories, and no defaultMode; #1327 — where the except BAD_REQUEST row goes → after the model and runtime rows, checked one worker at a time; #1327 — whether row 5 (NO_CAPACITY) counts the except filter → yes, so the request fails at once instead of waiting

    Written by an agent.

  5. V3RON commented on Nov 6, 2026

    @V3RON
    ContributorAuthor

    Delivery run

    Merged: none. The stack #1327 → #1333 → #1348 (#1329) → #1349 (#1330) → #1360 (#1331) stays open until every task joins it.
    Parked: #1331 — R5 and R6 are still blocking after the fix-check, at the round cap. The except BAD_REQUEST row runs after NO_CAPACITY, against ADR 0066 §5, and one test cannot fail. PR #1360 stays in draft.
    Waiting: #1332 — on #1331

    Written by an agent.

  6. V3RON commented on Nov 6, 2026

    @V3RON
    ContributorAuthor

    Delivery run

    Merged: none. All six PRs passed review and are ready in stack #1334 (#1327 → #1333 → #1348 → #1349 → #1360 → #1368). ADR 0066 is set to Accepted on the top branch.
    Parked: #1331 — the gate's second red CI: Fallow fails routable (CRAP 31.6 > 30) on #1360, run 42204614752. The first red, #readBack on #1348, is fixed.
    Decided: #1331 — order of the gateway's except check against the capacity check → ADR 0066 §5 as written (maintainer chose this in the session).

    Written by an agent.

  7. github-actions commented on Nov 6, 2026

    @github-actions
    Contributor

    Closing: all 5 sub-issues are closed. The PR that closed the last one walks the completion conditions (delivery rule 9); reopen this if one does not hold on main. Flip its ADRs to Accepted if delivery has not.

  8. V3RON commented on Nov 6, 2026

    @V3RON
    ContributorAuthor

    Delivery run

    Merged: #1327 (ADR 0066), #1333 (#1328), #1348 (#1329), #1349 (#1330), #1360 (#1331), #1368 (#1332), main at ba6582d
    Decided: #1331 — order of the gateway's except check against the capacity check → ADR 0066 §5 as written (maintainer); #1330 — initiator of a failed warm reboot's ready → shutdown → lease-engine, the repo's existing one (PR assumption)

    Written by an agent.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    feature:plannedSplit into tasks. Never picked up itself.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions