Pipeline Stage Type Compatibility
Auto-generated by
cargo run -p xtask-mcpb -- generate-type-tables. Do not edit manually. Source of truth:crates/ledger-core/tests/type_mesh.rs
Stage I/O Matrix
| Stage | Input Type | Output Type | Confidence | Jurisdiction | Notes |
|---|---|---|---|---|---|
| Ingest | TransactionInput | IngestedTransaction, JournalTransaction | Deterministic (1.0) | All | Blake3 content-hash IDs |
| Validate | TransactionInput | MetaCtx | 0.0–1.0 | All | Type checks, constraint evaluation |
| Classify | SampleTransaction | ClassificationOutcome, ClassifiedTransaction | 0.0–1.0 | US/AU/UK | Rhai rule waterfall |
| Reconcile | ClassifiedTransaction | OperationResult | 0.0–1.0 | All | Xero match/diff |
| Export | OperationContext | rust_xlsxwriter::Workbook | Deterministic (1.0) | All | CPA-auditable Excel |
| Verify | RepairProposal | VerificationOutcome | 0.0–1.0 | All | Multi-model proposer/reviewer |
Cross-Stage Compatibility
| From Type | To Type | Compatible? | Bridge | Test |
|---|---|---|---|---|
TransactionInput | SampleTransaction | Yes | deterministic_tx_id() | test_transaction_input_to_sample_transaction_shape |
TransactionInput | JournalTransaction | Yes | JournalTransaction::from_input() | test_transaction_input_to_journal_shape |
ClassificationOutcome | ClassifiedTransaction | Yes | Field mapping + tx_id | test_classification_outcome_to_classified_shape |
ClassifiedTransaction | TxProjectionRow | Partial | Requires upstream context | test_classified_to_projection_row_requires_context |
Issue | MetaCtx | Yes | MetaCtx::advance() | test_validation_pipeline_mesh |
MetaCtx | StageResult<T> | Yes | and_then() combinator | test_validation_pipeline_mesh |
LegalRule + TransactionFacts | Z3Result | Yes | LegalSolver::verify() | — |
VendorConstraintSet | ConstraintEvaluation | Yes | VendorConstraintSet::evaluate() | — |
Known Type Gaps
ClassifiedTransaction → TxProjectionRow
ClassifiedTransaction lacks account_id, date, amount, description, and source_ref fields that TxProjectionRow requires. The ExportWorkbookOp must reconstruct these from the OperationContext’s upstream ingest data.
Status: Documented in test_classified_to_projection_row_requires_context. Future work should either:
- Add missing fields to
ClassifiedTransaction, or - Create an explicit
ExportContexttype that carries full row data.
StageResult<T> constructors use MetaCtx::default()
StageResult::ok() and StageResult::with_issues() initialize meta with MetaCtx::default() (confidence 0.0). The correct way to chain stages is via the and_then() combinator, which properly advances the MetaCtx with multiplicative confidence.
Status: Documented in test_validation_pipeline_mesh.
Type Invariants
All pipeline I/O types must implement Send + Sync for async dispatch:
TransactionInput✓IngestedTransaction✓SampleTransaction✓ClassificationOutcome✓ClassifiedTransaction✓JournalTransaction✓TxProjectionRow✓Issue✓MetaCtx✓