xcl run: say on stderr when the log or report.json cannot be written (#2277) #2286

Open
github-bot wants to merge 1 commit from github-bot/gh-2286 into main AGit
Owner

@⁠Creaa on GitHub · 2026-11-25 12:26 UTC · original
Creaa:diagnostics/report-write-failures → main · +60 −7 · 2 files · 1 commits · open

When XCL cannot create its log or write report.json, it now says so once on stderr, with the path and the OS error, and the run goes on. Before, both failures were dropped: the run looked normal, the console showed a Log: path that did not exist, and there was nothing to attach to a bug report. Fixes #2277.

What is in it

  • crates/xcl/src/log.rs: init opens the log through a new open(p) that returns the error of create_dir_all or File::create with the path; init prints xcl: cannot create the log folder … / cannot open the log …: <OS error>. eprintln!, not xlog_*: the log is what failed, and its stderr echo is off unless the title sets log_to_stderr.
  • crates/xcl/src/report.rs: write_final writes through a new save(path, text); a failure prints xcl: cannot write the report …: <OS error> once per process (the report is written on several exit paths).
  • Unit tests a_log_that_cannot_be_opened_names_its_path and a_report_that_cannot_be_written_names_its_path: a path under an existing file fails with a message naming it; a normal path still writes.

Tested

  • RTX 4070 12 GB (driver 617.14), i7-13700F, 32 GB RAM, Windows 11 build 26300, Rust 1.100.0; debug for the tests, release for the runs.
  • cargo build --workspace && cargo test --workspace -- --test-threads=4: 1425 passed, 0 failed, 46 ignored. SKIPPED: the wave64 GPU tests (no wave64), the direct-DXIL f16/f32 cases refused per #1426, heap_window_out_of_memory_falls_back_to_the_switch_form (no heap windows), pso_measurement_compiles_an_exact_synthetic_record (Developer Mode is off), and test_title_draws_with_a_root_signature_under_the_debug_layer / uploads_start_from_each_subresources_state (no D3D12 debug layer installed).
  • The retail title for 10 s with XCL_DATA_ROOT pointing at a root whose <title>\logs is a file: on main the run exits 0 and prints nothing about it; with this PR it exits 0 and prints
    xcl: cannot create the log folder …\<title>\logs: Cannot create a file when that file already exists. (os error 183)
    xcl: cannot write the report …\<title>\logs\report.json: The system cannot find the path specified. (os error 3)
    
    (OS messages translated; the machine's Windows is not English.)

Regression run

main:

xcl-smoke v1
commit: e1d84b7d9153f86a97d2ec5d209d196046fc0bea
gpu: NVIDIA GeForce RTX 4070
title: RetailTitle
seconds: 60
exit: 0x0
frames shown: 1604 (PresentX 1604)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 16934 MB

this PR:

xcl-smoke v1
commit: c095117e147382d8b2fb2f3bc527e89569b76a92
gpu: NVIDIA GeForce RTX 4070
title: RetailTitle
seconds: 60
exit: 0x0
frames shown: 1555 (PresentX 1555)
presents per 2 s (last 3): 60 60 45
device removals: 0
crashes: 0
peak commit: 17850 MB

Not tested

  • A read-only or roamed profile and a full disk as such: the failure was made with a file in place of the logs folder.
  • AMD, other NVIDIA GPUs and drivers.

AI use

  • Claude Code (Claude Opus 5.5) wrote the change and the tests, ran them, the runs above and the smoke pair on my machine, and drafted this description; I checked it.

🤖 Generated with Claude Code

**@⁠Creaa** on GitHub · 2026-11-25 12:26 UTC · [original](https://github.com/xcl-dev/xcl/pull/2286) `Creaa:diagnostics/report-write-failures` → `main` · +60 −7 · 2 files · 1 commits · open When XCL cannot create its log or write `report.json`, it now says so once on stderr, with the path and the OS error, and the run goes on. Before, both failures were dropped: the run looked normal, the console showed a `Log:` path that did not exist, and there was nothing to attach to a bug report. Fixes #2277. **What is in it** - `crates/xcl/src/log.rs`: `init` opens the log through a new `open(p)` that returns the error of `create_dir_all` or `File::create` with the path; `init` prints `xcl: cannot create the log folder … / cannot open the log …: <OS error>`. `eprintln!`, not `xlog_*`: the log is what failed, and its stderr echo is off unless the title sets `log_to_stderr`. - `crates/xcl/src/report.rs`: `write_final` writes through a new `save(path, text)`; a failure prints `xcl: cannot write the report …: <OS error>` once per process (the report is written on several exit paths). - Unit tests `a_log_that_cannot_be_opened_names_its_path` and `a_report_that_cannot_be_written_names_its_path`: a path under an existing file fails with a message naming it; a normal path still writes. **Tested** - RTX 4070 12 GB (driver 617.14), i7-13700F, 32 GB RAM, Windows 11 build 26300, Rust 1.100.0; debug for the tests, release for the runs. - `cargo build --workspace && cargo test --workspace -- --test-threads=4`: 1425 passed, 0 failed, 46 ignored. SKIPPED: the wave64 GPU tests (`no wave64`), the direct-DXIL f16/f32 cases refused per #1426, `heap_window_out_of_memory_falls_back_to_the_switch_form` (no heap windows), `pso_measurement_compiles_an_exact_synthetic_record` (Developer Mode is off), and `test_title_draws_with_a_root_signature_under_the_debug_layer` / `uploads_start_from_each_subresources_state` (no D3D12 debug layer installed). - The retail title for 10 s with `XCL_DATA_ROOT` pointing at a root whose `<title>\logs` is a file: on `main` the run exits 0 and prints nothing about it; with this PR it exits 0 and prints ``` xcl: cannot create the log folder …\<title>\logs: Cannot create a file when that file already exists. (os error 183) xcl: cannot write the report …\<title>\logs\report.json: The system cannot find the path specified. (os error 3) ``` (OS messages translated; the machine's Windows is not English.) **Regression run** main: ``` xcl-smoke v1 commit: e1d84b7d9153f86a97d2ec5d209d196046fc0bea gpu: NVIDIA GeForce RTX 4070 title: RetailTitle seconds: 60 exit: 0x0 frames shown: 1604 (PresentX 1604) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 16934 MB ``` this PR: ``` xcl-smoke v1 commit: c095117e147382d8b2fb2f3bc527e89569b76a92 gpu: NVIDIA GeForce RTX 4070 title: RetailTitle seconds: 60 exit: 0x0 frames shown: 1555 (PresentX 1555) presents per 2 s (last 3): 60 60 45 device removals: 0 crashes: 0 peak commit: 17850 MB ``` **Not tested** - A read-only or roamed profile and a full disk as such: the failure was made with a file in place of the logs folder. - AMD, other NVIDIA GPUs and drivers. **AI use** - Claude Code (Claude Opus 5.5) wrote the change and the tests, ran them, the runs above and the smoke pair on my machine, and drafted this description; I checked it. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
log::init dropped the errors of create_dir_all and File::create, and
report::write_final the error of fs::write. With an unwritable diagnostics
folder (a read-only or roamed profile, a folder of another account, a full
disk) a run looked normal, the console showed a `Log:` path that did not
exist, and there was nothing to attach to a bug report. xlog_* cannot carry
the message: the log is what failed, and its stderr echo is off unless the
title sets log_to_stderr.

Each failure is now one `xcl: cannot ... <path>: <OS error>` line on stderr
(the report's once per process, as it is written on several exit paths);
the run goes on as before. The two writes move into small helpers (log::open,
report::save) that the new unit tests drive with a path under an existing
file.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 05:25:45 +00:00
Author
Owner

@⁠nnonno91 on GitHub · 2026-11-25 15:00 UTC · original

Independent Windows check of cb29250d8a5197a1f40ab96ab173e84564a7235d with a log file and a report file blocked independently.

Tested

  • Windows 11 25H2 build 26200.9974, Ryzen 7 9800X3D, Rust 1.100.0 MSVC, SDK DXC/DXIL 1.8.2502.11, unoptimized profile. Radeon(TM) Graphics driver 32.0.21042.62. cargo build --locked --workspace passed.
  • Temporarily extended the bundled title fixture to hold an exclusive Windows file handle on xcl.log or report.json in its own temporary data root. This prevented the launcher's rotation from clearing the obstruction. Ran cargo test --locked -p xcl --test e2e test_title_draws_with_a_root_signature_under_the_debug_layer -- --exact --nocapture --test-threads=1 with XCL_NETWORK=0 and XCL_ADAPTER=AMD Radeon.
  • Control: both artifacts were written, no warnings. Locked report: one report warning, normal log written. Locked log: one log warning, valid JSON report written. Each warning named the blocked file and Windows error 32, and the locked file's sentinel bytes were preserved.
  • All three title processes exited 0, and the test harness reported 1 passed, 0 failed, 0 ignored and no skips per run. The fixture edit was restored.

Not tested

Full disk, a retail title, the parent revision and the full workspace suite.

AI use

OpenAI Codex (GPT-6.2 Sol) adapted the temporary fixture, ran the checks and wrote this report.

**@⁠nnonno91** on GitHub · 2026-11-25 15:00 UTC · [original](https://github.com/xcl-dev/xcl/pull/2286#issuecomment-7166149249) Independent Windows check of `cb29250d8a5197a1f40ab96ab173e84564a7235d` with a log file and a report file blocked independently. **Tested** - Windows 11 25H2 build 26200.9974, Ryzen 7 9800X3D, Rust 1.100.0 MSVC, SDK DXC/DXIL 1.8.2502.11, unoptimized profile. Radeon(TM) Graphics driver 32.0.21042.62. `cargo build --locked --workspace` passed. - Temporarily extended the bundled title fixture to hold an exclusive Windows file handle on `xcl.log` or `report.json` in its own temporary data root. This prevented the launcher's rotation from clearing the obstruction. Ran `cargo test --locked -p xcl --test e2e test_title_draws_with_a_root_signature_under_the_debug_layer -- --exact --nocapture --test-threads=1` with `XCL_NETWORK=0` and `XCL_ADAPTER=AMD Radeon`. - Control: both artifacts were written, no warnings. Locked report: one report warning, normal log written. Locked log: one log warning, valid JSON report written. Each warning named the blocked file and Windows error 32, and the locked file's sentinel bytes were preserved. - All three title processes exited 0, and the test harness reported 1 passed, 0 failed, 0 ignored and no skips per run. The fixture edit was restored. **Not tested** Full disk, a retail title, the parent revision and the full workspace suite. **AI use** OpenAI Codex (GPT-6.2 Sol) adapted the temporary fixture, ran the checks and wrote this report.
Author
Owner

@⁠DavidM1911 on GitHub · 2026-11-25 17:17 UTC · original

Verification on RTX 3060 Ti (Windows 11), branch merged with current main:

  • cargo test -p xcl --lib: all passed, 0 failed, ~26 ignored. (Intermittent single-test flake / 0xc0000005 abort under parallel scheduling — tracked in #1978; clean on single-threaded rerun.)

Thanks!

**@⁠DavidM1911** on GitHub · 2026-11-25 17:17 UTC · [original](https://github.com/xcl-dev/xcl/pull/2286#issuecomment-7169288367) Verification on RTX 3060 Ti (Windows 11), branch merged with current `main`: - `cargo test -p xcl --lib`: all passed, 0 failed, ~26 ignored. (Intermittent single-test flake / 0xc0000005 abort under parallel scheduling — tracked in #1978; clean on single-threaded rerun.) Thanks!
Author
Owner

@⁠DavidM1911 on GitHub · 2026-11-26 08:15 UTC · original

Re-verification on RTX 3060 Ti (Windows 11), new head merged with current main:

  • cargo test -p xcl --lib: 1 failure under parallel scheduling; clean on --test-threads=1 rerun (1312 passed, 0 failed, 27 ignored, 82s). Intermittent single-test flake — tracked in #1978.

Thanks!

— Devin

**@⁠DavidM1911** on GitHub · 2026-11-26 08:15 UTC · [original](https://github.com/xcl-dev/xcl/pull/2286#issuecomment-7186376697) Re-verification on RTX 3060 Ti (Windows 11), new head merged with current `main`: - `cargo test -p xcl --lib`: 1 failure under parallel scheduling; clean on `--test-threads=1` rerun (**1312 passed, 0 failed, 27 ignored**, 82s). Intermittent single-test flake — tracked in #1978. Thanks! — Devin
Author
Owner

@⁠luckyteagirl on GitHub · 2026-11-26 08:51 UTC · original · reviewed

At exact head c095117e (base e1d84b7, current main b49be18), the two new error-reporting paths can turn the promised recoverable log/report I/O failure into a panic if stderr itself cannot be written. This is a source-derived review; I did not run a closed-pipe fixture.

log::init uses eprintln! after open(p) fails, and report::write_final does the same after save() fails. Rust documents that eprintln! panics on a stderr write error. A valid redirected stderr pipe whose reader has closed is one such case. The new tests call only open/save, so they do not cover the outer nonfatal path. This matters most when the log and report paths are already unwritable, since stderr may be the only remaining diagnostic channel.

Could both paths use a best-effort stderr write and discard its error, as the runner already does for SKIPPED notices? A subprocess with a valid but broken stderr pipe, or a small injected writer that returns BrokenPipe, could assert that the production warning path returns without unwinding while retaining the once-only report guard.

AI assistance: two GPT-6.2 Sol agents checked the source and Windows stderr behavior; GPT-6.2 Astra verified the exact-head paths and official Rust documentation.

**@⁠luckyteagirl** on GitHub · 2026-11-26 08:51 UTC · [original](https://github.com/xcl-dev/xcl/pull/2286#pullrequestreview-6070988420) · **reviewed** At exact head `c095117e` (base `e1d84b7`, current main `b49be18`), the two new error-reporting paths can turn the promised recoverable log/report I/O failure into a panic if stderr itself cannot be written. This is a source-derived review; I did not run a closed-pipe fixture. `log::init` uses `eprintln!` after `open(p)` fails, and `report::write_final` does the same after `save()` fails. [Rust documents that `eprintln!` panics on a stderr write error](https://doc.rust-lang.org/std/macro.eprintln.html#panics). A valid redirected stderr pipe whose reader has closed is one such case. The new tests call only `open`/`save`, so they do not cover the outer nonfatal path. This matters most when the log and report paths are already unwritable, since stderr may be the only remaining diagnostic channel. Could both paths use a best-effort stderr write and discard its error, as the runner already does for `SKIPPED` notices? A subprocess with a valid but broken stderr pipe, or a small injected writer that returns `BrokenPipe`, could assert that the production warning path returns without unwinding while retaining the once-only report guard. AI assistance: two GPT-6.2 Sol agents checked the source and Windows stderr behavior; GPT-6.2 Astra verified the exact-head paths and official Rust documentation.
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/2286/head:github-bot/gh-2286'
git switch 'github-bot/gh-2286'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-2286'
git switch 'github-bot/gh-2286'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-2286'
git switch 'github-bot/gh-2286'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-2286'
git switch 'main'
git merge --squash 'github-bot/gh-2286'
git switch 'main'
git merge --ff-only 'github-bot/gh-2286'
git switch 'main'
git merge 'github-bot/gh-2286'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.