fix: handle "every day [at HH:MM]" in ParseSchedule and fix testifylint warning#28929
Merged
fix: handle "every day [at HH:MM]" in ParseSchedule and fix testifylint warning#28929
Conversation
…nt warning Agent-Logs-Url: https://github.com/github/gh-aw/sessions/4b5c36c0-f14f-4a41-9c45-ff879964d705 Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix workflow failure on main - Run #1783
fix: handle "every day [at HH:MM]" in ParseSchedule and fix testifylint warning
Apr 28, 2026
Collaborator
|
@copilot add more tests |
Agent-Logs-Url: https://github.com/github/gh-aw/sessions/86921a24-21cb-49f3-9f94-145cbf6249e1 Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Contributor
Author
Added 10 new test cases in |
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes CI failures by adding explicit support for natural-language "every day [at TIME]" schedules in ParseSchedule, and updates a test assertion to satisfy testifylint.
Changes:
- Add
parseInterval()handling for"every day","every day on weekdays", and"every day at <time>". - Update
spec_test.goto useassert.Emptyinstead ofassert.Equal(..., ""). - Add targeted unit tests and fuzz corpus seeds for the new
"every day"patterns.
Show a summary per file
| File | Description |
|---|---|
| pkg/parser/schedule_parser.go | Adds "every day" parsing branch to prevent falling through to Atoi("day") and to generate the intended cron/fuzzy outputs. |
| pkg/parser/spec_test.go | Adjusts assertion style to satisfy testifylint. |
| pkg/parser/schedule_parser_test.go | Adds coverage for "every day" / "every day at TIME" variants and an invalid-format case. |
| pkg/parser/schedule_parser_fuzz_test.go | Seeds fuzz corpus with new "every day" inputs. |
Copilot's findings
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 4/4 changed files
- Comments generated: 2
Comment on lines
+203
to
+212
| // tokens[2] == "at": "every day at HH:MM" — token layout is [every, day, at, time...] | ||
| if len(p.tokens) > 2 && p.tokens[2] == "at" { | ||
| // extractTime handles the "at" keyword at index 2 and reads the time token(s) after it | ||
| timeStr, err := p.extractTime(2) | ||
| if err != nil { | ||
| return "", err | ||
| } | ||
| min, hr := parseTime(timeStr) | ||
| return fmt.Sprintf("%s %s * * *", min, hr), nil | ||
| } |
| min, hr := parseTime(timeStr) | ||
| return fmt.Sprintf("%s %s * * *", min, hr), nil | ||
| } | ||
| return "", errors.New("invalid 'every day' format, use 'every day' or 'every day at HH:MM'") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Two CI failures in the
testandlint-gojobs on main.Changes
pkg/parser/schedule_parser.go—parseInterval()had no handling fortokens[1] == "day"/"days", causing"every day at 9am"to fall through tostrconv.Atoi("day")and returninvalid interval 'day', must be a positive integer. Added an explicit branch:"every day"→FUZZY:DAILY * * *"every day on weekdays"→FUZZY:DAILY_WEEKDAYS * * *"every day at <time>"→ fixed cron, e.g."every day at 9am"→0 9 * * *pkg/parser/spec_test.go:548— replacedassert.Equal(t, "", err.Error(), ...)withassert.Empty(t, err.Error(), ...)to satisfytestifylint.pkg/parser/schedule_parser_test.go— added 10 test cases covering allevery day [at TIME]variants: fuzzy (every day), plural alias (every days), weekdays restriction (every day on weekdays), fixed-time forms (every day at 9am,09:00,14:30,midnight,noon,6pm), and an invalid-extra-token error case.pkg/parser/schedule_parser_fuzz_test.go— added fuzz corpus entries for the newevery daypatterns.