Repository navigation
Refuse a contradicting source choice even when it is the target - #135
Merged
Merged
Conversation
The policy checked "already in the target" before the explicit-source conflict, so a chosen source that was also the target skipped the conflict check. With the master build, -From windows-1252 -Target windows-1252 on a UTF-8 file with non-ASCII text reported it Unchanged, already windows-1252, exit 0; -From utf-8 -Target utf-8 on UTF-16 with a BOM ended as a validation error, exit 3. Nothing was written in either case. The conflict check now runs before both "already in the target" rules, so both files are Refused / ExplicitSourceConflictsWithDetection, exit 5, and an existing backup is left as it was. A choice that agrees with detection is still Unchanged. Semantics stay at 8: the change only turns some Unchanged decisions into refusals, which revalidation of an applied plan already permits, and semantics 8 has not been released. Backlog: BL-37. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
ConversionPolicy.Decidechecked "already in the target" before the explicit-source conflict. When the chosen source was also the target, the file skipped the conflict check. Reproduced with themasterbuild (3981e3c):-From windows-1252 -Target windows-1252Unchanged, reported as already windows-1252, exit 0-From utf-8 -Target utf-8Error/StrictValidationFailed, exit 3Nothing was written in either case, but the first report is false and
-FailOnChangespasses on it.Change
Refused/ExplicitSourceConflictsWithDetection, exit 5.Unchanged.Semantics version
Stays at 8. The change only turns some
Unchangeddecisions into refusals. Applying a plan re-decides each file, and revalidation may tighten an approved decision but never broaden it, so a plan written by an earlier semantics-8 build is at worst refused for these files. Semantics 8 has not been released; v3.14.5 plans (semantics 7) are refused outright.Tests
In
ExplicitSourceEncodingTests:-Backupand an existing.bakof known bytes: exit 5,Refused/ExplicitSourceConflictsWithDetection, source bytes unchanged, earlier.bakunchanged.-From utf-8 -Target utf-8on UTF-8 staysUnchanged, exit 0, no backup.Mutation check: restoring the old rule order fails the 3 conflict tests; restored byte-for-byte afterwards.
Verification
docs/Test-DefectBacklog.ps1passes.gui-smoke. The full smoke run and the four-corpus audit will be on the final committed release candidate.🤖 Generated with Claude Code