Skip to main content

read_memory_file_lossy

Function read_memory_file_lossy 

Source
pub(crate) fn read_memory_file_lossy(path: &Path) -> Result<String>
Expand description

Read one .md file’s content the same way the rest of the native-memory code does: lossy UTF-8. Unlike native_memory_handlers.rs’s own mirror-refresh path — which truncates an oversized file and separately reports the filename so an interactive caller (bundle.export_for_agent) can surface a warning — the drift detector has no interactive caller to warn. Silently truncating here would instead record the truncated tail as a new version, permanently misrepresenting content the file never actually contained as if it were authoritative (reagent P2 on PR #2675). So an oversized file is refused outright (ErrorKind:: InvalidData, distinguishable from a transient I/O error) rather than read partially; callers log and skip it, same treatment as any other per-file read failure.