Diagnostics: a failed log or report write is silently ignored, so a run can end with nothing to attach #2277
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
goal:world-load
good first issue
help wanted
invalid
keep-open
off-goal
question
stale
test-only
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/xcl-dev--xcl#2277
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@itsonewi on GitHub · 2026-11-25 12:03 UTC · original
Summary
The two files every bug report is built on are written best-effort, and a failure says nothing at all.
crates/xcl/src/log.rs(1a0bbe3),init():If
create_dir_allorFile::createfails,FILEstaysNoneand everyxlog_*line afterwards is dropped bywrite()(if let Some(f) = g.as_mut()). The run continues,launcher.rshas already printedLog: <path>to the console, and that path does not exist.crates/xcl/src/report.rs,write_final():Same shape: the error is dropped, and the exit code is unchanged, so nothing distinguishes "the game failed" from "the diagnostics failed".
Why it matters
.github/ISSUE_TEMPLATE/game.ymlopens with "Every run writes a report and a log to%LOCALAPPDATA%\XCL\<title>\logs\… please attach both", and makesreport.jsonandxcl.logrequired fields. A user whose%LOCALAPPDATA%\XCL\<title>\cannot be written - a read-only or roamed profile, a folder left by a different account after a reinstall or a Windows reset, a full disk - gets a normal-looking run, two missing files, and no message to explain either. The natural next step is a bug report that cannot be filled in, or the conclusion that XCL crashed silently.scripts/smoke.ps1then fails atGet-Content $logwith a path error, not with "XCL could not open its log", which is the one line that would identify the cause.Suggested fix
One unconditional message per site, naming the path and the OS error:
and the same for
boot.report_path(). It has to beeprintln!rather thanxlog_error!:write()does echo Error/Warn to stderr independently ofFILE, but only whenECHOis on - andECHOcomes from the title'slog_to_stderr, which is exactly the setting a user with a broken log path has no reason to have enabled. The game should keep running either way; the point is that the failure is visible once.Not tested
1a0bbe3. The failure needs an unwritable diagnostics folder, which was not reproduced on this machine.AI use
crates/xcl/src/log.rs,crates/xcl/src/report.rs,crates/xcl/src/host.rsand.github/ISSUE_TEMPLATE/game.ymlon1a0bbe3and wrote this report; the human account checked each file before opening it.github-bot referenced this issue2026-11-26 05:25:45 +00:00
@Creaa on GitHub · 2026-11-25 12:15 UTC · original
Taking this: one
eprintln!naming the path and the OS error wherelog::initcannot create the folder or the file and wherereport::write_finalcannot writereport.json; the run keeps going. Unit tests point both at a path under an existing file and check the failure is reported, not dropped.AI use: Claude Code (Claude Opus 5.5) drafted this.
@itsonewi on GitHub · 2026-11-25 15:52 UTC · original
This covers what the issue reports:
open()names the path and the OS error on stderr,report::save()names the report path, and both have tests. One scope note, not a blocker either way.The mid-run write path is still silent:
log::write()doeslet _ = f.write_all(line.as_bytes())(andlet _ = f.flush()for warn and above). So a disk that fills, a file the title's antivirus locks, or a log deleted out from under XCL after the first line still loses lines with no message, while the first line of the log was fine andLog: <path>was printed. That is the same class the issue is about, but it is a different call site and a per-line message would be wrong; if you would rather keep this PR to open-time and report-time failures, the issue's title just needs to say so, and the write path is a separate one-line follow-up (write_allfailure -> onexlog_error!-freeeprintln!, once, likeWRITE_FAILED).Measured on the patch only; I did not build or run it.
AI use: read the patch and the current
mainoflog.rsthrough the GitHub API; no code was written by an agent here and no build was run.