PeaBox Lab › PeaLang › Learn › Chapter 33 › Lesson 1

Part V — The Modern Experience Layer · Chapter 33 · Lesson 1 of 2

Signed packages, SBOMs and provenance

The supply-chain API lives in pealang/supply_chain.py. In 3.1.39 it is not registered in the built-in analysis namespace; .pea scripts reach it through interop.import_python("pealang.supply_chain"). PeaLang's own import takes a quoted path to another .pea file. The other release-hardening helpers remain Python-level host tooling.

Package metadata and signing

let sc = interop.import_python("pealang.supply_chain")
let payload = interop.call_python("builtins", "bytes", "pricing-rules-v1", "utf-8")
let meta = sc.PackageMetadata(
  "pricing-rules", "1.4.0", "aabbccdd", ["std.collections", "std.json"]
)

let digest = sc.sign_payload(payload)
let ok = sc.verify_signature(payload, digest)

PackageMetadata(name, version, checksum, depends=None, optional=False) is the structured manifest record: the checksum is a SHA-256 of the normalized package payload, and depends is a list of package names. sign_payload returns a detached SHA-256 hex digest over the raw bytes; verify_signature recomputes it and compares. This is integrity evidence, not public-key signing — the Python-level signing.py module covers keyed HMAC-SHA256 signatures and trust stores. The example builds bytes through the built-in interop namespace because PeaLang has no byte literal.

Resolving dependencies

let index = {
  "pricing-rules": sc.PackageMetadata("pricing-rules", "1.4.0", "aabbccdd", ["std.collections", "std.json"]),
  "std.collections": sc.PackageMetadata("std.collections", "1.0.0", "11223344"),
  "std.json": sc.PackageMetadata("std.json", "1.0.0", "55667788")
}
let plan = sc.resolve_dependencies("pricing-rules", index)

let idx = sc.SupplyChainIndex(".pea_index")
idx.publish("pricing-rules", "1.4.0", "aabbccdd", ["std.collections"])
let report = idx.scan("pricing-rules")

resolve_dependencies(wanted, index, max_depth=5) raises on a missing package, a cycle, or excessive depth, but 3.1.39 does not return the full transitive list: its inner _resolve() never appends to the outer resolved list, so a successful call returns only the requested package. It does not interpret version ranges; the resolver in ecosystem.py is a separate stub that always accepts constraints. SupplyChainIndex wraps a local index with publish, scan, resolve and list_packages, recording checksums and dependency declarations.

Checksums and SBOMs

These are Python-level functions in supply_chain.py, not members of analysis. Call them from host tooling: sha256_file hashes one file, artifact_checksums(*paths) returns a path-to-digest map, and write_checksums(checksums, dest) writes sorted JSON or SHA256SUMS lines. generate_sbom(root, version="0.0.0", dependencies=None) emits a CycloneDX 1.5 document with a file hash per component; verify_sbom(sbom, root) compares those hashes and reports mismatches. dependency_inventory reads a pyproject.toml or a UUID-keyed index into review rows.

verify_wheel and verify_source_archive inspect archive structure (a wheel needs pealang/__init__.py and *.dist-info/METADATA; a source zip needs pyproject.toml and README.md). They do not compare a supplied expected hash, so pair them with checksum verification. An SBOM nobody verifies is still just a PDF with ambition.

Provenance and reproducibility

Also Python-level: build_provenance(root, files, version="0.0.0", compiler="peac") records digests for a list of artifacts; verify_provenance checks them. deterministic_manifest(root) hashes every file in sorted order and verify_manifest reports changed paths. reproducible_build_metadata(build_id, timestamp, source_hash) captures the build knobs; migration_check(from_root, to_root) treats a migration as compatible when no source file vanished. sign_release_manifest and verify_release_signature use Ed25519 from the cryptography package.

Release gates

The Python-level gate helpers are release_checklist() (a fixed list of gate names), readiness_assessment(states) (scores a mapping of truthy states), containerfile() (a fixed Containerfile string) and ci_matrix() (OS and Python-version matrix). locked_dependency_evidence(root) and offline_install_evidence(wheelhouse, packages) return evidence dicts; packaging_quality_gate(manifest, sbom, provenance, deterministic, offline, files) turns those checks into a PASS/FAIL verdict. None of these are registered in analysis; keep them in release tooling.

How this composes with Chapter 24

Chapter 24 taught the discipline: manifests, hashes, SBOMs, RC validation, rollback. The 3.1.39 source implements part of that discipline as Python host modules; analysis does not register these supply-chain helpers, so .pea callers import the module through interop. If you already build releases with external tooling, keep it if it emits the same evidence; the goal is verifiable output, not uniformity.

Guided practice

Next →