Skip to content

ci: fix toolchain-drift false alarm — create --output dir, report exit code - #445

Merged
tylervick merged 1 commit into
mainfrom
tylervick/drift-output-dir-392
Aug 13, 2026
Merged

tylervick merged 1 commit into
mainfrom
tylervick/drift-output-dir-392

Conversation

@tylervick

@tylervick tylervick commented Aug 13, 2026

Copy link
Copy Markdown
Member

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 bundle step passed --output "$RUNNER_TEMP/drift-report", a directory nothing creates. xchtmlreport fails 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

  1. Create the output directory with mkdir -p before invoking xchtmlreport, and print the tool's exit code (::error:: annotation) when it fails.
  2. Report fidelity: the drift-issue template claimed any non-zero exit "means the report degraded (collected faults)" — false for this run (exit 1, not 3). The step now captures the exit code as a step output, and the report distinguishes exit 3 (degraded, faults collected — ExitCode(3) in XCTestHtmlReport.swift) from any other non-zero exit (hard error), including the actual code. Template structure otherwise unchanged.

The product-side behavior (--output pointing at a nonexistent directory failing late with a misleading error) is tracked separately — fix belongs in the CLI, not here.

Verification

  • actionlint clean (includes shellcheck on run blocks)
  • standalone shellcheck clean on the modified step script
  • zizmor clean (no findings; SHA-pinned actions untouched)
  • The scheduled workflow can't execute from a branch — coordinator re-dispatches on main after merge.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes
    • Improved toolchain drift reporting to distinguish report degradation from hard errors.
    • Preserved accurate failure status while ensuring report output is generated correctly.

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>
@coderabbitai

coderabbitai Bot commented Aug 13, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: b65b01d3-9f1c-42ae-b6c0-681f24e1fbd0

📥 Commits

Reviewing files that changed from the base of the PR and between 9ed0905 and 6575460.

📒 Files selected for processing (1)
  • .github/workflows/toolchain-drift.yml

📝 Walkthrough

Walkthrough

The toolchain drift workflow now creates the report directory, captures and exposes xchtmlreport’s exit code, preserves command failure status, and classifies degraded output separately from hard errors.

Changes

Toolchain drift reporting

Layer / File(s) Summary
Capture and classify report exit codes
.github/workflows/toolchain-drift.yml
The report step creates its output directory and captures xchtmlreport’s exit code. The drift report receives the value through TOOL_EXIT. Exit code 3 indicates degraded output. Other non-zero and unknown codes indicate hard errors.

Estimated code review effort: 2 (Simple) | ~10 minutes

Mergeability Score: ⚪ Minimal · up to 65754

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)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main CI workflow changes: creating the output directory and reporting the tool exit code.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch tylervick/drift-output-dir-392

Comment @coderabbitai help to get the list of available commands.

@tylervick
tylervick merged commit e54273c into main Aug 13, 2026
7 checks passed
@tylervick
tylervick deleted the tylervick/drift-output-dir-392 branch August 13, 2026 00:26
tylervick added a commit that referenced this pull request Aug 14, 2026
…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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant