gabriel / muse public
feat patch auth task/auth-hd-mnemonic-persistence #1 / 1
gabriel · 160 days ago · Apr 15, 2026 · Diff

feat(auth): Phase 2A — HD mnemonic persistence + full 8-category test coverage

- identity.py: _load_all now parses key_source, mnemonic, hd_path from TOML - auth.py run_keygen --hd: save_identity immediately after key generation so mnemonic is never lost between keygen and register - auth.py run_register: preserves HD fields from existing identity entry instead of silently discarding them on re-authentication - test_auth_hd_persistence.py: new file — 35 tests across all 8 categories - test_cmd_auth_keygen_hd.py: add Stress and Data Integrity classes (10 tests) - test_cmd_merge_autostash.py: add E2E, Security, Performance, Stress, Docstrings

sha256:c652a71ccca1fe41597c2d7ba7ad79937983692d65866489105173ffc998f3ea sha
+90 ~4 symbols
sha256:f8c123c5dce9a14622b64a0c2ebcebf89ef882551a32dc782df74579d56761af snapshot
+90
symbols added
~4
symbols modified
0
dead code introduced
Semantic Changes 94 symbols
~ tests/test_auth_hd_persistence.py .py 65 symbols added
+ FAKE_FINGERPRINT variable variable FAKE_FINGERPRINT L49–49
+ FAKE_HANDLE variable variable FAKE_HANDLE L50–50
+ FAKE_HD_PATH variable variable FAKE_HD_PATH L48–48
+ FAKE_MNEMONIC variable variable FAKE_MNEMONIC L44–47
+ HOSTNAME variable variable HOSTNAME L43–43
+ HUB variable variable HUB L42–42
+ TestDocstrings class class TestDocstrings L406–421
+ test_generate_hd_keypair_has_docstring method method test_generate_hd_keypair_has_docstring L419–421
+ test_load_all_has_docstring method method test_load_all_has_docstring L407–409
+ test_load_identity_has_docstring method method test_load_identity_has_docstring L415–417
+ test_save_identity_has_docstring method method test_save_identity_has_docstring L411–413
+ TestKeygenHdWritesIdentity class class TestKeygenHdWritesIdentity L184–241
+ _run method method _run L187–192
+ test_hd_path_written method method test_hd_path_written L209–212
+ test_identity_toml_created method method test_identity_toml_created L194–197
+ test_json_output_has_no_mnemonic_key method method test_json_output_has_no_mnemonic_key L214–224
+ test_key_source_hd_written method method test_key_source_hd_written L199–202
+ test_keygen_hd_force_overwrites_identity method method test_keygen_hd_force_overwrites_identity L235–241
+ test_mnemonic_absent_from_json_object method method test_mnemonic_absent_from_json_object L226–233
+ test_mnemonic_written method method test_mnemonic_written L204–207
+ TestLoadAllHdFields class class TestLoadAllHdFields L109–176
+ _write method method _write L112–113
+ test_jbok_entry_has_no_hd_fields method method test_jbok_entry_has_no_hd_fields L151–160
+ test_loads_all_hd_fields_together method method test_loads_all_hd_fields_together L139–149
+ test_loads_hd_path method method test_loads_hd_path L131–137
+ test_loads_key_source method method test_loads_key_source L115–121
+ test_loads_mnemonic method method test_loads_mnemonic L123–129
+ test_round_trip_hd_fields method method test_round_trip_hd_fields L162–176
+ TestMnemonicNeverInJsonObject class class TestMnemonicNeverInJsonObject L365–398
+ test_keygen_hd_json_mnemonic_word_count_present method method test_keygen_hd_json_mnemonic_word_count_present L384–398
+ test_keygen_hd_json_no_mnemonic_key method method test_keygen_hd_json_no_mnemonic_key L368–382
+ TestMnemonicTomlEscaping class class TestMnemonicTomlEscaping L331–357
+ test_hd_path_prime_and_slash_preserved method method test_hd_path_prime_and_slash_preserved L346–357
+ test_mnemonic_with_quotes_round_trips method method test_mnemonic_with_quotes_round_trips L332–344
+ TestPersistencePerformance class class TestPersistencePerformance L429–466
+ test_keygen_hd_then_load_identity_under_3s method method test_keygen_hd_then_load_identity_under_3s L454–466
+ test_save_and_load_identity_under_100ms method method test_save_and_load_identity_under_100ms L432–452
+ TestPersistenceStress class class TestPersistenceStress L474–518
+ test_10_successive_registers_preserve_mnemonic method method test_10_successive_registers_preserve_mnemonic L477–496
+ test_concurrent_identity_writes_do_not_corrupt method method test_concurrent_identity_writes_do_not_corrupt L498–518
+ TestRegisterPreservesHdFields class class TestRegisterPreservesHdFields L249–323
+ _run_register method method _run_register L267–271
+ _setup_hd_keygen method method _setup_hd_keygen L252–265
+ test_handle_updated_after_register method method test_handle_updated_after_register L284–293
+ test_hd_fields_preserved_after_register method method test_hd_fields_preserved_after_register L273–282
+ test_jbok_register_no_hd_fields_added method method test_jbok_register_no_hd_fields_ L306–323
+ test_register_second_time_still_preserves_mnemonic method method test_register_second_time_still_preserves_mnemonic L295–304
+ _identity_file function function _identity_file L94–95
+ _mock_bip39 function function _mock_bip39 L82–91
+ _mock_hub function function _mock_hub L70–79
+ _patch_home function function _patch_home L58–67
+ _read_identity_toml function function _read_identity_toml L98–101
+ cli variable variable cli L39–39
+ CliRunner import import CliRunner L35–35
+ annotations import import annotations L24–24
+ json import import json L26–26
+ kp_module import import kp_module L37–37
+ os import import os L27–27
+ patch import import patch L32–32
+ pathlib import import pathlib L28–28
+ pytest import import pytest L34–34
+ tempfile import import tempfile L29–29
+ time import import time L30–30
+ tomllib import import tomllib L31–31
+ runner variable variable runner L40–40
~ muse/cli/commands/auth.py .py 2 symbols modified
~ muse/core/identity.py .py 1 symbol modified
~ tests/test_cmd_auth_keygen_hd.py .py 7 symbols added
+ TestKeygenHdDataIntegrity class class TestKeygenHdDataIntegrity L656–729
+ test_derived_fingerprint_stable_across_invocations method method test_derived_fingerprint_stable_across_invocations L703–729
+ test_mnemonic_stored_in_identity_toml_round_trips method method test_mnemonic_stored_in_identity_toml_round_trips L659–693
+ test_slip010_child_key_identical_on_repeated_calls method method test_slip010_child_key_identical_on_repeated_calls L695–701
+ TestKeygenHdStress class class TestKeygenHdStress L605–648
+ test_10_successive_force_keygens_produce_valid_keys method method test_10_successive_force_keygens_produce_valid_keys L608–627
+ test_all_entropy_strengths_produce_valid_keys method method test_all_entropy_strengths_produce_valid_keys L629–648
~ tests/test_cmd_merge_autostash.py .py 18 symbols added, 1 symbol modified
+ test_file_mode_bits_preserved method method test_file_mode_bits_preserved L281–289
+ test_multiple_wip_files_all_restored method method test_multiple_wip_files_all_restored L291–299
+ TestDocstrings class class TestDocstrings L452–461
+ test_run_has_docstring method method test_run_has_docstring L455–457
+ test_run_merge_helper_has_docstring method method test_run_merge_helper_has_docstring L459–461
+ TestEndToEnd class class TestEndToEnd L307–326
+ test_binary_equivalent_content_survives_stash method method test_binary_equivalent_content_survives_stash L319–326
+ test_multiple_dirty_files_all_restored method method test_multiple_dirty_files_all_restored L310–317
+ TestPerformance class class TestPerformance L363–405
+ test_autostash_merge_under_5s method method test_autostash_merge_under_5s L366–372
+ test_autostash_overhead_vs_plain_merge method method test_autostash_overhead_vs_plain_merge L374–405
+ TestSecurity class class TestSecurity L334–355
+ test_autostash_force_mutually_exclusive method method test_autostash_force_mutually_exclusive L337–340
+ test_wip_file_not_in_merged_commit method method test_wip_file_not_in_merged_commit L342–355
+ TestStress class class TestStress L413–444
+ test_20_consecutive_autostash_merges method method test_20_consecutive_autostash_merges L416–435
+ test_large_wip_file_survives_stash method method test_large_wip_file_survives_stash L437–444
+ time import import time L53–53
← Older Oldest on task/auth-hd-mnemonic-persistence
All commits
Newer → Latest on task/auth-hd-mnemonic-persistence

0 comments

No comments yet. Be the first to start the discussion.

To add a comment, use the Muse CLI: muse hub commit comment sha256:c652a71ccca1fe41597c2d7ba7ad79937983692d65866489105173ffc998f3ea --body "your comment"