Conversation
|
Still have one more update to resolve a failing test due to word boundary issue in regex. Everything else is there to proceed with the code review. |
|
Will you take a look at the changes in #260? Would this serve your purposes? It would be a significantly simpler surface to maintain, because it uses existing APScheduler capabilities within the already built cron format. |
|
I have been on vacation with the family for this week and been meaning to respond to your query. I will be on vacation for the rest of the week, but I will try to respond with a few thoughts in the next day or two. |
|
Well I have looked over your There are a few things that you don't support such as months of the year and the last day of the month. Both of which can be added and supported. But that still leaves the fact of trying to encode everything in the cron format and I just think that is just a bad idea over the long run. In addition, if you notice I have extended OK, I am not trying to nit-pick here and want to be objective. So I had Claude look at both branches with the following prompt:
Here is the response that I received back: ⏺ Based on my analysis of both branches, here's my evaluation: Recommendation: origin/feat/flexible-schedule (your branch) is better Key Differences origin/feat/flexible-schedule (your branch):
upstream/feat/flexible-scheduling:
Code Quality Assessment origin/feat/flexible-schedule wins on:
upstream/feat/flexible-scheduling has:
Verdict For code quality and maintainability, origin/feat/flexible-schedule is significantly superior due to comprehensive testing and documentation. The upstream branch introduces a useful date bounds feature but lacks the quality infrastructure (tests, docs) needed for long-term maintenance. Now, Claude did miss the fact that my branch does support the start and end date functionality. I figure because it was slightly obscured with the regex. One final thought concerning trying to force the flexible cron format into the crontab format. It limits and greatly complicates any future features that |
Standard 5-field cron cannot express schedules like "the 4th Tuesday of every month" or "the last Friday" — patterns that come up constantly for ARES nets and other recurring meetings. Users were stuck hand-rolling day-of-month lists that drift across months with different lengths. Adds a flexible cron format: unordered fields with suffixes (9h, 30m, 15d, 3w for ISO week) plus month/day-of-week names, ordinal prefixes (1st/2nd/3rd/4th/5th/last), and optional start:/end: date bounds. The web viewer gets a new "Flexible (cron)" mode alongside the existing Advanced (cron) editor, and the edit modal now auto-detects which mode a stored schedule belongs to instead of always defaulting to Advanced. Storing a flexible-cron key verbatim in config.ini breaks the moment it contains an HH:MM time, since ":" is the INI key/value separator (the key becomes unparsable, e.g. "4th tue 14:00 jan-oct = Volusia ARES:..."). Fixed by encoding ":" as "!" in the schedule key when writing (encode_schedule_key_for_ini) and decoding it back on every read path: the web admin's read_entries() and the bot's own setup_scheduled_messages(). HHMM (no colon) needs no encoding. Also tightens the standard cron path to validate against a real regex (cron_re) before handing off to CronTrigger.from_crontab, and threads a specific error message back through ScheduleParseResult instead of a generic "not a valid schedule" string. Adds unit coverage for the new parse_flexible_cron/encode/decode helpers and a scheduler-level regression test that reproduces the HH!MM round-trip end to end. Adds docs/schedule-messages.md documenting all three schedule formats (simplified UI modes, standard cron, flexible cron) and how they're represented in config.ini. Known gap: */Nm and */Nh step syntax in flexible cron doesn't match when preceded by another field (e.g. "last sat 9h */15m") because \b can't anchor on "*" — two admin tests are marked accordingly and left for a follow-up. Signed-off-by: Gerard Hickey <hickey@kinetic-compute.com>
Signed-off-by: Gerard Hickey <hickey@kinetic-compute.com>
Signed-off-by: Gerard Hickey <hickey@kinetic-compute.com>
0aa43da to
c46d6ab
Compare
Signed-off-by: Gerard Hickey <hickey@kinetic-compute.com>
0e478f3 to
d8c1973
Compare
|
Thought that there was a easy to trip over case where minutes do not get specified and cron would trigger every minute causing the network to be overwhelmed with messages. After pushing a fix, found that In other words, if "9h" is specified, |
What this changes
Adds a flexible cron format: unordered fields with suffixes (9h, 30m, 15d, 3w for ISO week) plus month/day-of-week names, ordinal prefixes (1st/2nd/3rd/4th/5th/last), and optional start:/end: date bounds. The web viewer gets a new "Flexible (cron)" mode alongside the existing Advanced (cron) editor, and the edit modal now auto-detects which mode a stored schedule belongs to instead of always defaulting to Advanced. In addition, the month/day-of-week names can be used in regular cron entries and is suggested to avoid confusion.
Why
Standard 5-field cron cannot express schedules like "the 4th Tuesday of every month" or "the last Friday" — patterns that come up constantly for nets and other recurring meetings. Users were stuck hand-rolling day-of-month lists that drift across months with different lengths.
Testing
Added unit tests for the flexible schedule code. Running live on my
meshcore-botinstance.Checklist
devand targetingdevmake testpassesmake lintpasses (ruff + mypy)npm run lint:frontend)CHANGELOG.mdupdated under## [Unreleased]if user-visibleconfig.ini.example(and the minimal/quickstarttemplates where relevant) — CI validates these with
validate_config.py --strictnav:inmkdocs.ymlAny new command justifies its airtime and defaults conservatively