Expand description
§lm-provision
§Architecture
A spec-first pod provisioner built entirely in Rust around a typed
profile_ast::ProfileNode AST. A profile is authored as JSON or the
canonical text form, parsed into the AST by the frontend, and then
run through the read-only pipeline stages (validate / canonical / hash
/ plan) or the effectful exec engine (apply). There is no embedded
scripting runtime: the earlier embedded-Lua authoring frontend and its
VM / sandbox / bridge stack have been removed in favour of the single
AST pipeline.
§Modules
frontend— parse a profile file (.json→ serde bridge, canonical text → PEG grammar,.lua→ explicit rejection) into aprofile_ast::ProfileNodeAST.profile_ast— theProfileNodeAST (spec + the phase catalog kinds), the semantics adapter (ProfileSemantics/ProfileValue), and the dsl-kit engine wiring that drives execution.resolve— the fragment-import resolve stage between load and validate (11-fragment-import.md §Resolution): everyImportnode is replaced by its fragment’s expanded phase list, so everything downstream sees a plain expandedSpec.validate— the AST validate stage (03-pipeline-stage-artifacts.md §validate).canonical— deterministic byte encoder + SHA-256 profile hash over theprofile_ast::ProfileNodeAST (03-pipeline-stage-artifacts.md §canonical / §hash). Frontend- independent by construction:NodeIdis excluded, declared lists are sorted, phase order preserved.pin— the resolver-layerpinsubcommand (spec 11 §The resolver layer): rewritename@versionimports in a JSON profile into the explicit pinnedsrc+hashform against anindex.json, verifying the rewritten document resolves before overwriting it.plan— the AST plan stage: expand a profile into the plan artifact (03-pipeline-stage-artifacts.md §plan).to_bridge_json— expanded AST → serde-JSON serializer whose output the JSON serde bridge accepts (spec 11 §Cache last paragraph: the pin-verifiable cache entries the resolve stage writes, and — later — the payload the driver preflight uploads).resource— what a phase creates (produces) and what it needs already there (requires/assumes), and the forward fold that decides whether a profile is well-formed under that. Every ComfyUI-relative path is derived here from one declared root instead of being a host constant.digest— the crate’s single SHA-256 implementation, shared by the profile hash, the Assert model’s content predicate, and the driver’sensure-binarycheck.exec— the execution layer, with no embedded scripting runtime: the capability gate, the declaration-derived path / HTTP / secret policies, the pure-Rust effect implementations, and the per-step report builder (05-sandbox-layer-contract.md, 09-apply-report-and-ledger.md).machine— what the machine itself must be, and the contract a target implements to be judged against it:machine::admitbefore one exists,machine::observeonce one does.normalize— the canonical phase order every stage reads, imposed on a profile’s as-written order.- [
derive] — thedsl_execattribute’s expansion surface. apply— host-sideplan → dispatch → apply → reportentry point (apply::run_apply_ast, 09-apply-report-and-ledger.md).cli— subcommand / flag surface (07-cli.md).
§Static binary
Build a musl static binary requiring zero preinstalled dependencies on the target pod (08-push-driver-protocol.md §Inputs):
rustup target add x86_64-unknown-linux-musl
cargo build --release --target x86_64-unknown-linux-muslModules§
- apply
- Host-side apply entry point: plan → dispatch → apply → report (09-apply-report-and-ledger.md).
- canonical
- Canonical byte encoding + profile hash over the
ProfileNodeAST. - cli
- CLI subcommand surface and pipeline wiring (07-cli.md).
- derive
- Derive what a profile will demand of its declared lists, so validate
can assert
declared ⊇ derived(spec 00 §Capability derivation). - digest
- Content identity: the crate’s single SHA-256 implementation.
- egress
- sh.exec egress pin — route every subprocess’s network egress through a declared host allowlist (issue 45930cb0, spec 05 §L3).
- exec
- Execution layer for the
ProfileNodeDSL, with no embedded scripting runtime. - fetch
fetch— retrieve a shared profile over HTTP(S) and keep it only if its canonical hash matches the one the caller already holds (07-cli.md §Invocationfetch).- frontend
- Profile file frontend: parse a profile file into a
ProfileNodeAST. - machine
- What the machine itself must be, and which targets can be that.
- normalize
- Canonical-order normalization: the one AST→AST pass that both the plan stage and apply run before they consume a profile.
- pin
- The
pinsubcommand (spec 11 §The resolver layer): rewrite everyImportin a JSON profile whosesrcis thename@versionshorthand into the explicit pinnedsrc+hashform, using anindex.json— local file or HTTPS URL — as the resolver. - plan
- Expand a
ProfileNodeAST into the ordered plan artifact (03-pipeline-stage-artifacts.md§plan). - profile_
ast - The
ProfileNodeAST: the top-levelSpecand the phase catalog kinds (spec 02). - resolve
- Fragment-import resolution: the pipeline stage between load and
validate (spec
11-fragment-import.md§Resolution). - resource
- Resources: the static half of the model.
- to_
bridge_ json - Expanded
ProfileNodeAST →serde_json::Valueserializer whose output the JSON serde bridge accepts. - validate
- First-violation validation over the
ProfileNodeAST (03-pipeline-stage-artifacts.md§validate).