Skip to content

Restore source choices when a GUI review ends without writing - #137

Merged
amrali-eg merged 1 commit into
masterfrom
fix/cancel-restores-source-choice
Sep 28, 2026
Merged

amrali-eg merged 1 commit into
masterfrom
fix/cancel-restores-source-choice

Conversation

@amrali-eg

Copy link
Copy Markdown
Owner

Problem

In the GUI review, choosing a source for a refused file updates that row (CurrentCharsetLabel, SourceEncodingWasSpecified) so the plan shows it as ready. Rows survive between runs. Cancelling the review left the choice on them, so the next Convert on the same rows showed the file as ready to convert with a source nobody chose in that review, while the list still showed the detected encoding. No file was written. Found in the 2026-09-20 review (F1) and confirmed through the orchestration sequence.

Change

ConversionOrchestrator.Run saves each row's source choice when the review opens and restores it when the run ends without writing:

  • Cancelled, including a source choice that matched no file;
  • PlanWentStale;
  • CouldNotPlan;
  • cancellation before the write pass.

Choices that existed before the review opened are what gets restored, so they are kept. A completed or interrupted run keeps the choices it wrote with. Stale and could-not-plan are included because nothing was written with the choice either; the next review starts from the files as they are.

Backlog entry BL-39.

Tests

In ConversionOrchestrationTests, all on real files:

  • Choose then cancel: the choice takes effect inside the review, then cancelling restores the row. A second run on the same rows shows the file refused and needing a source choice; bytes unchanged throughout.
  • Earlier choice kept: a row carrying a choice from before the review keeps it after cancelling, and the next review converts it with that source, while the file chosen in the cancelled review needs a choice again.
  • Stale review: a choice followed by Proceed on a file changed meanwhile ends PlanWentStale with the choice restored and no backup.

Mutation checks (each restored byte-for-byte afterwards)

Mutation Tests failing
No restore after a review that wrote nothing 3
Clear every choice instead of restoring the earlier state 1
Restore only on Cancelled 1

Verification

  • Based on master after Accept ASCII in -Validate wherever BOM-less UTF-8 is allowed #136. Release build, 0 warnings; 970/970 tests pass.
  • docs/Test-DefectBacklog.ps1 passes.
  • GUI smoke not run locally for this PR; CI runs gui-smoke (phases C and J exercise source choices). The full smoke run and the four-corpus audit will be on the final committed release candidate.

🤖 Generated with Claude Code

Choosing a source for a refused file updates that row so the review can
show it as ready. Rows survive between runs, and cancelling left the choice
on them: the next Convert showed the file as ready with a source nobody
chose in that review.

The choices are saved when the review opens and restored when it ends
without writing (cancelled, stale, not plannable, or cancelled before the
write pass). Choices that existed before the review opened are kept; a
completed or interrupted run keeps the choices it wrote with.

Tests choose then cancel and run the same rows again, keep an earlier
choice, and cover a stale review. Removing the restore, clearing every
choice, or restoring only on cancellation each fails them.

Backlog: BL-39.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@amrali-eg
amrali-eg merged commit 02e4416 into master Sep 28, 2026
3 checks passed
@amrali-eg
amrali-eg deleted the fix/cancel-restores-source-choice branch September 28, 2026 21:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant