help: surface ADR-0017/0018 auto-fill semantics (B1)
ADR-0017 added --force-conversion / --dont-convert as opt-in flags on `change column`; the help text already mentioned the flags but didn't explain when they apply. ADR-0018 generalised serial beyond PK and added auto-fill on `add column ... (serial|shortid)` for non-empty tables; none of that was reflected in user-visible help. This commit: - Annotates the `add column` line with a continuation note that adding serial/shortid to a non-empty table auto-fills existing rows. - Annotates the `change column` line with a continuation note that converting to serial/shortid auto-fills null cells. - Appends an "Auto-generated types" section explaining serial and shortid: how they auto-fill, that they imply UNIQUE outside a PK (serial) or always (shortid), and that adding/converting-to either type on a non-empty table auto-fills existing/null cells. The new test `help_describes_auto_generated_type_behaviour` pins these phrases so a future help-text edit can't silently drop the pedagogical lines. The existing `help_command_lists_supported_commands` and `help_lists_export_and_import` tests still pass — they only assert substring presence. No engine vocabulary leaks (ADR-0002 posture preserved). 536 -> 537 passing, clippy clean.
This commit is contained in:
+10
@@ -1210,10 +1210,12 @@ impl App {
|
|||||||
" create table <T> with pk [<col>:<type>...]",
|
" create table <T> with pk [<col>:<type>...]",
|
||||||
" drop table <T>",
|
" drop table <T>",
|
||||||
" add column [to] [table] <T>: <col> (<type>)",
|
" add column [to] [table] <T>: <col> (<type>)",
|
||||||
|
" (for serial/shortid on a non-empty table: existing rows auto-filled)",
|
||||||
" drop column [from] [table] <T>: <col>",
|
" drop column [from] [table] <T>: <col>",
|
||||||
" rename column [in] [table] <T>: <old> to <new>",
|
" rename column [in] [table] <T>: <old> to <new>",
|
||||||
" change column [in] [table] <T>: <col> (<newtype>)",
|
" change column [in] [table] <T>: <col> (<newtype>)",
|
||||||
" [--force-conversion | --dont-convert]",
|
" [--force-conversion | --dont-convert]",
|
||||||
|
" (to serial/shortid: null cells auto-filled with generated values)",
|
||||||
" add 1:n relationship [as <name>] from <P>.<col> to <C>.<col>",
|
" add 1:n relationship [as <name>] from <P>.<col> to <C>.<col>",
|
||||||
" [on delete <action>] [on update <action>] [--create-fk]",
|
" [on delete <action>] [on update <action>] [--create-fk]",
|
||||||
" drop relationship <name>",
|
" drop relationship <name>",
|
||||||
@@ -1223,6 +1225,14 @@ impl App {
|
|||||||
" show table <T>",
|
" show table <T>",
|
||||||
" show data <T>",
|
" show data <T>",
|
||||||
"Types: text, int, real, decimal, bool, date, datetime, blob, serial, shortid",
|
"Types: text, int, real, decimal, bool, date, datetime, blob, serial, shortid",
|
||||||
|
"Auto-generated types (serial, shortid):",
|
||||||
|
" serial — integer that auto-fills with the next sequence value",
|
||||||
|
" (MAX(col)+1) on insert. Outside a primary key it carries",
|
||||||
|
" a UNIQUE contract.",
|
||||||
|
" shortid — short base58 identifier auto-filled at insert time. Always",
|
||||||
|
" carries a UNIQUE contract.",
|
||||||
|
" Adding or changing-to either type on a non-empty table auto-fills",
|
||||||
|
" existing/null cells in the same operation.",
|
||||||
] {
|
] {
|
||||||
self.note_system(line);
|
self.note_system(line);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -67,6 +67,36 @@ fn help_command_lists_supported_commands() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn help_describes_auto_generated_type_behaviour() {
|
||||||
|
// ADR-0017 / ADR-0018: the in-app help must surface the
|
||||||
|
// auto-fill contract for serial / shortid columns and the
|
||||||
|
// change-column conversion flags. Captured as a regression
|
||||||
|
// check so a future help-text edit doesn't silently drop the
|
||||||
|
// pedagogical lines.
|
||||||
|
let mut app = App::new();
|
||||||
|
type_str(&mut app, "help");
|
||||||
|
submit(&mut app);
|
||||||
|
let body = app
|
||||||
|
.output
|
||||||
|
.iter()
|
||||||
|
.map(|l| l.text.as_str())
|
||||||
|
.collect::<Vec<_>>()
|
||||||
|
.join("\n");
|
||||||
|
for keyword in [
|
||||||
|
"--force-conversion",
|
||||||
|
"--dont-convert",
|
||||||
|
"Auto-generated types",
|
||||||
|
"auto-filled",
|
||||||
|
"UNIQUE",
|
||||||
|
] {
|
||||||
|
assert!(
|
||||||
|
body.contains(keyword),
|
||||||
|
"help output missing `{keyword}`:\n{body}",
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn save_on_temp_opens_path_entry_modal() {
|
fn save_on_temp_opens_path_entry_modal() {
|
||||||
let mut app = App::new();
|
let mut app = App::new();
|
||||||
|
|||||||
Reference in New Issue
Block a user