bugfix(decide): collapse internal whitespace so multi-line text stays one bullet#4
Open
CryptoJones wants to merge 1 commit into
Open
bugfix(decide): collapse internal whitespace so multi-line text stays one bullet#4CryptoJones wants to merge 1 commit into
CryptoJones wants to merge 1 commit into
Conversation
… one bullet
`record_decision()` formatted the bullet as `- **{text} ({date})**` where
text had only outer whitespace stripped. A multi-line decision like
socrates decide $'first\nsecond'
produced
- **first
second (2026-05-20)**
which terminates the markdown list item at the first newline and leaves
an unclosed `**` on its own line — corrupting the DECISIONS.md file.
Fix: ' '.join(text.split()) to collapse every run of whitespace
(newlines, tabs, multiple spaces) into a single space before formatting.
Functionally a no-op for normal single-line inputs.
Test: assert a deliberately ugly multi-line input renders as a clean
single-line bullet with no stray newlines.
148/148 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.
record_decision()formatted the bullet as- **{text} ({date})**wheretext had only outer whitespace stripped. A multi-line decision like
socrates decide $'first\nsecond'
produced
second (2026-05-20)
which terminates the markdown list item at the first newline and leaves
an unclosed
**on its own line — corrupting the DECISIONS.md file.Fix: ' '.join(text.split()) to collapse every run of whitespace
(newlines, tabs, multiple spaces) into a single space before formatting.
Functionally a no-op for normal single-line inputs.
Test: assert a deliberately ugly multi-line input renders as a clean
single-line bullet with no stray newlines.
148/148 tests pass; ruff + mypy clean.
Self-review caveat: superseded in part by #refactor/shared-atomic-write-and-decide-lock, which folds in this same collapse logic. Merge whichever you prefer first; the refactor PR carries forward this fix.