Menu

#270 test: extend ASCII-only guarantee to 2fa remove and setup mode errors (#254)

closed
nobody
None
2026-08-06
2026-08-06
Anonymous
No

Originally created by: Wsif123

What this PR does

Fixes issue [#254]: two user-facing CLI messages slipped non-ASCII dashes past the cp1252-safe onboarding guarantee.

  • \src/doberman/cli/main.py\: the \2fa remove\ warning used an em-dash (U+2014)
  • \src/doberman/hosthooks/setup.py\: \parse_mode_choice\ error used an en-dash (U+2013)

Both replaced with plain hyphens.

Tests added (run in CI)

Extended \ ests/unit/test_cli_encode_safe.py\ so the ASCII guarantee covers the two paths that slipped through:

  • \ est_2fa_remove_warning_is_ascii_and_cp1252_safe\ - drives \2fa remove\ to the no-possession-factor warning and asserts ASCII + cp1252 safety
  • \ est_setup_bad_mode_choice_error_is_ascii_and_cp1252_safe\ - drives a bad numeric mode choice through the wizard and asserts ASCII + cp1252 safety

Verified both new tests FAIL when the character fixes are reverted. \
uff check\, \
uff format --check\ and all unit tests in the touched files pass.

Edge cases covered / Deviations from plan / Risks introduced

None - behavior and public API unchanged; only two user-facing strings and the tests covering them.

Related

Tickets: #254

Discussion

  • Anonymous

    Anonymous - 2026-08-06

    Originally posted by: fu351

    This is exactly the right work filed in the wrong container - easy fix. What you've written is a PR description, but no code arrived with it: push your branch to your fork and open a pull request (GitHub's "Compare & pull request" button, or gh pr create). The substance is spot on - verifying that your new tests go red when the character fixes are reverted is precisely this repo's bar for a test PR, so say that in the PR body too.

    One heads-up before you open it: the parse_mode_choice en-dash was already fixed as a side effect of [#266] (see the note on [#254]), so rebase on current main first. Keep both of your new tests - the setup-mode one now guards the fixed message against regression - plus the 2fa remove em-dash fix, which is still live.

    Closing this so the conversation stays on [#254], which is now assigned to you. Looking forward to the PR. We also hang out in Discord if you want a faster loop on questions: https://discord.gg/Sfy5XGNqty - entirely optional.

     

    Related

    Tickets: #254
    Tickets: #266

  • Anonymous

    Anonymous - 2026-08-06

    Ticket changed by: fu351

    • status: open --> closed
     
  • Anonymous

    Anonymous - 2026-08-06

    Originally posted by: Wsif123

    Rebased on current main (which already contains [#266]'s en-dash fix and re-prompt wizard) and reworked the setup-mode test to match: a bad mode choice now re-prompts instead of exiting, so the test feeds a valid choice after the invalid one and asserts the parse_mode_choice message stays ASCII + cp1252-safe. The 2fa remove em-dash fix is still live on main and covered by the other new test. Verified: new tests go red when the em-dash is restored.

     

    Related

    Tickets: #266


Log in to post a comment.