docs(core,cli): document implicit contracts flagged in code review
- import_lastpass.rs: note that password and extra are intentionally not trimmed (leading/trailing whitespace is significant for both). - cmd_import_lastpass: document the coupling between the ImportWarning message strings and the CLI summary's "skipped" filter — partial-import warnings (TOTP/URL) must not contain the word "skipped". Comment-only; no behavior change. Catches I1 and M5 from the final code review without taking on the cross-cut WarningKind enum refactor (deferred to a follow-up if it ever ships). Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -1618,6 +1618,11 @@ fn cmd_import_lastpass(csv_path: PathBuf) -> Result<()> {
|
|||||||
for w in &warnings {
|
for w in &warnings {
|
||||||
print_warning(w);
|
print_warning(w);
|
||||||
}
|
}
|
||||||
|
// Counts only true skips, not partial imports. Coupled by convention to
|
||||||
|
// the parser's warning message strings: skip messages end in "— skipped",
|
||||||
|
// partial-import messages say "imported without TOTP" / "imported without URL".
|
||||||
|
// If a future warning uses the word "skipped" in any other sense, this filter
|
||||||
|
// will need to switch to an enum tag (see ImportWarning::message).
|
||||||
eprintln!(
|
eprintln!(
|
||||||
"Imported {}, skipped {} (see warnings above)",
|
"Imported {}, skipped {} (see warnings above)",
|
||||||
total,
|
total,
|
||||||
|
|||||||
@@ -95,6 +95,8 @@ fn map_row(
|
|||||||
) -> (Option<Item>, Option<ImportWarning>) {
|
) -> (Option<Item>, Option<ImportWarning>) {
|
||||||
let url = record.get(0).unwrap_or("").trim();
|
let url = record.get(0).unwrap_or("").trim();
|
||||||
let username = record.get(1).unwrap_or("").trim();
|
let username = record.get(1).unwrap_or("").trim();
|
||||||
|
// password and extra are deliberately NOT trimmed: leading/trailing
|
||||||
|
// whitespace is significant inside passwords and free-form notes.
|
||||||
let password = record.get(2).unwrap_or("");
|
let password = record.get(2).unwrap_or("");
|
||||||
let totp_raw = record.get(3).unwrap_or("").trim();
|
let totp_raw = record.get(3).unwrap_or("").trim();
|
||||||
let extra = record.get(4).unwrap_or("");
|
let extra = record.get(4).unwrap_or("");
|
||||||
|
|||||||
Reference in New Issue
Block a user