Skip to content

A lease request chooses slim or full; ios.defaultMode sets the default #178

Closed

Description

@V3RON

Part of #172.

Scope

After this PR a lease request chooses its device mode. simlock lease --mode slim|full, and mode on MCP, HTTP, and the client, replace --full and full: true. ios.defaultMode sets what a request with no mode gets and replaces ios.slim.enabled. Every worker honours both modes. A slim request on a runtime that cannot be slimmed is granted a full device. A gateway passes the mode through unchanged.

{
  "ios": {
    "defaultMode": "full",       // default; "slim" or "full"
    "slim": {
      "categories": ["..."],     // unchanged
      "bootTimeoutMs": 600000    // unchanged
    }
  }
}

Technical spec

File and line references are to main at the time of writing.

Modules touched

  • src/contract/operations.ts (leaseRequestInputSchema, :116-143): mode (slim or full, optional) replaces full. Rewrite the comment at :108-114, which says mode is rejected.
  • src/contract/schemas.ts: deviceSpecSchema drops full and does not expose the spec's mode. The config schema gains ios.defaultMode and loses ios.slim.enabled.
  • src/contract/protocol.ts: raise the range by one again.
  • src/core/config.ts: ios.defaultMode with default full; a value outside the enum is rejected naming the key. ios.slim.enabled leaves the type, the defaults, and the validators, so it falls to the existing unknown-key warning with no extra code.
  • src/core/driver.ts: DeviceRequest.mode? replaces full. Driver.reducesFeatures is deleted. resolveSpec receives the resolved mode. makeReady receives the device's spec mode in its options.
  • src/core/domain.ts: DeviceSpec.mode?: "slim" replaces full?: true; absent means full. sameSpec compares it.
  • src/core/lease-acquisition-coordinator.ts (:240-255): the one place a missing mode gets the platform default, from a map built at the composition root. It accepts a slim spec from the driver only when the resolved mode is slim; otherwise it plans on the full spec.
  • src/core/managed-device-lifecycle.ts, src/core/warm-pool-coordinator.ts: pass record.spec.mode to every makeReady call.
  • src/core/registry.ts: registerDevice records the planned mode. On load, spec.full is ignored and not written back, and a spec.mode that is not slim fails the load. No migration (ADR 0007 §11).
  • src/drivers/ios/index.ts:
    • resolveSpec returns a slim spec only for a slim request on a runtime that passes the existing 18.5 gate. The resolution cache key ignores the mode today (specKey), so the mode is applied outside the cache.
    • planSlimBoot reads the mode from the makeReady option. The driverData.full stamp at provision and its parser are removed.
    • The boot estimate uses the slim budget only for a slim spec.
    • advisories() reports slim-runtime-unsupported only when the composition root told the driver the default mode is slim.
  • src/daemon/main.ts: build the default-mode map and the advisory boolean from config; stop threading slim.enabled. Fix the comment at :758-760.
  • src/daemon/dispatcher.ts, src/gateway/dispatcher.ts, src/gateway/fleet-coordinator.ts: carry mode where they carried full. The gateway adds no default.
  • src/cli/index.ts: --mode <slim|full> replaces --full. The CLI does not validate the value; the contract answers BAD_REQUEST.
  • src/http/app.ts, src/http/tracker.ts: mode replaces full, and the lease request body schema becomes strict.
  • src/mcp/contracts.ts: rewrite the comment at :20-27.
  • src/core/fake-driver.ts, e2e/fake-driver/: a script key for which OS versions can be slimmed.
  • e2e/slow-ios-slim.test.ts: rewritten for --mode and ios.defaultMode.
  • Docs: docs/CLI.md, docs/HTTP-API.md, docs/CONFIGURATION.md, docs/CLIENT.md, both EVENTS.md files. docs/CONFIGURATION.md carries the upgrade note: empty a worker that ran with slim on (simlock nuke --delete-devices) before upgrading. docs/internal/KNOWN-PITFALLS.md: rewrite the iOS slim section, add the upgrade pitfall, and add the entry that a budget sized for slim overcommits on full devices, naming Capacity counts slim and full devices separately #174.

Contract and event changes

  • lease.request input: full removed, mode added. config.get shape changes. Protocol version raised by one.
  • lease.requested and lease.rejected carry the request, so requestSpec.full becomes requestSpec.mode. device.provisioned carries the spec, so spec.full becomes spec.mode. Update their rows in docs/EVENTS.md and docs/internal/EVENTS.md, and extend the exception note at the top of docs/internal/EVENTS.md to name ADR 0007.
  • device.slimmed is unchanged. The prose about a slim pass skipped on an older runtime changes: that case is now decided when the spec is resolved.

Rules in play

  • ADR 0007, all of it.
  • architecture.md rules 1 to 3 (the core learns no platform fact; drivers hold no default), rule 10 (one place resolves the default, one place enforces the full guarantee), rule 13.
  • safety.md rule 2 (a recovery boot applies no slim pass) and rule 10.
  • events.md rules 6 and 8.
  • testing.md rules 1 to 4.
  • documentation.md rules 2 to 4.

Tests

  • A request with no mode resolves to the worker's default for its platform; a request with a mode ignores the default.
  • A full request is never planned onto a slim spec, even when the driver's resolveSpec returns one.
  • A full request does not reuse an idle slim device of the same model and runtime; a slim request does not reuse an idle full one.
  • A slim request on a runtime the driver cannot slim resolves to the full spec, reuses an idle full device, and is granted with mode: "full".
  • A slim request against a driver that knows nothing of modes is granted a full device.
  • makeReady receives the device's spec mode on prepare boots, and a recovery boot applies no slim pass.
  • iOS: with either default, a slim-spec device on 18.5 or newer gets the disable pass and the second boot; a full-spec device gets one boot and the normal deadline.
  • iOS: resolveSpec returns a full spec for a slim request on a runtime below 18.5, and two requests with different modes for one model and runtime get different specs.
  • iOS: the boot estimate is the slim budget only for a slim spec.
  • iOS: advisories() reports slim-runtime-unsupported only when told the default mode is slim.
  • A slim-spec device whose slim pass fails is granted with mode: "full" and stays in the slim pool.
  • A stored spec.full is ignored on load and not written back.
  • lease.request carrying full, or a mode other than slim or full, is BAD_REQUEST. This replaces the "rejects mode" tests in src/contract/operations.test.ts and src/mcp/contracts.test.ts.
  • POST /v1/lease-requests with full in the body is 400 BAD_REQUEST.
  • simlock lease --full fails as an unknown option.
  • A config with ios.slim.enabled loads with the unknown-key warning and ios.defaultMode: "full"; an ios.defaultMode outside the enum is rejected naming the key.
  • simlock config renders ios.defaultMode (e2e, fast lane).
  • A gateway forwards a request's mode unchanged and forwards none when the request named none.
  • E2E, gateway with one worker of each default: a request with a mode gets that mode on either worker, and a request with none gets the default of the worker it landed on.
  • Slow lane, real iOS: on a default-full worker --mode slim grants mode: "slim"; on a default-slim worker --mode full grants mode: "full" while a slim device sits idle.

Done when

  • Every test above passes and pnpm check is green.
  • grep -rn "reducesFeatures\|slim\.enabled\|--full" src e2e docs finds nothing outside docs/internal/adr/.
  • The slow lane passes on a Mac with an iOS 18.5 or newer runtime.
  • The PR body walks the Completion conditions of Lease requests choose slim or full; config sets the default #172.

Out of scope

Depends on

Approval

  • Approved for delivery

Written by an agent.

Activity

  1. added
    task:draft
    on Oct 1, 2026
  2. added
    task:ready
    and removed
    task:draft
    on Oct 1, 2026
  3. github-actions commented on Oct 1, 2026

    @github-actions
    Contributor

    Now task:ready: approved, technical spec present, #177 closed.

  4. self-assigned this
    on Oct 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

task:ready

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions