ci: fix toolchain-drift false alarm — create --output dir, report exit code - #445
Conversation
The first scheduled run failed not from toolchain drift but because the workflow passed --output "$RUNNER_TEMP/drift-report" without creating the directory; xchtmlreport fails late with a misleading error when the output directory is missing. Create it with mkdir -p before invoking the tool. Also capture the tool's exit code as a step output and surface it in the drift report: exit 3 is the deliberate "report degraded (collected faults)" signal since 3.0, while any other non-zero exit is a hard error — the old template conflated the two, which is exactly how this run got misreported. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThe toolchain drift workflow now creates the report directory, captures and exposes ChangesToolchain drift reporting
Estimated code review effort: 2 (Simple) | ~10 minutes Mergeability Score: ⚪ Minimal · up to This localized workflow change creates the report directory and preserves the tool's actual exit code, with no product-code impact; no actionable merge-blocking risk remains after normal checks and review. Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
…ex.html (fixes #446) (#471) `xchtmlreport <bundle> --output /missing/dir` parsed the bundle, exported attachments and rendered the whole report, then died at the final `html.write(toFile:)` with Error: An error has occured while creating the report Error: The file "index.html" doesn't exist. Neither line names the real problem, and both arrive after all the work is done — in linking mode, after payloads have already been exported into the bundle. This is what made the first scheduled toolchain-drift run (#444) look like toolchain drift. Create the output directory, intermediates included, before the `Summary` is built. Create-by-default is what every CLI this one sits next to does, and it is a no-op on the common path where the directory already exists. A directory that genuinely cannot be created — no write permission on the parent, a file in the way — is a usage error, not a degraded report: it throws `ValidationError`, so it exits 64 like the tool's other usage errors rather than 3, and the message names the path and the reason before any work starts. The `An error has occured` string is untouched; this fix simply makes that path unreachable for a missing output directory. Drop the `mkdir -p` that #445 added to the toolchain-drift workflow as a workaround for this bug. Pointing that job at an uncreated path is now part of what the step asserts, so restoring the mkdir would mask a regression. README's exit-code section documented the old behaviour verbatim ("Exit 1 covers failures to write the output — for example `-o` pointing at a directory that does not exist"); corrected, and `--output`'s help text now says the directory is created if missing. Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
Fixes the false alarm from the first scheduled toolchain-drift run (run 31652493537), triaged in #444. Workflow-only, same scoping as #442 — no product code touched.
What happened
The
Run xchtmlreport against a fresh bundlestep passed--output "$RUNNER_TEMP/drift-report", a directory nothing creates.xchtmlreportfails late when the output directory is missing ("An error has occured while creating the report" / "The file "index.html" doesn't exist") and exits 1. Reproduced on local Xcode 26.2 against a known-good bundle, so the failure is environment-independent — not drift, and Xcode 26.6 is exonerated.Changes
mkdir -pbefore invokingxchtmlreport, and print the tool's exit code (::error::annotation) when it fails.ExitCode(3)inXCTestHtmlReport.swift) from any other non-zero exit (hard error), including the actual code. Template structure otherwise unchanged.The product-side behavior (
--outputpointing at a nonexistent directory failing late with a misleading error) is tracked separately — fix belongs in the CLI, not here.Verification
actionlintclean (includes shellcheck on run blocks)shellcheckclean on the modified step scriptzizmorclean (no findings; SHA-pinned actions untouched)🤖 Generated with Claude Code
Summary by CodeRabbit