From 226289c0b474cabe9bb9de73b06ec4270f3d1ac6 Mon Sep 17 00:00:00 2001 From: melbinjp Date: Wed, 19 Aug 2026 15:43:44 +0530 Subject: [PATCH] Release notes with the version in the filename are history too `release[-_ ]?notes` has been on `_HISTORICAL_NAMES` since the fastapi measurement, where one release-notes.md produced 162 findings. The pattern demanded an extension or a slash straight after the name, so it matched `release-notes.md` and walked past `docs/release_notes_v7.9.0.md`. A version number is neither. enarjord/passivbot, sweep batch 10, is where it showed. Two of its five findings are release notes naming config files deleted in later releases. Both documents are correct: the config existed at the version the filename carries. Pillow escapes this only because its notes live in a `releasenotes/` DIRECTORY, which the path rule already reads; a project that keeps them flat gets judged for the same content. Measured over every sweep batch, 147 finding lines: this suppresses exactly those two and nothing else. Tight on purpose, so a suffix that is a word rather than a version stays judged. 197 tests. --- src/docproof/config.py | 19 ++++++++++++++++++- tests/test_paths.py | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 53 insertions(+), 1 deletion(-) diff --git a/src/docproof/config.py b/src/docproof/config.py index 4c31a54..8813a57 100644 --- a/src/docproof/config.py +++ b/src/docproof/config.py @@ -72,7 +72,24 @@ # document in the whole corpus and the other two matched none, which is not evidence; and # `TOMBSTONE` already draws the line that deprecated is not removed. HISTORICAL = re.compile( - rf"(?ix) (^|/) (?: {_HISTORICAL_NAMES} ) (?: \.[a-z0-9]+ )? (?: / | $ )" + # THE VERSION SUFFIX, which is this rule failing to recognise its own convention rather + # than a new class of document. `release[-_ ]?notes` has been on the list above since the + # fastapi measurement, and it matched `release-notes.md` while walking straight past + # `docs/release_notes_v7.9.0.md` - because after the name it demanded an extension or a + # slash, and a version number is neither. + # + # `enarjord/passivbot`, batch 10. Two of its five findings are `release_notes_v7.9.0.md` + # naming `configs/examples/default_trailing_grid_long_npos10.json` and + # `release_notes_v7.10.0.md` naming another config, both deleted in later releases. Both + # documents are correct: the config existed at the version the file is named for. Pillow + # gets this for free because its notes live in a `releasenotes/` DIRECTORY; a project that + # keeps them flat and stamps the version on the filename got judged for the same content. + # + # Measured over every sweep batch, 147 finding lines: this suppresses exactly those two + # and nothing else. Deliberately tight - the version must follow immediately, so + # `changelog-policy.md` stays judged, and so does anything whose suffix is a word. + rf"(?ix) (^|/) (?: {_HISTORICAL_NAMES} )" + rf" (?: [-_ ] v? \d+ (?: \.\d+ )* )? (?: \.[a-z0-9]+ )? (?: / | $ )" rf" | (^|/) changelog\.d/ " rf" | (^|/) archived? / " # A FILE called archive, not only a directory. This rule already believes the word means diff --git a/tests/test_paths.py b/tests/test_paths.py index 778f9e1..f7c087e 100644 --- a/tests/test_paths.py +++ b/tests/test_paths.py @@ -848,3 +848,38 @@ def test_a_plain_deletion_still_reads_as_a_deletion(make_repo: Callable[..., Pat assert verdict is Verdict.BROKEN assert "deleted in" in detail assert "moved to" not in detail + + +def test_release_notes_are_history_even_with_the_version_in_the_name(): + """`release[-_ ]?notes` has been on `_HISTORICAL_NAMES` since the fastapi measurement, + and it could not see `docs/release_notes_v7.9.0.md`: after the name the pattern demanded + an extension or a slash, and a version number is neither. + + `enarjord/passivbot` pays for that. Two of its five findings are release notes naming + config files deleted in later releases, and both documents are correct - the config + existed at the version the filename carries. Pillow escapes this only because its notes + sit in a `releasenotes/` DIRECTORY, which the path rule already reads. + + Measured across every sweep batch, 147 finding lines: the widened pattern suppresses + exactly those two. The near misses are what keep it honest - a suffix that is a word, + not a version, still gets judged. + """ + from docproof.config import is_historical + + for path in ( + "docs/release_notes_v7.9.0.md", + "docs/release_notes_v7.10.0.md", + "docs/release-notes-2.rst", + "CHANGELOG-1.2.md", + "docs/migration_v2.md", + ): + assert is_historical(path), path + + for path in ( + "docs/changelog-policy.md", + "docs/release-notes-process.md", + "docs/history-of-the-parser.md", + "docs/newsletter.md", + "README.md", + ): + assert not is_historical(path), path