Skip to content

FileSystem: atomic multi-edit method for shim MultiEdit parity #313

Description

@adtyavrdhn

Blocks swapping the gh-aw shim's MultiEdit tool onto the harness. Context: #265 (shim parity is FileSystem + Shell only and does not cover this).

FileSystemToolset.edit_file does one replacement and requires the match to be unique. MultiEdit applies an ordered list of edits to a single file atomically: if any old_string is missing, nothing is written.

Requirement: a method, e.g.

async def multi_edit(self, path: str, edits: list[EditOp], *, expected_hash: str | None = None) -> str

where EditOp is {old_string: str, new_string: str, replace_all: bool = False}, with:

  • edits applied in order, each to the result of the previous one
  • each edit replaces the first occurrence, or every occurrence when replace_all
  • all-or-nothing: if any old_string is not found, the file is left untouched and the call raises a recoverable ModelRetry
  • same containment and expected_hash semantics as edit_file

The one semantic difference from edit_file: per-edit matching is first-occurrence, not unique-occurrence.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions