fix(rank): keep every --exclude key out of the sweep when the list has spaces (#641)

* fix(rank): keep every --exclude key out of the sweep when the list has spaces

`sweep --exclude "a_b, c_d"` split on bare commas, so " c_d" matched no
entry and every key after the first was swept. On an --all run that
expired a re-scored entry whose fresh deadline apply then re-ranked, so
the report listed it as both expired and shortlisted. Strip each key.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* changelog: place the #641 entry under [Unreleased]

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: Mads Lorentzen <madslorentzen_17@hotmail.com>
This commit is contained in:
authored and GitHub committed 2026-10-19 19:49:24 +02:00
1 parent 4cbe273b56
commit 51c7dfdbd7
3 files changed
+23 -1

No files matched your search

+13
View File
@@ -259,6 +259,19 @@ class Sweep(RankStateCase):
self.assertEqual(out["swept"], 1)
self.assertEqual(self.read_state()["new_past"]["status"], "new")
def test_excluded_keys_tolerate_spaces_after_commas(self):
self.write_state(
{
"a": entry(status="ranked", deadline="2026-09-01"),
"b": entry(status="ranked", deadline="2026-09-01"),
"other": entry(status="ranked", deadline="2026-09-01"),
}
)
out = self.run_tool("sweep", "--write", "--exclude", "a, b")
self.assertEqual([r["key"] for r in out["newly_expired"]], ["other"])
self.assertEqual(out["swept"], 1)
self.assertEqual(self.read_state()["b"]["status"], "ranked", "a key scored this run is never swept")
def test_without_write_nothing_is_persisted(self):
self.write_state({"past": entry(status="ranked", deadline="2026-09-01")})
out = self.run_tool("sweep")