Skip to main content

Module binding_migrate

Module binding_migrate 

Source
Expand description

Gen-2 four-primitive → binding v1 migration (D10, gen-2 path).

Converts the current four-primitive store (per-mem Projection + flat [Ingest]) into v1 BindingV1 records: each flat ingest is merged into the projection its projection ref names, collapsing the declaration/schedule split into one versioned binding. The canonical binding id is <mem>/<stem> — the projection’s owning mem dir plus its file stem, i.e. the very string the ingest already used as its projection ref (D3).

migrate_gen2_bindings is pure and IO-free — it transforms already-loaded PipelineConfigs into keyed bindings. The CLI (memstead projection migrate) wraps it with the load / write / validate IO. This module is additive and un-wired: it neither flips the loader version-gate (D2) nor implements the gen-1 root-folder path (also D10) — those are separate, later slices.

§Field mapping (gen-2 → v1)

  • version = 1 (BINDING_VERSION).
  • intent / source_facets / reference_mems / destination_mem / rules — carried over from the Projection verbatim.
  • deny_paths — moved up from the per-ingest record to the binding (strategy-invariant, E1); bare directory segments are rewritten to E1’s workspace-relative glob dialect where trivially derivable (see [to_glob_dialect]), every rewrite recorded as a note.
  • coverage_semantics — defaults CoverageSemantics::Exhaustive (gen-2 has no such field).
  • operations.build — the ingest’s mode / trigger / batch_size / post_actions. mode maps discoveryBuildMode::Discovery and one-shotBuildMode::OneShot; refinement is a typed migrate error (BindingMigrateError::RefinementModeDeleted) — the vocabulary is deleted, not migrated (D1).
  • operations.sync / operations.verifyNone. A gen-2 config declares only the build-equivalent schedule; sync/verify are enabled later via projection enable, never fabricated by migration.

A dangling ingest→projection ref is a typed migrate error (BindingMigrateError::DanglingProjectionRef), never a silent drop (D10).

Structs§

MigratedBinding
A single migrated binding paired with the identity and provenance the CLI needs to write it to disk and report it.

Enums§

BindingMigrateError
Why a gen-2 config could not be migrated to a v1 binding. Every variant names the offending ingest so the failure is diagnosable without re-reading the store.

Functions§

migrate_gen2_bindings
Migrate every gen-2 flat ingest in configs into a v1 MigratedBinding, keyed by binding id (<mem>/<stem>, D3), in id order.
resolve_migrated_binding
Resolve a migrated binding’s primary sources (facet + medium) via the binding resolve layer, so the produced binding can be validated against the D6 capability matrix (crate::binding::validate_binding).