ADR-0019 §9 sweep (1/2): replay/client_side/ok/mode/messages/project/parse

First half of the catalog migration sweep. Six categories of
user-visible literals moved from inline `format!` calls to the
i18n catalog via `t!()`:

- **replay.*** — `[ok] replay … N command(s) run`,
  `replay … failed at line N: …`, the `> command` echo, and
  the inner `could not open` / `parse error` / `nested replay`
  wordings the runtime constructs inside `ReplayFailed.error`.
- **client_side.*** — the four [client-side] pedagogical notes
  from ADR-0017 §6 / ADR-0018 §9 (transformed,
  transformed_lossy, auto_fill_transition,
  auto_fill_add_serial, auto_fill_add_shortid). The
  `format_auto_fill_add_note` helper in db.rs now routes via
  the catalog too.
- **ok.*** — the `[ok] {verb} {subject}` summary header
  (consolidated through a new `App::note_ok_summary` helper)
  plus the per-operation row-count footers
  (`{count} row(s) inserted/updated/deleted`).
- **mode.*** — `mode: simple/advanced` set/show banners +
  `usage: mode …` + `unknown mode '{value}' …` errors.
- **messages.*** — `messages: short/verbose` set/show + the
  `unknown messages mode` error.
- **project.*** — `[ok] rebuild — {summary}`, `[ok] now
  editing: {display_name}`, `[ok] export — wrote {path}`, plus
  matching failure variants and the `usage: export/import`
  + `import: empty target after as` argument-parsing errors.
- **parse.*** — the `parse error: {detail}` wrapper around
  chumsky's structural output, the `{padding}^` caret pointer,
  and the `empty input` fallback for `ParseError::Empty`.

Catalog total: 99 lines of YAML across the new categories,
44 new entries declared in `keys.rs::KEYS_AND_PLACEHOLDERS`.
The validator (`keys_validate_against_catalog`) walks the
expanded list and confirms placeholder coverage / no format
specifiers / no engine vocabulary across every entry.

Anchor phrases (ADR-0019 §10) preserved verbatim; existing
substring assertions in the test suite hold.

## Tally

610 tests passing (no change in count — pure refactor).
Clippy clean with nursery lints. Release builds.

## Still ahead in the sweep

- Sweep 7: HELP_TEXT (CLI banner) + in-app `note_help` —
  large multi-line blocks.
- Sweep 8: modal labels (load picker, rebuild confirm,
  save-as path entry) + any remaining strays. Final pass.

Both shipping in a follow-up commit so this checkpoint
stays reviewable.
This commit is contained in:
claude@clouddev1
2026-05-09 22:20:34 +00:00
parent 431645ae60
commit aff528aa3f
5 changed files with 240 additions and 86 deletions
+99
View File
@@ -151,3 +151,102 @@ error:
headline: "INSERT requires at least one column value."
empty_update:
headline: "UPDATE requires at least one assignment."
# ---- DSL parse error rendering --------------------------------------
parse:
# Wrapper around chumsky's structural error message. The
# caret pointer (visualising the failure column) is printed
# on its own preceding line via `parse.caret`.
error: "parse error: {detail}"
# Caret pointer showing where in the input the parser
# failed. `{padding}` is the leading whitespace; the
# template appends `^` so the rendered line places the
# marker under the offending character.
caret: "{padding}^"
# Default for the `ParseError::Empty` variant — surfaces as
# `{detail}` inside the wrapper.
empty: "empty input"
# ---- Project lifecycle event notes -----------------------------------
project:
rebuild_ok: "[ok] rebuild — {summary}"
rebuild_failed: "rebuild failed: {error}"
switched_ok: "[ok] now editing: {display_name}"
switch_failed: "project switch failed: {error}"
export_ok: "[ok] export — wrote {path}"
export_failed: "export failed: {error}"
# Usage / argument-parsing errors for app-level commands.
export_usage: "usage: export [<path>]"
import_usage: "usage: import <zip-path> [as <target>]"
import_empty_target: "import: empty target after `as`"
# ---- mode / messages banners (app-level commands) -------------------
mode:
set_simple: "mode: simple"
set_advanced: "mode: advanced"
show_simple: "mode: simple"
show_advanced: "mode: advanced"
usage: "usage: mode simple | mode advanced"
unknown: "unknown mode '{value}' (expected 'simple' or 'advanced')"
messages:
show: "messages: {current}"
set_short: "messages: short"
set_verbose: "messages: verbose"
unknown: "unknown messages mode '{value}' (expected 'short' or 'verbose')"
# ---- DSL command success summaries (ADR-0019 §9 sweep) --------------
ok:
# Generic `[ok] <verb> <subject>` header used for every
# successful DSL command. Verbs come from `Command::verb()`
# (already English keywords); subjects are the table /
# relationship endpoints derived in `Command::display_subject()`.
summary: "[ok] {verb} {subject}"
# Per-operation row-count footers shown beneath the summary.
rows_inserted: " {count} row(s) inserted"
rows_updated: " {count} row(s) updated"
rows_deleted: " {count} row(s) deleted"
# ---- Client-side success notes (ADR-0017 §6, ADR-0018 §9) ------------
client_side:
# Per-cell transformation notice when `change column ...` rewrote
# at least one stored value (storage-class change or non-identity
# mapping). `lossy` variant fires under --force-conversion when
# information was discarded.
transformed: |-
[client-side] {count} row(s) were transformed before being stored. In raw SQL this would need an explicit `CAST` or application-level code.
transformed_lossy: |-
[client-side] {count} row(s) transformed; {lossy} of those discarded information (lossy). In raw SQL this would need an explicit `CAST` or application-level code.
# Auto-fill notice when null cells were populated by the
# serial/shortid auto-generation contract (change column path).
auto_fill_transition: |-
[client-side] {count} null cell(s) given auto-generated {kind} values. In raw SQL this would need an explicit UPDATE to populate.
# Auto-fill notice for `add column T: x (serial)` on a
# non-empty table — values run 1..N.
auto_fill_add_serial: |-
[client-side] {count} row(s) given auto-generated serial values 1..{count}. In raw SQL this would need an explicit UPDATE to populate.
# Auto-fill notice for `add column T: x (shortid)` on a
# non-empty table.
auto_fill_add_shortid: |-
[client-side] {count} row(s) given auto-generated shortid values. In raw SQL this would need an explicit UPDATE to populate.
# ---- Replay command surfaces (ADR-0019 §9 sweep) ---------------------
replay:
# Success summary printed when `replay <path>` completes
# without per-line failure.
completed: "[ok] replay {path} — {count} command(s) run"
# File-open failure (line_number == 0 from the runtime).
failed_open: "replay {path} failed: {error}"
# Per-line failure header. The command echo is on a
# follow-up `command_echo` line so the renderer can format
# them as separate output rows.
failed_at_line: "replay {path} failed at line {line_number}: {error}"
# Indented echo of the offending command line, shown after
# `failed_at_line` when the runtime supplied the source.
command_echo: " > {command}"
# Errors the runtime constructs inside ReplayFailed.error
# before forwarding to App. Carried as plain text so they
# compose with `failed_at_line`'s `{error}` placeholder.
error_could_not_open: "could not open `{path}`: {detail}"
error_parse: "parse error: {detail}"
error_nested: "nested `replay` is not allowed inside a replay file"