Skip to content

bug(scheduler): _normalize_dow_field does not handle range-step tokens like '1-7/2' — day 7 never normalized to 0 #4944

@mrveiss

Description

@mrveiss

Bug

_normalize_dow_field in trigger_service.py (added by #4918) correctly handles scalars (7→0) and pure ranges (1-7→1-6,0) but does not handle range-step tokens like 1-7/2.

The regex r'(\d+)-(\d+)' does not match 1-7/2 (because of the /2 suffix). The token falls through to the scalar branch, which returns 1-7/2 unchanged. When _parse_cron_field processes 1-7/2, it produces {1, 3, 5, 7} — the 7 is never mapped to Sunday (0), so the cron expression fires on an unrecognized day.

Reproducer

_normalize_dow_field('1-7/2')  # returns '1-7/2' unchanged — should return '1-6/2,0' or equivalent

Fix

Extend _replace_token to match the pattern r'(\d+)-(\d+)/(\d+)' and replace hi=7 with 6 in the range portion, then add ,0 to include Sunday.

File

autobot-backend/services/trigger_service.py_normalize_dow_field / _replace_token

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions