feat: muse#53 item 6 — relative time syntax for symlog @{...} refs
Extends resolve_symlog_addr() to accept relative-time specs alongside the existing @{N} integer-index form, mirroring muse#54 item 1's reflog equivalent:
- @{N.unit.ago} — unit is second/minute/hour/day/week, singular or plural (e.g. "1.hour.ago", "2.days.ago"). - @{yesterday} — start of today (UTC midnight).
Both forms resolve to the newest entry at or before the computed cutoff. _SYMLOG_REF_RE (duplicated in both muse/core/symlog.py and muse/cli/commands/symlog.py -- the CLI validates the addr@{...} shape before calling into core) was broadened from a digits-only capture to "anything inside the braces" in both places; disambiguation (digit vs time spec) happens in the new _resolve_symlog_index() helper inside resolve_symlog_addr() itself, so none of the three CLI call sites (resolve/show/diff) needed changes beyond the regex. An out-of-range digit index still raises IndexError(index, total); a valid time spec with no qualifying entry raises IndexError(-1, total); an unrecognized @{...} spec raises ValueError.
Covered by tests/test_symlog_time_resolution.py (7 cases: hour-ago cutoff selection, minutes-ago, yesterday, no-entry-old-enough raises IndexError, unrecognized spec raises ValueError, non-regression of the plain @{N} index form, and a `muse symlog resolve` CLI integration test). Confirmed genuine RED by reverting the fix file and re-running (6 of 7 failed; the plain-index non-regression case passed incidentally since it's pre-existing unaffected behavior), then GREEN with the fix restored plus the full symlog regression suite (229 tests, zero regressions). Live-verified via muse-dev against a disposable /tmp sandbox (0.second.ago resolves correctly; 1.week.ago with no qualifying entry produces a clear out-of-range error).
Co-Authored-By: Claude Sonnet 5 <[email protected]>
Semantic Changes
38 symbols
Files Changed
+1
~3
1234 in snapshot
0 comments
muse hub commit comment sha256:9cb57906be1b86b25d7956f3bd72fe735ecde4b0bdde0b005c500d4f7e0f983c --body "your comment"
No comments yet. Be the first to start the discussion.