phenotypic.sdk_.migrate_metadata_bundle#

phenotypic.sdk_.migrate_metadata_bundle(source: str | Path | BundleLayout, *, expected_plan_fingerprint: str, kinds: frozenset[str] | None = None, target_role: Literal['bundle_durable', 'bundle_all', 'exact_file'] | None = None, commit_guard: Callable[[], AbstractContextManager[None]] | None = None) MetadataMigrationResult[source]#

Migrate authoritative sources in a full or standalone bundle.

Re-running after an interruption is safe, by two mechanisms that are worth naming because “pass 1 is idempotent by content” is false – a parquet rewrite is not byte-idempotent and a re-applied rewrite changes every sha256. The real mechanisms are that an existing receipt short-circuits the re-run onto itself, and that an already-canonical bundle returns a compatible no-op that rewrites nothing. An executor who “optimizes” past the receipt check on the strength of the wrong reason breaks marker validity for the whole tree.

Parameters:
  • source (str | Path | BundleLayout) – Bundle path or resolved BundleLayout.

  • expected_plan_fingerprint (str) – Fingerprint from the matching preflight.

  • kinds (frozenset[str] | None) – Restrict the migration to these TargetKind values, and record that scope in the receipt. None means every kind.

  • target_role (Literal['bundle_durable', 'bundle_all', 'exact_file'] | None) – Explicit bundle ownership role. The migrate CLI passes bundle_durable; None preserves the generic full-bundle API.

  • commit_guard (Callable[[], AbstractContextManager[None]] | None)

Returns:

The migration result.

Return type:

MetadataMigrationResult