Skip to main content

Module pipeline_edit

Module pipeline_edit 

Source
Expand description

Edit operations over the v2 single-record pipeline store.

Sits above the dumb file ops in crate::pipeline_store: each function loads the current store, enforces identity rules (no clobber, no silent overwrite), validates the candidate record in-place, then writes. The engine’s in-memory pipeline_configs cache is refreshed by the Engine wrapper methods that call these — not here — so these functions stay pure disk ops that unit-test with a bare TempDir.

One record kind, four verbs: a binding is created / patched / deleted / renamed under its (mem, name) file identity. The cross-record referential-integrity machinery of the three-file era (dangling facet / medium refs, delete-blocked-by-referrer, rename repointing) is gone with the references — in-record source validation (crate::binding::validate_binding) covers what remains: source name rules plus the medium-capability matrix.

The JSON entry points (add_binding_json / update_binding_json) accept a BindingPatch over the full author-editable record — sources, operations block, deny_paths, coverage_semantics, rules (clearable via explicit null), prune — with version engine-managed. A field absent from the payload is preserved from the stored record (the tail-preservation contract): edits merge over the stored record, never rebuild it from form fields.

Structs§

BindingPatch
A partial edit of a binding record, decoded from the JSON edit entry points (update_binding_json / add_binding_json).

Enums§

PipelineEditError
Failure modes of a pipeline edit. Distinct from the entity-centric crate::engine::EngineError — these describe binding-store edits. key is the display identity: "<mem>/<name>".

Functions§

add_binding_json
Create a binding from a JSON BindingPatch applied to the default scaffold. Refuses when (mem, name) already holds a record (PipelineEditError::AlreadyExists), when the patch leaves destination_mem empty (PipelineEditError::InvalidJson), or when the candidate fails in-record validation (PipelineEditError::Capability — every refusal blocks; a fresh record has no pre-existing state to grandfather). Returns the written record.
delete_binding
Delete a binding. Refuses if (mem, name) does not exist. Nothing references a binding record, so there is no referential gate — the binding’s own state files (advance / findings / watermarks) simply stop being consulted.
rename_binding
Rename a binding within its mem (oldnew, same <mem> tier). A binding has no embedded name, so a file move is its whole rename. Refuses a missing source or an existing target. No-op when old == new.
update_binding_json
Patch an existing binding from a JSON BindingPatch — the update path over the full author-editable record (sources, operations, deny_paths, coverage_semantics, rules including clearing, prune). Absent fields are preserved (the tail-preservation contract); explicit null clears intent / rules / prune; a present sources or operations block replaces that whole block; version stays engine-managed.