Skip to content

Bake pipeline

xratu bake turns one generated reusable capability block into an Xratu package: an immutable artifact holding the block's files, its build record, and the block's execution capsule. Bake runs on the block folder, after xratu capability generate has produced the block's interface seed and generated code.

xratu bake . --out-dir ../build

What bake does, in order

  1. Reads the block folder. It reads the block manifest at the folder's root and the package version, which must be a semantic version.
  2. Archives the block folder. Every file under the folder goes into one .xratu.tgz archive, and every file is hashed. The hashes together give the package its bundle digest. Keep the output folder outside the block folder, so an earlier bake's output is never archived into the next one.
  3. Checks the block's interface. For the interface seed in the folder, bake compiles the block's interface again and compares it with what generation recorded: the same XCI source, the same interface id, version and hash, the same method numbers, and generated files identical byte for byte. See Interface conformance.
  4. Builds the block's capsule. From the seed it writes a build input, a capsule manifest and an executable surface index, and computes the capsule digest. See Execution capsules.
  5. Seals the provider requirement. Each capsule states the runtime provider it needs, taken from the Python that ran bake unless runtime.xratu raises it: {"kind": "cpython", "abi": "cp311", "min_version": "3.11.12"}.
  6. Writes the build record. The xratufile records the archive's identity, the execution plan, the environment intent and every capsule's documents.
flowchart TB
  P["Generated block folder<br/>source, XCI source, bindings, seeds, manifest"]
  P --> A["Archive and hash every file"]
  A --> V["Recompile each interface, compare with its seed"]
  V --> C["Build the block's capsule"]
  C --> X["Write capsules and the xratufile"]
  X --> K["Xratu package"]

What it writes

xratufile                                                     the build record, in the block folder
../build/acme.billing-manifest-1.2.0-1de656841841.xratu.tgz   the package archive
../build/acme.billing-manifest-1.2.0-capsules/
  acme.billing.manifest.json
  acme.billing.executable_surface_index.json
  acme.billing.build_input.json

and prints a summary that names every capsule:

{
  "status": "baked",
  "bundle_digest": "9c8dc1d987eca10970c86629ca215315885382ed61e52576385caaff63a20cda",
  "capsule_count": 1,
  "capsules": ["sha256:40e4f7107cd51aaf3f71dfa261b1db2a8c4f7f2c50f5c92965f4dce90124d537"],
  "provider_requirement": {"kind": "cpython", "abi": "cp311", "min_version": "3.11.12"}
}

When bake stops

Error Cause Fix
manifest is required for bake No block manifest at the folder's root Run xratu capability generate for the folder's blocks
<block> XCI verification refused: …; regenerate the reusable block The block, its XCI source or a generated file changed after generation Run xratu capability generate again, then bake
<block> declares generated source <path>, which is not in the project being baked A generated file was deleted Regenerate the block
<file> and <file> both declare reusable capability block <id> Two interface seeds name the same block Remove the stale seed and regenerate

What bake leaves to later stages

Bake fixes what the block is. The runtime foundation a project runs it on, the source of each dependency, and where the block runs are chosen later, when a project resolves a closure for the capsule. See Resolved runtime closures.