Skip to content

feat(lease): name a backend baseline in a proxy lease device spec - #4236

Merged
thymikee merged 2 commits into
mainfrom
feat/device-baseline
Nov 12, 2026
Merged

thymikee merged 2 commits into
mainfrom
feat/device-baseline

Conversation

@V3RON

@V3RON V3RON commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Proxy leases can request a saved device state with --device-baseline <name> (deviceBaseline in the SDK/MCP). The backend reports the restored baseline as lease.device.baseline: {name, version}. New grants missing the requested name are released and refused; reused leases must match their original request.

Names retain their exact spelling, including surrounding whitespace. Blank names select nothing; invalid types fail. Plain daemons refuse named device specifications. CLI/config defaults, help, and contract docs cover the field. Changes span 21 files with no scope expansion.

agent-device open MyApp --platform ios --device-baseline logged-in

Closes #4235. Backend counterpart: callstackincubator/simlock#1308.

Validation

At 05ceb7b64cdafd3308f84078a7a0001cf79a06f6, pnpm check:affected --run --head 05ceb7b64cdafd3308f84078a7a0001cf79a06f6 --json passed all 42 runnable checks; receipt reports exactCommit: true.

Receipt, regression results, and review evidence: unit 19,182 passed / 3 skipped; provider integration 260 passed. Identical regression command: 588983c837 has 2 failures / 18 passes; head passes all 20. Independent review found no regressions.

Rebased onto 2deb909ec8; range-diff preserves the original feature. CI is green at this head, including coverage, integration, docs, size, compatibility, and Android/iOS/macOS/Linux smoke tests. GitHub reports a clean merge state. All review threads are resolved. No native behavior changed. External backend restoration has not been live-tested.

@github-actions

github-actions Bot commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

Size Report

Metric Base Current Diff
Installed (including dependencies) 6.21 MB 6.21 MB +2.0 kB
Package (unpacked) 6.21 MB 6.21 MB +2.0 kB
Package (download) 1.88 MB 1.88 MB +378 B

Startup median (7 runs, lower is better):

Scenario Base Current Diff
CLI --version 39.2 ms 29.9 ms -9.2 ms
CLI --help 73.2 ms 65.0 ms -8.2 ms

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 issue found across 21 files

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="src/commands/schema/cli-help.ts">

<violation number="1" location="src/commands/schema/cli-help.ts:573">
P3: This help text names the screenshot comparison option as `diff --baseline`, but the CLI syntax is `diff screenshot --baseline <path>`; use the full form.</violation>
</file>

Tip: Get a Slack DM when cubic finishes reviewing your PRs. Connect Slack

View guided diff | Turn on auto-fix | Re-trigger cubic

Comment thread packages/contracts/src/lease-scope.ts Resolved
Comment thread src/commands/schema/cli-help.ts Resolved
Comment thread packages/contracts/src/lease-scope.ts Resolved
@thymikee

thymikee commented Nov 5, 2026

Copy link
Copy Markdown
Member

At b7331fa, the baseline routing and the contract look right: deviceBaseline follows the deviceMode path, and existing callers are unaffected. All 18 checks pass and there are no conflicts.

One thing before merge: readLeaseDeviceBaseline trims the echoed baseline name, while the requested name is kept as given, so a padded name compares unequal and a lease the backend honoured is released and refused (thread). Both sides should use the same comparison, either both untrimmed or both trimmed.

The help wording thread also still applies: please write diff screenshot --baseline in full. The Number.isSafeInteger thread does not apply, since nothing branches on baseline.version and the integer check already matches the contract, so it can be resolved.

Not blocking, take or leave: reflow the doc comments on readLeaseDeviceSpec in lease-scope.ts and on bindLeaseNamedDevice in proxy-lease-device.ts, and add baseline to the lease.device field list in website/docs/docs/remote-proxy.md, as cli-help.ts already does. I read the diff and tests without running them; the backend echo shape {name, version} comes from #4235 and was not checked against a real backend.

@thymikee

thymikee commented Nov 7, 2026

Copy link
Copy Markdown
Member

This now conflicts with main after the latest merges (b7331fa no longer merges cleanly). Please rebase onto main. The findings from the earlier review still apply to this head.

@thymikee
thymikee force-pushed the feat/device-baseline branch from b7331fa to 862133e Compare November 7, 2026 05:40
@thymikee

thymikee commented Nov 7, 2026

Copy link
Copy Markdown
Member

Rebased onto main at c96a2d5 to resolve the conflict. New head 862133e. Conflicts in docs/adr/0007-remote-device-leases.md: main moved the device spec section into packages/contracts/docs/lease-device-spec.md and slimmed the ADR, so I kept main's ADR and re-applied the deviceBaseline and baseline wording to the new doc. No other changes.

@thymikee

thymikee commented Nov 7, 2026

Copy link
Copy Markdown
Member

The rebase onto main is clean: the conflict from the earlier review (b7331fa) is gone, and I found no new problems in 862133e. The code still has one open issue, the trimmed echo of the baseline name from the open P2 thread. No conflicts.

CI on this head is not conclusive. Eight jobs show cancelled, which follows the rebase push replacing earlier runs. Smoke Tests and Integration Tests are still running, and none has failed. The same jobs were green at b7331fa. I did not re-run validation or tests. I checked the moved doc's relative link and the ADR link by reading them, because the docs-link and prose gates were cancelled. The backend side (simlock#1308) is outside this repository, so the {name, version} echo shape comes from issue #4235. No live device run is needed: the change is CLI and contract routing for a proxy lease, and the rebase touched only prose.

The open inline thread on the trimmed baseline name still applies (#4236 (comment)), and so does the one on the diff --baseline help wording (#4236 (comment)). The thread on baseline.version validation does not apply, because nothing branches on that value and the integer check already enforces the contract (#4236 (comment)), so you can resolve it.

Not blocking, and you can take or leave these: the doc comment on readLeaseDeviceSpec in lease-scope.ts breaks after "deviceBaseline and" and leaves a short orphan line, the JSDoc above bindLeaseNamedDevice in proxy-lease-device.ts has an over-long line, and the field list in remote-proxy.md does not mention baseline ({name, version}) the way cli-help.ts does.

Before merge, please resolve the P2 thread by keeping the echoed baseline name untrimmed, as the requested name is, and get a full green CI run on 862133e.

@thymikee
thymikee force-pushed the feat/device-baseline branch from 862133e to 05ceb7b Compare November 11, 2026 22:37
@thymikee

Copy link
Copy Markdown
Member

Took over and pushed 05ceb7b64cdafd3308f84078a7a0001cf79a06f6.

  • Rebased onto 2deb909ec88bbbde615ec7c8f3895ef222d8ab3d; git range-diff c96a2d5..862133e 2deb909..588983c reports the original feature commit unchanged.
  • Preserved baseline names exactly while rejecting blank echoes, corrected diff screenshot --baseline <path>, added the baseline field to the returned-device docs, and reflowed the two public comments.
  • Independent read-only review of the full 2deb909..05ceb7b range found no regressions.
  • Regression proof in a disposable checkout at 588983c837: the two changed suites fail on the uncorrected parser (2 failed, 18 passed; both lose the padded name). The identical command at 05ceb7b64c passes all 20 tests: pnpm exec vitest run --project unit-core packages/contracts/src/__tests__/lease-scope.test.ts packages/client/src/__tests__/index-leases.test.ts. The disposable checkout was removed.
  • pnpm check:affected --run --head 05ceb7b64cdafd3308f84078a7a0001cf79a06f6 --json passed all 42 runnable checks, with exactCommit: true and an unchanged clean checkout. Full unit: 19,182 passed / 3 skipped; provider integration: 260 passed; smoke: 76 passed / 6 skipped. The 25 skipped checks below remain CI/manual obligations, not local passes.
  • Earlier CI at 862133e stalled during Blacksmith checkout / Git mirror fetch and was canceled before validation; for example Lint, Typecheck & Package. New CI is pending at the pushed head.
  • This changes proxy spec routing and response parsing; no native device behavior changed. External backend restoration has not been live-tested. Backend contract follows proxy lease: name a backend baseline with --device-baseline #4235.

Monitoring PR events and checking every two hours until ready for human review. No merge requested.

Named-commit validation receipt (portable fields)
{
  "version": 1,
  "status": "passed",
  "exitCode": 0,
  "startedAt": "2026-11-11T22:28:00.778Z",
  "finishedAt": "2026-11-11T22:37:31.122Z",
  "refs": {
    "base": "origin/main",
    "head": "05ceb7b64cdafd3308f84078a7a0001cf79a06f6",
    "resolvedBase": "2deb909ec88bbbde615ec7c8f3895ef222d8ab3d",
    "resolvedHead": "05ceb7b64cdafd3308f84078a7a0001cf79a06f6",
    "mergeBase": "2deb909ec88bbbde615ec7c8f3895ef222d8ab3d"
  },
  "checkoutChanged": false,
  "exactCommit": true,
  "results": [
    {
      "id": "format",
      "status": "passed",
      "exitCode": 0
    },
    {
      "id": "lint",
      "status": "passed",
      "exitCode": 0
    },
    {
      "id": "typecheck",
      "status": "passed",
      "exitCode": 0
    },
    {
      "id": "test-app-typecheck",
      "status": "skipped",
      "reason": "GitHub-authoritative (jobs: Test App Build Cache / Resolve native fingerprint)"
    },
    {
      "id": "test-app-security",
      "status": "skipped",
      "reason": "GitHub-authoritative (jobs: Test App Build Cache / Resolve native fingerprint)"
    },
    {
      "id": "layering",
      "status": "passed",
      "exitCode": 0
    },
    {
      "id": "di-seams",
      "status": "passed",
      "exitCode": 0
    },
    {
      "id": "fallow",
      "status": "passed",
      "exitCode": 0
    },
    {
      "id": "native-dupes",
      "status": "passed",
      "exitCode": 0
    },
    {
      "id": "native-dupes-model",
      "status": "passed",
      "exitCode": 0
    },
    {
      "id": "mcp-metadata",
      "status": "passed",
      "exitCode": 0
    },
    {
      "id": "build",
      "status": "passed",
      "exitCode": 0
    },
    {
      "id": "package",
      "status": "passed",
      "exitCode": 0
    },
    {
      "id": "integration-node",
      "status": "passed",
      "exitCode": 0
    },
    {
      "id": "macos-coverage",
      "status": "passed",
      "exitCode": 0
    },
    {
      "id": "ios-snapshot-differential",
      "status": "skipped",
      "reason": "GitHub-authoritative (jobs: Apple / Smoke Tests (${{ matrix.platform }}))"
    },
    {
      "id": "vitest-related",
      "status": "passed",
      "exitCode": 0
    },
    {
      "id": "unit",
      "status": "passed",
      "exitCode": 0
    },
    {
      "id": "unit-ci",
      "status": "skipped",
      "reason": "GitHub-authoritative (jobs: Coverage)"
    },
    {
      "id": "coverage",
      "status": "skipped",
      "reason": "GitHub-authoritative (jobs: Coverage)"
    },
    {
      "id": "coverage-crap",
      "status": "skipped",
      "reason": "GitHub-authoritative (jobs: Coverage)"
    },
    {
      "id": "provider-integration",
      "status": "passed",
      "exitCode": 0
    },
    {
      "id": "integration-progress",
      "status": "passed",
      "exitCode": 0
    },
    {
      "id": "swift-runner-ios",
      "status": "skipped",
      "reason": "GitHub-authoritative (jobs: Apple / Smoke Tests (${{ matrix.platform }}), Conformance Differential / iOS Conformance Differential, Perf Nightly / iOS Command Perf, XCTest Nightly / iOS Runner Full XCTest Suite (${{ matrix.leg.name }}))"
    },
    {
      "id": "swift-runner-macos",
      "status": "skipped",
      "reason": "GitHub-authoritative (jobs: Apple / Smoke Tests (${{ matrix.platform }}))"
    },
    {
      "id": "android-helpers",
      "status": "skipped",
      "reason": "GitHub-authoritative (jobs: Android / Smoke Tests, Perf Nightly / Android Command Perf)"
    },
    {
      "id": "macos-helper",
      "status": "skipped",
      "reason": "GitHub-authoritative (jobs: Apple / Smoke Tests (${{ matrix.platform }}))"
    },
    {
      "id": "web-smoke",
      "status": "skipped",
      "reason": "GitHub-authoritative (jobs: Apple / Smoke Tests (${{ matrix.platform }}), Integration Tests, Lint, Typecheck & Package, Perf Nightly / Android Command Perf, Perf Nightly / iOS Command Perf)"
    },
    {
      "id": "replay-compat",
      "status": "passed",
      "exitCode": 0
    },
    {
      "id": "daemon-wire-compat",
      "status": "passed",
      "exitCode": 0
    },
    {
      "id": "affected-selector",
      "status": "passed",
      "exitCode": 0
    },
    {
      "id": "gate-manifest",
      "status": "passed",
      "exitCode": 0
    },
    {
      "id": "gate-manifest-model",
      "status": "passed",
      "exitCode": 0
    },
    {
      "id": "depgraph",
      "status": "passed",
      "exitCode": 0
    },
    {
      "id": "tmpdir-leaks",
      "status": "passed",
      "exitCode": 0
    },
    {
      "id": "tmpdir-leaks-model",
      "status": "passed",
      "exitCode": 0
    },
    {
      "id": "coverage-model",
      "status": "passed",
      "exitCode": 0
    },
    {
      "id": "coverage-crap-model",
      "status": "passed",
      "exitCode": 0
    },
    {
      "id": "wire-compat-model",
      "status": "passed",
      "exitCode": 0
    },
    {
      "id": "production-exports",
      "status": "passed",
      "exitCode": 0
    },
    {
      "id": "bundle-owner-files",
      "status": "passed",
      "exitCode": 0
    },
    {
      "id": "freerange",
      "status": "skipped",
      "reason": "GitHub-authoritative (jobs: Numeric Ranges)"
    },
    {
      "id": "fixture-cache",
      "status": "passed",
      "exitCode": 0
    },
    {
      "id": "fixture-fallback",
      "status": "passed",
      "exitCode": 0
    },
    {
      "id": "command-docs",
      "status": "passed",
      "exitCode": 0
    },
    {
      "id": "adr-citations",
      "status": "passed",
      "exitCode": 0
    },
    {
      "id": "capabilities-matrix",
      "status": "passed",
      "exitCode": 0
    },
    {
      "id": "docs-links",
      "status": "passed",
      "exitCode": 0
    },
    {
      "id": "docs-prose",
      "status": "passed",
      "exitCode": 0
    },
    {
      "id": "agent-guidance",
      "status": "passed",
      "exitCode": 0
    },
    {
      "id": "xctest-selection",
      "status": "passed",
      "exitCode": 0
    },
    {
      "id": "packaged-runner-swift",
      "status": "passed",
      "exitCode": 0
    },
    {
      "id": "maestro-conformance",
      "status": "passed",
      "exitCode": 0
    },
    {
      "id": "maestro-differential",
      "status": "skipped",
      "reason": "GitHub-authoritative (jobs: Conformance Differential / iOS Conformance Differential)"
    },
    {
      "id": "maestro-regenerate",
      "status": "skipped",
      "reason": "GitHub-authoritative (jobs: Conformance Regenerate Verify / Regenerate & Verify Fixtures)"
    },
    {
      "id": "fuzz-parsers",
      "status": "skipped",
      "reason": "GitHub-authoritative (jobs: Replay Nightly / Parser Fuzz Lane)"
    },
    {
      "id": "mutation",
      "status": "skipped",
      "reason": "GitHub-authoritative (jobs: Mutation Harness Canary / Mutants (${{ matrix.name }}), Mutation Weekly / Mutants (${{ matrix.name }}))"
    },
    {
      "id": "mutation-affected",
      "status": "skipped",
      "reason": "GitHub-authoritative (jobs: Mutation Harness Canary / Select harness validation kernels)"
    },
    {
      "id": "mutation-check",
      "status": "skipped",
      "reason": "GitHub-authoritative (jobs: Mutation Weekly / Mutation score report)"
    },
    {
      "id": "mutation-model",
      "status": "passed",
      "exitCode": 0
    },
    {
      "id": "concurrency-torture",
      "status": "skipped",
      "reason": "GitHub-authoritative (jobs: Concurrency Torture Nightly / Session/lease/lock torture sweep, Integration Tests)"
    },
    {
      "id": "replay-ios",
      "status": "skipped",
      "reason": "parked, workflow_dispatch only (Replay Manual / iOS Replay Suite)"
    },
    {
      "id": "replay-ios-device",
      "status": "skipped",
      "reason": "parked, workflow_dispatch only (Replay Manual / iOS Replay Suite)"
    },
    {
      "id": "replay-macos",
      "status": "skipped",
      "reason": "GitHub-authoritative (jobs: Apple / Smoke Tests (${{ matrix.platform }}))"
    },
    {
      "id": "replay-linux",
      "status": "skipped",
      "reason": "GitHub-authoritative (jobs: Linux / Smoke Tests)"
    },
    {
      "id": "linux-command-evidence",
      "status": "skipped",
      "reason": "GitHub-authoritative (jobs: Linux / Smoke Tests)"
    },
    {
      "id": "replay-android",
      "status": "skipped",
      "reason": "parked, workflow_dispatch only (Replay Manual / Android Full Emulator Suite)"
    }
  ]
}

@thymikee

Copy link
Copy Markdown
Member

Ready for human review at 05ceb7b64cdafd3308f84078a7a0001cf79a06f6.

CI is green, including coverage, integration, docs, size, compatibility, and Android/iOS/macOS/Linux smoke tests. GitHub reports CLEAN and MERGEABLE. All three review threads are resolved, independent review found no regressions, and the named-commit local receipt and regression evidence are recorded. No new actionable comments remain.

The requested two-hour babysitting is complete; monitoring is being stopped for handoff. This PR remains open for human review and merge. External backend restoration remains outside this repository’s live evidence, as documented in the PR.

@thymikee

Copy link
Copy Markdown
Member

At 05ceb7b, the earlier parser finding is fixed: baseline names retain their original spacing, and the updated assertions detect the previous trimming behavior. I found no further code issues. No conflicts are known.

The name preservation thread is fixed by the parser and comparison changes. The help text thread is fixed by the corrected baseline option. The integer validation thread can be resolved because the existing positive-integer check matches the contract and no version branching requires a safe-integer restriction.

Smoke Tests are still running, with no failure log available to attribute. Before merge, wait for the current run to finish and, if it fails, inspect and attribute the exact failing step. I did not rerun tests or inspect an external backend; live restoration evidence remains absent.

@thymikee thymikee added the ready-for-human Valid work that needs human implementation, judgment, or maintainer merge label Nov 11, 2026
@thymikee
thymikee merged commit 799e9c0 into main Nov 12, 2026
21 checks passed
@thymikee
thymikee deleted the feat/device-baseline branch November 12, 2026 07:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-for-human Valid work that needs human implementation, judgment, or maintainer merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

proxy lease: name a backend baseline with --device-baseline

2 participants