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
@@ -156,7 +156,7 @@ fn semantic_goldens_match_end_to_end_execution() {
let source = fs::read_to_string(fixture)
.unwrap_or_else(|error| panic!("cannot read {}: {error}", fixture.display()));
let module_id = ModuleId::from("index.mq.md");
let analysis = marqdo_frontend::analyze_source(&module_id.0, &source);
let analysis = marqdo_frontend::analyze_source(&module_id.to_string(), &source);
if analysis.has_errors() {
panic!(
"semantic fixture `{}` must compile without errors:\n{}",
+1 -1
View File
@@ -209,7 +209,7 @@ fn runtime_negative_goldens() {
let source = fs::read_to_string(fixture)
.unwrap_or_else(|error| panic!("cannot read {}: {error}", fixture.display()));
let module_id = ModuleId::from("index.mq.md");
let analysis = marqdo_frontend::analyze_source(&module_id.0, &source);
let analysis = marqdo_frontend::analyze_source(&module_id.to_string(), &source);
assert!(
!analysis.has_errors(),
"runtime fixture `{}` must compile; diagnostics: {:?}",
+1 -1
View File
@@ -379,7 +379,7 @@ fn narration_removal_preserves_execution() {
let mut values = Vec::new();
for source in [base.source, clean.as_str()] {
let analysis = marqdo_frontend::analyze_source(&module_id.0, source);
let analysis = marqdo_frontend::analyze_source(&module_id.to_string(), source);
assert!(!analysis.has_errors(), "{:?}", analysis.diagnostics);
let mut program = marqdo_ir::Program::default();
program.insert(analysis.module.clone());