Context
PR 3 Round 2 adversarial review caught the F3 load-bearing fix in FilesystemCorpusBackend.render_index_summary: when the INDEX file contains non-UTF-8 bytes and UnicodeDecodeError fires, the method re-reads with errors="replace" and prepends a warning comment (<!-- WARNING: INDEX.md contained non-UTF-8 bytes; replaced. -->), matching bundle.py:_safe_read_text byte-for-byte. The fix landed in PR 3 (commit at #304), but Round 3 acknowledged the partial-content branch lacks a direct test (R3-F2). The IRON RULE regression suite exercises the soft-degrade contract but not the partial-content prepended-warning shape.
Evidence
atomic_agents/corpus/filesystem.py -- render_index_summary UnicodeDecodeError catch block. The branch re-reads with errors="replace" and prepends the <!-- WARNING: ... --> comment to the partial rendered content. No test in tests/test_corpus_filesystem_backend.py or tests/test_corpus_protocol_conformance.py writes a non-UTF-8 INDEX.md fixture and asserts the prepended warning shape on the return value. Surfaced as R3-F2 in PR 3 Round 3 adversarial review (acknowledged coverage gap; PR 4 follow-up).
Proposed fix
Add a test that writes an INDEX.md fixture with deliberate non-UTF-8 bytes (e.g., a stray \xff byte) and asserts:
render_index_summary("wiki") returns a non-empty string.
- The returned string starts with
<!-- WARNING: INDEX.md contained non-UTF-8 bytes; replaced. -->.
- The partial content for clean portions of the INDEX is preserved.
Acceptance criteria
- A test exercises the
UnicodeDecodeError branch of render_index_summary directly with a non-UTF-8 INDEX.md fixture.
- The test asserts the prepended warning comment AND the partial content preservation.
uv run pytest tests/test_corpus_filesystem_backend.py -q passes with zero regressions.
Source
PR 3 of #65 (PR #304), Round 3 adversarial finding R3-F2.
Context
PR 3 Round 2 adversarial review caught the F3 load-bearing fix in
FilesystemCorpusBackend.render_index_summary: when the INDEX file contains non-UTF-8 bytes andUnicodeDecodeErrorfires, the method re-reads witherrors="replace"and prepends a warning comment (<!-- WARNING: INDEX.md contained non-UTF-8 bytes; replaced. -->), matchingbundle.py:_safe_read_textbyte-for-byte. The fix landed in PR 3 (commit at #304), but Round 3 acknowledged the partial-content branch lacks a direct test (R3-F2). The IRON RULE regression suite exercises the soft-degrade contract but not the partial-content prepended-warning shape.Evidence
atomic_agents/corpus/filesystem.py--render_index_summaryUnicodeDecodeError catch block. The branch re-reads witherrors="replace"and prepends the<!-- WARNING: ... -->comment to the partial rendered content. No test intests/test_corpus_filesystem_backend.pyortests/test_corpus_protocol_conformance.pywrites a non-UTF-8 INDEX.md fixture and asserts the prepended warning shape on the return value. Surfaced as R3-F2 in PR 3 Round 3 adversarial review (acknowledged coverage gap; PR 4 follow-up).Proposed fix
Add a test that writes an INDEX.md fixture with deliberate non-UTF-8 bytes (e.g., a stray
\xffbyte) and asserts:render_index_summary("wiki")returns a non-empty string.<!-- WARNING: INDEX.md contained non-UTF-8 bytes; replaced. -->.Acceptance criteria
UnicodeDecodeErrorbranch ofrender_index_summarydirectly with a non-UTF-8 INDEX.md fixture.uv run pytest tests/test_corpus_filesystem_backend.py -qpasses with zero regressions.Source
PR 3 of #65 (PR #304), Round 3 adversarial finding R3-F2.