gabriel / muse public
refactor BREAKING harmony task/harmony-decompose #11 / 13
AI Agent gabriel · 115 days ago · May 22, 2026 · Diff

refactor(harmony): Phase 2 — extract paths.py

Move all path helpers and path-level validation to muse/core/harmony/paths.py.

Moved to paths.py ----------------- Directory helpers: patterns_dir, policies_dir, audit_dir, escalations_dir, escalation_path, pattern_dir (_pattern_entry_dir alias), _resolutions_dir, resolution_path (_resolution_path alias)

Validation: _validate_id, _validate_fingerprint, _validate_policy_id

Constants: _HARMONY, _PATTERNS, _POLICIES, _AUDIT, _ESCALATIONS, _RESOLUTIONS, _PATTERN_FILE, _MAX_FINGERPRINT_BYTES, _SHA256_ID_RE, _BARE_HEX64_RE, _POLICY_ID_RE

__init__.py changes ------------------- - Imports all of the above from .paths (full re-export — no call site changes required anywhere in the codebase) - Retains persistence-layer size caps (_MAX_PATTERN_BYTES etc.) inline until they move with their respective persistence modules - Removes unused stdlib imports: hashlib, re (re is now only needed inside paths.py)

Test result: 707 passed / 0 failed (baseline: 707 passed)

sha256:47e5edb0d431c5b4e41a97332a6d8d5358601668a13f383366b6b2e3bc167c08 sha
+53 −27 symbols
sha256:c49e316b407b89c5dca7ab07f0fc75d9f1bd2a08e650194cf53fd51e5aab0434 snapshot
+53
symbols added
−27
symbols removed
0
dead code introduced
Semantic Changes 80 symbols
~ muse/core/harmony/paths.py .py 29 symbols added
+ _AUDIT variable variable _AUDIT L23–23 ← moved from muse/core/harmony/__init__.py
+ _BARE_HEX64_RE variable variable _BARE_HEX64_RE L40–40 ← moved from muse/core/harmony/__init__.py
+ _ESCALATIONS variable variable _ESCALATIONS L24–24 ← moved from muse/core/harmony/__init__.py
+ _HARMONY variable variable _HARMONY L20–20 ← moved from muse/core/harmony/__init__.py
+ _MAX_FINGERPRINT_BYTES variable variable _MAX_FINGERPRINT_BYTES L34–34 ← moved from muse/core/harmony/__init__.py
+ _PATTERNS variable variable _PATTERNS L21–21 ← moved from muse/core/harmony/__init__.py
+ _PATTERN_FILE variable variable _PATTERN_FILE L26–26 ← moved from muse/core/harmony/__init__.py
+ _POLICIES variable variable _POLICIES L22–22 ← moved from muse/core/harmony/__init__.py
+ _POLICY_ID_RE variable variable _POLICY_ID_RE L43–43 ← moved from muse/core/harmony/__init__.py
+ _RESOLUTIONS variable variable _RESOLUTIONS L25–25 ← moved from muse/core/harmony/__init__.py
+ _SHA256_ID_RE variable variable _SHA256_ID_RE L37–37 ← moved from muse/core/harmony/__init__.py
+ _pattern_entry_dir variable variable _pattern_entry_dir L99–99 ← moved from muse/core/harmony/__init__.py
+ _resolution_path variable variable _resolution_path L126–126 ← moved from muse/core/harmony/__init__.py
+ _resolutions_dir function function _resolutions_dir L101–103 ← moved from muse/core/harmony/__init__.py
+ _validate_fingerprint function function _validate_fingerprint L151–178 ← moved from muse/core/harmony/__init__.py
+ _validate_id function function _validate_id L132–149 ← moved from muse/core/harmony/__init__.py
+ _validate_policy_id function function _validate_policy_id L180–197 ← moved from muse/core/harmony/__init__.py
+ audit_dir function function audit_dir L59–61 ← moved from muse/core/harmony/__init__.py
+ escalation_path function function escalation_path L67–77 ← moved from muse/core/harmony/__init__.py
+ escalations_dir function function escalations_dir L63–65 ← moved from muse/core/harmony/__init__.py
+ _harmony_dir import import _harmony_dir L13–13 ← moved from muse/core/harmony/__init__.py
+ annotations import import annotations L8–8
+ pathlib import import pathlib L10–10
+ re import import re L11–11 ← moved from muse/core/harmony/__init__.py
+ split_id import import split_id L14–14
+ pattern_dir function function pattern_dir L79–96 ← moved from muse/core/harmony/__init__.py
+ patterns_dir function function patterns_dir L51–53 ← moved from muse/core/harmony/__init__.py
+ policies_dir function function policies_dir L55–57 ← moved from muse/core/harmony/__init__.py
+ resolution_path function function resolution_path L105–123 ← moved from muse/core/harmony/__init__.py
~ muse/core/harmony/__init__.py .py 24 symbols added, 27 symbols removed
_AUDIT variable variable _AUDIT L140–140 → moved to muse/core/harmony/paths.py
_BARE_HEX64_RE variable variable _BARE_HEX64_RE L178–178 → moved to muse/core/harmony/paths.py
_ESCALATIONS variable variable _ESCALATIONS L141–141 → moved to muse/core/harmony/paths.py
_HARMONY variable variable _HARMONY L137–137 → moved to muse/core/harmony/paths.py
_MAX_FINGERPRINT_BYTES variable variable _MAX_FINGERPRINT_BYTES L163–163 → moved to muse/core/harmony/paths.py
_PATTERNS variable variable _PATTERNS L138–138 → moved to muse/core/harmony/paths.py
_PATTERN_FILE variable variable _PATTERN_FILE L143–143 → moved to muse/core/harmony/paths.py
_POLICIES variable variable _POLICIES L139–139 → moved to muse/core/harmony/paths.py
_POLICY_ID_RE variable variable _POLICY_ID_RE L181–181 → moved to muse/core/harmony/paths.py
_RESOLUTIONS variable variable _RESOLUTIONS L142–142 → moved to muse/core/harmony/paths.py
_SHA256_ID_RE variable variable _SHA256_ID_RE L175–175 → moved to muse/core/harmony/paths.py
_pattern_entry_dir variable variable _pattern_entry_dir L237–237 → moved to muse/core/harmony/paths.py
_resolution_path variable variable _resolution_path L264–264 → moved to muse/core/harmony/paths.py
_resolutions_dir function function _resolutions_dir L239–241 → moved to muse/core/harmony/paths.py
_validate_fingerprint function function _validate_fingerprint L289–316 → moved to muse/core/harmony/paths.py
_validate_id function function _validate_id L270–287 → moved to muse/core/harmony/paths.py
_validate_policy_id function function _validate_policy_id L318–335 → moved to muse/core/harmony/paths.py
audit_dir function function audit_dir L197–199 → moved to muse/core/harmony/paths.py
escalation_path function function escalation_path L205–215 → moved to muse/core/harmony/paths.py
escalations_dir function function escalations_dir L201–203 → moved to muse/core/harmony/paths.py
_harmony_dir import import _harmony_dir L102–102 → moved to muse/core/harmony/paths.py
hashlib import import hashlib L92–92
re import import re L97–97 → moved to muse/core/harmony/paths.py
pattern_dir function function pattern_dir L217–234 → moved to muse/core/harmony/paths.py
patterns_dir function function patterns_dir L189–191 → moved to muse/core/harmony/paths.py
policies_dir function function policies_dir L193–195 → moved to muse/core/harmony/paths.py
resolution_path function function resolution_path L243–261 → moved to muse/core/harmony/paths.py
+ _AUDIT import import _AUDIT L104–104
+ _BARE_HEX64_RE import import _BARE_HEX64_RE L104–104
+ _ESCALATIONS import import _ESCALATIONS L104–104
+ _HARMONY import import _HARMONY L104–104
+ _MAX_FINGERPRINT_BYTES import import _MAX_FINGERPRINT_BYTES L104–104
+ _PATTERNS import import _PATTERNS L104–104
+ _PATTERN_FILE import import _PATTERN_FILE L104–104
+ _POLICIES import import _POLICIES L104–104
+ _POLICY_ID_RE import import _POLICY_ID_RE L104–104
+ _RESOLUTIONS import import _RESOLUTIONS L104–104
+ _SHA256_ID_RE import import _SHA256_ID_RE L104–104
+ _pattern_entry_dir import import _pattern_entry_dir L104–104
+ _resolution_path import import _resolution_path L104–104
+ _resolutions_dir import import _resolutions_dir L104–104
+ _validate_fingerprint import import _validate_fingerprint L104–104
+ _validate_id import import _validate_id L104–104
+ _validate_policy_id import import _validate_policy_id L104–104
+ audit_dir import import audit_dir L104–104
+ escalation_path import import escalation_path L104–104
+ escalations_dir import import escalations_dir L104–104
+ pattern_dir import import pattern_dir L104–104
+ patterns_dir import import patterns_dir L104–104
+ policies_dir import import policies_dir L104–104
+ resolution_path import import resolution_path L104–104

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