F [100%] =================================== FAILURES =================================== _______ test_overlay_recovery_rejects_symlink_and_data_inode_replacement _______ tmp_path = PosixPath('/tmp/pytest-of-cube/pytest-0/test_overlay_recovery_rejects_0') monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0x7290da211820> 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() > 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 =========================== short test summary info ============================ FAILED tests/test_adaptive_nutrition.py::test_overlay_recovery_rejects_symlink_and_data_inode_replacement 1 failed in 0.17s