refactor(db): unwind vestigial worker source plumbing (ADR-0052 follow-up)
ADR-0052 moved success journaling out of the worker to the dispatch layer, leaving the `source` that handlers threaded purely for the worker's old history.log write dead. Remove it: - drop `_source` from finalize_persistence and do_rebuild_from_text - inline + delete the three read-only *_request wrappers - drop the now-unused `source` param from the ~30 forwarding worker handlers (leaf + composite), compiler-guided - remove the `source` field from the DescribeTable/QueryData/RunSelect requests and their DatabaseHandle methods (call sites updated) The only worker `source` left is the snapshot/undo label (snapshot_then / stage_pre_mutation / begin_batch). Purely mechanical, no behaviour change. 2471 pass / 0 fail / 1 ignored, clippy clean.
This commit is contained in:
@@ -64,7 +64,7 @@ fn created_table_appears_with_playground_types() {
|
||||
assert!(tables.contains(&"Widget".to_string()));
|
||||
|
||||
let desc = r
|
||||
.block_on(db.describe_table("Widget".to_string(), None))
|
||||
.block_on(db.describe_table("Widget".to_string()))
|
||||
.expect("describe");
|
||||
let types: Vec<(String, Option<Type>)> = desc
|
||||
.columns
|
||||
@@ -98,7 +98,7 @@ fn integer_primary_key_is_plain_int() {
|
||||
))
|
||||
.expect("create");
|
||||
let desc = r
|
||||
.block_on(db.describe_table("T".to_string(), None))
|
||||
.block_on(db.describe_table("T".to_string()))
|
||||
.expect("describe");
|
||||
assert_eq!(desc.columns[0].user_type, Some(Type::Int));
|
||||
}
|
||||
@@ -137,7 +137,7 @@ fn serial_pk_autoincrements_in_multi_column_table() {
|
||||
}
|
||||
|
||||
let data = r
|
||||
.block_on(db.query_data("T".to_string(), None, None, None))
|
||||
.block_on(db.query_data("T".to_string(), None, None))
|
||||
.expect("query");
|
||||
let id_idx = data
|
||||
.columns
|
||||
@@ -220,7 +220,7 @@ fn table_without_primary_key_is_allowed() {
|
||||
))
|
||||
.expect("insert into PK-less table");
|
||||
let data = r
|
||||
.block_on(db.query_data("Notes".to_string(), None, None, None))
|
||||
.block_on(db.query_data("Notes".to_string(), None, None))
|
||||
.expect("query");
|
||||
assert_eq!(data.rows.len(), 1);
|
||||
}
|
||||
@@ -299,7 +299,7 @@ fn default_is_applied_when_column_omitted() {
|
||||
))
|
||||
.expect("insert");
|
||||
let data = r
|
||||
.block_on(db.query_data("T".to_string(), None, None, None))
|
||||
.block_on(db.query_data("T".to_string(), None, None))
|
||||
.expect("query");
|
||||
let n_idx = data.columns.iter().position(|c| c == "n").expect("n column");
|
||||
assert_eq!(data.rows[0][n_idx].as_deref(), Some("7"), "DEFAULT 7 applied");
|
||||
@@ -381,7 +381,7 @@ fn check_default_and_composite_unique_survive_rebuild() {
|
||||
// A valid row inserts; DEFAULT n=7 survived.
|
||||
r.block_on(ins("1", "1", "5")).expect("valid row");
|
||||
let data = r
|
||||
.block_on(db.query_data("T".to_string(), None, None, None))
|
||||
.block_on(db.query_data("T".to_string(), None, None))
|
||||
.expect("query");
|
||||
let n_idx = data.columns.iter().position(|c| c == "n").expect("n column");
|
||||
assert_eq!(data.rows[0][n_idx].as_deref(), Some("7"), "DEFAULT survived rebuild");
|
||||
@@ -679,7 +679,7 @@ fn sql_create_table_is_one_undo_step() {
|
||||
/// Sorted `id` column values of table `T`.
|
||||
fn ids(db: &Database, r: &tokio::runtime::Runtime) -> Vec<Option<String>> {
|
||||
let d = r
|
||||
.block_on(db.query_data("T".to_string(), None, None, None))
|
||||
.block_on(db.query_data("T".to_string(), None, None))
|
||||
.expect("query");
|
||||
let idx = d.columns.iter().position(|c| c == "id").expect("id column");
|
||||
let mut v: Vec<Option<String>> = d.rows.iter().map(|row| row[idx].clone()).collect();
|
||||
@@ -801,7 +801,7 @@ fn dropping_a_column_a_table_check_references_fails_cleanly() {
|
||||
|
||||
// The table is intact: both columns survive (rollback) ...
|
||||
let desc = r
|
||||
.block_on(db.describe_table("T".to_string(), None))
|
||||
.block_on(db.describe_table("T".to_string()))
|
||||
.expect("describe still works");
|
||||
assert_eq!(
|
||||
desc.columns.iter().map(|c| c.name.clone()).collect::<Vec<_>>(),
|
||||
@@ -925,14 +925,14 @@ fn foreign_key_creates_named_relationship_visible_in_describe() {
|
||||
.expect("create child with FK");
|
||||
|
||||
// The child has an outbound relationship; the parent an inbound one.
|
||||
let child = r.block_on(db.describe_table("child".to_string(), None)).expect("describe child");
|
||||
let child = r.block_on(db.describe_table("child".to_string())).expect("describe child");
|
||||
assert_eq!(child.outbound_relationships.len(), 1, "child references parent");
|
||||
let rel = &child.outbound_relationships[0];
|
||||
assert_eq!(rel.name, "parent_id_to_child_pid", "auto-named per ADR-0013");
|
||||
assert_eq!(rel.other_table, "parent");
|
||||
assert_eq!(rel.local_columns, vec!["pid".to_string()]);
|
||||
|
||||
let parent = r.block_on(db.describe_table("parent".to_string(), None)).expect("describe parent");
|
||||
let parent = r.block_on(db.describe_table("parent".to_string())).expect("describe parent");
|
||||
assert_eq!(parent.inbound_relationships.len(), 1, "parent is referenced by child");
|
||||
}
|
||||
|
||||
@@ -954,7 +954,7 @@ fn explicit_constraint_name_is_used() {
|
||||
Some("create table child (id serial primary key, pid int, constraint child_to_parent foreign key (pid) references parent(id))".to_string()),
|
||||
))
|
||||
.expect("create child with named FK");
|
||||
let child = r.block_on(db.describe_table("child".to_string(), None)).expect("describe");
|
||||
let child = r.block_on(db.describe_table("child".to_string())).expect("describe");
|
||||
assert_eq!(child.outbound_relationships[0].name, "child_to_parent");
|
||||
}
|
||||
|
||||
@@ -974,7 +974,7 @@ fn bare_references_resolves_to_parent_single_column_pk() {
|
||||
Some("create table child (id serial primary key, pid int references parent)".to_string()),
|
||||
))
|
||||
.expect("create child with bare REFERENCES");
|
||||
let child = r.block_on(db.describe_table("child".to_string(), None)).expect("describe");
|
||||
let child = r.block_on(db.describe_table("child".to_string())).expect("describe");
|
||||
assert_eq!(child.outbound_relationships[0].other_columns, vec!["id".to_string()], "resolved to parent PK");
|
||||
}
|
||||
|
||||
@@ -1108,7 +1108,7 @@ fn create_table_with_fk_is_one_undo_step() {
|
||||
// parent (now un-referenced) can be described without a dangling rel.
|
||||
r.block_on(db.undo()).expect("undo").expect("a step was undone");
|
||||
assert!(!r.block_on(db.list_tables()).unwrap().contains(&"child".to_string()));
|
||||
let parent = r.block_on(db.describe_table("parent".to_string(), None)).expect("describe parent");
|
||||
let parent = r.block_on(db.describe_table("parent".to_string())).expect("describe parent");
|
||||
assert!(parent.inbound_relationships.is_empty(), "the relationship was undone with the table");
|
||||
}
|
||||
|
||||
@@ -1152,7 +1152,7 @@ fn foreign_key_on_delete_cascade_takes_effect() {
|
||||
))
|
||||
.expect("delete parent");
|
||||
let child_rows = r
|
||||
.block_on(db.query_data("child".to_string(), None, None, None))
|
||||
.block_on(db.query_data("child".to_string(), None, None))
|
||||
.expect("query child");
|
||||
assert!(child_rows.rows.is_empty(), "ON DELETE CASCADE removed the child row");
|
||||
}
|
||||
@@ -1232,7 +1232,7 @@ fn fk_survives_a_rebuild_triggering_column_add() {
|
||||
.expect("add column via rebuild");
|
||||
|
||||
// The relationship still exists after the rebuild.
|
||||
let child = r.block_on(db.describe_table("child".to_string(), None)).expect("describe");
|
||||
let child = r.block_on(db.describe_table("child".to_string())).expect("describe");
|
||||
assert_eq!(child.outbound_relationships.len(), 1, "FK survived the column-add rebuild");
|
||||
// And the engine still enforces it (now and after a fresh rebuild).
|
||||
insert_parent_row(&db, &r);
|
||||
@@ -1275,7 +1275,7 @@ fn fk_referential_actions_survive_rebuild() {
|
||||
))
|
||||
.expect("create");
|
||||
r.block_on(db.rebuild_from_text(p.path().to_path_buf(), None)).expect("rebuild");
|
||||
let child = r.block_on(db.describe_table("child".to_string(), None)).expect("describe");
|
||||
let child = r.block_on(db.describe_table("child".to_string())).expect("describe");
|
||||
let rel = &child.outbound_relationships[0];
|
||||
assert_eq!(rel.on_delete, ReferentialAction::Cascade, "ON DELETE survived rebuild");
|
||||
assert_eq!(rel.on_update, ReferentialAction::SetNull, "ON UPDATE survived rebuild");
|
||||
@@ -1299,7 +1299,7 @@ fn dropping_the_child_clears_the_fk_relationship() {
|
||||
.expect("create");
|
||||
r.block_on(db.drop_table("child".to_string(), Some("drop table child".to_string())))
|
||||
.expect("drop child");
|
||||
let parent = r.block_on(db.describe_table("parent".to_string(), None)).expect("describe parent");
|
||||
let parent = r.block_on(db.describe_table("parent".to_string())).expect("describe parent");
|
||||
assert!(parent.inbound_relationships.is_empty(), "dropping the child cleared the relationship");
|
||||
}
|
||||
|
||||
@@ -1341,7 +1341,7 @@ fn bare_self_reference_resolves_to_own_pk() {
|
||||
Some("create table emp (id int primary key, mgr int references emp)".to_string()),
|
||||
))
|
||||
.expect("create self-referential emp with a bare reference");
|
||||
let emp = r.block_on(db.describe_table("emp".to_string(), None)).expect("describe");
|
||||
let emp = r.block_on(db.describe_table("emp".to_string())).expect("describe");
|
||||
assert_eq!(emp.outbound_relationships[0].other_columns, vec!["id".to_string()], "bare self-ref resolved to own PK");
|
||||
// Enforced: a non-existent manager is rejected.
|
||||
r.block_on(db.insert(
|
||||
|
||||
Reference in New Issue
Block a user