Skip to main content

commit

Function commit 

Source
pub fn commit(
    _child: FlowLocal,
    _parent: &mut FlowLocal,
) -> Result<(), CommitError>
Expand description

Fold a forked child’s own-layer overrides back into its parent’s, making the child’s writes visible through parent (and, transitively, anything parent itself chains to or is later written through).

This is a deferred seam, not implemented in this release. It exists so the shape of the eventual write-back API is fixed and callers can write code against it now (always getting CommitError::NotImplemented back) rather than the API appearing later with no forward-compatible slot. Per the spec, only a fork ever commits — a root flow has no parent to fold into, and its Local-scoped writes already persist for its own lifetime; World-scoped writes already escape live, with no “make it back” step needed.

Intended semantics, when implemented: walk child’s own top-layer overrides (globals, visit counts, turn counts, turn index, RNG) and apply each onto parent’s own top layer, as if child’s writes had been made directly against parent — last-write-wins per unit, since a fork is single-writer for its whole lifetime (no concurrent-write conflict is possible, so no merge policy is needed). Commit never touches World directly: a folded Local-scoped write still only lands in parent’s overrides, reaching World only if parent is itself later written through a World-scoped op or committed further up the chain. Sandbox-mode writes are exactly what this would fold back — commit is what would turn a sandboxed probe into a real, persisted mutation, for a caller that chooses to call it instead of dropping the child.

§Errors

Always returns CommitError::NotImplemented in this release.