Skip to main content

Module overlay

Module overlay 

Source
Expand description

A patch applied to a parsed profile.yml before the compiler ever sees it.

§Why this is not a compile stage

A host that serves many accounts from one set of behaviors needs the same profile bound differently per account: a different set of mounted behaviors, different values supplied to them, a different charter. An overlay is that difference, expressed as a patch.

It is applied here, to the deserialized ProfileFile, before warble::compile is called. That placement is what keeps the mechanism small:

  • compile’s signature is untouched, and the compiler holds no notion of an overlay;
  • the compiler stays sans-IO — this module reads the patch file, as the host layer should;
  • every existing compile-time check applies to the patched profile for free. In particular the capability ceiling is enforced per mount, so a patch that mounts a behavior requiring something the profile does not permit is refused without any ordering rule having to be arranged. The same holds for slot declarations, context preconditions and required binds.

§What a patch may touch, and why so little

Which behaviors are mounted, the values bound to them, and which charter the profile uses. Nothing else — not a mounted behavior’s internals, its steps, or its capabilities.

Everything on that list is already expressible on a profile mount, so the patch adds an entry point rather than new expressive power. That is deliberate: a deployment that could rewrite what a behavior declares it needs would make the declaration meaningless, since the same behavior would claim different requirements per deployment. Differences in what a runtime can actually provide are expressed by target profiles and provider fragments instead, where an unmet need surfaces as a degrade or a loud failure.

Structs§

OverlayFile
A parsed overlay document.
OverlayMount
One mount: entry — a behavior to add, with the values it should be bound with.

Functions§

apply_overlay
Applies an overlay to a parsed profile, in place.
read_overlay
Reads and parses an overlay document.