fix(error-handling): _handle_file_edit() now respects encoding parameter
Remove duplicate step function definition in tool_builtins_steps.py that was shadowing the decorated @when handler, causing the Behave step to be orphaned at runtime. Add CHANGELOG entry documenting the encoding fix for issue #7559. ISSUES CLOSED: #7559 # Conflicts: # CHANGELOG.md
This commit is contained in:
@@ -223,6 +223,15 @@ The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
|
||||
prefix check using OS path separators. Added regression test tagged
|
||||
`@tdd_issue_7558`.
|
||||
|
||||
- **File Edit Encoding Parameter** (#7559): `_handle_file_edit()` now correctly
|
||||
respects the `encoding` parameter when reading and writing files. Previously the
|
||||
function ignored the caller-supplied encoding and fell back to the platform default,
|
||||
causing data corruption with non-UTF-8 files. The fix extracts `encoding` from the
|
||||
tool inputs (defaulting to `"utf-8"`) and passes it to both `path.read_text()` and
|
||||
`path.write_text()`. The `FILE_EDIT_SPEC` input schema was updated to declare the
|
||||
`encoding` field. BDD scenarios were added to cover explicit encoding and the
|
||||
UTF-8 default.
|
||||
|
||||
- **Validation Gate Empty-Run Guard** (#7508): Fixed `ApplyValidationSummary.all_required_passed`
|
||||
returning `True` when zero validations were run, silently bypassing the apply gate. The property
|
||||
now returns `False` when the validation result set is empty (`is_empty` is `True`), ensuring
|
||||
|
||||
@@ -176,21 +176,6 @@ def step_when_file_edit_with_encoding(
|
||||
)
|
||||
|
||||
|
||||
def step_when_file_edit_with_encoding(
|
||||
context: Any, old: str, new: str, encoding: str
|
||||
) -> None:
|
||||
_run_tool(
|
||||
context,
|
||||
"builtin/file-edit",
|
||||
{
|
||||
"path": "edit-enc.txt",
|
||||
"old_text": old,
|
||||
"new_text": new,
|
||||
"encoding": encoding,
|
||||
},
|
||||
)
|
||||
|
||||
|
||||
@when('I execute the "builtin/file-edit" tool replacing all "{old}" with "{new}"')
|
||||
def step_when_file_edit_all(context: Any, old: str, new: str) -> None:
|
||||
_run_tool(
|
||||
|
||||
Reference in New Issue
Block a user