[pr-fix][startup] play: a question given up on no longer takes the next question's answer (first-start offer, then DLSS/FSR/MFG) #265

Open
iBooM72 wants to merge 2 commits from iboom72/fix/play-one-console-reader into main AGit
Contributor

What it changes

  • The problem on main: read from the code only (apps/darner/src/play.rs, offer_auto_detect, since 85c11db9, the commit that made the offer give up after 20 s).

The first-start question "Apply them now? [Y/n]" reads its answer on a thread and gives up after 20 s. That thread is never stopped: it stays in read_line and holds the console's input. Every later question of the same start reads the console itself, so the first line the player types goes to the old thread and is thrown away, and the question keeps waiting for a second line.

The questions that can follow in the same start are the NVIDIA files (offer_dlss), the AMD files (offer_fsr), MFG Unlocker (offer_mfg), and "press Enter to close" after a failed start (hold_window). The first two take an empty line as yes: a player who types n, sees nothing happen and presses Enter again gets the download they declined, and no declined mark is written.

A start that can reach it: a new install started by double click (a console of its own, no settings file), nobody answers within 20 s, the default --dlss quality plans DLSS and the NVIDIA files are missing.

What this does: every question in play.rs now asks one helper, answer. A read that was given up on is kept, and the next question takes its line instead of starting a second read. A line that arrived before the next question was shown is dropped (it was typed for the old question). A question without a time limit still reads on the calling thread, as before, when no earlier read is waiting. No thread loops on the console.

The Agility SDK question in check_shader_model runs before the offer and was not affected; it uses the helper too, so the order of the questions can change later. main.rs's own read runs before prepare and is left alone.

How it was tested

  • Tested revision: 98a3c911
  • Commands and results:
    • cargo test -p darner --locked: passed (149 passed, 1 ignored in the app's unit tests, with the new a_question_given_up_on_does_not_take_the_next_answer; 2 + 2 + 8 in its three test files).
    • cargo clippy -p darner --all-targets --locked -- -D warnings: passed.
  • Changes a default: no
  • Gates run on that revision (the three in AGENTS.md; there is no CI): cargo clippy --workspace --all-targets --locked -- -D warnings and the same with --all-features: both passed. cargo test --workspace --locked was not run as a whole (only -p darner, above; the change is in apps/darner only).
  • Gameplay, when relevant: not relevant (launcher questions before the game starts).
  • Hardware dependence: likely general.
  • Coverage gaps: not reproduced on a real console, before or after: the bug and the fix are from reading the code, and the new test drives the helper with a stand-in for the console. Not checked: several lines pasted at once, and a console that is not Windows' own (msys).

Checklist

  • I ran this change in the game, or say below why it can't be (docs, tests only).
  • This PR contains one change based on main.
  • The diff follows docs/asset-policy.md.
  • I recorded this PR's dependencies below.
    • Depends on: none

Not run in the game: the questions come up only at a first start without a settings file and without the NVIDIA or AMD files, and need 20 s without an answer.

Checked for overlap

  • I searched the open pull requests for the same issue and for the files this touches.
  • Related PRs: #132 (merged; asks only on a console; same questions, other problem). 17 open pull requests were found that change apps/darner/src/play.rs (#243, #233, #222, #216, #215, #205, #154, #153, #143, #140, #130, #80, #75, #59, #16, #12, #9); none of their diffs touches these questions.
  • Replaces or overlaps: none found

🤖 Generated with Claude Code

## What it changes - The problem on main: read from the code only (`apps/darner/src/play.rs`, `offer_auto_detect`, since 85c11db9, the commit that made the offer give up after 20 s). The first-start question "Apply them now? [Y/n]" reads its answer on a thread and gives up after 20 s. That thread is never stopped: it stays in `read_line` and holds the console's input. Every later question of the same start reads the console itself, so the first line the player types goes to the old thread and is thrown away, and the question keeps waiting for a second line. The questions that can follow in the same start are the NVIDIA files (`offer_dlss`), the AMD files (`offer_fsr`), MFG Unlocker (`offer_mfg`), and "press Enter to close" after a failed start (`hold_window`). The first two take an empty line as yes: a player who types `n`, sees nothing happen and presses Enter again gets the download they declined, and no `declined` mark is written. A start that can reach it: a new install started by double click (a console of its own, no settings file), nobody answers within 20 s, the default `--dlss quality` plans DLSS and the NVIDIA files are missing. What this does: every question in `play.rs` now asks one helper, `answer`. A read that was given up on is kept, and the next question takes its line instead of starting a second read. A line that arrived before the next question was shown is dropped (it was typed for the old question). A question without a time limit still reads on the calling thread, as before, when no earlier read is waiting. No thread loops on the console. The Agility SDK question in `check_shader_model` runs before the offer and was not affected; it uses the helper too, so the order of the questions can change later. `main.rs`'s own read runs before `prepare` and is left alone. ## How it was tested - Tested revision: 98a3c911 - Commands and results: - `cargo test -p darner --locked`: passed (149 passed, 1 ignored in the app's unit tests, with the new `a_question_given_up_on_does_not_take_the_next_answer`; 2 + 2 + 8 in its three test files). - `cargo clippy -p darner --all-targets --locked -- -D warnings`: passed. - Changes a default: no - Gates run on that revision (the three in AGENTS.md; there is no CI): `cargo clippy --workspace --all-targets --locked -- -D warnings` and the same with `--all-features`: both passed. `cargo test --workspace --locked` was not run as a whole (only `-p darner`, above; the change is in `apps/darner` only). - Gameplay, when relevant: not relevant (launcher questions before the game starts). - Hardware dependence: likely general. - Coverage gaps: not reproduced on a real console, before or after: the bug and the fix are from reading the code, and the new test drives the helper with a stand-in for the console. Not checked: several lines pasted at once, and a console that is not Windows' own (msys). ## Checklist - [ ] I ran this change in the game, or say below why it can't be (docs, tests only). - [x] This PR contains one change based on `main`. - [x] The diff follows `docs/asset-policy.md`. - [x] I recorded this PR's dependencies below. - Depends on: none Not run in the game: the questions come up only at a first start without a settings file and without the NVIDIA or AMD files, and need 20 s without an answer. ## Checked for overlap - [x] I searched the open pull requests for the same issue and for the files this touches. - Related PRs: #132 (merged; asks only on a console; same questions, other problem). 17 open pull requests were found that change `apps/darner/src/play.rs` (#243, #233, #222, #216, #215, #205, #154, #153, #143, #140, #130, #80, #75, #59, #16, #12, #9); none of their diffs touches these questions. - Replaces or overlaps: none found 🤖 Generated with [Claude Code](https://claude.com/claude-code)
The first-start offer of auto-detect's picks reads its answer on a thread and
gives up after 20 s (85c11db9). The thread stayed in read_line, so the first
line typed for the next question of the same start (NVIDIA files, AMD files,
MFG Unlocker, "press Enter to close") went to it and was thrown away; the
download questions then took the next empty line as yes.

Every question in play.rs now asks one helper: a read given up on is kept, and
the next question takes its line instead of starting a second read. A line
typed before the next question was shown is dropped.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
First-time contributor

Tested the input handling on Windows in 12 private console processes, using the launcher’s input code from f3840d73 and 98a3c911 with the original 20-second timeout.

After the first question timed out, I sent n and Enter once after the second prompt appeared. On main, the second question stayed open. Sending another Enter then selected the default yes. On the PR, the same single n and Enter declined immediately.

With two lines sent together after the second prompt (n then y), the PR correctly delivered n to the second question and y to the third. There is one shared boundary: when two complete lines (old then y) were already queued before the second prompt, both revisions consumed y as its answer immediately. A single stale line followed by a fresh n behaved as expected on the PR.

The harness used the Windows console line reader and an isolated input buffer. It did not run the full launcher or download an SDK.

Tested the input handling on Windows in 12 private console processes, using the launcher’s input code from `f3840d73` and `98a3c911` with the original 20-second timeout. After the first question timed out, I sent `n` and Enter once after the second prompt appeared. On main, the second question stayed open. Sending another Enter then selected the default yes. On the PR, the same single `n` and Enter declined immediately. With two lines sent together after the second prompt (`n` then `y`), the PR correctly delivered `n` to the second question and `y` to the third. There is one shared boundary: when two complete lines (`old` then `y`) were already queued before the second prompt, both revisions consumed `y` as its answer immediately. A single stale line followed by a fresh `n` behaved as expected on the PR. The harness used the Windows console line reader and an isolated input buffer. It did not run the full launcher or download an SDK.
Author
Contributor

Follow-up to "How it was tested": the description says cargo test --workspace --locked was not run as a whole. It has now been run, together with five other small pull requests of mine, on one local branch.

  • Tested revision: main f3840d73 with these six commits picked on top, no conflicts: 98a3c911 (#265), 5799f84a (#270), c782a6e2 (#283), e69c0f77 (#284), 1c142d36 (#285), 5eae3d19 (#286). Not run on this pull request's branch alone.
  • cargo clippy --workspace --all-targets --locked -- -D warnings: passed.
  • cargo clippy --workspace --all-targets --all-features --locked -- -D warnings: passed.
  • cargo test --workspace --locked: one test failed, in darner-shader: emit::waterfall_tests::sampled_marks_restore_early_depth_only_when_safe_in_pixel_shaders ("DXIL validation failed ... Not all elements of output SV_Depth were written"). The same test fails the same way on main f3840d73 without these commits, none of the six changes darner-shader, and #227 (open) fixes it. darner-shader's other tests: 557 passed, 16 ignored.
  • Cargo stops at the first package that fails, so the rest was run with cargo test --workspace --locked --no-fail-fast --exclude darner-shader: passed, all packages and the doc tests (darner-gpu: 1,773 passed, 81 ignored).

Still not run in the game.

Follow-up to "How it was tested": the description says `cargo test --workspace --locked` was not run as a whole. It has now been run, together with five other small pull requests of mine, on one local branch. - Tested revision: `main` f3840d73 with these six commits picked on top, no conflicts: 98a3c911 (#265), 5799f84a (#270), c782a6e2 (#283), e69c0f77 (#284), 1c142d36 (#285), 5eae3d19 (#286). Not run on this pull request's branch alone. - `cargo clippy --workspace --all-targets --locked -- -D warnings`: passed. - `cargo clippy --workspace --all-targets --all-features --locked -- -D warnings`: passed. - `cargo test --workspace --locked`: one test failed, in `darner-shader`: `emit::waterfall_tests::sampled_marks_restore_early_depth_only_when_safe_in_pixel_shaders` ("DXIL validation failed ... Not all elements of output SV_Depth were written"). The same test fails the same way on `main` f3840d73 without these commits, none of the six changes `darner-shader`, and #227 (open) fixes it. `darner-shader`'s other tests: 557 passed, 16 ignored. - Cargo stops at the first package that fails, so the rest was run with `cargo test --workspace --locked --no-fail-fast --exclude darner-shader`: passed, all packages and the doc tests (`darner-gpu`: 1,773 passed, 81 ignored). Still not run in the game.
After a question was given up on, the line its read got before the next
question was shown was dropped. Lines typed after that one stayed in the
console's input, and the next question read the first of them as its answer;
an empty one is a yes for the download questions. The read that follows a
dropped line now clears the console's input first.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
Author
Contributor

@superhero-520 wrote in #265 (comment):

when two complete lines (old then y) were already queued before the second prompt, both revisions consumed y as its answer immediately

Pushed 9d3ede12 for this case. When the read that was given up on already has its line by the time the next question is asked, that line is dropped as before, and the read that follows now clears the console's input first (FlushConsoleInputBuffer). So y in your case is dropped too, and the question waits for a line typed after it was shown.

What stays as it was:

  • A question that follows no given-up read still takes what was typed ahead, like any console question.
  • A read that is still waiting when the next question is asked gives that question its line.

How it was tested

  • Tested revision: 9d3ede12 (98a3c911 plus this commit, on main f3840d73).
  • cargo test -p darner --locked: passed (149 passed, 1 ignored in the app's unit tests; 2 + 2 + 8 in its three test files). a_question_given_up_on_does_not_take_the_next_answer now also checks that the read after a dropped line is told to drop the rest.
  • cargo clippy --workspace --all-targets --locked -- -D warnings and the same with --all-features: both passed.
  • cargo test --workspace --locked was not run again for this commit (only -p darner; the change is in apps/darner/src/play.rs only).
  • Not run on a real console: the test tells the helper's stand-in to drop the rest, it does not call FlushConsoleInputBuffer. If you can run your harness on 9d3ede12 with the old then y case, that would cover it.

The description above still names 98a3c911 as the tested revision.

@superhero-520 wrote in https://git.gtahub.st/TrustNo1/Darner/pulls/265#issuecomment-862989: > when two complete lines (`old` then `y`) were already queued before the second prompt, both revisions consumed `y` as its answer immediately **Pushed 9d3ede12 for this case.** When the read that was given up on already has its line by the time the next question is asked, that line is dropped as before, and the read that follows now clears the console's input first (`FlushConsoleInputBuffer`). So `y` in your case is dropped too, and the question waits for a line typed after it was shown. What stays as it was: - A question that follows no given-up read still takes what was typed ahead, like any console question. - A read that is still waiting when the next question is asked gives that question its line. **How it was tested** - Tested revision: 9d3ede12 (98a3c911 plus this commit, on `main` f3840d73). - `cargo test -p darner --locked`: passed (149 passed, 1 ignored in the app's unit tests; 2 + 2 + 8 in its three test files). `a_question_given_up_on_does_not_take_the_next_answer` now also checks that the read after a dropped line is told to drop the rest. - `cargo clippy --workspace --all-targets --locked -- -D warnings` and the same with `--all-features`: both passed. - `cargo test --workspace --locked` was not run again for this commit (only `-p darner`; the change is in `apps/darner/src/play.rs` only). - Not run on a real console: the test tells the helper's stand-in to drop the rest, it does not call `FlushConsoleInputBuffer`. If you can run your harness on 9d3ede12 with the `old` then `y` case, that would cover it. The description above still names 98a3c911 as the tested revision.
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/265/head:iboom72/fix/play-one-console-reader'
git switch 'iboom72/fix/play-one-console-reader'

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.

git switch 'main'
git merge --no-ff 'iboom72/fix/play-one-console-reader'
git switch 'iboom72/fix/play-one-console-reader'
git rebase 'main'
git switch 'main'
git merge --ff-only 'iboom72/fix/play-one-console-reader'
git switch 'iboom72/fix/play-one-console-reader'
git rebase 'main'
git switch 'main'
git merge --no-ff 'iboom72/fix/play-one-console-reader'
git switch 'main'
git merge --squash 'iboom72/fix/play-one-console-reader'
git switch 'main'
git merge --ff-only 'iboom72/fix/play-one-console-reader'
git switch 'main'
git merge 'iboom72/fix/play-one-console-reader'
git push origin 'main'
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
2 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!265
No description provided.