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
+13 -13
View File
@@ -1190,7 +1190,7 @@ async fn build_schema_cache(database: &Database) -> crate::completion::SchemaCac
// miss leaves that table's columns unpopulated and the
// walker falls back to the schemaless value-literal list.
for name in cache.tables.clone() {
if let Ok(desc) = database.describe_table(name.clone(), None).await {
if let Ok(desc) = database.describe_table(name.clone()).await {
// Per-table indexes for the items panel (S2, ADR-0025).
// Carry uniqueness so the panel can mark a UNIQUE index
// (ADR-0035 §4d). Captured before `desc.columns` is
@@ -1650,7 +1650,7 @@ async fn build_show_data_echo(
limit: Some(_),
..
} => database
.describe_table(name.clone(), None)
.describe_table(name.clone())
.await
.map(|desc| {
desc.columns
@@ -1732,7 +1732,7 @@ async fn collect_echo_lookups(
Command::DropIndex {
selector: IndexSelector::Columns { table, columns },
} => {
if let Ok(desc) = database.describe_table(table.clone(), None).await
if let Ok(desc) = database.describe_table(table.clone()).await
&& let Some(idx) = desc.indexes.iter().find(|i| i.columns == *columns)
{
out.drop_index_name = Some(idx.name.clone());
@@ -1747,7 +1747,7 @@ async fn collect_echo_lookups(
child_column,
},
} => {
if let Ok(desc) = database.describe_table(child_table.clone(), None).await
if let Ok(desc) = database.describe_table(child_table.clone()).await
&& let Some(rel) = desc.outbound_relationships.iter().find(|r| {
// The Endpoints drop selector is single-column
// (ADR-0043 keeps DROP by-endpoints single-column;
@@ -1771,7 +1771,7 @@ async fn collect_echo_lookups(
// resolver API would be the next step if schemas grow.
if let Ok(tables) = database.list_tables().await {
for table in tables {
if let Ok(desc) = database.describe_table(table.clone(), None).await
if let Ok(desc) = database.describe_table(table.clone()).await
&& desc.outbound_relationships.iter().any(|r| r.name == *name)
{
out.drop_relationship = Some((name.clone(), table.clone()));
@@ -1795,8 +1795,8 @@ async fn collect_echo_lookups(
// *before* execution to know which `ADD COLUMN` lines to
// emit. The parent columns here are the explicit DSL list,
// paired positionally with the child list.
let parent_desc = database.describe_table(parent_table.clone(), None).await;
let child_desc = database.describe_table(child_table.clone(), None).await;
let parent_desc = database.describe_table(parent_table.clone()).await;
let child_desc = database.describe_table(child_table.clone()).await;
if let (Ok(parent_desc), Ok(child_desc)) = (parent_desc, child_desc) {
let mut new_columns: Vec<(String, crate::dsl::types::Type)> = Vec::new();
for (child_col, parent_col) in child_columns.iter().zip(parent_columns) {
@@ -2064,7 +2064,7 @@ async fn enrich_check_violation(
.await
.map(|v| v.to_string());
// The rule itself — the column's compiled CHECK expression.
if let Ok(desc) = database.describe_table(table.to_string(), None).await
if let Ok(desc) = database.describe_table(table.to_string()).await
&& let Some(col) = desc.columns.iter().find(|c| c.name == column)
{
facts.check_rule.clone_from(&col.check);
@@ -2272,7 +2272,7 @@ async fn user_value_for_column_with_schema(
} = command
{
let desc = database
.describe_table(table.to_string(), None)
.describe_table(table.to_string())
.await
.ok()?;
// Build the natural-order column list the same way
@@ -2311,7 +2311,7 @@ async fn user_value_for_column_with_schema(
&& literal_rows.len() == 1
{
let desc = database
.describe_table(table.to_string(), None)
.describe_table(table.to_string())
.await
.ok()?;
let idx = desc.columns.iter().position(|c| c.name == column)?;
@@ -2930,7 +2930,7 @@ async fn execute_command_typed(
.await
.map(|d| CommandOutcome::Schema(Some(d))),
Command::ShowTable { name } => database
.describe_table(name, src)
.describe_table(name)
.await
.map(|d| CommandOutcome::Schema(Some(d))),
// ADR-0044: a named relationship renders as a diagram (App-side),
@@ -2983,14 +2983,14 @@ async fn execute_command_typed(
filter,
limit,
} => database
.query_data(name, filter, limit, src)
.query_data(name, filter, limit)
.await
.map(CommandOutcome::Query),
// A SQL `SELECT` (advanced mode; ADR-0030 §6, ADR-0031).
// The grammar walker has already validated `sql` is in
// the supported subset; the worker runs it as text.
Command::Select { sql } => database
.run_select(sql, src)
.run_select(sql)
.await
.map(CommandOutcome::Query),
// A SQL `INSERT` (advanced mode; ADR-0033 §1). Grammar-as-