Skip to content

fix: handle "every day [at HH:MM]" in ParseSchedule and fix testifylint warning#28929

Merged
pelikhan merged 3 commits intomainfrom
copilot/fix-workflow-failure-main-1783
Apr 28, 2026
Merged

fix: handle "every day [at HH:MM]" in ParseSchedule and fix testifylint warning#28929
pelikhan merged 3 commits intomainfrom
copilot/fix-workflow-failure-main-1783

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 28, 2026

Two CI failures in the test and lint-go jobs on main.

Changes

  • pkg/parser/schedule_parser.goparseInterval() had no handling for tokens[1] == "day"/"days", causing "every day at 9am" to fall through to strconv.Atoi("day") and return invalid 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 — replaced assert.Equal(t, "", err.Error(), ...) with assert.Empty(t, err.Error(), ...) to satisfy testifylint.

  • pkg/parser/schedule_parser_test.go — added 10 test cases covering all every 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 new every day patterns.

Copilot AI linked an issue Apr 28, 2026 that may be closed by this pull request
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
Copilot AI requested a review from pelikhan April 28, 2026 12:15
@github-actions github-actions Bot mentioned this pull request Apr 28, 2026
@pelikhan
Copy link
Copy Markdown
Collaborator

@copilot add more tests

Copy link
Copy Markdown
Contributor Author

Copilot AI commented Apr 28, 2026

@copilot add more tests

Added 10 new test cases in schedule_parser_test.go covering all every day [at TIME] variants (fuzzy, weekdays, fixed times like 9am, 09:00, 14:30, midnight, noon, 6pm, and an invalid-extra-token error case), plus fuzz corpus entries for the same patterns in schedule_parser_fuzz_test.go. Commit: f59795e

@pelikhan pelikhan marked this pull request as ready for review April 28, 2026 14:36
Copilot AI review requested due to automatic review settings April 28, 2026 14:36
@pelikhan pelikhan merged commit b6b4797 into main Apr 28, 2026
@pelikhan pelikhan deleted the copilot/fix-workflow-failure-main-1783 branch April 28, 2026 14:36
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.go to use assert.Empty instead of assert.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'")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[CGO] Workflow failure on main - Run #1783

3 participants