Context
Claude flagged a mismatch between marker counting and section processing in lib/bash/file/lib_file.sh. I verified it locally.
update_file_section counts markers with grep -cF, which matches substrings anywhere on a line. The AWK update/remove logic uses exact full-line equality with $0 == START_M and $0 == END_M.
Failure Scenario
A file containing echo # BEGIN and echo # END with markers # BEGIN and # END is treated as having a managed section. The AWK logic never sees exact marker lines, so the function logs an update and returns success without changing the file.
Scope
- Make marker counting use exact full-line semantics, consistent with the AWK processors.
- Keep option-like markers working.
- Add BATS coverage for embedded marker substrings that should not count as managed section markers.
Acceptance Criteria
- Embedded marker substrings do not make
section_exists=true.
- Existing exact marker behavior remains unchanged.
./tests/validate.sh passes.
Validation
Context
Claude flagged a mismatch between marker counting and section processing in
lib/bash/file/lib_file.sh. I verified it locally.update_file_sectioncounts markers withgrep -cF, which matches substrings anywhere on a line. The AWK update/remove logic uses exact full-line equality with$0 == START_Mand$0 == END_M.Failure Scenario
A file containing
echo # BEGINandecho # ENDwith markers# BEGINand# ENDis treated as having a managed section. The AWK logic never sees exact marker lines, so the function logs an update and returns success without changing the file.Scope
Acceptance Criteria
section_exists=true../tests/validate.shpasses.Validation
./tests/validate.sh