[gen] Nickname parts that survive title edits (v0.1.1) #2

Manually merged
mnovak merged 1 commits from feature/nickname-parts into main 2026-10-31 10:24:05 +01:00
Owner

Lets a new web login's nickname follow its title as it is typed without drawing a new word and number on
every keystroke.

What

  • custos-gen: nickname_parts(&opts) -> NicknameParts { words, numbers, entropy_bits } draws the random
    parts once; NicknameParts::render(title, template) fills in {Name} (same rules: diacritics stripped,
    PascalCase, ≤ 20 chars, dropped with its separator when empty). nickname() is now parts + render, so its
    behaviour and entropy are unchanged.
  • The word pool for several kinds is a sorted, de-duplicated union (was an order-dependent merge).
  • Version 0.1.1.

Tests

cargo test --workspace --release: custos-gen 15 passed (one new: the same parts rendered for "", "G",
"Gi", "GitHub" keep word and number, and a template with more tokens than parts is refused),
custos-vault 10 passed, doctest 1 passed. Total 26, 0 failed.

Self-review

  • No change to the vault format or to any secret-handling code.
  • render takes the template again rather than storing it; a caller that changes the template between
    drawing and rendering gets an error when the token counts differ, not a silently wrong nickname. If only
    literals change, the new literals are used — intended (the settings dialog can preview a template edit).
  • Not verified: nothing beyond the tests.
Lets a new web login's nickname follow its title as it is typed without drawing a new word and number on every keystroke. ## What - `custos-gen`: `nickname_parts(&opts) -> NicknameParts { words, numbers, entropy_bits }` draws the random parts once; `NicknameParts::render(title, template)` fills in `{Name}` (same rules: diacritics stripped, PascalCase, ≤ 20 chars, dropped with its separator when empty). `nickname()` is now parts + render, so its behaviour and entropy are unchanged. - The word pool for several kinds is a sorted, de-duplicated union (was an order-dependent merge). - Version 0.1.1. ## Tests `cargo test --workspace --release`: custos-gen **15 passed** (one new: the same parts rendered for "", "G", "Gi", "GitHub" keep word and number, and a template with more tokens than parts is refused), custos-vault **10 passed**, doctest **1 passed**. Total 26, 0 failed. ## Self-review - No change to the vault format or to any secret-handling code. - `render` takes the template again rather than storing it; a caller that changes the template between drawing and rendering gets an error when the token counts differ, not a silently wrong nickname. If only literals change, the new literals are used — intended (the settings dialog can preview a template edit). - Not verified: nothing beyond the tests.
mnovak added 1 commit 2026-10-31 10:23:59 +01:00
mnovak manually merged commit 686c662835 into main 2026-10-31 10:24:05 +01:00
Sign in to join this conversation.
No Reviewers
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: mnovak/CustosPublic#2