mirror of
https://github.com/MadsLorentzen/ai-job-search.git
synced 2026-09-17 00:26:26 +00:00
fix(scrape): add a client-side recency fallback for flagless portals
Step 1b.3's "scope to 14 days using the portal's recency flag" was unsatisfiable on jobdanmark, which has no date filter or sort - the agent either silently skipped the scoping or invented a flag, and the CLIs now reject invented flags loudly. Every portal emits date, so the instruction now filters client-side after the call, and stops presenting --order (a sort) as interchangeable with a filter. Review finding F32 (2026-08-19). Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5
parent
2c3d2d8558
commit
9a69309749
@@ -78,5 +78,33 @@ class ScrapeProvenanceSpec(unittest.TestCase):
|
||||
)
|
||||
|
||||
|
||||
class TestRecencyFallback(unittest.TestCase):
|
||||
"""Step 1b.3 says to scope to the last 14 days via the portal's recency
|
||||
flag - but not every portal has one (jobdanmark offers no date filter or
|
||||
sort at all), which left the instruction unsatisfiable there: the agent
|
||||
either silently skipped the scoping or invented a flag, and inventing a
|
||||
flag is exactly what the UNKNOWN_FLAG rejection now errors on (review
|
||||
finding F32, 2026-08-19). Every portal emits a `date` field, so
|
||||
client-side filtering is always available as the fallback."""
|
||||
|
||||
def test_step1b_names_a_client_side_fallback_for_flagless_portals(self):
|
||||
text = SKILL.read_text(encoding="utf-8")
|
||||
self.assertIn(
|
||||
"no recency flag",
|
||||
text,
|
||||
"Step 1b.3 must say what to do when a portal offers no recency flag",
|
||||
)
|
||||
self.assertIn(
|
||||
"filter client-side",
|
||||
text,
|
||||
"the fallback is filtering results by their `date` field after the call",
|
||||
)
|
||||
self.assertIn(
|
||||
"a sort is not a filter",
|
||||
text,
|
||||
"the instruction must stop presenting --order (a sort) as interchangeable with a filter",
|
||||
)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
|
||||
Reference in New Issue
Block a user