From 4109a667b93f9fd979433802ffe9628ac8466c31 Mon Sep 17 00:00:00 2001 From: Ed_ Date: Sat, 20 Jun 2026 17:54:48 -0400 Subject: [PATCH] fix(chronology): skip **Status:**/**Track ID:**/**Track:**/**>** metadata lines in summary extraction --- scripts/audit/generate_chronology.py | 11 +++++++++-- tests/test_generate_chronology.py | 9 ++++++++- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/scripts/audit/generate_chronology.py b/scripts/audit/generate_chronology.py index c5e69df2..295a97ae 100644 --- a/scripts/audit/generate_chronology.py +++ b/scripts/audit/generate_chronology.py @@ -79,9 +79,16 @@ def extract_summary(folder_path: Path) -> str: continue for line in text.splitlines(): stripped = line.strip() - if not stripped or stripped.startswith("#"): + if not stripped: continue - return _truncate_to_25_words(_first_sentence(stripped)) + if stripped.startswith("#"): + continue + if stripped.startswith(">"): + continue + bare = stripped.lstrip(">").strip() + if bare.startswith("**Status:**") or bare.startswith("**Track ID:**") or bare.startswith("**Track:**"): + continue + return _truncate_to_25_words(_first_sentence(bare)) return "Imported from archive (no spec)" diff --git a/tests/test_generate_chronology.py b/tests/test_generate_chronology.py index 52866fc7..7da9ebca 100644 --- a/tests/test_generate_chronology.py +++ b/tests/test_generate_chronology.py @@ -35,4 +35,11 @@ def test_summary_extraction_truncates_to_25_words(tmp_path: Path) -> None: result: str = extract_summary(tmp_path) expected: str = " ".join(["word"] * 25) + "\u2026" assert result == expected - assert result.endswith("\u2026") \ No newline at end of file + assert result.endswith("\u2026") + + +def test_summary_extraction_skips_status_metadata_line(tmp_path: Path) -> None: + spec_content: str = "# Title\n\n**Status:** Spec approved 2026-06-19\n\nReal description of the work.\n" + (tmp_path / "spec.md").write_text(spec_content, encoding="utf-8") + result: str = extract_summary(tmp_path) + assert result == "Real description of the work." \ No newline at end of file