@@ -211,6 +211,33 @@ def test_load_findings_includes_duplicates_dir_and_sorts(tmp_path):
211211 assert [f .key for f in found ] == ["CVE-2025-63662" , "CVE-2025-63663" , "EL-2026-014" ]
212212
213213
214+ def test_published_newest_first_orders_by_disclosure_date (tmp_path ):
215+ write (tmp_path , "findings/CVE-2025-63662/finding.md" , PUBLISHED )
216+ write (tmp_path , "findings/CVE-2026-27959/finding.md" , PUBLISHED
217+ .replace ("CVE-2025-63662" , "CVE-2026-27959" )
218+ .replace ("disclosed: 2025-12-22" , "disclosed: 2026-02-26" ))
219+ ordered = records .published_newest_first (records .load_findings (tmp_path ))
220+ assert [f .key for f in ordered ] == ["CVE-2026-27959" , "CVE-2025-63662" ]
221+
222+
223+ def test_published_newest_first_breaks_ties_on_key (tmp_path ):
224+ """Same-day disclosures keep load_findings' key order, so output is stable."""
225+ write (tmp_path , "findings/CVE-2025-63664/finding.md" , PUBLISHED .replace ("63662" , "63664" ))
226+ write (tmp_path , "findings/CVE-2025-63662/finding.md" , PUBLISHED )
227+ write (tmp_path , "findings/CVE-2025-63663/finding.md" , PUBLISHED .replace ("63662" , "63663" ))
228+ ordered = records .published_newest_first (records .load_findings (tmp_path ))
229+ assert [f .key for f in ordered ] == [
230+ "CVE-2025-63662" , "CVE-2025-63663" , "CVE-2025-63664" ,
231+ ]
232+
233+
234+ def test_published_newest_first_drops_unpublished_records (tmp_path ):
235+ write (tmp_path , "findings/CVE-2025-63662/finding.md" , PUBLISHED )
236+ write (tmp_path , "findings/EL-2026-001/finding.md" , PENDING )
237+ ordered = records .published_newest_first (records .load_findings (tmp_path ))
238+ assert [f .key for f in ordered ] == ["CVE-2025-63662" ]
239+
240+
214241def test_duplicate_key_across_findings_and_duplicates_is_an_error (tmp_path ):
215242 write (tmp_path , "findings/EL-2026-014/finding.md" , PENDING .replace (
216243 "EL-2026-001" , "EL-2026-014" ))
0 commit comments