WIP: [pr-feature] F1 ZIP LOGS FOR A BUG REPORT and darner zip-logs: one zip of the newest logs, user folder hidden #146
Loading…
Reference in a new issue
No description provided.
Delete branch "Jesper-A/Darner:up-log-zip"
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?
Contributor role (optional)
What it changes
Players who report a problem paste or attach play logs of 8 MB and more. Those are too big for paste sites, and they contain the player's user folder (
C:\Users\<name>\...). This adds one zip that fixes both: it is small, it attaches straight to Fluxer or to an issue, and the user folder and user name are hidden in it.New for the player:
darner-logs-<date>-<time>.zipinreports(in%LOCALAPPDATA%\darner, or inDARNER_HOME) and opens File Explorer with the zip picked. The zip is made on a thread of its own, so the game keeps drawing.darner.exe zip-logs, the same thing outside the game (for example after a crash). It prints what went into the zip and where it is (and "No log file is in the zip." if no log made it).What is in the zip: the newest play log (this run's log if there is one), and per title
crashes.logand the newest*.crash.log. Nothing else: no saves, settings, shaders or game files. A log over 200 MB goes in as its last 64 MB (from a whole line when it has one), and aREADME.txtin the zip says so. The zip is deflate level 9 and written under a.partname first, so a half-written zip is never seen.What is hidden: in the zipped copies, the user's folder (
%USERPROFILE%) is written as%USERPROFILE%, andUsers\<name>without the drive asUsers\%USERNAME%. It matches\,/and\\, in any case, and only a whole name (Sammyis notSam). The logs on the PC are not changed. No log line is known to write the machine name; the one place that could (crates/darner-hle/src/modules/net.rs,once) prints<pc>.Code: the zip writer of
save_share.rsmoves to a newzip.rs, re-indented, with a newwrite_packed(.., level);writecalls it at level 6, sosave_shareoutput is the same.save_share::nowanddos_nowbecomepub(crate), and the newlog_zip.rsuses them.There is no
DARNER_*switch: it is an action the player starts, not a changed default. Nothing runs unless the player picks the row or runs the subcommand.Credit: ported from our own fork's commit
3a0f490a3(pr4-log-zip); same author as this PR.Refs: none. There is no issue for this; none was opened just to fill the line.
How it was tested
31ea50416(on top ofcdc8c755a, which is onmain57dea7f23). The 63-test run below was oncdc8c755a; on31ea50416I re-ran only thelog_ziplib tests (5 passed) and the workspace clippy.cargo test --locked -p darner-gpu -j 4 --lib -- log_zip zip save_share host::menu: 63 passed, 2 ignored.cargo clippy --workspace --all-targets --locked -j 4 -- -D warnings(gate 1): clean (also on31ea50416).cargo xtask policy: 555 files ok.cargo clippy ... --all-features ...) and gate 3 (cargo test --workspace --locked, the whole workspace) were not run on this commit. Only the narrower test filter above ran.darner.exe zip-logs.log_zip.rs(the #98 quota remark, thespam.ymlmention and the spam-word test).Spec dependence
Likely general. It reads files and writes a zip; it does not touch the GPU, shaders or the title's memory, so it should not depend on the GPU, driver or console profile. It was written on a PC with an RTX 2070 SUPER (Windows 11); the unit tests do not need a GPU. Untested elsewhere: other Windows versions, a
LOCALAPPDATAon a network or redirected drive, and a user folder whose name has non-ASCII letters (the match is on the bytes of the name; the test names are ASCII).Checklist
main.docs/asset-policy.md. (cargo xtask policy: 555 files ok.)Checked for overlap
git merge-tree --write-tree) of this commit against each PR head:main.rs), #130 (main.rs), #118 and #110 (README), #59, #37, #36, #34.apps/darner/src/main.rs, where both add to theCommand::UpscalerCheckarea. It is a one-line resolution for whichever merges second.mainon their own, and nothing is added by this PR: #48, #9, #10, #12, #14, #15, #16, #17, #18.Drafted with AI assistance (Claude Code).
WIP: [pr-feature] F1 ZIP LOGS FOR A BUG REPORT and darner zip-logs: one zip of the newest logs, user folder hiddento [pr-feature] F1 ZIP LOGS FOR A BUG REPORT and darner zip-logs: one zip of the newest logs, user folder hiddenTested
cdc8c755on Windows (release, --locked): build OK;cargo test -p darnergreen (144 passed, 1 ignored); all 5 new log_zip tests pass.darner zip-logswrote reports\darner-logs-20261204-010416.zip (1,607 KB): newest play log (11.9 MB -> 1.64 MB packed) + README.txt. In the zip: 0 hits for the user name or C:\Users<user> (21 paths as %USERPROFILE%); the logs on disk are unchanged. No crashes.log/crash log existed here, so those entries were only covered by unit tests. F1 menu path not tested (no game launch). One unrelated watch:: test flaked in the full parallel darner-gpu run and passes in isolation.Drafted with AI assistance (OpenCode).
One case the existing oversized-file test exposes on
cdc8c755:log_zip::write()skipsdarner-play-big.logand the ZIP only containsREADME.txt.log_zip::make()reports names from the original selection, so the CLI would printin the zip: darner-play-big.logand offer a ZIP with no log. Couldwrite()return the log names actually written and have CLI/F1 signal explicitly when the list is empty? The existing oversized-file test can assert the returned names as well. This is from source review of the test and its callers. Writer and returned names · TestReproduced the oversized-file case on
cdc8c755(Windows): a temp DARNER_HOME with a 201 MiB darner-play-big.log (over MOST = 200 MiB), thendarner zip-logsprintsin the zip: darner-play-big.logbut the zip holds only README.txt (75 bytes, the left-out note). Confirmed in code: write() skips the oversized file (log_zip.rs:157) while make() returns the original selection (log_zip.rs:192). Returning the written names from write() and having CLI/F1 say when the list is empty, with the oversized-file test asserting the returned names, would cover it.Drafted with AI assistance (OpenCode).
Thanks @tyr0nsur for the review, and thanks m3m3dub5 for the test report and the repro.
What was wrong:
write()skipped any log over the 200 MB cap, so the ZIP held only README.txt, andmake()returned the names it was given instead of the names written. The CLI could printin the zip: darner-play-big.logfor a ZIP with no log. You were right.New commit
31ea50416(on top ofcdc8c755):write()returns the names it actually put in the ZIP, andmake()passes them on. This is your suggestion. The oversized test now asserts the returned names.Gates run: the
log_ziplib tests (5 passed) andcargo clippy --workspace --all-targets --locked -- -D warnings(clean). Not run:--all-featuresclippy,cargo test --workspace, the CLI on a real oversized file, F1 in game.Drafted with AI assistance (Claude Code).
[pr-feature] F1 ZIP LOGS FOR A BUG REPORT and darner zip-logs: one zip of the newest logs, user folder hiddento WIP: [pr-feature] F1 ZIP LOGS FOR A BUG REPORT and darner zip-logs: one zip of the newest logs, user folder hiddenRe-tested
31ea504with the same repro: fixed. A 201 MiB darner-play-big.log is now kept as its tail in the zip (README: 'only its last 64 MB is here, from a whole line when it has one'), the CLI names match the zip contents, and with a marker file the entry contains END-MARKER but not START-MARKER. The small-log case is unchanged (named and included).Drafted with AI assistance (OpenCode).
Second-opinion review: the oversized-log fix in
31ea50416is right (tail of 64 MB from a whole line, the README in the zip says so,write()returns what it wrote, the CLI says when no log is in), and a tester confirmed it. Before merging:zip_logsalways shows "FILE EXPLORER OPENS WITH THE ZIP", even when the zip failed or holds no log; the failure only goes to the log file. Show it on screen.C:\Users\NAME~1) and the user name outside a path are not replaced. Say "the user folder in paths" instead of "the user name".Optional: in game, a log just under 200 MB is read whole and copied again by
hide_profile, a few hundred MB extra in the game process for a moment. A lower in-game cap would avoid it. The F1 label and CLI help are English only.View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.