Expand description
Adapter-profile overlay merge — leaf-replace semantics (CONTEXT.md §adapter profile).
A profile is a named sparse overlay on its parent adapter manifest. The
merge rule is leaf-replace: a profile key replaces the whole value at that
path — tables recurse key-by-key, but every non-table value (scalar, array,
datetime) overrides wholesale. Arrays are replaced, never spliced or
appended. Keys present only in the parent survive; keys present only in the
overlay are added. The merged [toml::Value] re-deserializes into a complete
crate::Manifest, so the profile behaves as a distinct adapter option
everywhere a bare adapter_name rides.
This is a pure function with no I/O; the unit table below is its contract.
Functions§
- as_
file_ pointer - A
[strings]value that is a file pointer (M12-W3, REQ-MANIFEST-5): a value-position table with EXACTLY one key,file, whose value is a string — e.g.key = { file = "rel/path" }. Returns that relative path. The exactly-one-key rule is the disambiguation (doyle): any OTHER table shape (including one that merely contains afilekey alongside others) stays an opaque nested strings tree, so existing nested trees are untouched (back-compat). This single-key table shape IS reserved as the pointer form — a literal{ file = … }value cannot double as inline data. The pointer is resolved to the file’s contents lazily atget-stringtime, never here. - check_
tighten_ only - Consent floors are tighten-only (CONTEXT.md §adapter profile): a profile
may demand more approval than its parent, never less. Refused at
registration if the merged profile loosens an approval-class floor
(
require_approval, or the at-capover_capbehavior). Capacity limits (max_instances_per_owner) are not approval-class and are not floored here. - merge_
leaf_ replace - Leaf-replace deep merge of
overlayontobase. - resolve
- Resolve a shipped profile (
[profiles.<name>]declared onparent) into a complete, validated manifest — the merged view a<adapter>:<profile>address selects. A bare adapter name never calls this (it uses the parent unmodified). - resolve_
overlay - Apply an arbitrary sparse
overlayontoparent— the shared core of both shipped-profile (resolve) and local-profile (registry) resolution. Serializes the parent to a [Value], leaf-replace-merges the overlay, re-deserializes, drops the profile catalogue from the resolved view, then re-runs the manifest invariants and the tighten-only consent floor. - set_
string_ at - Set
valueat a dot-separatedkey_pathin a[strings]tree, creating intermediate tables as needed (the write half ofset-string). Errors on an empty path segment or a path that traverses an existing non-table leaf. - split_
option - Split an adapter option string into
(adapter, profile?)on the first:— the canonical composite addressing form. A bare name (no:) yields(name, None)and resolves to the parent unmodified;<adapter>:<profile>yields(adapter, Some(profile)). The split is on the first:so an adapter name itself may not contain one (it never does), while a profile name may. - string_
at - Read a dot-separated
key_pathout of a[strings]KV tree: each segment indexes a nested table, the final segment’s value is returned.Noneif any segment is missing or a non-final segment is not a table. Used byspt adapter get-stringafter the profile overlay has merged the tree.