Skip to content

Fix false-success CSV reporting on cancel, stale plan, and mid-decide cancellation - #107

Merged
amrali-eg merged 2 commits into
masterfrom
fix/conversion-report-false-success
Sep 13, 2026
Merged

Fix false-success CSV reporting on cancel, stale plan, and mid-decide cancellation#107
amrali-eg merged 2 commits into
masterfrom
fix/conversion-report-false-success

Conversation

@amrali-eg

Copy link
Copy Markdown
Owner

Summary

  • ConversionOrchestrator's decide pass marks eligible entries "would convert" before the user is ever asked. Cancelling the confirmation, hitting a stale plan, failing to plan, or the ChooseSourceEncoding retry not matching any file all returned without correcting that, so those same entries could later export to CSV as Converted even though nothing was written. Fixed by marking them NotAttempted at each no-write return, the same idiom already used for an interrupted run.
  • A second, deeper instance of the same bug: cancellation reaching Run() from RefreshSourceSnapshots, either whatIf decide-pass call, or the explicit ThrowIfCancellationRequested check was completely unguarded. Run() now wraps the whole decide/confirm/write sequence in one cancellation handler that reconciles entries before rethrowing; the write pass's own cancellation handling (which returns Interrupted rather than throwing) is untouched.
  • Corrects docs/SAFETY.md / docs/CONVERSION-WORKFLOW.md, which said an already-matching file is not decoded — it is now strictly validated in full before being reported Unchanged.
  • Strengthens WhatIf_NeverModifiesAnything, which was silently refused before ever reaching the dry-run branch it meant to test.

Test plan

  • dotnet build sources/EncodingChecker.sln --configuration Release
  • dotnet test sources/EncodingChecker.sln --configuration Release --no-build — 819/826 pass; the 7 failures are pre-existing GuiSmokeExecutionTests failures on this machine (pwsh.exe not on PATH), unrelated to this change.
  • Each regression test mutation-checked: reverted the corresponding fix, confirmed the new assertion fails with the exact defect described, then restored the fix and confirmed it passes.

🤖 Generated with Claude Code

amrali-eg and others added 2 commits September 14, 2026 01:04
ConversionOrchestrator's decide pass marks eligible entries "would
convert" before the user is ever asked. Cancelling, hitting a stale
plan, or failing to plan returned without correcting that, so the
same entries later exported to CSV as Converted even though nothing
was written. Mark them NotAttempted at each no-write return, the same
idiom already used for an interrupted run.

Also corrects SAFETY.md/CONVERSION-WORKFLOW.md, which said an
already-matching file is not decoded (it is now strictly validated
before being reported Unchanged), and strengthens
WhatIf_NeverModifiesAnything, which was silently refused before
reaching the dry-run branch it meant to test.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
The previous fix marked entries NotAttempted at the confirmation loop's
no-write return points, but cancellation could also escape earlier:
from RefreshSourceSnapshots, from either whatIf decide-pass RunPass
call, or from the explicit ThrowIfCancellationRequested check, none of
which were guarded. Any of those left the decide pass's "would
convert" marks on entries with no reconciliation, reproducing the same
false-success CSV export the prior fix closed.

Run() now wraps the whole decide/confirm/write sequence (extracted to
DecideConfirmAndRun) in one cancellation handler that marks every
entry NotAttempted before rethrowing. The write pass's own cancellation
handling is untouched: it returns an Interrupted result rather than
throwing, so it never reaches the new outer catch.

Also covers the ApplyChosenSource-fails-to-Cancelled branch with a
test using a mixed batch, since the existing test for it used a
fixture that was never marked Converted in the first place.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@amrali-eg
amrali-eg merged commit 6cb28e9 into master Sep 13, 2026
3 checks passed
@amrali-eg
amrali-eg deleted the fix/conversion-report-false-success branch September 13, 2026 22:42
pull Bot pushed a commit to jnnycn007/EncodingChecker that referenced this pull request Sep 13, 2026
CLAUDE.md and AGENTS.md carry the same project-specific instructions
(safety rules, shared-detector boundary, build/test and file
conventions) for each agent's own convention, differing only in which
global preferences file they say they supplement.

Also logs BL-33 in the defect ledger: the false-success CSV reporting
defect fixed across PR amrali-eg#107, distinct from BL-31 which covered only
the write-pass-interrupted case.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
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