feat(m0.6-r1): package-aware module identity and resolver

- replace path-only ModuleId with {instance, relative_path} and canonical
  <instance>::<path> encoding
- add PackageResolver/ResolvedPackage in marqdo-package for path sources;
  hash package trees deterministically for content-addressed instance ids
- move import resolution out of the CLI loader; reject package escapes
- emit lock_version 2 with instance ids and migrate v1 lockfiles
- update references/package-format specs and the function-ref golden
- add package resolver tests for stable identity across path moves
This commit is contained in:
cflmy committed 2026-11-20 11:37:16 +08:00
1 parent 66476fbbfb
commit 5877d9aa5e
16 files changed
+665 -155

No files matched your search

+1 -1
View File
@@ -329,7 +329,7 @@ fn resolve_ref(
0 => {
if let Some(function) = module.functions.iter().find(|f| f.unit == unit_id) {
return Ok(Value::FunctionRef(FunctionRef {
module: function.id.module.0.clone(),
module: function.id.module.to_string(),
name: function.id.name.clone(),
}));
}
+2 -2
View File
@@ -551,7 +551,7 @@ impl<'a> Interpreter<'a> {
match callee {
Value::FunctionRef(reference) => {
let id = FunctionId {
module: ModuleId(reference.module),
module: ModuleId::from(reference.module),
name: reference.name,
};
let Some(function) = program.function(&id) else {
@@ -596,7 +596,7 @@ impl<'a> Interpreter<'a> {
span: Option<Span>,
module: &ModuleId,
) -> Result<Value, RuntimeError> {
let context = ExecutionContext::new(module.0.clone(), span);
let context = ExecutionContext::new(module.to_string(), span);
self.host.invoke(op, args, &context)
}
}