feature(1100): Discover .markdown posts and always log run summary

Extend the anniversary matcher to recursively scan both .md and
.markdown posts under _posts/blog, retaining the existing filename
validation and relative-path dedupe identifier so published-state
bookkeeping keeps working.

Drop the zero-counter short-circuit in log_run_summary so the
run_complete line is always emitted on a successful pass. Debug and
manual runs now clearly show that scanning completed and found
nothing instead of going silent.

Update matching, logging, and run-logging tests to cover the new
extension and always-emit contract, and refresh the logging
architecture doc accordingly.
This commit is contained in:
m0rph3us1987
2026-08-05 11:58:04 +02:00
parent 5f6ddf76a4
commit f243f2213c
6 changed files with 79 additions and 12 deletions
+42
View File
@@ -222,6 +222,48 @@ def test_missing_post_root_returns_empty(tmp_path: Path) -> None:
assert find_anniversary_matches(tmp_path / "does-not-exist", SITE_URL, today=today) == []
def test_markdown_extension_is_discovered(tmp_path: Path) -> None:
root = tmp_path / "_posts" / "blog"
_write_post(
root,
"2014/2014-08-04-foo.markdown",
body="---\ntitle: Foo\ndate: 2014-08-04\n---\nbody\n",
)
today = date(2024, 8, 4)
matches = find_anniversary_matches(root, SITE_URL, today=today)
assert len(matches) == 1
match = matches[0]
assert match.path == "2014/2014-08-04-foo.markdown"
assert match.title == "Foo"
assert match.date == date(2014, 8, 4)
assert match.url == "https://chaospott.de/2014/08/04/foo/"
def test_markdown_and_md_are_discovered_together(tmp_path: Path) -> None:
root = tmp_path / "_posts" / "blog"
_write_post(
root,
"2014/2014-08-04-from-md.md",
body="---\ntitle: Md\ndate: 2014-08-04\n---\n",
)
_write_post(
root,
"2014/2014-08-04-from-markdown.markdown",
body="---\ntitle: Markdown\ndate: 2014-08-04\n---\n",
)
today = date(2024, 8, 4)
matches = find_anniversary_matches(root, SITE_URL, today=today)
paths = {m.path for m in matches}
assert paths == {
"2014/2014-08-04-from-md.md",
"2014/2014-08-04-from-markdown.markdown",
}
def test_invalid_filename_is_skipped(tmp_path: Path) -> None:
root = tmp_path / "_posts" / "blog"
_write_post(root, "2014/not-a-date.md", body="---\ntitle: Bad\n---\n")