breadbug-gui: a failed preview rebuild drops the old report #51

Open
Breadway wants to merge 1 commit from fix/bread-35-breadbug-gui-stale-report into main
Owner

How it was found: source review of the Preview report callback in breadbug-gui/src/lib.rs on origin/main (6e2010a). On a successful build the report is stored in State.prepared and Save and Send are enabled. On a later failed rebuild the callback only changed the status text and disabled Send, so State.prepared, the old preview and Save stayed live. Confidence high from source; I did not launch the window.

What changed:

  • New breadbug-gui/src/preview.rs with no GTK in it: settle() replaces the prepared report on success and empties it on failure; actions() returns (save, send) with Save needing a prepared report and Send also needing uploads on.
  • The preview handler empties the slot and disables Save and Send when a rebuild starts, and applies settle()/set_actions() on every result. A failure clears the preview, disables both buttons and shows the error.

Coverage: 5 unit tests in preview.rs (failed rebuild clears the old report, successful rebuild replaces it, rebuild in progress is not actionable, Save and Send gating, nothing prepared allows nothing). The new tests cover the helpers; they are not a GTK test of the callback, which needs a display. Gates run in breadbug-gui: cargo test --lib 9 passed, 0 failed; cargo check --all-targets pass; cargo clippy --all-targets -- -D warnings pass. cargo fmt --check fails only on examples/walkthrough.rs, which is identical to origin/main and not touched here; the two changed files pass rustfmt --check. Not verified: the window itself was not run.

Refs BREAD-35

How it was found: source review of the Preview report callback in breadbug-gui/src/lib.rs on origin/main (6e2010a). On a successful build the report is stored in State.prepared and Save and Send are enabled. On a later failed rebuild the callback only changed the status text and disabled Send, so State.prepared, the old preview and Save stayed live. Confidence high from source; I did not launch the window. What changed: - New breadbug-gui/src/preview.rs with no GTK in it: settle() replaces the prepared report on success and empties it on failure; actions() returns (save, send) with Save needing a prepared report and Send also needing uploads on. - The preview handler empties the slot and disables Save and Send when a rebuild starts, and applies settle()/set_actions() on every result. A failure clears the preview, disables both buttons and shows the error. Coverage: 5 unit tests in preview.rs (failed rebuild clears the old report, successful rebuild replaces it, rebuild in progress is not actionable, Save and Send gating, nothing prepared allows nothing). The new tests cover the helpers; they are not a GTK test of the callback, which needs a display. Gates run in breadbug-gui: cargo test --lib 9 passed, 0 failed; cargo check --all-targets pass; cargo clippy --all-targets -- -D warnings pass. cargo fmt --check fails only on examples/walkthrough.rs, which is identical to origin/main and not touched here; the two changed files pass rustfmt --check. Not verified: the window itself was not run. Refs BREAD-35
breadbug-gui: a failed preview rebuild drops the old report
Some checks failed
check / check (push) Failing after 12s
a2e3964019
A successful preview stored the report and enabled Save and Send. A later
rebuild that failed only changed the status text and disabled Send, so the
previous report stayed in State.prepared and Save still wrote it to disk.

Move the state rule into breadbug-gui/src/preview.rs, free of GTK: a rebuild
empties the slot first, a failed rebuild leaves it empty, and Save and Send
are enabled only for a prepared report (Send also needs uploads on). The
preview handler applies those rules on every path and shows the error text
with an empty preview.

Refs BREAD-35
Some checks failed
check / check (push) Failing after 12s
This pull request can be merged automatically.
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 fix/bread-35-breadbug-gui-stale-report:fix/bread-35-breadbug-gui-stale-report
git switch fix/bread-35-breadbug-gui-stale-report

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 fix/bread-35-breadbug-gui-stale-report
git switch fix/bread-35-breadbug-gui-stale-report
git rebase main
git switch main
git merge --ff-only fix/bread-35-breadbug-gui-stale-report
git switch fix/bread-35-breadbug-gui-stale-report
git rebase main
git switch main
git merge --no-ff fix/bread-35-breadbug-gui-stale-report
git switch main
git merge --squash fix/bread-35-breadbug-gui-stale-report
git switch main
git merge --ff-only fix/bread-35-breadbug-gui-stale-report
git switch main
git merge fix/bread-35-breadbug-gui-stale-report
git push origin main
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
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
Breadway/bread!51
No description provided.