Skip to main content

table_instance_risks_with_sidecar

Function table_instance_risks_with_sidecar 

Source
pub fn table_instance_risks_with_sidecar(
    db: &Database,
    records: &[CarvedRecord],
    attributions: &[Attribution],
    prior_schema: &BTreeMap<String, String>,
) -> Vec<TableInstanceRisk>
Expand description

Per-record TableInstanceRisk over BOTH Detector A (bare AUTOINCREMENT high-water) AND Detector B (sidecar schema-change), the sidecar-aware pass the CLI composes when a -wal/-journal is in play (docs/design/drop-recreate-attribution.md).

prior_schema is the sidecar’s PRIOR sqlite_master as name -> CREATE SQL (sqlite_core::PriorSnapshot::schema_sql for a -journal; Database::schema_sql of the pre-WAL base bytes for a -wal). Pass an EMPTY map to run Detector A only (the no-sidecar path), so this is a strict superset of table_instance_risks.

Detector B trips TableInstanceRisk::SidecarSchemaChanged for a record that is Attribution::Known(table) whose table has a sidecar schema change — prior absent, or prior CREATE SQL differs from current. Precedence: Detector A wins where it fires — its rowid+seq evidence is more specific than B’s table-level boundary — so a record qualifying for both is surfaced as RowidExceedsAutoincHighwater; Detector B fills only records A left as TableInstanceRisk::None. Neither alters attribution, tier, or routing.