gabriel / muse public
feat patch feat/53-symlog-grep #1 / 1
AI Agent gabriel · 1 day ago · Oct 22, 2026 · Diff

feat: muse#53 item 8 — muse symlog grep

Adds `muse symlog grep PATTERN [--file path] [--json]`: searches symbol bodies across their full symlog history for a case-insensitive substring match, answering "when did this symbol last contain the string X?" Reconstructs each entry's body via the existing resolve_symbol_body() and checks it against PATTERN. Scope defaults to every symbol with a journal; narrow with --file.

Covered by tests/test_cmd_symlog_grep.py (6 cases: match in current body, match only in an older version (correctly indexed via newest-first @{N} convention), no match returns empty, case-insensitive matching, --file scoping excludes other files' symbols, missing PATTERN errors). One test iteration note: a comment-only source diff doesn't change a symbol's AST-derived content_id, so no new symlog entry gets written — the "older version" test uses a real statement (a variable assignment) instead of a comment to produce two distinct entries, confirmed via a live muse-dev sandbox before finalizing the test. Confirmed genuine RED by reverting the fix file and re-running (5 of 6 failed; the missing-pattern error case passed incidentally via the pre-existing unrecognized-subcommand fallback), then GREEN with the fix restored plus the full symlog regression suite (239 tests, zero regressions). Live-verified via muse-dev against a disposable /tmp sandbox.

Co-Authored-By: Claude Sonnet 5 <[email protected]>

sha256:7beffebf7a5585efe2edc5971d33e032bf723c7dda0d0f890d1cccbca6b08d5a sha
+23 ~4 symbols
3 changed · 1236 in snapshot files
sha256:394298366c85c11bc057e87457f8fb94de8988108ed7b462dbc4881dae0ce53d snapshot
+23
symbols added
~4
symbols modified
3
files changed
1236
files in snapshot
0
dead code introduced
Semantic Changes 27 symbols
~ tests/test_cmd_symlog_grep.py .py 20 symbols added
+ TestSymlogGrep class class TestSymlogGrep L61–124
+ test_case_insensitive_match method method test_case_insensitive_match L101–108
+ test_finds_pattern_in_current_body method method test_finds_pattern_in_current_body L62–73
+ test_finds_pattern_only_in_older_version method method test_finds_pattern_only_in_older_version L75–89
+ test_missing_pattern_errors method method test_missing_pattern_errors L121–124
+ test_no_match_returns_empty method method test_no_match_returns_empty L91–99
+ test_scoped_to_file method method test_scoped_to_file L110–119
+ _commit function function _commit L39–49
+ _init_repo function function _init_repo L28–30
+ _invoke function function _invoke L19–25
+ _make_repo function function _make_repo L52–54
+ _symlog function function _symlog L57–58
+ _write_file function function _write_file L33–36
+ CliRunner import import CliRunner L14–14
+ annotations import import annotations L7–7
+ json import import json L9–9
+ os import import os L10–10
+ pathlib import import pathlib L11–11
+ textwrap import import textwrap L12–12
+ runner variable variable runner L16–16
~ muse/cli/commands/symlog.py .py 3 symbols added, 1 symbol modified
+ _GrepJson class class _GrepJson L183–188
+ _GrepMatchJson class class _GrepMatchJson L172–180
+ run_grep function function run_grep L826–923
~ run
Files Changed
+1 ~2
1236 in snapshot
← Older Oldest on feat/53-symlog-grep
All commits
Newer → Latest on feat/53-symlog-grep

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