feat(package): lock v3 package-instance graph and strict sync (B-02 B-03 B-04)

- lock the full transitive closure with per-instance alias edges, root
  manifest digest, full content digests and structured path/git sources
- reject v1/v2 locks; validate ids, digests, edges, reachability and sources
- resolve every locked edge by (parent instance, alias) and fail closed on
  missing locks/edges/records, digest or source drift and root drift
- require a lock for run/check/inspect when dependencies exist and map lock
  errors to exit 1
- make sync strict in both modes, never rewrite the lock, and materialize the
  whole closure with env.json schema 2
- verify Git cache markers, require full commit hashes and confirm HEAD
- stop add/remove from patching the lock; regenerate example locks
- update package-format.md and STATUS for S1
This commit is contained in:
cflmy committed 2026-11-20 12:55:30 +08:00
1 parent cd90f38ce1
commit 6fed396d20
8 files changed
+1243 -275

No files matched your search

+17 -1
View File
@@ -146,8 +146,24 @@ pub fn load(entry: &Path) -> Result<LoadedProject, String> {
None
};
let lock = if root.join(LOCK_FILE).is_file() {
Some(LockFile::load(&root.join(LOCK_FILE))?)
let lock = LockFile::load(&root.join(LOCK_FILE))
.map_err(|error| format!("{LOCK_FILE}: {error}"))?;
if let Some(manifest) = &manifest {
lock.validate_root(manifest)
.map_err(|error| format!("{LOCK_FILE}: {error}"))?;
}
Some(lock)
} else {
if manifest
.as_ref()
.map(|manifest| !manifest.dependencies.is_empty())
.unwrap_or(false)
{
return Err(
"marqdo.lock is missing; run `marqdo lock` before checking or running this project"
.to_string(),
);
}
None
};
let resolver = PackageResolver::new(root.clone(), manifest, lock);