pub fn load_text_strict(path: &Path, display: &str) -> Result<String>Expand description
Load a path as UTF-8 text under the Strict sole-path policy (#1894).
Use for explicit single-file mutators and sole-path reads (CLI/MCP/tx/api).
| Kind | Result |
|---|---|
| Text | Ok(String) |
| Binary | Err(BinaryError) — target is a binary file: {display} (error_kind: binary) |
| Invalid UTF-8 | Err(InvalidEncodingError) — target is not valid UTF-8 text: {display} (error_kind: invalid_encoding) |
| Not a file | Err(InvalidInputError) — target is not a file: {display} |
| IO NotFound | Err with io::Error + context failed to read {display} (is_io_not_found) |
| IO other (permission, …) | Err(InvalidInputError) — failed to read {display}: {os error} |
Binary / invalid UTF-8 are distinct from argument invalid_input so hosts can
recover overwrite without treating empty paths the same as content SoftSkip
(#1963). Non-NotFound IO is typed so agent JSON gets error_kind: invalid_input
and a single complete message that includes the OS error even when callers
format with Display / to_string() (which drops anyhow cause chains).
NotFound stays an IO error so [crate::exit::is_io_not_found] keeps working.
Directory walks and multi-path soft-skip must use read_text_file (or
tx::read_and_probe), not this function.