Skip to content

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

Open
Creaa wants to merge 1 commit into
xcl-dev:mainfrom
Creaa:diagnostics/report-write-failures
Open

Creaa wants to merge 1 commit into
xcl-dev:mainfrom
Creaa:diagnostics/report-write-failures

Conversation

@Creaa

@Creaa Creaa commented Nov 25, 2026

Copy link
Copy Markdown

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: 1252 passed, 0 failed, 46 ignored. SKIPPED: the wave64 GPU tests (no wave64), the direct-DXIL f16/f32 cases refused per gpu: direct RDNA2 -> DXIL backend (no HLSL / DXC), behind XCL_DIRECT_DXIL #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: 1a0bbe3a2ba91ea8f5b6fc29130a053868d3c9e6
gpu: NVIDIA GeForce RTX 4070
title: RetailTitle
seconds: 60
exit: 0x0
frames shown: 1533 (PresentX 1533)
presents per 2 s (last 3): 60 60 45
device removals: 0
crashes: 0
peak commit: 18347 MB

this PR:

xcl-smoke v1
commit: cb29250d8a5197a1f40ab96ab173e84564a7235d
gpu: NVIDIA GeForce RTX 4070
title: RetailTitle
seconds: 60
exit: 0x0
frames shown: 1387 (PresentX 1387)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 15620 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

…cl-dev#2277)

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 <noreply@anthropic.com>
@throny throny added the off-goal Does not bear on the current goal (world loading); waits until it is reached label Nov 25, 2026
@nnonno91

Copy link
Copy Markdown

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.

@DavidM1911

Copy link
Copy Markdown
Contributor

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

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

off-goal Does not bear on the current goal (world loading); waits until it is reached

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Diagnostics: a failed log or report write is silently ignored, so a run can end with nothing to attach

4 participants