-
-
Notifications
You must be signed in to change notification settings - Fork 0
release: add coverage and Xcode MCP guidance #129
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| # Code Coverage Contract | ||
|
|
||
| Code coverage is execution evidence: it shows which instrumented code ran during a test run. It does not prove behavior is correct, tests assert the right outcomes, or UI and device paths are adequately verified. | ||
|
|
||
| ## Default Policy | ||
|
|
||
| - Report coverage by target and file, and include function-level detail when the tool provides it. | ||
| - Keep test failures, coverage-collection failures, and missing-report failures as separate results. | ||
| - Default to reporting only. Do not invent a global coverage percentage, fail a build, exclude a source path, or claim changed-line coverage without an explicit repository policy. | ||
| - Treat generated, vendored, test-target, and platform-glue sources as visible in the first report. Exclude them only with a checked-in, human-readable reason. | ||
| - Do not commit generated coverage reports by default. Keep local reports ephemeral and upload CI reports only when that repository's CI policy asks for it. | ||
|
|
||
| ## Required Evidence Packet | ||
|
|
||
| Every coverage result should state the toolchain and coverage command; configuration, scheme or package, and destination when applicable; report artifact path and format; target and file summary; exclusions and their reason; whether the result is comparable with a baseline; and test, collection, and report-extraction failures independently. | ||
|
|
||
| ## Comparison And Gates | ||
|
|
||
| Compare coverage only when the source revision, toolchain, build configuration, selected targets, destination, and exclusion policy are compatible. A raw project-wide percentage is not a substitute for changed-file or changed-line evidence. | ||
|
|
||
| Add a CI gate only after the repository chooses one concrete metric: an overall minimum, target minimum, changed-file minimum, or changed-line minimum. Record the policy and allowed exceptions in the repository; keep the Apple Dev Skills default report-only. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| # SwiftPM Code Coverage | ||
|
|
||
| Use SwiftPM coverage for a package-first test surface. Follow the shared [`code-coverage-contract`](../../../shared/references/code-coverage-contract.md) for evidence, artifacts, comparisons, and gates. | ||
|
|
||
| ## Collection And Report Discovery | ||
|
|
||
| Run coverage as part of the test command: | ||
|
|
||
| ```bash | ||
| swift test --enable-code-coverage | ||
| ``` | ||
|
|
||
| After a successful collection, ask the active toolchain for the exported JSON location instead of hard-coding a `.build` path: | ||
|
|
||
| ```bash | ||
| swift test --show-codecov-path | ||
| ``` | ||
|
|
||
| Treat `--show-codecov-path` as a separate report-location query. Do not assume every SwiftPM release accepts it combined with `--enable-code-coverage`, and do not split coverage into a separate build plus `swift test --skip-build` path unless that exact toolchain has been verified. | ||
|
|
||
| ## Reporting | ||
|
|
||
| Read the exported JSON from the reported path and summarize the targets and files it contains. Preserve the original artifact path in the evidence packet. If the file is missing, unreadable, or does not contain the expected coverage payload, report extraction failed; do not substitute a guessed `.build` location or a percentage inferred from test output. | ||
|
|
||
| SwiftPM coverage is appropriate for package targets and their ordinary tests. It does not replace app-host, XCUITest, simulator, physical-device, or Xcode test-plan coverage. Hand off to `xcode-testing-workflow` when those surfaces matter. | ||
|
|
||
| ## Failure Boundaries | ||
|
|
||
| - A passing `swift test` without an exported coverage JSON is a coverage-collection failure, not a zero-coverage result. | ||
| - Keep package coverage reports out of version control unless the package has an explicit artifact policy. | ||
| - Do not create a coverage gate without a repository-owned metric and exclusion policy. | ||
|
Comment on lines
+27
to
+31
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win 🧩 Analysis chain🏁 Script executed: #!/bin/bash
set -euo pipefail
# Inspect the target file with line numbers.
sed -n '1,120p' plugins/apple-dev-skills/skills/swift-package-testing-workflow/references/code-coverage.md | cat -n
# Find related coverage wording in the skill.
rg -n "coverage|swift test|show-codecov-path|enable-code-coverage" plugins/apple-dev-skills/skills/swift-package-testing-workflow -SRepository: gaelic-ghost/socket Length of output: 11478 🏁 Script executed: #!/bin/bash
set -euo pipefail
# Pull the relevant SwiftPM docs text from the web for the exact flag semantics.
python3 - <<'PY'
import urllib.request
url = "https://docs.swift.org/swiftpm/documentation/packagemanagerdocs/swifttest/"
with urllib.request.urlopen(url, timeout=20) as r:
html = r.read().decode("utf-8", "replace")
for needle in ["--enable-code-coverage", "--show-codecov-path", "code coverage"]:
idx = html.find(needle)
print(f"\n=== {needle} @ {idx} ===")
if idx != -1:
start = max(0, idx - 500)
end = min(len(html), idx + 1200)
print(html[start:end])
PYRepository: gaelic-ghost/socket Length of output: 2751 🏁 Script executed: #!/bin/bash
set -euo pipefail
# Check whether the specific file exists in this repo snapshot and show its exact contents if accessible.
test -f plugins/apple-dev-skills/skills/swift-package-testing-workflow/references/code-coverage.md && \
sed -n '1,120p' plugins/apple-dev-skills/skills/swift-package-testing-workflow/references/code-coverage.md | cat -nRepository: gaelic-ghost/socket Length of output: 2139 Scope the missing-report rule to coverage-enabled runs. The failure-boundary bullet reads as if any passing 🤖 Prompt for AI Agents |
||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -160,6 +160,12 @@ Observed current behavior: | |||||||||||||||||||||
| - `xcrun --find lldb-mcp` resolves the beta executable, but `xcrun lldb-mcp --help` fails before startup because dyld cannot resolve `@rpath/lib_CompilerSwiftIDEUtils.dylib`. | ||||||||||||||||||||||
| - A non-mutating fallback-library-path probe did not change that failure. Do not modify Xcode, copy libraries, create symlinks, or publish an environment-variable workaround; use Xcode's active debugger session until a later toolchain starts `lldb-mcp` normally. | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| ### Documented Xcode 27 MCP Additions | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| Apple's Xcode 27 beta release notes describe MCP capability additions for manipulating active run state, interacting with and reading the debugger console, listing and switching schemes and run destinations, inspecting and modifying build settings/compiler flags/entitlements/Info.plist keys, runtime health insights, simulator boot/install/launch/touch/screenshot actions, preview variants, and String Catalog workflows. | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| The release notes do not document a dedicated MCP code-coverage reporting tool. Keep code coverage on the `xcodebuild` plus `xccov` path unless a live Xcode session exposes a documented coverage contract. | ||||||||||||||||||||||
|
Comment on lines
+163
to
+167
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win Keep the coverage fallback explicitly scoped to MCP. Line 167 says “live Xcode session,” while the corresponding contracts in Proposed wording-The release notes do not document a dedicated MCP code-coverage reporting tool. Keep code coverage on the `xcodebuild` plus `xccov` path unless a live Xcode session exposes a documented coverage contract.
+The release notes do not document a dedicated MCP code-coverage reporting tool. Keep code coverage on the `xcodebuild` plus `xccov` path unless a live Xcode MCP session exposes a documented coverage contract.📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||
|
|
||||||||||||||||||||||
| The Device Hub and Xcode debugger workflow references own the detailed behavior and handoffs from this probe. | ||||||||||||||||||||||
| - Xcode copied imported plug-ins into `~/Library/Developer/Xcode/CodingAssistant/codex/plugins/cache`. | ||||||||||||||||||||||
| - Xcode enabled imported plug-ins in `~/Library/Developer/Xcode/CodingAssistant/codex/config.toml`. | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -1,13 +1,13 @@ | ||||||
| --- | ||||||
| name: xcode-testing-workflow | ||||||
| description: Guide Swift Testing, XCTest, XCUITest, XCUIAutomation-oriented mechanics, xctestplan matrices, accessibility-verification follow-through, test filtering, retries, diagnostics, and test-specific fallback work in existing Xcode-managed projects and workspaces. Use when Xcode-aware execution is needed and the task is primarily about testing rather than build or run work. | ||||||
| description: Guide Swift Testing, XCTest, XCUITest, XCUIAutomation-oriented mechanics, code coverage, xctestplan matrices, accessibility-verification follow-through, test filtering, retries, diagnostics, and test-specific fallback work in existing Xcode-managed projects and workspaces. Use when Xcode-aware execution is needed and the task is primarily about testing rather than build or run work. | ||||||
| --- | ||||||
|
|
||||||
| # Xcode Testing Workflow | ||||||
|
|
||||||
| ## Purpose | ||||||
|
|
||||||
| Use this skill as the primary execution workflow for test-focused work in or around Xcode-managed projects and workspaces. Keep it focused on Swift Testing, XCTest, XCUITest, XCUIAutomation-oriented mechanics, `.xctestplan`, destinations, launch arguments, interruption handling, attachments, accessibility-verification follow-through, Instruments profiling, `xctrace` trace capture, filters, retries, diagnostics, and test-specific Debug/Release validation instead of broad build/run or toolchain work. `scripts/run_workflow.py` is the runtime entrypoint for MCP-first test execution, official CLI fallback planning, and the remaining `.pbxproj` warning boundary when mutation enters project-file territory. | ||||||
| Use this skill as the primary execution workflow for test-focused work in or around Xcode-managed projects and workspaces. Keep it focused on Swift Testing, XCTest, XCUITest, XCUIAutomation-oriented mechanics, code coverage, `.xctestplan`, destinations, launch arguments, interruption handling, attachments, accessibility-verification follow-through, Instruments profiling, `xctrace` trace capture, filters, retries, diagnostics, and test-specific Debug/Release validation instead of broad build/run or toolchain work. `scripts/run_workflow.py` is the runtime entrypoint for MCP-first test execution, official CLI fallback planning, and the remaining `.pbxproj` warning boundary when mutation enters project-file territory. | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win Describe The document states elsewhere that the script applies configuration, safeguards, and fallback planning while MCP execution remains agent-side. Calling it the entrypoint for “MCP-first test execution” is contradictory and may send users to a script that cannot perform the promised MCP execution. Proposed wording-`scripts/run_workflow.py` is the runtime entrypoint for MCP-first test execution, official CLI fallback planning, and the remaining `.pbxproj` warning boundary when mutation enters project-file territory.
+`scripts/run_workflow.py` is the runtime entrypoint for runtime configuration, official CLI fallback planning, and the remaining `.pbxproj` warning boundary when mutation enters project-file territory; MCP execution remains agent-side.📝 Committable suggestion
Suggested change
🤖 Prompt for AI AgentsThere was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
For Xcode coverage requests such as Useful? React with 👍 / 👎. |
||||||
|
|
||||||
| ## When To Use | ||||||
|
|
||||||
|
|
@@ -41,6 +41,7 @@ Use this skill as the primary execution workflow for test-focused work in or aro | |||||
| - preserve its project-appropriate logging, telemetry, and SwiftUI architecture guidance | ||||||
| 4. Run `scripts/run_workflow.py` to apply runtime configuration, `.pbxproj` warning safeguards, and CLI fallback planning. | ||||||
| 5. Use the focused references for the right testing surface: | ||||||
| - `references/code-coverage.md` for Xcode coverage collection, `.xcresult` artifacts, `xccov` reporting, comparison, and the Xcode 27 MCP boundary | ||||||
| - `references/xctestplan-configurations-and-matrix.md` for `.xctestplan`, launch-argument matrices, named configurations, and Debug/Release test coverage | ||||||
| - `references/xcuitest-and-xcuiautomation.md` for UI automation mechanics, waits, interruption handling, activities, and attachments | ||||||
| - `references/ui-accessibility-verification.md` for accessibility-specific runtime verification expectations and coordination with `apple-ui-accessibility-workflow` | ||||||
|
|
@@ -119,6 +120,7 @@ Use this skill as the primary execution workflow for test-focused work in or aro | |||||
| - `references/workflow-policy.md` | ||||||
| - `references/mcp-tool-matrix.md` | ||||||
| - `references/cli-fallback-matrix.md` | ||||||
| - `references/code-coverage.md` | ||||||
| - `references/xctestplan-configurations-and-matrix.md` | ||||||
| - `references/xcuitest-and-xcuiautomation.md` | ||||||
| - `references/ui-accessibility-verification.md` | ||||||
|
|
||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For coverage-only requests such as
collect coverage, the skill now advertises code coverage here, butscripts/run_workflow.pystill only infers test work from words liketest/xctestandbuild_commands()still emits plainswift testrather thanswift test --enable-code-coverageplus the report-location query. That makes the documented coverage path disagree with the command-planning entrypoint: agents either block when the user says “coverage” without “test”, or run tests without collecting coverage when the request is inferred as testing.Useful? React with 👍 / 👎.