feat(ext): extension selection + lock v4, inspect --extensions (RFC-EXT-0001 PR-04)

- marqdo.yaml.extensions accepts only ./path or @alias/path, resolves to a
  regular file inside its owning package, never grants
- lock_version 4 records plugin/kernel/provider manifest+artifact identity;
  v3 requires explicit 'marqdo lock' migration; sync/check/run compare identity
- check stays static; run re-verifies artifact bytes; pure/strict refuse
- inspect --extensions reports declared/locked identity, plugin descriptors and
  stdlib aliases with authorization 'not_granted'
- black-box extension_selection suite (13) + package-layer tests; specs/ADR-0056
- workspace gate: fmt/clippy clean, 599 passed across 67 targets
This commit is contained in:
cflmy committed 2026-11-22 00:43:18 +08:00
1 parent 1f6fd644a0
commit 89555382e0
19 files changed
+2240 -63

No files matched your search

+14 -1
View File
@@ -163,6 +163,12 @@ pub struct LoadedProject {
/// These are ordinary `Marqdo` bindings; the runtime has no print special
/// case and no `Program.print_override`.
pub official_aliases: Vec<marqdo_ir::callable::OfficialAlias>,
/// Project manifest, when the entry belongs to a project.
pub manifest: Option<Manifest>,
/// Verified lock file, when present (lock v4).
pub lock: Option<LockFile>,
/// Resolved `marqdo.yaml.extensions` activation sources (static paths only).
pub extension_sources: Vec<marqdo_package::ResolvedExtension>,
}
impl LoadedProject {
@@ -271,7 +277,7 @@ pub fn load(entry: &Path) -> Result<LoadedProject, String> {
}
None
};
let resolver = PackageResolver::new(root.clone(), manifest.clone(), lock);
let resolver = PackageResolver::new(root.clone(), manifest.clone(), lock.clone());
let entry_module = resolver.resolve_entry(&entry)?;
let stdlib = StdlibBundle::discover().map_err(|error| format!("stdlib: {error}"))?;
let mut loader = Loader {
@@ -290,6 +296,10 @@ pub fn load(entry: &Path) -> Result<LoadedProject, String> {
// the target module/function; only aliases the program actually references
// load their module, and the runtime binds them as ordinary Marqdo calls.
let official_aliases = loader.load_official_aliases()?;
let extension_sources = loader
.resolver
.resolve_extension_sources()
.map_err(|error| format!("extension selection: {error}"))?;
let stdlib_info = loader.stdlib.as_ref().map(|bundle| StdlibInfo {
version: bundle.version().to_string(),
@@ -314,6 +324,9 @@ pub fn load(entry: &Path) -> Result<LoadedProject, String> {
diagnostics: loader.diagnostics,
stdlib: stdlib_info,
official_aliases,
manifest,
lock,
extension_sources,
})
}