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:
claude@clouddev1
2026-06-14 13:47:49 +00:00
parent ae73a4be85
commit e8fa859ab9
22 changed files with 231 additions and 384 deletions
+10 -16
View File
@@ -215,7 +215,7 @@ fn decimal_aggregation_display_trims_ieee754_noise() {
// The reported case: the aggregate no longer leaks float noise.
let agg = rt
.block_on(db.run_select("select sum(price * qty) from Products".to_string(), None))
.block_on(db.run_select("select sum(price * qty) from Products".to_string()))
.expect("aggregate select");
assert_eq!(
agg.rows[0][0].as_deref(),
@@ -226,7 +226,7 @@ fn decimal_aggregation_display_trims_ieee754_noise() {
// Raw decimal column is still exact — TEXT storage preserves
// the input string verbatim, including the trailing zero.
let raw = rt
.block_on(db.run_select("select price from Products".to_string(), None))
.block_on(db.run_select("select price from Products".to_string()))
.expect("raw decimal select");
let prices: Vec<&str> = raw.rows.iter().map(|r| r[0].as_deref().unwrap()).collect();
assert_eq!(
@@ -240,10 +240,7 @@ fn decimal_aggregation_display_trims_ieee754_noise() {
fn database_run_select_constant_returns_a_single_row() {
let (_p, db, _dir) = open_project_db();
let data = rt()
.block_on(db.run_select(
"select 1".to_string(),
Some("select 1".to_string()),
))
.block_on(db.run_select("select 1".to_string()))
.expect("`select 1` runs clean");
assert_eq!(data.rows.len(), 1, "one result row");
assert_eq!(data.rows[0].len(), 1, "one column");
@@ -288,7 +285,7 @@ fn database_run_select_from_user_table_returns_inserted_rows() {
.expect("insert row");
});
let data = rt
.block_on(db.run_select("select Name from T".to_string(), None))
.block_on(db.run_select("select Name from T".to_string()))
.expect("SELECT runs");
assert_eq!(data.rows.len(), 1);
assert_eq!(data.rows[0][0].as_deref(), Some("Ada"));
@@ -336,7 +333,7 @@ fn database_run_select_recovers_bool_column_type() {
.expect("insert row");
});
let data = rt
.block_on(db.run_select("select Active from Products".to_string(), None))
.block_on(db.run_select("select Active from Products".to_string()))
.expect("SELECT runs");
assert_eq!(data.rows.len(), 2);
assert_eq!(data.column_types, vec![Some(Type::Bool)]);
@@ -374,7 +371,7 @@ fn database_run_select_recovers_text_type_through_alias() {
// playground type is recovered.
let data = rt
.block_on(
db.run_select("select Name as n from Users".to_string(), None),
db.run_select("select Name as n from Users".to_string()),
)
.expect("SELECT runs");
assert_eq!(data.columns, vec!["n".to_string()]);
@@ -402,7 +399,7 @@ fn database_run_select_computed_expression_stays_typeless() {
.expect("insert");
});
let data = rt
.block_on(db.run_select("select Score + 1 from T".to_string(), None))
.block_on(db.run_select("select Score + 1 from T".to_string()))
.expect("SELECT runs");
assert_eq!(data.column_types, vec![None]);
}
@@ -439,7 +436,6 @@ fn engine_aggregate_in_where_routes_through_catalog() {
let err = rt
.block_on(db.run_select(
"select id from T where count(score) > 0".to_string(),
None,
))
.expect_err("engine should reject aggregate in WHERE");
let DbError::Sqlite { .. } = &err else {
@@ -512,7 +508,6 @@ fn engine_group_by_missing_routes_through_catalog() {
let _ = rt
.block_on(db.run_select(
"select category, count(*) from T group by category".to_string(),
None,
))
.expect("benign GROUP BY query runs");
// Direct unit test on the matcher: ensure a message that
@@ -574,7 +569,6 @@ fn engine_scalar_subquery_too_many_rows_routes_through_catalog() {
let _ = rt
.block_on(db.run_select(
"select (select v from T) from T".to_string(),
None,
))
.expect("benign scalar subquery query runs");
let synthetic = DbError::Sqlite {
@@ -624,13 +618,13 @@ fn database_run_select_type_recovery_works_on_empty_table() {
});
// No INSERT — the table is empty.
let data_text = rt
.block_on(db.run_select("select col_text from Empty".to_string(), None))
.block_on(db.run_select("select col_text from Empty".to_string()))
.expect("SELECT runs even on empty table");
assert!(data_text.rows.is_empty());
assert_eq!(data_text.column_types, vec![Some(Type::Text)]);
let data_blob = rt
.block_on(db.run_select("select col_blob from Empty".to_string(), None))
.block_on(db.run_select("select col_blob from Empty".to_string()))
.expect("SELECT runs even on empty table");
assert!(data_blob.rows.is_empty());
assert_eq!(
@@ -723,7 +717,7 @@ fn database_run_select_recovers_all_ten_playground_types() {
for (col, expected_type) in cases {
let sql = format!("select {col} from AllTypes");
let data = rt
.block_on(db.run_select(sql.clone(), None))
.block_on(db.run_select(sql.clone()))
.expect("SELECT runs");
assert_eq!(
data.column_types,