feat(schedule): tinyflows-schedule crate (schedule model + next-run logic) - #98
Conversation
Fixed a bug where the schedule gap detection logic incorrectly identified overlapping time windows as gaps. The issue occurred when adjacent windows shared a boundary time, causing the gap checker to treat them as non-contiguous. This change ensures that windows with matching start and end times are properly recognized as overlapping rather than gapped. Auto-committed-on: dragonfly Co-authored-by: Medulla <medulla@tinyhumans.ai>
Introduce a new `tinyflows-schedule` crate that provides cron expression parsing and timezone-aware scheduling, replacing the previous gate-based test infrastructure. The old gate tests have been removed as the scheduling logic has been reimplemented using the `cron` and `chrono-tz` crates, which offer more robust and standard-compliant time handling. The schedule tests have been updated to accommodate the new implementation's error message formatting. Auto-committed-on: dragonfly Co-authored-by: Medulla <medulla@tinyhumans.ai>
Co-authored-by: Medulla <medulla@tinyhumans.ai>
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Advanced Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Comment |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 5aca914b93
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Tiny Sweeper reviewTiny Sweeper reviewed this change across 6 lane(s) and found 1 active actionable finding(s). Detailed lane evidence and any incomplete work are listed below. State: Incomplete Review snapshot
Completeness: Incomplete What changedThe review could not produce a supported behavioral summary; inspect the cited changed surface and lane details below. FeaturesNone identified with supported citations. TestsNo supported feature-to-test mapping was produced. Test execution is not inferred. Findings
Previously reported and still active
Could not review: CHANGELOG.md, CLAUDE.md, crates/tinyflows-schedule/Cargo.toml, crates/tinyflows-schedule/src/lib.rs, crates/tinyflows-schedule/src/schedule.rs, crates/tinyflows-schedule/src/schedule_gap_tests.rs, crates/tinyflows-schedule/src/schedule_tests.rs, crates/tinyflows-schedule/src/types.rs, crates/tinyflows-schedule/src/types_tests.rs, crates/tinyflows-schedule/src/wire_tests.rs Before merge
Agent review detailscritique
security
tests
commits
description
e2e
Evidence and run details
|
Add validation in `validate_schedule` to reject `Every` intervals whose conversion to milliseconds would overflow or fail to advance the clock, matching the same arithmetic used when computing the next run. This prevents persisted schedules from becoming stuck. Also add `skip_serializing_if` to `CronJobPatch::agent_id` so absent fields are omitted from JSON output while explicitly cleared fields remain as `null`. Auto-committed-on: dragonfly Co-authored-by: Medulla <medulla@tinyhumans.ai>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 00d292275f
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
The `ACTIVE_WINDOW_CANDIDATE_LIMIT` and `RUN_GAP_SCAN_OCCURRENCES` constants were too low to reliably detect one-minute gaps caused by annual daylight saving time transitions. A full leap year at the minimum five-minute cadence produces up to 105,408 runs, so the scan limit is raised to 105,500 and the active window candidate limit is increased to 600,000 to ensure the gap detection works regardless of where the scan starts. A new test verifies that the scan finds the spring-forward gap across a full year. Auto-committed-on: dragonfly Co-authored-by: Medulla <medulla@tinyhumans.ai>
There was a problem hiding this comment.
tinysweeper found nothing blocking, but could not review everything, so this is not an approval: CHANGELOG.md, CLAUDE.md, crates/tinyflows-schedule/Cargo.toml, crates/tinyflows-schedule/src/lib.rs, crates/tinyflows-schedule/src/schedule.rs, crates/tinyflows-schedule/src/schedule_gap_tests.rs, crates/tinyflows-schedule/src/schedule_tests.rs, crates/tinyflows-schedule/src/types.rs and 2 more.
$0.0123 · 151,611 in / 11,933 out · 5,888 cached (4%) · ladder/vectors, deepseek/deepseek-v4-flash · 1,146 embedded
tests: $0.0032 · 34,035 in / 2,260 out · 3,072 cached (9%) · deepseek/deepseek-v4-flash
description: $0.0024 · 25,480 in / 1,259 out · 2,304 cached (9%) · deepseek/deepseek-v4-flash
e2e: $0.0035 · 37,974 in / 624 out · 0 cached (0%) · deepseek/deepseek-v4-flash
There was a problem hiding this comment.
tinysweeper found nothing blocking, but could not review everything, so this is not an approval: CHANGELOG.md, CLAUDE.md, crates/tinyflows-schedule/Cargo.toml, crates/tinyflows-schedule/src/lib.rs, crates/tinyflows-schedule/src/schedule.rs, crates/tinyflows-schedule/src/schedule_gap_tests.rs, crates/tinyflows-schedule/src/schedule_tests.rs, crates/tinyflows-schedule/src/types.rs and 2 more.
$0.0098 · 125,903 in / 8,564 out · 32,437 cached (26%) · ladder/vectors, deepseek/deepseek-v4-flash · 1,146 embedded
tests: $0.0002 · 34,357 in / 131 out · 30,389 cached (88%) · deepseek/deepseek-v4-flash
description: $0.0030 · 25,782 in / 3,500 out · 0 cached (0%) · deepseek/deepseek-v4-flash
e2e: $0.0037 · 38,276 in / 2,017 out · 1,536 cached (4%) · deepseek/deepseek-v4-flash
| @@ -0,0 +1,24 @@ | |||
| //! Scheduling model and next-run computation for timed jobs. | |||
There was a problem hiding this comment.
Add #![forbid(unsafe\_code)] and #![warn(missing\_docs)] to the new crate root
The repository coding rules (from untrusted-repo-rules) require #![forbid(unsafe_code)] and #![warn(missing_docs)] on every crate root. The new tinyflows-schedule crate is missing both. Without #![forbid(unsafe_code)] the crate could inadvertently introduce unsafe code without a compile-time guard, and without #![warn(missing_docs)] public items will silently lack documentation. Add both attributes at the top of crates/tinyflows-schedule/src/lib.rs, after the doc comment and before any module declarations.
[RULE] missing-crate-attributes ·
Stacked on #97 (
oh-extract-flows-voice, itself stacked on #96move-openhuman-flow-logic); retarget tomainonce those land.Extracted from OpenHuman's
crondomain: a newcrates/tinyflows-schedulecrate holding only pure scheduling logic.types:Schedule,ActiveHours,DeliveryConfig,JobType,SessionTarget,CronJob,CronRun,CronJobPatch.schedule: cron-expression normalisation, time-zone and active-window awarenext_run_for_schedule,validate_schedule,runs_closer_than/validate_agent_schedule(cadence floor).Serde shapes are unchanged (they are persisted in the host job store and cross RPC);
wire_tests.rspins them with literal JSON, including the bare-stringScheduleshorthand and theagent_iddouble-option patch semantics.Not moved (stays in OpenHuman): the scheduler runtime, store, ops, RPC, and the scheduler gate (its
Policy/config types live in tinymemory-api and its signal sampler is host probing).Verification:
cargo fmt --check,cargo clippy --all-targets -- -D warnings,cargo test -p tinyflows-schedule(62 tests).