Context
update_file_section has asymmetric behavior when multiple sections use the same marker pair. The update path replaces only the first matching section, while the remove path deletes every matching START...END pair.
Failure Scenario
A file contains two sequential sections with the same markers.
update_file_section file "# BEGIN" "# END" new updates only the first section.
update_file_section -r file "# BEGIN" "# END" removes both sections.
That asymmetry can delete content the caller did not intend to manage.
Scope
- Decide and implement the canonical behavior for duplicate matching marker pairs.
- Prefer aligning remove with update by removing only the first matching section, unless duplicate markers should instead be rejected as ambiguous.
- Update function docs and README text to describe the chosen behavior.
- Add BATS coverage for multiple matching sections.
Acceptance Criteria
- Add/update/remove behavior agrees for duplicate marker pairs.
- The chosen behavior is documented.
- Existing single-section behavior remains unchanged.
./tests/validate.sh passes.
Validation
Context
update_file_sectionhas asymmetric behavior when multiple sections use the same marker pair. The update path replaces only the first matching section, while the remove path deletes every matchingSTART...ENDpair.Failure Scenario
A file contains two sequential sections with the same markers.
update_file_section file "# BEGIN" "# END" newupdates only the first section.update_file_section -r file "# BEGIN" "# END"removes both sections.That asymmetry can delete content the caller did not intend to manage.
Scope
Acceptance Criteria
./tests/validate.shpasses.Validation
./tests/validate.sh