fix(rank): treat non-ISO stored deadlines as absent in urgency and the sweep

Rule 6's expiry sweep mutates status automatically from stored deadline
values, yet had no rule for the non-ISO shapes portals have shipped into
seen_jobs.json ("ASAP", DD.MM.YYYY, free text) - "ASAP" is incomparable
and "01.09.2026" is ambiguous between 1 Sep and 9 Jan. /outcome, which
merely displays dates, already carried the defensive-parse rule. A
non-YYYY-MM-DD stored value is now handled like an absent one (left
alone, never compared, never guessed at) and reported once with its
portal. Includes the F24-style coupling test. Review finding F17
(2026-08-19).

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Mads Lorentzen
2026-08-19 19:53:29 +02:00
co-authored by Claude Opus 5
parent 9ab697de64
commit 57e82d2b59
3 changed files with 28 additions and 2 deletions
+19
View File
@@ -132,6 +132,25 @@ class RankCommandSpec(unittest.TestCase):
"stale claim: the gate result IS tracked by /scrape and /rank now",
)
def test_sweep_parses_stored_deadlines_defensively(self):
"""Rule 6's expiry sweep mutates status automatically from stored
deadline values, and portals have shipped non-ISO shapes into
seen_jobs.json ("ASAP" from jobindex, DD.MM.YYYY from jobbank,
free text from jobdanmark's detail fallback). /outcome carries a
defensive date-parse rule for mere display; the command that
silently changes state needs one at least as much."""
text = COMMAND.read_text(encoding="utf-8")
self.assertIn(
"Parse stored deadlines defensively",
text,
"rule 6's sweep must state the defensive-parse rule",
)
self.assertRegex(
text,
r"not a `YYYY-MM-DD` date[^.]*treated exactly like an absent one",
"a non-ISO stored deadline must be handled as absent, not compared or guessed at",
)
def test_step2_schema_includes_language_gate_fields(self):
sections = _sections(COMMAND.read_text(encoding="utf-8"))
step2 = sections.get("Step 2: Batch-Fetch and Score", "")