<?xml version="1.0" encoding="utf-8"?><testsuites name="pytest tests"><testsuite name="pytest" errors="0" failures="1" skipped="0" tests="1" time="0.165" timestamp="2026-08-17T01:17:32.769523+09:00" hostname="cube-B850M-AORUS-ELITE-WIFI6E-ICE"><testcase classname="tests.test_adaptive_nutrition" name="test_overlay_recovery_rejects_symlink_and_data_inode_replacement" time="0.001"><failure message="assert b'replacement' == b'{&quot;append_se...0&quot;}\n{&quot;torn&quot;:'&#10;  &#10;  At index 0 diff: b'r' != b'{'&#10;  Use -v to get more diff">tmp_path = PosixPath('/tmp/pytest-of-cube/pytest-0/test_overlay_recovery_rejects_0')
monkeypatch = &lt;_pytest.monkeypatch.MonkeyPatch object at 0x7290da211820&gt;

    def test_overlay_recovery_rejects_symlink_and_data_inode_replacement(tmp_path, monkeypatch):
        path = tmp_path / "adaptive-overlays.jsonl"
        journal = OverlayJournal(path, root=tmp_path)
        journal.append(AdaptiveOverlay("base", "proposal", "2026-07-01T00:00:00+09:00"))
        complete = path.read_bytes()
    
        outside = tmp_path / "outside.jsonl"
        outside.write_bytes(b"outside")
        path.unlink()
        path.symlink_to(outside)
        outside_before = outside.read_bytes()
        with pytest.raises(ValueError):
            journal.recover()
        assert outside.read_bytes() == outside_before
    
        path.unlink()
        path.write_bytes(complete + b'{"torn":')
        replacement = tmp_path / "replacement.jsonl"
        replacement.write_bytes(b"replacement")
    
        original_read = journal._read_overlay_rows_locked
    
        def replace_data_inode(token, *, allow_truncated_tail):
            result = original_read(token, allow_truncated_tail=allow_truncated_tail)
            os.replace(replacement, path)
            return result
    
        monkeypatch.setattr(journal, "_read_overlay_rows_locked", replace_data_inode)
        with pytest.raises(ValueError, match="unsafe|replaced"):
            journal.recover()
&gt;       assert path.read_bytes() == complete + b'{"torn":'
E       assert b'replacement' == b'{"append_se...0"}\n{"torn":'
E         
E         At index 0 diff: b'r' != b'{'
E         Use -v to get more diff

tests/test_adaptive_nutrition.py:945: AssertionError</failure></testcase></testsuite></testsuites>