bugfix(journal): only YYYY-MM-DD.md files count as entries#15
Open
CryptoJones wants to merge 1 commit into
Open
bugfix(journal): only YYYY-MM-DD.md files count as entries#15CryptoJones wants to merge 1 commit into
CryptoJones wants to merge 1 commit into
Conversation
\`_list\` and \`_show_latest\` previously globbed every .md file in
\`planning/journal/\`, with a hardcoded README.md exclusion. Any other
file the operator dropped in — notes.md, ideas.md, drafts/, a
zzz.md decoy — got listed/shown as if it were a daily entry.
Worse for \`--show\`: alphabetical sorting put zzz.md after every real
dated entry, so \`socrates journal --show\` would print the wrong
file (whatever happened to sort last).
Fix: introduce \`_is_journal_entry\` that requires the stem to match
^\\d{4}-\\d{2}-\\d{2}$ (canonical ISO date). Used by both \`_list\`
and \`_show_latest\`. Also pinned encoding="utf-8" on the show
read_text (matching the localization fix elsewhere).
Tests added (2):
- --list shows only 2025-09-01.md and 2026-01-15.md when notes.md,
ideas.md, and an unpadded 2025-9-1.md are also present.
- --show picks 2026-06-15.md as the latest, NOT zzz.md (alphabetical
decoy that would otherwise sort last).
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.
`_list` and `_show_latest` previously globbed every .md file in
`planning/journal/`, with a hardcoded README.md exclusion. Any other
file the operator dropped in — notes.md, ideas.md, drafts/, a
zzz.md decoy — got listed/shown as if it were a daily entry.
Worse for `--show`: alphabetical sorting put zzz.md after every real
dated entry, so `socrates journal --show` would print the wrong
file (whatever happened to sort last).
Fix: introduce `_is_journal_entry` that requires the stem to match
^\d{4}-\d{2}-\d{2}$ (canonical ISO date). Used by both `_list`
and `_show_latest`. Also pinned encoding="utf-8" on the show
read_text (matching the localization fix elsewhere).
Tests added (2):
ideas.md, and an unpadded 2025-9-1.md are also present.
decoy that would otherwise sort last).
149/149 tests pass; ruff + mypy clean.
Self-review caveat: regex matches
9999-99-99.md(impossible date)._dt.date.fromisoformatwould reject it downstream but--liststill prints it. Cosmetic.