Skip to main content

type_bridge_migration/
lib.rs

1//! Migration specification IR for type-bridge.
2//!
3//! This crate defines the serde contract that Python migration authoring lowers
4//! into, plus pure validation, checksum gates, the transaction-aware planner,
5//! and the async executor that runs each step over a `Database`.
6
7#![deny(missing_docs)]
8
9// The legacy CLI source is shared by the standalone binary and the Python
10// extension. Give the library its package name so the shared module can keep
11// using the same absolute imports in both compilation contexts.
12extern crate self as type_bridge_migration;
13
14#[cfg(test)]
15#[macro_use]
16mod typeql_test;
17
18pub mod adoption;
19pub mod author;
20pub mod backfill;
21pub mod checksum;
22pub mod error;
23pub mod executor;
24pub mod graph;
25pub mod loader;
26pub mod plan;
27pub mod recovery;
28pub mod spec;
29pub mod state;
30
31/// Released V1 command-line parser and command runner.
32///
33/// The standalone `type-bridge-migration` binary and the Python wheel entry
34/// point both call this module, keeping one parser, one execution path, and the
35/// same stdout/stderr and exit-code contract.
36#[path = "bin/type_bridge_migration.rs"]
37pub mod legacy_cli;
38
39#[cfg(test)]
40pub(crate) mod testing;
41
42pub use adoption::{
43    LEGACY_ADOPTION_METADATA_V2, LEGACY_IGNORED_SOURCE_METADATA_V1,
44    LEGACY_SIDECAR_ADOPTION_METADATA_V1, LegacyAdoptionHistory, LegacyAdoptionMetadata,
45    LegacyDirectoryAuthority, LegacyDirectoryEntry, LegacyIgnoredSourceMetadata,
46    LegacyMetadataRevision, LegacySchemaEffect, LegacySidecarAdoptionMetadata,
47    MAX_LEGACY_ARTIFACT_BYTES, MAX_LEGACY_DIRECTORY_ENTRIES, MAX_LEGACY_HISTORY_BYTES,
48    VerifiedLegacyHead, load_adoption_history, reconstruct_legacy_head,
49};
50pub use author::map_schema_diff;
51pub use backfill::{BackfillResult, execute_backfill};
52pub use checksum::{
53    ChecksumDrift, check_checksum_drift, checksum_drift_errors, migration_file_checksum,
54};
55pub use error::{MigrationError, Result};
56pub use executor::{MigrationResult, execute_migration, execute_plan, execute_plan_with_run_log};
57pub use graph::{AppliedMigrationRecord, MigrationValidationError, ValidationCode, validate_graph};
58pub use loader::{load_dir, load_dir_checked, load_sidecar};
59pub use plan::{
60    ExecutionPlan, ExecutionStep, MigrationAction, MigrationExecution, OperationKind, StepKind,
61    plan,
62};
63pub use recovery::{
64    CheckedExecutionPlan, CheckedExecutionStep, CheckedMigrationExecution,
65    CheckedMigrationIdentity, ExecutionStepId, PendingProof, RecoveryExecutionResult,
66    RecoveryFuture, RecoveryMigrationResult, RecoveryMigrationStatus, RecoveryPlanStatus,
67    StepExecutionOutcome, StepExecutionResult, StepRecoveryController, StepRecoveryDecision,
68    StepRecoveryEvent, StepRecoveryEventKind, execute_recovery_plan, plan_recovery,
69    prepare_recovery_plan,
70};
71pub use spec::{MigrationDependencySpec, MigrationGraph, MigrationSpec, OperationSpec};
72pub use state::{
73    InMemoryStateStore, LEGACY_CUTOVER_SENTINEL_APP_LABEL, LEGACY_CUTOVER_SENTINEL_APPLIED_AT,
74    LEGACY_CUTOVER_SENTINEL_MIGRATION_ID, LEGACY_CUTOVER_SENTINEL_NAME,
75    LEGACY_WRITER_CUTOVER_MESSAGE, LegacyCutoverSentinelError, LegacyCutoverSentinelExpectation,
76    MigrationExecutorInfo, MigrationRunRecord, MigrationStateSchemaKind, MigrationStateStore,
77    TypeDbStateStore, VerifiedLegacyAppliedPartition, applied_migration_entity_label,
78    collect_executor_info, finished_run_record, is_migration_state_type, migration_state_schema,
79    migration_timestamp_now, require_legacy_writer_open, require_legacy_writer_open_in_transaction,
80    started_run_record,
81};