bugfix(timeline): anchor decision-date regex to bullet end, not first match#7
Open
CryptoJones wants to merge 1 commit into
Open
bugfix(timeline): anchor decision-date regex to bullet end, not first match#7CryptoJones wants to merge 1 commit into
CryptoJones wants to merge 1 commit into
Conversation
… match
`_decision_events` parsed lines like
- **Migrate by (2024-12-31) for compliance (2026-05-20)**
with an unanchored regex `\((\d{4}-\d{2}-\d{2})\)`. re.search returns
the FIRST match — so the user's deadline date (2024-12-31) was used as
the decision's recording date, instead of the trailing stamp
(2026-05-20) that `record_decision`/`_decisions_md` actually emit.
`socrates timeline` would then place the decision at the wrong point
in the chronological feed, breaking the whole "what happened on this
project in order?" premise.
Fix: try an end-anchored regex first
\((\d{4}-\d{2}-\d{2})\)\*{0,2}\s*$
which matches the canonical bullet shape (with or without the bold
markers). Fall back to the unanchored regex for legacy bullets that
don't end in `)**`. The stripped-from-content regex is also anchored,
so a user-typed date in the body is preserved in the rendered title.
Tests added (2):
- bullet with user-typed date BEFORE the recording stamp → uses the
trailing stamp, and the body-date is preserved in the title.
- bullet with NO trailing `)**` → fallback regex still picks up
the single in-line date.
149/149 tests pass; ruff + mypy clean.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
_decision_eventsparsed lines likewith an unanchored regex
\((\d{4}-\d{2}-\d{2})\). re.search returnsthe FIRST match — so the user's deadline date (2024-12-31) was used as
the decision's recording date, instead of the trailing stamp
(2026-05-20) that
record_decision/_decisions_mdactually emit.socrates timelinewould then place the decision at the wrong pointin the chronological feed, breaking the whole "what happened on this
project in order?" premise.
Fix: try an end-anchored regex first
((\d{4}-\d{2}-\d{2}))*{0,2}\s*$
which matches the canonical bullet shape (with or without the bold
markers). Fall back to the unanchored regex for legacy bullets that
don't end in
)**. The stripped-from-content regex is also anchored,so a user-typed date in the body is preserved in the rendered title.
Tests added (2):
trailing stamp, and the body-date is preserved in the title.
)**→ fallback regex still picks upthe single in-line date.
149/149 tests pass; ruff + mypy clean.
Self-review caveat: partial fix. The unanchored FALLBACK regex (for legacy non-canonical bullets) still has the original bug — for those, the FIRST date in the line still wins. Only the canonical
)**-terminated bullets get the fix. Acceptable because all NEW bullets from record_decision use the canonical form.