gabriel / muse public
fix BREAKING task/invariants-load-rules-repo-root #1 / 1
AI Agent gabriel · 136 days ago · May 5, 2026 · Diff

fix: add repo_root param to load_invariant_rules; delete _DEFAULT_RULES_FILE

load_invariant_rules now takes repo_root as its first positional argument and computes the default path via code_invariants_path(repo_root), eliminating the bare-relative-path construction pathlib.Path('.muse/code_invariants.toml').

_DEFAULT_RULES_FILE constant deleted. CodeChecker.check already held repo_root so it now threads it through. callers in code_check.py and invariants.py updated; invariants.py also deletes its own _RULES_FILE constant and inlines the string literal in the user-facing message.

Tests written first (TDD): four failing tests in TestLoadInvariantRules that cover no-file defaults, explicit default path resolution, explicit missing path, and explicit TOML file loading — all now pass.

sha256:c0a78b6e29c171e5b934687e207afadfd60a77ff1abf2b92c26eb8bf06f0153f sha
+3 ~10 −2 symbols
sha256:2b938d645d804c5a6866f06dee2f473023be04080602c610fa37353aec8c72cc snapshot
+3
symbols added
~10
symbols modified
−2
symbols removed
0
dead code introduced
Semantic Changes 15 symbols
~ muse/cli/commands/code_check.py .py 1 symbol modified
~ run
~ muse/cli/commands/invariants.py .py 1 symbol added, 1 symbol removed, 1 symbol modified
_RULES_FILE variable variable _RULES_FILE L170–170
+ code_invariants_path import import code_invariants_path L117–117
~ run
~ muse/plugins/code/_invariants.py .py 1 symbol added, 1 symbol removed, 4 symbols modified
_DEFAULT_RULES_FILE variable variable _DEFAULT_RULES_FILE L103–103
+ code_invariants_path import import code_invariants_path L81–81
~ check
~ tests/test_code_invariants.py .py 1 symbol added, 4 symbols modified
← Older Oldest on task/invariants-load-rules-repo-root
All commits
Newer → Latest on task/invariants-load-rules-repo-root

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