feat(seed): SeedResult outcome, capped preview, advisory, count cap (ADR-0048 P1.3c)
A dedicated SeedResult replaces the borrowed insert outcome (X5): - CommandOutcome::Seed + DslSeedSucceeded event + handle_dsl_seed_success render: the echo, "N row(s) seeded into T", a capped preview table (D18, first 20 rows; full count always reported), and a Hint-styled advisory naming enum-ish / un-derivable-CHECK columns filled with generic text (D12/D13, Phase-1 wording). - SeedResult carries requested vs produced, so a junction cap is now reported to the user, not only logged. - Count cap (D6): a seed over 10000 rows is refused with a friendly error. - Catalog keys ok.rows_seeded / seed.capped / seed.advisory_generic. 4 new tests (advisory flag, IN-check not flagged, preview cap, excess count). 2346 pass / 0 fail / 0 skip, clippy clean.
This commit is contained in:
+32
@@ -771,6 +771,10 @@ impl App {
|
||||
self.handle_dsl_insert_success(&command, &result);
|
||||
Vec::new()
|
||||
}
|
||||
AppEvent::DslSeedSucceeded { command, result } => {
|
||||
self.handle_dsl_seed_success(&command, &result);
|
||||
Vec::new()
|
||||
}
|
||||
AppEvent::DslUpdateSucceeded {
|
||||
command,
|
||||
result,
|
||||
@@ -2072,6 +2076,34 @@ impl App {
|
||||
}
|
||||
}
|
||||
|
||||
/// Render a successful `seed` (ADR-0048): the ✓ echo, the seeded-row
|
||||
/// count (with a cap note when the unique-value space ran out), the
|
||||
/// capped preview table (D18), and a Hint-styled advisory naming
|
||||
/// columns filled with generic text that look like fixed value sets
|
||||
/// (D12/D13).
|
||||
fn handle_dsl_seed_success(&mut self, command: &Command, result: &crate::db::SeedResult) {
|
||||
self.note_ok_summary(command);
|
||||
let mut summary = crate::t!(
|
||||
"ok.rows_seeded",
|
||||
count = result.produced,
|
||||
table = result.table
|
||||
);
|
||||
if result.produced < result.requested {
|
||||
summary.push(' ');
|
||||
summary.push_str(&crate::t!("seed.capped", requested = result.requested));
|
||||
}
|
||||
self.note_system(summary);
|
||||
for line in crate::output_render::render_data_table(&result.data) {
|
||||
self.note_system(line);
|
||||
}
|
||||
if !result.advisory_columns.is_empty() {
|
||||
self.push_category_three_prose(crate::t!(
|
||||
"seed.advisory_generic",
|
||||
columns = result.advisory_columns.join(", ")
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
fn handle_dsl_update_success(&mut self, command: &Command, result: &UpdateResult) {
|
||||
self.note_ok_summary(command);
|
||||
self.note_system(crate::t!("ok.rows_updated", count = result.rows_affected));
|
||||
|
||||
Reference in New Issue
Block a user