Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Added

- **`crates/tinyflows-schedule`** — the schedule model (`Schedule`,
`ActiveHours`, the job/run records) and its pure logic: cron-expression
normalisation, time-zone and active-window aware next-run computation,
validation and the minimum-cadence check. Extracted from OpenHuman's `cron`
domain; the serde shapes are byte-identical and pinned by literal-JSON
fixtures. No runtime, store or config.
- **`tinyflows_catalog::graph_hash::compute_graph_hash`** — the content pin over
a graph plus its `require_approval` flag that a parked run records and a
resume re-checks. Extracted from OpenHuman; the digest is byte-identical to
Expand Down
1 change: 1 addition & 0 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ uses, so a reader who knows one knows them all.
| `crates/tinyflows-sqlite` | SQLite implementations of the catalog and of the engine's checkpoint store, plus the JSON draft store. Every entry point takes a directory, never a host config type. |
| `crates/tinyflows-copilot` | The authoring copilot's *words*: the `workflow_builder` / `flow_discovery` standing archetypes, and the turn brief that opens a builder turn. Names no tool trait, no agent registry, no model client. |
| `crates/tinyflows-adaptive` | The adaptive loop over the engine: select or author a workflow, run it, judge it, learn. |
| `crates/tinyflows-schedule` | Schedule model and pure next-run logic (cron / interval / one-shot, time zones, active hours, cadence floor). No runtime, store or config. |

**Where a new thing goes.** Ask what it depends on, not what it is about. If it
needs storage, it is not `tinyflows-catalog`. If it needs a tool trait or a model
Expand Down
74 changes: 74 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

28 changes: 28 additions & 0 deletions crates/tinyflows-schedule/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Pure scheduling logic for timed jobs: the `Schedule` / `ActiveHours` model
# (with its persisted wire shape), cron-expression normalisation, time-zone and
# active-window aware next-run computation, and the minimum-cadence check.
#
# Deliberately no scheduler runtime, store, clock or config here: a host owns
# when to poll, where jobs are kept and what a run does. This crate only
# answers "given this schedule and this instant, when next?".
[package]
name = "tinyflows-schedule"
version = "0.1.0"
description = "Cron/interval/one-shot schedule model and next-run computation for tinyflows hosts"
edition.workspace = true
rust-version.workspace = true
license.workspace = true
repository.workspace = true
homepage.workspace = true
readme = "../../README.md"

[dependencies]
serde = { workspace = true }
chrono = { workspace = true }
anyhow = "1.0"
cron = "0.12"
chrono-tz = "0.10"
tracing = { workspace = true }

[dev-dependencies]
serde_json = { workspace = true }
24 changes: 24 additions & 0 deletions crates/tinyflows-schedule/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
//! Scheduling model and next-run computation for timed jobs.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

priority medium e2e confident

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 ·

//!
//! * [`types`] — [`Schedule`], [`ActiveHours`] and the job/run records a host
//! persists. Their serde shapes are a wire contract (a host's job store and
//! RPC surface carry them), pinned by `wire_tests`.
//! * [`schedule`] — next-run computation, validation, cron-expression
//! normalisation and the minimum-cadence check.
//!
//! No runtime, storage or configuration lives here; a host supplies those.

pub mod schedule;
pub mod types;

pub use schedule::{
MIN_AGENT_JOB_INTERVAL, TooFrequent, next_run_for_schedule, normalize_expression,
runs_closer_than, schedule_cron_expression, validate_agent_schedule, validate_schedule,
};
pub use types::{
ActiveHours, CronJob, CronJobPatch, CronRun, DeliveryConfig, JobType, Schedule, SessionTarget,
};

#[cfg(test)]
#[path = "wire_tests.rs"]
mod wire_tests;
Loading
Loading