Repository navigation
feat(apple-runner): pass App Store Connect API key args for unattended device signing - #5042
Conversation
a2eeae4 to
a1a1147
Compare
|
Thanks for the PR. At a1a1147 the code needs changes before merge, and live device evidence is required. The PR changes the xcodebuild call for the real-device runner build, a native-execution path for the Apple runner. All seam tests mock A second independent pass found that the key path is not validated before xcodebuild starts (runner-cache-metadata.ts#L347). With the three variables set and A second independent pass found that the key path can reach the runner logs (runner-artifact.ts#L960). Xcode can echo its invocation with A second independent pass found that the full argv, including the key path, ends up in execution errors (runner-artifact.ts#L969). When a cold device build exits nonzero, times out, or fails to spawn (for example EACCES), A second independent pass found that the key path also reaches xcodebuild through its environment (runner-artifact.ts#L953). The request binds the daemon environment at A second independent pass found that the physical-device help is out of date (installation.md#L112). The page sends a headless Mac operator to Not blocking, and these can be taken or left: the args array in error details exposes The code needs changes as listed above. The Body rules job was cancelled by the workflow concurrency group, and the other 16 jobs pass at this head. Body rules grades the title and body only, so the diff has nothing to do with it, but it will likely fail on rerun until the body is trimmed. No conflicts. Not verified here: a device run, xcodebuild, or the apple-runner tests, since the argv assertions were read from the diff and the mocked seam tests; the layering control experiment and the generate:reasons and generate:command-docs zero-diff claims; and the Body rules result itself, since the word count is from a local run of the check-pr-body.ts rules. Before merge, the live real-device run at a1a1147 described above is required, then the body trim so Body rules can run. |
6b3e0e6 to
70086c3
Compare
|
Thanks for the fixes since a1a1147. Most of the earlier findings are now addressed, and one requirement is still broken at 70086c3. A second independent pass found that the readable-file requirement is not met. On a cold real-device build, set the complete trio and point the key path at a mode-000 regular file in a directory the daemon can traverse. The check at https://github.com/callstack/agent-device/blob/70086c3/packages/apple-runner/src/runner-cache-metadata.ts#L339 only calls The live run in the PR body covers the redaction path. It does not print the head SHA, but the head content matches the run's code. It cannot show the key turning a no-sign-in build from failure into success, so the headless-provisioning claim still rests on the earlier hand test in #4961. Not verified here: whether the stream scrubber still matches a key path with spaces when Xcode backslash-escapes it in its invocation echo. Lint, Typecheck & Package, Repo Guards & Compatibility and Coverage fail after the latest delta, and they exercise the files it changed, so they are likely related. Not verified here: the failure logs for those four jobs. The other 16 jobs passed. There are no conflicts. The next step before merge is the readable-file check above, then green CI. |
Review finding on the ASC API key args: a mode-000 key file passed the isFile check, so the resolver assembled the argv and xcodebuild started, failing later with a build reason instead of signing_auth_key_invalid_path. The path check now also demands read access (fs.accessSync R_OK) after isFile, inside the same try, so a file the daemon cannot open refuses before argv assembly. The refusal still names only the env variable; the value and the raw filesystem error stay out of the details. New tests pin the mode-000 refusal at the resolver and at the spawn seam. Green-CI repairs on the same delta: - Split exec.ts: the redaction subsystem moves to internal/exec-redact.ts and executable resolution to internal/exec-which.ts. exec.ts fits 1000 again, so its legacy cap entry goes; runner-artifact.ts fits 1000 by moving the signing-auth spawn options beside the trio's owner in runner-cache-metadata.ts. The two new eager modules carry APPROVED_CLOSURE_ADDITIONS rows (callstack#5042), the gate's own exception record, since every closure that reaches exec.ts pays +1 per module. - Align envOmit with its documented contract out of scope: a bare out-of-scope spawn inherits the environment natively and has no captured object to delete from, so the process.env capture leaves and deletion applies to an explicit env or a bound host scope (R86). - Use replaceAll in the redaction stream test. - help physical-device: move the App Store Connect key block behind the first-screen budget, which the delta had pushed past line 30; the guarded rules return to their pre-delta lines and the first-screen and command-docs guards pass.
|
Done at The rule, as implemented. The path must name a regular file the daemon can open for reading, checked before argv assembly. Tests. The mode-000 case joined Green CI. All three lint errors fixed: exec.ts is split (redaction →
Coverage's log at 70086c3 ends mid-run with no gate verdict and no failing annotation — it reads as a lost runner, not a gate result. Two local-only failures I did not chase into the PR: |
|
Thanks for the update. The unreadable-key-file problem from the earlier review (70086c3) is now fixed in 943b51b, and the code looks good to me. Repo Guards & Compatibility still fails at 943b51b. The delta adds two eager modules in host-kit (exec-redact.ts, exec-which.ts) with new APPROVED_CLOSURE_ADDITIONS rows, removes a LEGACY_FILE_LINE_CAPS entry in oxlint.config.ts and moves the help block, so one of those is the likely cause. Not verified here: the exact failing guard, because no failure log was read. Body rules also fails, and it grades the PR body text, so the body needs a fix. The two new closure rows name the maintainer as owner and need their sign-off. Before merge, please fix the PR body and the Repo Guards failure so CI is green. No conflicts are known. Not verified here: the tests were not run, and the mode-000 tests were checked only by reading the earlier predicate. Also not verified here: whether the stream scrubber matches a key path with spaces when Xcode backslash-escapes it. Headless provisioning success still rests on the hand test in #4961. |
|
The Repo Guards fallow findings on head
Cleanup in
The audit invocation now exits 0 against the GitHub base: dead code 0 · complexity 0 · duplication 0. host-kit (50 files, 738 tests) and apple-runner (89 files, 1005 tests) suites, |
|
Thanks for the follow-up changes. At a3d3eec the code looks good, and the earlier review of 943b51b still holds. The fallow findings from Repo Guards (dead exports, settle complexity, two clone groups) were on lines this update changed, and all 16 checks now pass. Not verified here: how a real xcodebuild command echo prints a key path that contains a space, since the only evidence is the Xcode 26.2 log from the first review, where the echo double-quotes the path. Not verified here: a new device run, because the live run in the PR body is from 943b51b and this update is a behavior-preserving refactor of host-kit spawn settlement, checked by reading and by green CI. Nothing blocks merge from the code side. Sign-off on the two maintainer-owned APPROVED_CLOSURE_ADDITIONS rows remains a maintainer decision. |
|
Thanks for sticking with this. One scope change before merge: please drop the key-path redaction from host-kit exec. The key path is configuration, not a secret. The secret is the Concretely: remove |
Per thymikee's 2026-11-24 review ruling on callstack#5042: the App Store Connect key path is configuration, not a secret — the .p8 file never leaves the host and the key ID / issuer ID are visible anyway — so AGENT_DEVICE_IOS_AUTH_KEY_PATH is treated like AGENT_DEVICE_IOS_PROVISIONING_PROFILE: a plain operator setting with no redaction around it. Removed (the key-path redaction mechanism this PR had added): - exec-redact.ts deleted (redactArgv, createArgRedactor, stream scrubbing) - exec.ts back to its pre-PR shape: no ExecOptions.envOmit, no ExecStreamOptions.redactions, no redactor/safeArgs, no appendRedactedTails, no stream scrubbing, no sanitizeSpawnCause; resolveSpawnEnv back to two args; error argv back to raw args; the exec-which split merged back and exec-which.ts deleted; command.ts back to the single export block; the oxlint line-cap entry restored (exec.ts is 1029 lines again) - runnerSigningAuthSpawnOptions dropped: spawn options carry no envOmit or redactions; RUNNER_SIGNING_AUTH_ENV_NAMES removed with it - redaction/envOmit tests removed; the raw-argv byte-for-byte test stays (renamed without the redactions token); apple-runner tests keep the mode-000 refusal, zero-spawn seam, and argv-seam cases verbatim - eager-closure-budgets entries for exec-redact.ts and exec-which.ts removed - help/docs: dropped the three sentences that claimed environment stripping and log scrubbing; the trio setup, all-three-or-none, and both typed-refusal docs stay Retained: resolveRunnerProvisioningAuthArgs (readable-regular-file pre-check via statSync isFile plus accessSync R_OK, the all-three-or-none refusal, typed signing_auth_key_incomplete and signing_auth_key_invalid_path reasons whose details name the variable and never the path value, the -authenticationKey* argv assembly), its tests, the cli-help signing-auth block, and the three doc pages' ASC key setup. Gate evidence: targeted vitest exit 0 (87/87 across 6 files); host-kit + apple-runner suite exit 0; tsc -b exit 0; oxlint --deny-warnings exit 0; fallow --base ecb2089 exit 0 (dead 0, complexity 0; duplication 2 = two base-native exec.ts clone groups the PR had incidentally suppressed, restored byte-faithfully with the revert, inherited and non-blocking); orphan-token grep 0 hits; retained-surface greps present; mutation self-proofs: breaking all-three-or-none and dropping the accessSync R_OK pre-check each turn the suite red, byte-identical restores verified by shasum.
|
Scope change applied at |
|
Thanks for the update. The code at 25890cb looks good: the delta restores the host-kit exec, command and lint config files and the closure budgets to match base, which removes the overlap that earlier broke Repo Guards. The rest of the diff is the apple-runner resolver and argv, help and docs, and tests. No conflicts are known. All nine remaining CI jobs are still running at this head and none has failed, so green status is not yet confirmed. Not verified here: the tests were not run locally, and the test claims rest on reading the tests and the author's report. Live device evidence was not rerun at this head, and none is needed, because the 943b51b run was accepted earlier and the delta since then only removes redaction code and leaves the xcodebuild argv assembly untouched. Nothing else is needed from review; the PR can merge once those CI jobs finish green. |
|
Thanks for the update. The feature is worth having, and it can be about a third of its current size with the same behavior for users:
|
…d device signing A macOS host with no interactive Xcode sign-in cannot resolve automatic provisioning for the real-device runner build, so -allowProvisioningUpdates has no credential source to ride on (callstack#4961). Three environment variables now complete the Apple runner setup family: AGENT_DEVICE_IOS_AUTH_KEY_PATH, AGENT_DEVICE_IOS_AUTH_KEY_ID, and AGENT_DEVICE_IOS_AUTH_KEY_ISSUER_ID. When a real-device build runs and all three are set, xcodebuild also receives -authenticationKeyPath, -authenticationKeyID, and -authenticationKeyIssuerID. A partial trio refuses the build before it spawns, with details.reason signing_auth_key_incomplete and the names that are missing; with none set, the invocation is unchanged byte for byte. No CLI flag and no command surface changes: this is build-time configuration like the rest of the family. The reason is declared in a package reason table beside the resolver that publishes it, so the generated error-reasons page documents it.
Four review must-fixes on top of the ASC API key args: - Validate the key path before the argv is built: a missing file, a directory, or a NUL-bearing value refuses with the typed reason signing_auth_key_invalid_path, naming the variable instead of the value or the raw filesystem error. - Scrub the key path from the build streams and error payloads: a streaming scrubber washes chunk-boundary-split matches and masks a cut-off trailing fragment at close, and only caller-redacted values are scrubbed so flag names and key ids stay in the logs. - Carry sanitized argv on every error surface: exit, timeout, cancel, stdin, and spawn failures read the redacted copy, and a spawn cause's spawnargs are rebuilt on the sanitized face. - Omit the three key variables from the child environment when the trio rides the argv, so credentials travel by argument only; without the trio nothing changes. Docs: help physical-device, installation, configuration, and the generated error reasons name the two signing_auth_key_* reasons.
Review finding on the ASC API key args: a mode-000 key file passed the isFile check, so the resolver assembled the argv and xcodebuild started, failing later with a build reason instead of signing_auth_key_invalid_path. The path check now also demands read access (fs.accessSync R_OK) after isFile, inside the same try, so a file the daemon cannot open refuses before argv assembly. The refusal still names only the env variable; the value and the raw filesystem error stay out of the details. New tests pin the mode-000 refusal at the resolver and at the spawn seam. Green-CI repairs on the same delta: - Split exec.ts: the redaction subsystem moves to internal/exec-redact.ts and executable resolution to internal/exec-which.ts. exec.ts fits 1000 again, so its legacy cap entry goes; runner-artifact.ts fits 1000 by moving the signing-auth spawn options beside the trio's owner in runner-cache-metadata.ts. The two new eager modules carry APPROVED_CLOSURE_ADDITIONS rows (callstack#5042), the gate's own exception record, since every closure that reaches exec.ts pays +1 per module. - Align envOmit with its documented contract out of scope: a bare out-of-scope spawn inherits the environment natively and has no captured object to delete from, so the process.env capture leaves and deletion applies to an explicit env or a bound host scope (R86). - Use replaceAll in the redaction stream test. - help physical-device: move the App Store Connect key block behind the first-screen budget, which the delta had pushed past line 30; the guarded rules return to their pre-delta lines and the first-screen and command-docs guards pass.
… dead signing-auth export The Repo Guards fallow audit against the upstream base reported two clone groups and one over-threshold function in exec.ts, plus two unused exports of RUNNER_SIGNING_AUTH_ENV_NAMES in apple-runner. - settle in runSpawnedCommand breached the cognitive ceiling (16) on the settlement-reason chain and the redaction-tail flush; both move into commandSettlementReason and appendRedactedTails, and runCmdBackground's finish reuses commandSettlementReason for the same reason table - the kill-settlement and abort-watch wiring, and the exit/close listener pair, were duplicated across runSpawnedCommand and runCmdBackground; they move into watchCommandAbortSettlement and recordCommandExitAndClose - RUNNER_SIGNING_AUTH_ENV_NAMES loses the export in runner-cache-metadata (its only consumer reads it in the same file) and the re-export entry in runner-cache; the repo has no consumer of either export No behavior change: the host-kit exec suites and the apple-runner suites pass unchanged, and the fallow audit against the GitHub base reports dead code 0, complexity 0, duplication 0.
Per thymikee's 2026-11-24 review ruling on callstack#5042: the App Store Connect key path is configuration, not a secret — the .p8 file never leaves the host and the key ID / issuer ID are visible anyway — so AGENT_DEVICE_IOS_AUTH_KEY_PATH is treated like AGENT_DEVICE_IOS_PROVISIONING_PROFILE: a plain operator setting with no redaction around it. Removed (the key-path redaction mechanism this PR had added): - exec-redact.ts deleted (redactArgv, createArgRedactor, stream scrubbing) - exec.ts back to its pre-PR shape: no ExecOptions.envOmit, no ExecStreamOptions.redactions, no redactor/safeArgs, no appendRedactedTails, no stream scrubbing, no sanitizeSpawnCause; resolveSpawnEnv back to two args; error argv back to raw args; the exec-which split merged back and exec-which.ts deleted; command.ts back to the single export block; the oxlint line-cap entry restored (exec.ts is 1029 lines again) - runnerSigningAuthSpawnOptions dropped: spawn options carry no envOmit or redactions; RUNNER_SIGNING_AUTH_ENV_NAMES removed with it - redaction/envOmit tests removed; the raw-argv byte-for-byte test stays (renamed without the redactions token); apple-runner tests keep the mode-000 refusal, zero-spawn seam, and argv-seam cases verbatim - eager-closure-budgets entries for exec-redact.ts and exec-which.ts removed - help/docs: dropped the three sentences that claimed environment stripping and log scrubbing; the trio setup, all-three-or-none, and both typed-refusal docs stay Retained: resolveRunnerProvisioningAuthArgs (readable-regular-file pre-check via statSync isFile plus accessSync R_OK, the all-three-or-none refusal, typed signing_auth_key_incomplete and signing_auth_key_invalid_path reasons whose details name the variable and never the path value, the -authenticationKey* argv assembly), its tests, the cli-help signing-auth block, and the three doc pages' ASC key setup. Gate evidence: targeted vitest exit 0 (87/87 across 6 files); host-kit + apple-runner suite exit 0; tsc -b exit 0; oxlint --deny-warnings exit 0; fallow --base ecb2089 exit 0 (dead 0, complexity 0; duplication 2 = two base-native exec.ts clone groups the PR had incidentally suppressed, restored byte-faithfully with the revert, inherited and non-blocking); orphan-token grep 0 hits; retained-surface greps present; mutation self-proofs: breaking all-three-or-none and dropping the accessSync R_OK pre-check each turn the suite red, byte-identical restores verified by shasum.
25890cb to
a77c74c
Compare
|
Thanks for the update. The code at a77c74c has no review findings, and the conflict reported at 25890cb is resolved, but the rebase leaves one lint failure to fix before merge. Lint, Typecheck & Package fails because Runner Build (tvOS + visionOS + watchOS) fails for an unrelated infrastructure reason: the visionOS cache-restore step could not find The required evidence is satisfied. Not verified here: tests were not run locally, so test claims rest on reading the unchanged test files and on CI. Not verified here: no live device run was done at this commit. Coverage is inferred because the argument assembly is byte-identical and the new released-artifact path from the base is simulator-only. |
The rebase onto 4228173 pushed runner-artifact.ts to 1002 lines, over the repo's 1000-line cap (callstack#5042 CI oxlint). The discovery and scoring block (findXctestrun, collect/compare/scoreXctestrunCandidate) is one owning concern - walking the derived-data tree and picking the .xctestrun a device runs - so it moves to runner-xctestrun-discovery.ts verbatim; the build pipeline imports findXctestrun and the package surface keeps findRunnerXctestrun via index.ts. Behavior unchanged (1026 apple-runner tests pass). Co-Authored-By: Claude Code <[email protected]>
|
Thanks for the update. No code problems were found at b432611: the change since the earlier review of a77c74c, which found none either, is a byte-identical module move, and the required evidence is in place. The Coverage job failed in the Not verified here: the cause of the Coverage failure could not be tied to a test, and no local tests or live device run were done at this commit; the move was compared by text diff and its call sites by search, and a pure move does not need a new device run. Please re-run the Coverage job and confirm that it passes before merge. |
…budget The separate runner-xctestrun-discovery module added one module to the import closure of apple-runner and three platform-apple facades, which fails the no-growth budget. Move the functions unchanged into runner-xctestrun-products, which those closures already evaluate. runner-artifact stays under the line cap. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
|
Thanks for the update, no code issues were found at b4b5891, and the move matches the base definitions in a text comparison and a search of every importer. All 17 checks pass, including the Coverage job that needed a re-run after it crashed at b432611, so nothing else is needed before merge. Not verified here: local tests or a device run at this commit; a pure move needs no new device evidence, and the earlier live signing evidence was accepted. |
Summary
Extends the Apple runner setup env family (
AGENT_DEVICE_IOS_TEAM_ID,AGENT_DEVICE_IOS_SIGNING_IDENTITY,AGENT_DEVICE_IOS_PROVISIONING_PROFILE) with an App Store Connect API key trio:AGENT_DEVICE_IOS_AUTH_KEY_PATH,AGENT_DEVICE_IOS_AUTH_KEY_ID,AGENT_DEVICE_IOS_AUTH_KEY_ISSUER_ID. A real-device-allowProvisioningUpdatesbuild with all three set passes the three-authenticationKey*args toxcodebuild; a partial trio refuses before the build; an unreadable key path refuses at the resolver; none set keeps the invocation byte-identical. No CLI surface change. Per the review scope change, key-path redaction is out:AUTH_KEY_PATHis configuration, treated likeAGENT_DEVICE_IOS_PROVISIONING_PROFILE. The refusal reasons live in a package-local reason table.Before / after
Partial trio: base runs without auth args and classifies
build_failed_unclassified; head refuses pre-spawn withsigning_auth_key_incompletenaming the missing variable. All three set: the argv tail gains-allowProvisioningUpdatesplus the three-authenticationKey*pairs (seam test, byte-for-byte). Mode-000 key file: base starts a doomed build; head refusessigning_auth_key_invalid_pathwith zero spawns.Validation
Head
25890cba1: apple-runner 1004 tests and host-kit suites green,tsc -bexit 0,fallow auditagainst the GitHub base clean (12 changed files). Live device run (2026-11-24 at70086c3, iPhone 12 Pro Max, iOS 18.1, no Xcode sign-in on the host): the trio rode the argv and automatic signing built and installed; the teardown is removal-only, so that run carries. The success-flip record remains the 2026-11-13 hand test in #4961.