gabriel / muse public
feat patch mist task/mist-domain-phase1 #1 / 1
gabriel · 147 days ago · Apr 15, 2026 · Diff

feat(mist): add MistPlugin domain — Phase 1 core implementation

- New muse/plugins/mist/plugin.py with full MuseDomainPlugin protocol: snapshot, diff, merge, drift, apply, schema - compute_mist_id: SHA-256 → base-58 (Bitcoin alphabet) → 12-char prefix Same bytes always produce the same URL-safe, visually unambiguous ID - detect_artifact_type: magic-byte → JSON-key → extension cascade Correctly classifies MIDI, ABI JSON, JSON Schema, code, prose, binary - _validate_mist_filename: security gate rejecting null bytes, path separators, traversal sequences, control chars, ANSI escapes, >255 chars - extract_mist_symbol_anchors: delegates to ast_parser for Python, TS, Solidity, Markdown; returns empty list for binary (never raises) - Register MistPlugin in muse/plugins/registry.py — muse status/diff/ merge/log/etc. all work on mist repos immediately, zero core changes - 72 tests covering Tiers 1, 5, 6, 8 (shape, data integrity, perf, docstrings) — all green

sha256:b2b3ba5782a9b733e5ba54e9368892f805ff7a6e2858260556fc6edf60292252 sha
+118 ~1 symbols
sha256:d806eed7ede302261f4b3ce2499b3b2d5b036d4e8a4312944916ec34b75cd448 snapshot
+118
symbols added
~1
symbol modified
0
dead code introduced
Semantic Changes 119 symbols
~ muse/plugins/mist/plugin.py .py 34 symbols added
+ MistPlugin class class MistPlugin L294–562
+ apply method method apply L479–493
+ diff method method diff L366–386
+ drift method method drift L457–477
+ merge method method merge L388–455
+ schema method method schema L499–562
+ snapshot method method snapshot L314–364
+ _BASE58_ALPHABET variable variable _BASE58_ALPHABET L65–65
+ _DOMAIN_NAME variable variable _DOMAIN_NAME L60–60
+ _EXT_MAP variable variable _EXT_MAP L74–106
+ _MIST_ID_LENGTH variable variable _MIST_ID_LENGTH L70–70
+ _validate_mist_filename function function _validate_mist_filename L202–254
+ compute_mist_id function function compute_mist_id L114–147
+ detect_artifact_type function function detect_artifact_type L150–199
+ extract_mist_symbol_anchors function function extract_mist_symbol_anchors L257–286
+ DimensionSpec import import DimensionSpec L37–37
+ DomainSchema import import DomainSchema L37–37
+ DriftReport import import DriftReport L44–44
+ LiveState import import LiveState L44–44
+ Manifest import import Manifest L43–43
+ MergeResult import import MergeResult L44–44
+ SetSchema import import SetSchema L37–37
+ SnapshotManifest import import SnapshotManifest L44–44
+ StateDelta import import StateDelta L44–44
+ StateSnapshot import import StateSnapshot L44–44
+ TYPE_CHECKING import import TYPE_CHECKING L33–33
+ __version__ import import __version__ L35–35
+ _stat import import _stat L32–32
+ annotations import import annotations L27–27
+ hashlib import import hashlib L29–29
+ load_cache import import load_cache L42–42
+ os import import os L30–30
+ pathlib import import pathlib L31–31
+ snapshot_diff import import snapshot_diff L36–36
~ tests/test_mist_plugin.py .py 83 symbols added
+ TestComputeMistId class class TestComputeMistId L136–189
+ test_deterministic method method test_deterministic L139–143
+ test_empty_bytes_stable_id method method test_empty_bytes_stable_id L176–182
+ test_length_is_12 method method test_length_is_12 L145–149
+ test_no_ambiguous_chars method method test_no_ambiguous_chars L159–168
+ test_only_base58_alphabet method method test_only_base58_alphabet L151–157
+ test_single_bit_change_produces_different_id method method test_single_bit_change_produces_different_id L184–189
+ test_uniqueness_across_different_content method method test_uniqueness_across_different_content L170–174
+ TestDetectArtifactType class class TestDetectArtifactType L197–265
+ test_abi_json method method test_abi_json L213–219
+ test_json_schema method method test_json_schema L221–227
+ test_markdown_extension method method test_markdown_extension L241–245
+ test_midi_magic_bytes method method test_midi_magic_bytes L200–204
+ test_midi_magic_bytes_wrong_extension method method test_midi_magic_bytes_wrong_extension L206–211
+ test_python_extension method method test_python_extension L229–233
+ test_returns_dict_with_required_keys method method test_returns_dict_with_required_keys L259–265
+ test_solidity_extension method method test_solidity_extension L247–251
+ test_typescript_extension method method test_typescript_extension L235–239
+ test_unknown_extension_fallback method method test_unknown_extension_fallback L253–257
+ TestExtractMistSymbolAnchors class class TestExtractMistSymbolAnchors L346–389
+ test_binary_returns_empty method method test_binary_returns_empty L363–368
+ test_no_import_pseudo_symbols method method test_no_import_pseudo_symbols L383–389
+ test_python_class_anchor class method test_python_class_anchor L356–361
+ test_python_function_anchor method method test_python_function_anchor L349–354
+ test_returns_list_always method method test_returns_list_always L372–381
+ TestMistPluginDocstrings class class TestMistPluginDocstrings L543–588
+ test_function_has_docstring method method test_function_has_docstring L573–579
+ test_mist_plugin_class_docstring class method test_mist_plugin_class_docstring L567–570
+ test_module_docstring method method test_module_docstring L562–565
+ test_plugin_method_has_docstring method method test_plugin_method_has_docstring L582–588
+ TestMistPluginFilesystemSnapshot class class TestMistPluginFilesystemSnapshot L467–507
+ test_drift_detects_new_file_on_disk method method test_drift_detects_new_file_on_disk L501–507
+ test_snapshot_empty_directory method method test_snapshot_empty_directory L470–476
+ test_snapshot_hidden_files_excluded method method test_snapshot_hidden_files_excluded L485–492
+ test_snapshot_nested_files_included method method test_snapshot_nested_files_included L494–499
+ test_snapshot_single_file method method test_snapshot_single_file L478–483
+ TestMistPluginInMemory class class TestMistPluginInMemory L397–459
+ test_apply_returns_live_state_unchanged method method test_apply_returns_live_state_unchanged L456–459
+ test_diff_add_file method method test_diff_add_file L409–412
+ test_diff_empty_to_empty_has_no_ops method method test_diff_empty_to_empty_has_no_ops L405–407
+ test_diff_remove_file method method test_diff_remove_file L414–417
+ test_drift_detects_change method method test_drift_detects_change L452–454
+ test_drift_no_drift_when_identical method method test_drift_no_drift_when_identical L448–450
+ test_merge_conflict_both_sides_change_same_path method method test_merge_conflict_both_sides_change_same_path L429–436
+ test_merge_no_conflict_both_sides_add_different method method test_merge_no_conflict_both_sides_add_different L419–427
+ test_merge_no_conflict_same_add_both_sides method method test_merge_no_conflict_same_add_both_sides L438–446
+ test_snapshot_passes_through_manifest method method test_snapshot_passes_through_manifest L400–403
+ TestMistPluginPerformance class class TestMistPluginPerformance L515–535
+ test_compute_mist_id_1mb_under_100ms method method test_compute_mist_id_1mb_under_100ms L518–526
+ test_snapshot_1000_files_under_5s method method test_snapshot_1000_files_under_5s L528–535
+ TestMistPluginShape class class TestMistPluginShape L66–128
+ test_all_required_methods_present method method test_all_required_methods_present L71–74
+ test_registered_domains_includes_mist method method test_registered_domains_includes_mist L125–128
+ test_registered_in_registry method method test_registered_in_registry L110–116
+ test_resolve_plugin_by_domain method method test_resolve_plugin_by_domain L118–123
+ test_schema_domain_is_mist method method test_schema_domain_is_mist L86–87
+ test_schema_has_two_dimensions method method test_schema_has_two_dimensions L97–101
+ test_schema_merge_mode_three_way method method test_schema_merge_mode_three_way L103–104
+ test_schema_returns_domain_schema method method test_schema_returns_domain_schema L76–84
+ test_schema_top_level_is_set method method test_schema_top_level_is_set L89–95
+ test_schema_version_is_string method method test_schema_version_is_string L106–108
+ TestValidateMistFilename class class TestValidateMistFilename L273–338
+ test_accepts_name_of_exactly_255_chars method method test_accepts_name_of_exactly_255_chars L335–338
+ test_rejects_ansi_escape method method test_rejects_ansi_escape L323–327
+ test_rejects_backslash method method test_rejects_backslash L298–302
+ test_rejects_control_characters method method test_rejects_control_characters L310–315
+ test_rejects_del_character method method test_rejects_del_character L317–321
+ test_rejects_dotdot method method test_rejects_dotdot L304–308
+ test_rejects_forward_slash method method test_rejects_forward_slash L292–296
+ test_rejects_name_exceeding_255_chars method method test_rejects_name_exceeding_255_chars L329–333
+ test_rejects_null_byte method method test_rejects_null_byte L286–290
+ test_valid_name_with_dots_and_dashes method method test_valid_name_with_dots_and_dashes L281–284
+ test_valid_simple_name method method test_valid_simple_name L276–279
+ empty_snap function function empty_snap L45–48
+ annotations import import annotations L22–22
+ hashlib import import hashlib L24–24
+ inspect import import inspect L25–25
+ pathlib import import pathlib L26–26
+ pytest import import pytest L30–30
+ sys import import sys L27–27
+ time import import time L28–28
+ plugin function function plugin L38–41
+ snap_with_one function function snap_with_one L52–58
~ muse/plugins/registry.py .py 1 symbol added, 1 symbol modified
+ MistPlugin import import MistPlugin L25–25
← Older Oldest on task/mist-domain-phase1
All commits
Newer → Latest on task/mist-domain-phase1

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:b2b3ba5782a9b733e5ba54e9368892f805ff7a6e2858260556fc6edf60292252 --body "your comment"