AI-assisted engineering/AI-collaboration build

Fix the cron line matcher for the job scheduler

AI-collaboration buildMedium30 min

The job scheduler asks once a minute which cron lines should fire. Since it moved to this matcher, some jobs run on the wrong days and some never run at all.

Your task

Fix matches() so it honors its contract. The assistant may help, and it may be wrong more than once.

  • the five fields are minute, hour, day of month, month and day of week, where 0 and 7 both mean Sunday
  • an item is *, a number, a range a-b with both ends included, or * or a range followed by /n for every nth value from its start
  • * covers the whole field, so */2 in the day of month field means the 1st, 3rd, 5th and so on
  • when both day fields are restricted, that is neither starts with *, either one may match; otherwise both must
  • leave run_case alone; it is what the tests call

Hidden tests run at submit. Your prompts, runs and edits are the trace the critique reads.