[pr-feature][startup][shaders] Preload window: say what step 3 is doing, and keep a log file #215

Manually merged
TrustNo1 merged 0 commits from Jesper-A/Darner:up-preload-step3-progress into main 2026-12-04 22:17:09 +00:00
Collaborator

Refs #128

Contributor role (optional)

  • Fluxer ID:

What it changes

  • The problem on main: step 3 of the preload window ("Storing them for loading") can look stuck. A screenshot reported to us on the community server showed "0 of 822 pipelines (0 %)" with nothing moving, and the last save at the end of the step prints nothing. The step-3 hint also says "Play now keeps what is built", which is not true for step 3: its pipelines are written to the library only when the step ends (unless DARNER_PRELOAD_SAVE_EVERY is set). Seen in use, not measured; the rest is read from the code.
  • Refs #128 only: this is the "say what it is doing" part, not a fix of the "starts over" loop (that is #140, #142, #153 and #147).

What it does, all in apps/darner/src/warm.rs, apps/darner/src/preload_ui.rs, locales/en.json and two small pub(crate) changes (play.rs, warm.rs):

  • Progress line (warm.rs): N of M in the library, T s is printed for the first pipeline, then every 2 s or every 1 % of the list, whichever comes first (was every 500 pipelines in into_library and every 250 in fill_library). New log-style lines opening the pipeline library and saving the pipeline library are printed before the open and before the final save.
  • Window (preload_ui.rs):
    • an activity line: opening the saved library, making pipelines, saving it, or a save skipped because another Darner held the library's writer lock;
    • the time spent in the step, e.g. "Step 3 of 3: Storing them for loading (2:05 in this step)";
    • a "Still working: no new count for N s" note after 60 s with no count change, shown only when compile memory lines have been seen (so it is not shown when nothing is compiling);
    • the step-3 hint now reads "Play now keeps steps 1 and 2. Step 3 is kept only when it finishes." The old text stays when DARNER_PRELOAD_SAVE_EVERY is set;
    • the window is 44 px taller to fit the new lines.
  • Log file: the preload child now writes <home>\logs\darner-preload-<stamp>-<pid>.log (its printed lines and its tracing; the 5 newest are kept). The window shows the path and prints Log: <path> when the preload ends, so a player can attach it to a report. If the folder cannot be made, the preload logs to the console only, as before.

Behaviour changes, stated plainly

  • There is no new switch. This is UI and log behaviour that is on by default for everyone who gets the preload window.
  • The preload child now writes a log file (it wrote none before; the window removed DARNER_LOG_FILE for it).
  • The window now pipes the child's stderr (it only read stdout before) and echoes it to its own console.
  • The writer-lock line ("could not acquire the writer lock") only appears after the library's 30 s wait for the lock has failed, so the "save skipped" activity shows up that late.
  • The final N of M in the pipeline library in T s line now counts as step 3; before it was parsed as step 2.
  • New strings are in locales/en.json only; zh-CN falls back to English (not translated here).
  • The progress line is printed more often: at most one line per 2 s, or per 1 % of the list when that comes first. The longer the preload, the more lines in the log file.

Whether this needs the maintainer's OK: upstream's template asks "Changes a default" and asks for an A/B result for a change of a default. This is a change of what is shown and logged, not of how pipelines are made, so there is no speed claim. I put "yes" below and ask the maintainer to say whether he wants it behind a switch (for example, only the log file) or on by default.

How it was tested

  • Tested revision: branch up-preload-step3-progress @ 3278a86ae, on top of main ad070f073 (main has moved to f3840d73d since; a trial merge with it had no conflicts).
  • Commands and results (all on 3278a86ae):
    • cargo test -p darner --bin darner -- preload_ui warm::tests: 30 passed, 1 ignored.
    • cargo clippy --workspace --all-targets --locked -- -D warnings: clean.
    • cargo clippy --workspace --all-targets --all-features --locked -- -D warnings: clean.
    • cargo test --workspace --locked: all passed except 2 darner-gpu watch tests, which passed when run alone; a full cargo test -p darner-gpu --lib rerun gave 1753 passed.
    • cargo xtask policy: ok.
  • Changes a default: yes, for everyone who sees the preload window: what the window shows, and that the preload writes a log file. No pipeline is made differently.
  • A/B result: not applicable, no speed claim. Not measured: the cost of the extra progress lines and of the stderr pipe.
  • Gates run on that revision: all three (the two clippy runs and the workspace test), with the 2 flaky-when-parallel watch tests noted above. There is no CI.
  • Gameplay: not run in game. The unit tests cover the line parsing, the throttle, the activity text, the still-working note and the hint choice.
  • Shader wave sizes tested: not relevant.
  • Hardware dependence: see "Spec dependence".
  • Coverage gaps, to check in game (this is why it is WIP):
    1. The step-3 window shows the activity line and the time in the step, and the count moves every 2 s or 1 %.
    2. "Opening" shows before the first count, and "Saving" shows during the final save.
    3. A pipeline that takes over 60 s with no count change shows "Still working", and only when compile memory lines are in the log.
    4. The step-3 hint shows the new text without DARNER_PRELOAD_SAVE_EVERY, and the old text with it.
    5. The log file exists at the path shown, holds the preload's lines and its tracing, and only the 5 newest are kept.
    6. The window text fits (the taller window, the long log path ellipsis), especially with a long home path.
    7. A save skipped by the writer lock shows its line (needs a second Darner holding the library).
    8. The end of the preload prints Log: <path>; Play now and Quit still end the child normally with stderr piped.
    9. Not tested in zh-CN (falls back to English).

Spec dependence

  • Likely general (helps any card): the window text, the progress rate and the log file do not depend on the GPU.
  • May depend on our specs: how long step 3 stands without a count (the "Still working" note) depends on the CPU and RAM; the picture of "no count for minutes" came from a screenshot reported to us, not from our PC. Our PC is an RTX 2070 SUPER 8 GB (Turing), Windows 11, Ryzen 7 5800X, 32 GB.
  • Untested elsewhere: everything in game, on any hardware. Only unit tests ran (on the PC above).

Checklist

  • I ran this change in the game, or say below why it can't be (docs, tests only). Not yet: unit tests only, see "Coverage gaps". Kept as WIP until a game run.
  • This PR contains one change based on main. (Branch is on ad070f073, not the latest main; one commit.)
  • The diff follows docs/asset-policy.md. (Text only: 4 files, +320 -41; no game data, no dumps, no screenshots.)
  • I recorded this PR's dependencies below.
    • Depends on: none

Checked for overlap

  • I searched the open pull requests for the same issue and for the files this touches.
  • Related PRs:
    • #210 (tragice, WIP) also changes preload_ui.rs, translate.rs and locales/en.json: step-1 progress by bytes, and F1 menu presets. Different change (step 1, not step 3); conflicts in preload_ui.rs and locales/en.json are likely. Whichever merges second will rebase.
    • #140 (resume mark, WIP) also touches preload_ui.rs, play.rs and locales/en.json. #142 (skip done files, WIP) touches only translate.rs and the shader cache, so no file overlap. #153 touches play.rs. #140 and #142 currently show as not mergeable; the maintainer has said #140 merges after the rebase.
    • #147 (merged): DARNER_PRELOAD_SAVE_EVERY; this PR reads it only to choose the hint text.
    • #184 (closed): the progress line before each title file (step 1); not changed here.
  • Replaces or overlaps: none found that does the step-3 activity line, the hint or the preload log file (searched "step 3 hint", "pipeline library progress", "preload log").

This change was made with AI assistance (Claude Code).

Refs #128 ## Contributor role (optional) - Fluxer ID: ## What it changes - The problem on main: step 3 of the preload window ("Storing them for loading") can look stuck. A screenshot reported to us on the community server showed "0 of 822 pipelines (0 %)" with nothing moving, and the last save at the end of the step prints nothing. The step-3 hint also says "Play now keeps what is built", which is not true for step 3: its pipelines are written to the library only when the step ends (unless `DARNER_PRELOAD_SAVE_EVERY` is set). Seen in use, not measured; the rest is read from the code. - Refs #128 only: this is the "say what it is doing" part, not a fix of the "starts over" loop (that is #140, #142, #153 and #147). What it does, all in `apps/darner/src/warm.rs`, `apps/darner/src/preload_ui.rs`, `locales/en.json` and two small `pub(crate)` changes (`play.rs`, `warm.rs`): - **Progress line (`warm.rs`):** `N of M in the library, T s` is printed for the first pipeline, then every 2 s or every 1 % of the list, whichever comes first (was every 500 pipelines in `into_library` and every 250 in `fill_library`). New log-style lines `opening the pipeline library` and `saving the pipeline library` are printed before the open and before the final save. - **Window (`preload_ui.rs`):** - an activity line: opening the saved library, making pipelines, saving it, or a save skipped because another Darner held the library's writer lock; - the time spent in the step, e.g. "Step 3 of 3: Storing them for loading (2:05 in this step)"; - a "Still working: no new count for N s" note after 60 s with no count change, shown only when `compile memory` lines have been seen (so it is not shown when nothing is compiling); - the step-3 hint now reads "Play now keeps steps 1 and 2. Step 3 is kept only when it finishes." The old text stays when `DARNER_PRELOAD_SAVE_EVERY` is set; - the window is 44 px taller to fit the new lines. - **Log file:** the preload child now writes `<home>\logs\darner-preload-<stamp>-<pid>.log` (its printed lines and its tracing; the 5 newest are kept). The window shows the path and prints `Log: <path>` when the preload ends, so a player can attach it to a report. If the folder cannot be made, the preload logs to the console only, as before. ### Behaviour changes, stated plainly - There is **no new switch**. This is UI and log behaviour that is on by default for everyone who gets the preload window. - The preload child now **writes a log file** (it wrote none before; the window removed `DARNER_LOG_FILE` for it). - The window now **pipes the child's stderr** (it only read stdout before) and echoes it to its own console. - The **writer-lock line** ("could not acquire the writer lock") only appears after the library's 30 s wait for the lock has failed, so the "save skipped" activity shows up that late. - The final `N of M in the pipeline library in T s` line now counts as **step 3**; before it was parsed as step 2. - New strings are in `locales/en.json` only; zh-CN falls back to English (not translated here). - The progress line is printed more often: at most one line per 2 s, or per 1 % of the list when that comes first. The longer the preload, the more lines in the log file. Whether this needs the maintainer's OK: upstream's template asks "Changes a default" and asks for an A/B result for a change of a default. This is a change of what is shown and logged, not of how pipelines are made, so there is no speed claim. I put "yes" below and ask the maintainer to say whether he wants it behind a switch (for example, only the log file) or on by default. ## How it was tested - Tested revision: branch `up-preload-step3-progress` @ 3278a86ae, on top of `main` ad070f073 (main has moved to f3840d73d since; a trial merge with it had no conflicts). - Commands and results (all on 3278a86ae): - `cargo test -p darner --bin darner -- preload_ui warm::tests`: 30 passed, 1 ignored. - `cargo clippy --workspace --all-targets --locked -- -D warnings`: clean. - `cargo clippy --workspace --all-targets --all-features --locked -- -D warnings`: clean. - `cargo test --workspace --locked`: all passed except 2 `darner-gpu` watch tests, which passed when run alone; a full `cargo test -p darner-gpu --lib` rerun gave 1753 passed. - `cargo xtask policy`: ok. - Changes a default: yes, for everyone who sees the preload window: what the window shows, and that the preload writes a log file. No pipeline is made differently. - A/B result: not applicable, no speed claim. Not measured: the cost of the extra progress lines and of the stderr pipe. - Gates run on that revision: all three (the two clippy runs and the workspace test), with the 2 flaky-when-parallel watch tests noted above. There is no CI. - Gameplay: **not run in game.** The unit tests cover the line parsing, the throttle, the activity text, the still-working note and the hint choice. - Shader wave sizes tested: not relevant. - Hardware dependence: see "Spec dependence". - Coverage gaps, to check in game (this is why it is WIP): 1. The step-3 window shows the activity line and the time in the step, and the count moves every 2 s or 1 %. 2. "Opening" shows before the first count, and "Saving" shows during the final save. 3. A pipeline that takes over 60 s with no count change shows "Still working", and only when `compile memory` lines are in the log. 4. The step-3 hint shows the new text without `DARNER_PRELOAD_SAVE_EVERY`, and the old text with it. 5. The log file exists at the path shown, holds the preload's lines and its tracing, and only the 5 newest are kept. 6. The window text fits (the taller window, the long log path ellipsis), especially with a long home path. 7. A save skipped by the writer lock shows its line (needs a second Darner holding the library). 8. The end of the preload prints `Log: <path>`; Play now and Quit still end the child normally with stderr piped. 9. Not tested in zh-CN (falls back to English). ## Spec dependence - Likely general (helps any card): the window text, the progress rate and the log file do not depend on the GPU. - May depend on our specs: how long step 3 stands without a count (the "Still working" note) depends on the CPU and RAM; the picture of "no count for minutes" came from a screenshot reported to us, not from our PC. Our PC is an RTX 2070 SUPER 8 GB (Turing), Windows 11, Ryzen 7 5800X, 32 GB. - Untested elsewhere: everything in game, on any hardware. Only unit tests ran (on the PC above). ## Checklist - [ ] I ran this change in the game, or say below why it can't be (docs, tests only). Not yet: unit tests only, see "Coverage gaps". Kept as WIP until a game run. - [x] This PR contains one change based on `main`. (Branch is on ad070f073, not the latest main; one commit.) - [x] The diff follows `docs/asset-policy.md`. (Text only: 4 files, +320 -41; no game data, no dumps, no screenshots.) - [x] I recorded this PR's dependencies below. - Depends on: none ## Checked for overlap - [x] I searched the open pull requests for the same issue and for the files this touches. - Related PRs: - #210 (tragice, WIP) also changes `preload_ui.rs`, `translate.rs` and `locales/en.json`: step-1 progress by bytes, and F1 menu presets. Different change (step 1, not step 3); conflicts in `preload_ui.rs` and `locales/en.json` are likely. Whichever merges second will rebase. - #140 (resume mark, WIP) also touches `preload_ui.rs`, `play.rs` and `locales/en.json`. #142 (skip done files, WIP) touches only `translate.rs` and the shader cache, so no file overlap. #153 touches `play.rs`. #140 and #142 currently show as not mergeable; the maintainer has said #140 merges after the rebase. - #147 (merged): `DARNER_PRELOAD_SAVE_EVERY`; this PR reads it only to choose the hint text. - #184 (closed): the progress line before each title file (step 1); not changed here. - Replaces or overlaps: none found that does the step-3 activity line, the hint or the preload log file (searched "step 3 hint", "pipeline library progress", "preload log"). This change was made with AI assistance (Claude Code).
A member's screenshot showed "0 of 822 pipelines (0 %)" with no sign of
life in step 3 ("Storing them for loading").

- warm: the "N of M in the library" line is printed by time (every 2 s)
  or every hundredth of the list, whichever comes first, in both
  into_library and fill_library (was every 500 and 250 pipelines), plus
  "opening the pipeline library" and "saving the pipeline library" lines.
- preload window: the time spent in the step; a line naming the activity
  (opening the saved library, making pipelines, saving it, a save skipped
  because another Darner held the library's writer lock); a "still
  working" note after 60 s with no new count while compile memory lines
  show the compiles go on. The window now reads the preload's stderr too.
- The step-3 hint said Play now keeps what is built; step 3's pipelines
  are written only when it ends (unless DARNER_PRELOAD_SAVE_EVERY).
- The preload's log (its lines and its tracing) goes to
  <home>\logs\darner-preload-<time>-<pid>.log (five newest kept) instead
  of nowhere; the path is in the window and printed when it ends.

New strings are in locales/en.json only; zh-CN falls back to English.

This change was made with AI assistance (Claude Code).
Owner

Review of 3278a86a (read only, not built or run):

  • The progress throttle is right: the first line at once, then every 2 s or 1 %, behind one mutex across the workers. Each line keeps the N of M in the library form, so the window's parser still reads it. The test covers the cases.
  • saving the pipeline library before the final save fixes the silent end of step 3. The new step-3 hint is honest about what Play now keeps.
  • The log file is safe. The child's logger opens DARNER_LOG_FILE with create + append (darner-core logging.rs), and the parent appends the printed lines to the same file. On Windows both handles share writes, so neither truncates the other. Piping stderr and echoing it keeps the console as it was. Pruning to the five newest by name works because the stamp sorts by time.
  • Merges cleanly with main, but conflicts with #140 in preload_ui.rs. Whichever goes second needs a rebase. #140 also reads the final ... in the pipeline library in ... s line, which this PR leaves unchanged.
  • Please add the new keys to locales/zh-CN.json (the five preload.activity.*, preload.log, preload.play_now_description_store, preload.progress.step_time), as #26 and later PRs did, so Chinese players don't see English lines in a Chinese window.
  • Behaviour on by default: a new log file per preload and a taller window. Both are harmless, and the description says so.

Ready to merge once the WIP tag is dropped and the zh-CN keys are in.

Review of 3278a86a (read only, not built or run): - The progress throttle is right: the first line at once, then every 2 s or 1 %, behind one mutex across the workers. Each line keeps the `N of M in the library` form, so the window's parser still reads it. The test covers the cases. - `saving the pipeline library` before the final save fixes the silent end of step 3. The new step-3 hint is honest about what Play now keeps. - The log file is safe. The child's logger opens `DARNER_LOG_FILE` with create + append (darner-core `logging.rs`), and the parent appends the printed lines to the same file. On Windows both handles share writes, so neither truncates the other. Piping stderr and echoing it keeps the console as it was. Pruning to the five newest by name works because the stamp sorts by time. - **Merges cleanly with main, but conflicts with #140** in `preload_ui.rs`. Whichever goes second needs a rebase. #140 also reads the final `... in the pipeline library in ... s` line, which this PR leaves unchanged. - **Please add the new keys to `locales/zh-CN.json`** (the five `preload.activity.*`, `preload.log`, `preload.play_now_description_store`, `preload.progress.step_time`), as #26 and later PRs did, so Chinese players don't see English lines in a Chinese window. - Behaviour on by default: a new log file per preload and a taller window. Both are harmless, and the description says so. Ready to merge once the WIP tag is dropped and the zh-CN keys are in.
Jesper-A changed title from WIP: [pr-feature][startup][shaders] Preload window: say what step 3 is doing, and keep a log file to [pr-feature][startup][shaders] Preload window: say what step 3 is doing, and keep a log file 2026-12-04 06:13:25 +00:00
Adds preload.activity.*, preload.log, preload.play_now_description_store
and preload.progress.step_time to locales/zh-CN.json.

This change was made with AI assistance (Claude Code).
This change was made with AI assistance (Claude Code).
Author
Collaborator

The zh-CN keys are in: 23ec6ad82 adds the eight new keys to locales/zh-CN.json (the five preload.activity.*, preload.log, preload.play_now_description_store, preload.progress.step_time), and 0d431b386 puts back a space after a colon that the first commit dropped in the existing preload.description line. Net change against 3278a86ae: locales/zh-CN.json +8 lines, nothing else.

On 23ec6ad82: the zh-CN.json parse check passed; cargo test --locked -p darner --bin darner -- preload i18n locale 11 passed, 1 ignored; cargo clippy --workspace --all-targets --locked -- -D warnings clean; cargo xtask policy ok. Not run with --all-features, and not run in game; the Chinese text width in the window is unchecked.

Two translations a native reader may want to adjust: "Making pipelines." is "正在生成管线。", and the step time is "{0}(本步骤已用 {1})".

This comment was written with AI assistance (Claude Code).

The zh-CN keys are in: 23ec6ad82 adds the eight new keys to `locales/zh-CN.json` (the five `preload.activity.*`, `preload.log`, `preload.play_now_description_store`, `preload.progress.step_time`), and 0d431b386 puts back a space after a colon that the first commit dropped in the existing `preload.description` line. Net change against 3278a86ae: `locales/zh-CN.json` +8 lines, nothing else. On 23ec6ad82: the zh-CN.json parse check passed; `cargo test --locked -p darner --bin darner -- preload i18n locale` 11 passed, 1 ignored; `cargo clippy --workspace --all-targets --locked -- -D warnings` clean; `cargo xtask policy` ok. Not run with `--all-features`, and not run in game; the Chinese text width in the window is unchecked. Two translations a native reader may want to adjust: "Making pipelines." is "正在生成管线。", and the step time is "{0}(本步骤已用 {1})". This comment was written with AI assistance (Claude Code).
First-time contributor

One failure is missing from the log the window asks players to attach. On a clean release build of 0d431b3867, create a regular file named shaders inside a disposable profile’s cache, then start darner play with first-start preload enabled. The preload child prints Error: creating <cache>/shaders and Windows error 183 before the launcher reports child exit 1. The advertised preload log is 579 bytes and ends after the normal introduction. It contains neither the error nor its cause. The game then fails separately on the same path. In preload_ui.rs, the stderr reader echoes the child’s plain stderr to the console. The child logger only duplicates structured tracing into the file. A regression check should verify that both the outer error and its cause appear once in the attachment.

The successful run used --language zh-CN, two preload workers and 768 previously recorded pipeline keys on Windows 11 / RTX 4070 Ti SUPER. In the actual window I could read the translated step timer, progress count and log filename on steps 1 and 2. At 200/760 the building message and both buttons fit. The long directory was shortened in the middle and the filename stayed visible. The final store took one second, too short for my visual capture. Its log contains opening, 110 progress updates from 1/768 through 764/768, saving, then 767/768 stored. The game reached the world and exited normally. Retention kept the four newest seeded preload logs plus this run and left an unrelated log intact.

Separately, I measured ten labels per language with Windows GDI at 96, 120, 144 and 192 DPI. All 80 English/Chinese rectangles fit horizontally and vertically. Only the current desktop scale was visually checked. This covers layout, not a native-speaker review. Tested with Codex assistance.

One failure is missing from the log the window asks players to attach. On a clean release build of `0d431b3867`, create a regular file named `shaders` inside a disposable profile’s cache, then start `darner play` with first-start preload enabled. The preload child prints `Error: creating <cache>/shaders` and Windows error 183 before the launcher reports child exit 1. The advertised preload log is 579 bytes and ends after the normal introduction. It contains neither the error nor its cause. The game then fails separately on the same path. In `preload_ui.rs`, the stderr reader echoes the child’s plain stderr to the console. The child logger only duplicates structured tracing into the file. A regression check should verify that both the outer error and its cause appear once in the attachment. The successful run used `--language zh-CN`, two preload workers and 768 previously recorded pipeline keys on Windows 11 / RTX 4070 Ti SUPER. In the actual window I could read the translated step timer, progress count and log filename on steps 1 and 2. At 200/760 the building message and both buttons fit. The long directory was shortened in the middle and the filename stayed visible. The final store took one second, too short for my visual capture. Its log contains opening, 110 progress updates from 1/768 through 764/768, saving, then 767/768 stored. The game reached the world and exited normally. Retention kept the four newest seeded preload logs plus this run and left an unrelated log intact. Separately, I measured ten labels per language with Windows GDI at 96, 120, 144 and 192 DPI. All 80 English/Chinese rectangles fit horizontally and vertically. Only the current desktop scale was visually checked. This covers layout, not a native-speaker review. Tested with Codex assistance.
The preload log only held the child's tracing lines and its stdout, so a
failure printed with `Error: ...` / `Caused by:` on stderr never reached the
attachment. The stderr reader now also appends lines the child's logger did not
write (no timestamp first, not a `[log]` note) to the file, once; the console
echo is unchanged. Reported by akimfomin on #215.

This change was made with AI assistance (Claude Code).
Author
Collaborator

Thanks, that's a real gap: the attachment the window asks for left out exactly the line that explains the failure.

Fixed in 0cea71f11 (one file, apps/darner/src/preload_ui.rs). The launcher's stderr reader still echoes every line of the child to the console, and now also appends to the preload log the lines the child's own logger did not write there (Error: ..., Caused by: ..., a panic message). Lines that start with a log timestamp or [log] are already in the file from the child's logger and are not written twice.

New test the_childs_plain_error_lines_reach_the_log_once_and_its_logged_lines_do_not_repeat feeds the reader an Error: creating <cache>/shaders / Caused by: ... (os error 183) pair plus a logged line, and checks the two error lines appear once in the log and the logged line is not repeated.

On 0cea71f11: cargo test -p darner --bin darner -- preload 12 passed (the new test included), 1 ignored; cargo clippy --workspace --all-targets -- -D warnings clean (the commit does not touch Cargo.lock); cargo xtask policy ok. Not run: a real failing preload (your shaders-file repro), --all-features clippy and the full workspace tests. One known limit: a tracing message that itself contains a newline would have its later lines appended a second time (duplicated, not lost).

Thanks also for the zh-CN, DPI and retention checks.

This comment was written with AI assistance (Claude Code).

Thanks, that's a real gap: the attachment the window asks for left out exactly the line that explains the failure. Fixed in 0cea71f11 (one file, `apps/darner/src/preload_ui.rs`). The launcher's stderr reader still echoes every line of the child to the console, and now also appends to the preload log the lines the child's own logger did not write there (`Error: ...`, `Caused by: ...`, a panic message). Lines that start with a log timestamp or `[log] ` are already in the file from the child's logger and are not written twice. New test `the_childs_plain_error_lines_reach_the_log_once_and_its_logged_lines_do_not_repeat` feeds the reader an `Error: creating <cache>/shaders` / `Caused by: ... (os error 183)` pair plus a logged line, and checks the two error lines appear once in the log and the logged line is not repeated. On 0cea71f11: `cargo test -p darner --bin darner -- preload` 12 passed (the new test included), 1 ignored; `cargo clippy --workspace --all-targets -- -D warnings` clean (the commit does not touch Cargo.lock); `cargo xtask policy` ok. Not run: a real failing preload (your `shaders`-file repro), `--all-features` clippy and the full workspace tests. One known limit: a tracing message that itself contains a newline would have its later lines appended a second time (duplicated, not lost). Thanks also for the zh-CN, DPI and retention checks. This comment was written with AI assistance (Claude Code).
First-time contributor

Confirmed on 0cea71f117 with the original failing preload on Windows 11. I put a regular file at <private cache>/shaders and compared the child’s console output before the launcher reported exit 1 with the attachment named by the window. The attachment now contains Error: creating …/shaders, Caused by:, and the Windows error 183 message exactly once each. The same three lines appeared zero times on 0d431b3867. The files were 830 and 579 bytes respectively. Both children exited 1 as expected for this fixture. This closes the missing-error reproduction I reported above. Tested with Codex assistance.

Confirmed on `0cea71f117` with the original failing preload on Windows 11. I put a regular file at `<private cache>/shaders` and compared the child’s console output before the launcher reported exit 1 with the attachment named by the window. The attachment now contains `Error: creating …/shaders`, `Caused by:`, and the Windows error 183 message exactly once each. The same three lines appeared zero times on `0d431b3867`. The files were 830 and 579 bytes respectively. Both children exited 1 as expected for this fixture. This closes the missing-error reproduction I reported above. Tested with Codex assistance.
Owner

Review of 0cea71f1 (read only, not built or run):

Checked:

  • Throttle (warm.rs): progress_due prints the first line, then one every 2 s or every 1 % (at least 1), and the mutex keeps the workers from printing the same count twice. Both fill_library and into_library use it. The new opening / saving the pipeline library lines go around the open and the final save, so step 3 always says something.
  • Window state (preload_ui.rs):
    • The activity follows the last line read.
    • "Still working" only shows after 60 s with no count change and after compile memory lines, so an idle preload doesn't claim to be working.
    • The step-3 hint only changes when DARNER_PRELOAD_SAVE_EVERY is off, which matches what step 3 actually keeps.
    • The final ... in the pipeline library in ... line is now read as step 3.
  • Log file:
    • The child logs through DARNER_LOG_FILE.
    • The stdout lines are appended.
    • Stderr is now piped and drained on its own thread, so the child can't block on a full pipe.
    • Only lines the child's logger did not write (Error:, Caused by:, a panic) are added, and the test covers the colour-code and [log] cases.
    • akimfomin's missing-error case is fixed and confirmed on Windows 11.
    • Rotation keeps 5: 4 old plus the new one. The YYYYMMDD-HHMMSS stamp sorts correctly, and it only deletes darner-preload-* files in Darner's own logs folder.
  • Layout: the rows don't overlap at 96 dpi:
    • count 114-136
    • activity 138-158
    • text 172-212
    • buttons 226-262
    • log 276-296
    • window 306
  • The en and zh-CN keys are both present. It merges cleanly with main (f3840d73).

Small points, none blocking:

  1. The module doc says darner-preload-<time>.log, but the name is darner-preload-<time>-<pid>.log.
  2. The two parent handles and the child write the same file in append mode. writeln! can issue the line and the newline as separate writes, so a line can rarely be split by another writer's line. Formatting into a String and writing it once would avoid that. It's cosmetic.
  3. The taller window and the 11 pt path row should be checked once at 125/150 % scaling.
  4. Merge order: this conflicts with #228 (which also rewrites the step-1 progress line in preload_ui.rs) and with #140. Whichever lands second needs a rebase.

Ready to merge. 0cea71f1 testcall-ok: safe to build and test. It only changes the preload window and writes and rotates its own log files.

Review of 0cea71f1 (read only, not built or run): **Checked:** - **Throttle (`warm.rs`):** `progress_due` prints the first line, then one every 2 s or every 1 % (at least 1), and the mutex keeps the workers from printing the same count twice. Both `fill_library` and `into_library` use it. The new `opening` / `saving the pipeline library` lines go around the open and the final save, so step 3 always says something. - **Window state (`preload_ui.rs`):** - The activity follows the last line read. - "Still working" only shows after 60 s with no count change *and* after `compile memory` lines, so an idle preload doesn't claim to be working. - The step-3 hint only changes when `DARNER_PRELOAD_SAVE_EVERY` is off, which matches what step 3 actually keeps. - The final `... in the pipeline library in ...` line is now read as step 3. - **Log file:** - The child logs through `DARNER_LOG_FILE`. - The stdout lines are appended. - Stderr is now piped and drained on its own thread, so the child can't block on a full pipe. - Only lines the child's logger did not write (`Error:`, `Caused by:`, a panic) are added, and the test covers the colour-code and `[log]` cases. - akimfomin's missing-error case is fixed and confirmed on Windows 11. - Rotation keeps 5: 4 old plus the new one. The `YYYYMMDD-HHMMSS` stamp sorts correctly, and it only deletes `darner-preload-*` files in Darner's own `logs` folder. - **Layout:** the rows don't overlap at 96 dpi: - count 114-136 - activity 138-158 - text 172-212 - buttons 226-262 - log 276-296 - window 306 - The en and zh-CN keys are both present. It merges cleanly with main (f3840d73). **Small points, none blocking:** 1. The module doc says `darner-preload-<time>.log`, but the name is `darner-preload-<time>-<pid>.log`. 2. The two parent handles and the child write the same file in append mode. `writeln!` can issue the line and the newline as separate writes, so a line can rarely be split by another writer's line. Formatting into a `String` and writing it once would avoid that. It's cosmetic. 3. The taller window and the 11 pt path row should be checked once at 125/150 % scaling. 4. **Merge order:** this conflicts with #228 (which also rewrites the step-1 progress line in `preload_ui.rs`) and with #140. Whichever lands second needs a rebase. Ready to merge. 0cea71f1 testcall-ok: safe to build and test. It only changes the preload window and writes and rotates its own log files.
First-time contributor

I tested 0cea71f117bf using the PR’s WM_PAINT code and English and zh-CN catalogs on Windows 11. The fixture supplied step-3 progress and a log path. No game was launched.

On a physical 150% display, a hidden per-monitor-aware window painted a 900 × 459 client. I inspected both languages. The activity, hints, buttons and log row stayed separate, and a 260-character path retained its complete filename after ellipsis. The default DPI-unaware fixture reported 96 DPI and painted a 600 × 306 logical client.

At 125% (120 DPI injected into the same paint code, 750 × 382 client), I found one zh-CN edge case. A 98-character path was drawn without an ellipsis and lost the final g in .log. Removing that g changed zero pixels inside the production clip but changed 60 pixels without the clip. English showed the same path in full. The 260-character path kept its filename in both languages. I saw no vertical clipping or row overlap.

I tested `0cea71f117bf` using the PR’s `WM_PAINT` code and English and zh-CN catalogs on Windows 11. The fixture supplied step-3 progress and a log path. No game was launched. On a physical 150% display, a hidden per-monitor-aware window painted a 900 × 459 client. I inspected both languages. The activity, hints, buttons and log row stayed separate, and a 260-character path retained its complete filename after ellipsis. The default DPI-unaware fixture reported 96 DPI and painted a 600 × 306 logical client. At 125% (120 DPI injected into the same paint code, 750 × 382 client), I found one zh-CN edge case. A 98-character path was drawn without an ellipsis and lost the final `g` in `.log`. Removing that `g` changed zero pixels inside the production clip but changed 60 pixels without the clip. English showed the same path in full. The 260-character path kept its filename in both languages. I saw no vertical clipping or row overlap.
Author
Collaborator

Thank you, TrustNo1, for the review, and superhero-520 for the 125 % and 150 % check.

All three small points are real. I read each one on 0cea71f11 (apps/darner/src/preload_ui.rs). Nothing was built or run for this comment. I'd rather not move the approved head, so each fix goes into a follow-up PR after this one merges.

  1. Log name. The module doc at line 16 says darner-preload-<time>.log. log_path() (lines 256 and 276) builds darner-preload-<time>-<pid>.log. Fix: add -<pid> to the doc.
  2. Split lines. Three writers append to one file: the child's logger (through DARNER_LOG_FILE), the stdout thread (lines 338 to 346) and the stderr thread (lines 353 to 360 and 312). The two parent threads use writeln!(file, "{line}"), which can write the text and the newline separately. Fix: the parent gets one writer behind a lock, and each line is built as one String with its newline and sent in a single write_all. The child's logger stays as it is. I can't promise this removes every interleave with the child, only the ones between our two threads.
  3. Path at 125 %. The log row (line 518) uses DT_PATH_ELLIPSIS, and all rows are scaled by GetDpiForSystem (lines 439 to 446). superhero-520's 98-character zh-CN path lost its last g at 120 DPI, so I take it as confirmed. I haven't found why the ellipsis does not trigger there. Fix: measure the text with GetTextExtentPoint32W and shorten the path myself, keeping the file name. Wrapping the row to a second line is the other option. Whichever I pick, I'd check it at 100, 125 and 150 % in both languages before posting the PR.

The same follow-up can also read the child's stderr as lossy bytes to the end (line 306 uses lines().map_while(Result::ok), which stops at the first line that isn't valid UTF-8).

Merge order with #228 and #140 is noted. #140 is mine, so I'll rebase it if it lands second.

This comment was written with AI assistance (Claude Code).

Thank you, TrustNo1, for the review, and superhero-520 for the 125 % and 150 % check. All three small points are real. I read each one on 0cea71f11 (`apps/darner/src/preload_ui.rs`). Nothing was built or run for this comment. I'd rather not move the approved head, so each fix goes into a follow-up PR after this one merges. 1. **Log name.** The module doc at line 16 says `darner-preload-<time>.log`. `log_path()` (lines 256 and 276) builds `darner-preload-<time>-<pid>.log`. Fix: add `-<pid>` to the doc. 2. **Split lines.** Three writers append to one file: the child's logger (through `DARNER_LOG_FILE`), the stdout thread (lines 338 to 346) and the stderr thread (lines 353 to 360 and 312). The two parent threads use `writeln!(file, "{line}")`, which can write the text and the newline separately. Fix: the parent gets one writer behind a lock, and each line is built as one `String` with its newline and sent in a single `write_all`. The child's logger stays as it is. I can't promise this removes every interleave with the child, only the ones between our two threads. 3. **Path at 125 %.** The log row (line 518) uses `DT_PATH_ELLIPSIS`, and all rows are scaled by `GetDpiForSystem` (lines 439 to 446). superhero-520's 98-character zh-CN path lost its last `g` at 120 DPI, so I take it as confirmed. I haven't found why the ellipsis does not trigger there. Fix: measure the text with `GetTextExtentPoint32W` and shorten the path myself, keeping the file name. Wrapping the row to a second line is the other option. Whichever I pick, I'd check it at 100, 125 and 150 % in both languages before posting the PR. The same follow-up can also read the child's stderr as lossy bytes to the end (line 306 uses `lines().map_while(Result::ok)`, which stops at the first line that isn't valid UTF-8). Merge order with #228 and #140 is noted. #140 is mine, so I'll rebase it if it lands second. This comment was written with AI assistance (Claude Code).
TrustNo1 manually merged commit e26c9c7687 into main 2026-12-04 22:17:09 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
4 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
TrustNo1/Darner!215
No description provided.