Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Dec 16, 2025

Implementation Complete: "around" Constraint in Fuzzy Scheduling

✅ All implementation tasks completed successfully!

  • Add parser support for "daily around HH:MM" syntax
    • Extend parseBase() in schedule_parser.go to recognize "around" keyword
    • Create FUZZY:DAILY_AROUND:HH:MM format for around constraints
    • Reuse existing parseTime() parser for UTC and am/pm support
  • Implement scattering algorithm for "around" constraint
    • Extend ScatterSchedule() to handle FUZZY:DAILY_AROUND pattern
    • Use deterministic hash-based scattering with bounded window around target time
    • Avoid quadratic algorithms (use simple hash modulo)
    • Window size set to ±1 hour (120 minutes total)
  • Add tests for around constraint
    • Add parser tests for "daily around HH:MM" syntax
    • Add scattering tests for around constraint
    • Test edge cases (midnight, boundaries)
    • Add tests for UTC offsets with around constraint
    • Add tests for am/pm format with around constraint
    • Updated test assertions for ±1 hour window
    • Add comprehensive fuzz test coverage (20+ valid patterns, 12+ invalid patterns)
  • Update documentation
    • Add "around" syntax to triggers.md
    • Add examples of around constraint usage
    • Document UTC and am/pm support
    • Updated all examples to reflect ±1 hour window
  • Run validation and tests
    • Run parser unit tests (all pass ✅)
    • Run workflow tests (all pass ✅)
    • Run fuzz tests (134k+ executions, no crashes ✅)
    • Manually test compilation (works correctly ✅)
    • Format and lint code (all pass ✅)

Implementation Summary:

  • Added support for daily around HH:MM syntax (e.g., daily around 14:00, daily around 9am)
  • Reuses existing parseTime() function to automatically support:
    • UTC time offsets (e.g., utc+9, utc-5, utc+05:30)
    • am/pm format (e.g., 3pm, 11am)
    • Named times (midnight, noon)
    • 24-hour format (HH:MM)
  • Scatters execution time within ±1 hour window of target time
  • Uses O(1) hash-based algorithm (no quadratic complexity)
  • Maintains deterministic behavior (same workflow → same scattered time)
  • Handles edge cases like midnight and time boundaries correctly
  • Comprehensive fuzz testing with 20+ valid and 12+ invalid seed patterns
  • Documentation updated with examples and usage guidance

Example Usage:

on:
  schedule: daily around 14:00          # Scatters between 13:00-15:00
  schedule: daily around 3pm utc-5      # Scatters around 8 PM UTC (3 PM EST)
  schedule: daily around 9am utc+05:30  # Scatters around 3:30 AM UTC (9 AM IST)

The implementation is complete, tested, and ready for review.

Original prompt

Extend the fuzzy scheduling schedule syntax with "around" constraints

schedule: daily around <time>

which hints the scheduler to use a time close to the requested time.

This is not a hard constraint and the sub-optimal solution is allowed. Watch out for quadratic algorithms.


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
@pelikhan
Copy link
Contributor

@copilot support utc Time , am/pm. Reuse existing parser.

Copilot AI and others added 2 commits December 16, 2025 21:36
Implement parser support and scattering algorithm for "daily around HH:MM" syntax.
Uses deterministic hash-based scattering within ±2 hour window around target time.

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
All tests pass, code is formatted and linted. Implementation complete.

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title [WIP] Extend fuzzy scheduling with around constraints Add "around" constraint for fuzzy schedule syntax Dec 16, 2025
Copilot AI requested a review from pelikhan December 16, 2025 21:46
@pelikhan
Copy link
Contributor

@copilot make +- 1 h

…straint

The implementation already supports UTC offsets and am/pm format by reusing the existing parseTime function. Added explicit test coverage and documentation.

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Dec 16, 2025

@copilot support utc Time , am/pm. Reuse existing parser.

Done in commit 6180fe4. The implementation already supported UTC offsets and am/pm format by reusing the existing parseTime() function. Added explicit test coverage and documentation to make this clear.

Supported formats:

  • daily around 3pm (am/pm)
  • daily around 14:00 utc+9 (UTC offset)
  • daily around 3pm utc-5 (both combined)
  • daily around 9am utc+05:30 (UTC with HH:MM format)

@pelikhan pelikhan marked this pull request as ready for review December 16, 2025 21:56
@pelikhan
Copy link
Contributor

@copilot update/add fuzz tests for the new format

Updated window size to 120 minutes (±1 hour) as requested. This provides tighter time constraints while still distributing load.

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Dec 16, 2025

@copilot make +- 1 h

Done in commit 62269ee. Changed scattering window from ±2 hours to ±1 hour (120 minutes total window).

Example: daily around 14:00 now scatters between 13:00-15:00 instead of 12:00-16:00.

Added seed corpus with valid and invalid "around" schedule patterns including UTC offsets and am/pm formats. Enhanced fuzz test validation to properly handle FUZZY:DAILY_AROUND format.

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Dec 16, 2025

@copilot update/add fuzz tests for the new format

Done in commit 16b132e. Added comprehensive fuzz test coverage including:

Valid patterns (20+ seeds):

  • daily around 14:00, daily around midnight, daily around noon
  • daily around 3pm, daily around 9am (am/pm format)
  • daily around 14:00 utc+9, daily around 3pm utc-5 (UTC offsets)
  • Various combinations of time formats and UTC offsets

Invalid patterns (12+ seeds):

  • daily around (missing time)
  • daily around 25:00, daily around 12:60 (invalid times)
  • weekly around monday, monthly around 15 (wrong schedule type)
  • hourly around 12:00 (unsupported)

Enhanced validation to properly handle FUZZY:DAILY_AROUND:HH:MM format. Fuzz test ran 134k+ executions without finding crashes or panics.

@pelikhan pelikhan merged commit f2187dc into main Dec 16, 2025
6 checks passed
@pelikhan pelikhan deleted the copilot/extend-fuzzy-scheduling-syntax branch December 16, 2025 22:23
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.

2 participants