pub fn read(project_root: &Path) -> Result<Option<String>>Expand description
Read bynk.schema.lock‘s raw content from project_root, if it exists.
Ok(None) means verified absent — no such file — which is the only
thing CompileOptions’ SchemaLock::On { existing: None } is allowed to
mean (see that type’s own doc). A present-but-unreadable file is a real
io::Error, not folded into None — silently treating a permission
error, a non-traversable ancestor, or any other stat/read failure as
“fresh project” would risk re-baselining a real registry’s history
exactly as wrongly as never reading it at all.
#1085 review: a prior version checked path.exists() first and only then
read — exists() maps every metadata error to false, not just
“not found,” so a non-ENOENT stat failure (or a dangling symlink, or a
race with another process between the two calls) would have silently
produced Ok(None) here. Reading directly and matching on
ErrorKind::NotFound is both narrower (only the one error kind degrades)
and race-free (one syscall, not two).