Files
Jarvis/project.yml
T
james.maes 0517926f61 fix(01): split entitlements per-config + address AMFI rejection on ad-hoc Debug
The debugger agent diagnosed the JarvisAppTests xctest launch failure
(Runningboard error 5 / Launchd job spawn failed). Root cause: AMFI
rejected the ad-hoc signed Debug bundle because it carried the managed
`com.apple.developer.speech-recognition-assets` entitlement. The kernel
logged `AMFI: Code has restricted entitlements, but the validation of
its code signature failed` → `load code signature error 4` → spawn
failure → Runningboard error 5.

**Changes:**

- Split `App/Jarvis.entitlements` → `Jarvis.Debug.entitlements` (no
  `speech-recognition-assets`; adds `get-task-allow` for XCTest attach)
  + `Jarvis.Release.entitlements` (full managed set, unchanged).
- `project.yml`: per-config `CODE_SIGN_ENTITLEMENTS`; Debug gets
  `ENABLE_HARDENED_RUNTIME=NO` + `OTHER_CODE_SIGN_FLAGS=""` +
  `ONLY_ACTIVE_ARCH=YES`; `DEVELOPMENT_TEAM` moved from base → Release
  only (avoids Team ID leaking into the Xcode 26 debug dylib).
- `scripts/codesign.sh`: resolves entitlements via $CODE_SIGN_ENTITLEMENTS
  env, falls back to config-specific file, then to the legacy path.
  Also signs `Contents/MacOS/*.debug.dylib` now that Xcode 26 emits it.
- `scripts/verify-entitlements.sh`: per-config `MAIN_REQUIRED` +
  `MAIN_FORBIDDEN` lists — Debug forbids `speech-recognition-assets`
  (wrong for ad-hoc) and requires `get-task-allow`; Release enforces
  the shipping posture with all 3 managed keys.

**Residual known issue** (documented in `.planning/debug/xctest-launch-runningboard-error-5.md`
and `01-HUMAN-UAT.md` §4): Xcode 26 still emits `Jarvis.debug.dylib`
with a code signature whose Team ID context diverges from our ad-hoc
outer sign, producing a dyld "different Team IDs" rejection when xctest
tries to load the bundle. Multiple workarounds attempted
(SWIFT_ENABLE_DEBUG_DYLIB=NO, resigning the dylib, stripping it
post-build). `xcodebuild test -scheme Jarvis -only-testing:JarvisAppTests`
fails bootstrap; SPM package tests (56, all passing) and `xcodebuild
build` both succeed. Actual code quality is unaffected — this is a
harness/tooling boundary issue.

Verified: 56 SPM tests pass; `xcodebuild build -configuration Debug`
BUILD SUCCEEDED; `scripts/test-verify-entitlements.sh` self-test
PASS=3 FAIL=0.
2026-04-23 17:06:10 -05:00

209 lines
6.7 KiB
YAML

name: Jarvis
options:
createIntermediateGroups: true
generateEmptyDirectories: true
minimumXcodeGenVersion: "2.40.0"
deploymentTarget:
macOS: "13.0"
settings:
base:
SWIFT_VERSION: "6.0"
SWIFT_STRICT_CONCURRENCY: complete
ENABLE_HARDENED_RUNTIME: YES
CODE_SIGN_STYLE: Manual
CODE_SIGN_IDENTITY: "-"
OTHER_CODE_SIGN_FLAGS: "--options=runtime --timestamp"
LD_RUNPATH_SEARCH_PATHS: "@executable_path/../Frameworks"
MACOSX_DEPLOYMENT_TARGET: "13.0"
configs:
# DEVELOPMENT_TEAM intentionally unset for Debug.
# With ad-hoc signing (CODE_SIGN_IDENTITY="-") and DEVELOPMENT_TEAM set,
# Xcode generates incremental debug dylibs signed with the Team ID while
# the main executable remains adhoc — dyld refuses to load the mismatched
# dylib ("different Team IDs"), and xctest crashes during bootstrap.
Debug:
ONLY_ACTIVE_ARCH: YES
Release:
DEVELOPMENT_TEAM: 7UC2HETAN9
packages:
Keychain:
path: packages/Keychain
Config:
path: packages/Config
Logging:
path: packages/Logging
Shell:
path: packages/Shell
targets:
Jarvis:
type: application
platform: macOS
sources:
- path: App
excludes:
- "Info.plist"
- "Jarvis.entitlements"
- "Jarvis.Debug.entitlements"
- "Jarvis.Release.entitlements"
- "Tests/**"
settings:
base:
PRODUCT_BUNDLE_IDENTIFIER: com.koftwentytwo.jarvis
PRODUCT_NAME: Jarvis
INFOPLIST_FILE: App/Info.plist
GENERATE_INFOPLIST_FILE: NO
ENABLE_HARDENED_RUNTIME: YES
CODE_SIGN_STYLE: Manual
CODE_SIGN_IDENTITY: "-"
OTHER_CODE_SIGN_FLAGS: "--options=runtime --timestamp"
SWIFT_STRICT_CONCURRENCY: complete
SWIFT_VERSION: "6.0"
MACOSX_DEPLOYMENT_TARGET: "13.0"
LD_RUNPATH_SEARCH_PATHS: "@executable_path/../Frameworks"
configs:
Debug:
CODE_SIGNING_ALLOWED: NO
CODE_SIGNING_REQUIRED: NO
CODE_SIGN_ENTITLEMENTS: App/Jarvis.Debug.entitlements
# Hardened Runtime OFF for Debug — HR's strict "non-platform Team IDs
# must match" rule rejects Xcode 26's debug dylib incremental-link
# artifact (Jarvis.debug.dylib) against our ad-hoc signed main
# executable, producing the abrt-during-bootstrap crash on xctest
# launch. HR is only meaningful for Release/distribution anyway.
ENABLE_HARDENED_RUNTIME: NO
# OTHER_CODE_SIGN_FLAGS must not carry `--options=runtime` on Debug —
# that flag enables HR regardless of ENABLE_HARDENED_RUNTIME. Strip it.
OTHER_CODE_SIGN_FLAGS: ""
Release:
DEVELOPMENT_TEAM: 7UC2HETAN9
CODE_SIGNING_ALLOWED: NO
CODE_SIGNING_REQUIRED: NO
CODE_SIGN_ENTITLEMENTS: App/Jarvis.Release.entitlements
dependencies:
- package: Keychain
product: Keychain
- package: Config
product: Config
- package: Logging
product: JarvisLogging
- package: Shell
product: Shell
copyFiles:
- destination: wrapper
subpath: Contents/Helpers
files: []
postBuildScripts:
- name: Create Contents/Helpers directory
script: |
mkdir -p "${TARGET_BUILD_DIR}/${WRAPPER_NAME}/Contents/Helpers"
runOnlyWhenInstalling: false
basedOnDependencyAnalysis: false
- name: Verify entitlements (pre-codesign)
script: |
"${SRCROOT}/scripts/verify-entitlements.sh" --pre-codesign
runOnlyWhenInstalling: false
basedOnDependencyAnalysis: false
- name: Codesign bundle (deepest-first)
script: |
# Fall back to CODE_SIGN_IDENTITY (then ad-hoc "-") when CODE_SIGNING_ALLOWED=NO,
# since Xcode does not set EXPANDED_CODE_SIGN_IDENTITY in that case.
export EXPANDED_CODE_SIGN_IDENTITY="${EXPANDED_CODE_SIGN_IDENTITY:-${CODE_SIGN_IDENTITY:--}}"
"${SRCROOT}/scripts/codesign.sh"
runOnlyWhenInstalling: false
basedOnDependencyAnalysis: false
- name: Verify entitlements (post-codesign)
script: |
"${SRCROOT}/scripts/verify-entitlements.sh" --post-codesign
runOnlyWhenInstalling: false
basedOnDependencyAnalysis: false
- name: Verify codesign settings (pbxproj lint)
script: |
"${SRCROOT}/scripts/verify-codesign-settings.sh"
runOnlyWhenInstalling: false
basedOnDependencyAnalysis: false
JarvisAppTests:
type: bundle.unit-test
platform: macOS
sources:
- path: App/Tests/AppTests
settings:
base:
PRODUCT_NAME: JarvisAppTests
PRODUCT_BUNDLE_IDENTIFIER: com.koftwentytwo.jarvis.AppTests
GENERATE_INFOPLIST_FILE: YES
SWIFT_STRICT_CONCURRENCY: complete
SWIFT_VERSION: "6.0"
MACOSX_DEPLOYMENT_TARGET: "13.0"
BUNDLE_LOADER: "$(TEST_HOST)"
TEST_HOST: "$(BUILT_PRODUCTS_DIR)/Jarvis.app/Contents/MacOS/Jarvis"
CODE_SIGN_IDENTITY: "-"
CODE_SIGN_STYLE: Manual
configs:
Debug:
CODE_SIGNING_ALLOWED: NO
CODE_SIGNING_REQUIRED: NO
dependencies:
- target: Jarvis
JarvisEntitlementProbeTests:
type: bundle.unit-test
platform: macOS
sources:
- path: App/Tests/JarvisEntitlementProbeTests
excludes:
- "Info.plist"
settings:
base:
PRODUCT_NAME: JarvisEntitlementProbeTests
PRODUCT_BUNDLE_IDENTIFIER: com.koftwentytwo.jarvis.EntitlementProbeTests
INFOPLIST_FILE: App/Tests/JarvisEntitlementProbeTests/Info.plist
GENERATE_INFOPLIST_FILE: NO
SWIFT_STRICT_CONCURRENCY: complete
SWIFT_VERSION: "6.0"
MACOSX_DEPLOYMENT_TARGET: "13.0"
BUNDLE_LOADER: "$(TEST_HOST)"
TEST_HOST: "$(BUILT_PRODUCTS_DIR)/Jarvis.app/Contents/MacOS/Jarvis"
CODE_SIGN_IDENTITY: "-"
CODE_SIGN_STYLE: Manual
OTHER_SWIFT_FLAGS: "-DJARVIS_ENTITLEMENT_PROBE"
configs:
Debug:
CODE_SIGNING_ALLOWED: NO
CODE_SIGNING_REQUIRED: NO
dependencies:
- target: Jarvis
schemes:
Jarvis:
build:
targets:
Jarvis: all
JarvisAppTests: [test]
test:
targets:
- JarvisAppTests
gatherCoverageData: false
run:
config: Debug
profile:
config: Release
analyze:
config: Debug
archive:
config: Release
EntitlementProbe:
build:
targets:
Jarvis: all
JarvisEntitlementProbeTests: [test]
test:
targets:
- JarvisEntitlementProbeTests
gatherCoverageData: false
run:
config: Release
profile:
config: Release
analyze:
config: Release
archive:
config: Release