Add JSON-first CLI companion binary and DB CRUD helpers (solverforge-calendar-cli)#1
Add JSON-first CLI companion binary and DB CRUD helpers (solverforge-calendar-cli)#1blackopsrepl wants to merge 2 commits intomainfrom
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c6daa00b07
ℹ️ 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".
src/bin/solverforge-calendar-cli.rs
Outdated
| require_resource(db::get_event(conn, from_event_id)?, "event", from_event_id) | ||
| .context("from-event-id must reference an existing non-deleted event")?; | ||
| require_resource(db::get_event(conn, to_event_id)?, "event", to_event_id) | ||
| .context("to-event-id must reference an existing non-deleted event")?; |
There was a problem hiding this comment.
Reject cycle-forming dependency edges
validate_dependency only verifies that both event IDs exist and are distinct, so dependencies create/update can persist cycles (for example, creating A -> B and then B -> A). The scheduler DAG builder explicitly skips cycle-forming edges, so persisted dependencies can diverge from runtime dependency behavior and produce inconsistent results for users and automation. Add cycle detection against existing blocks edges before insert/update.
Useful? React with 👍 / 👎.
src/bin/solverforge-calendar-cli.rs
Outdated
| Some(next) if !next.starts_with("--") => iter.next(), | ||
| _ => None, | ||
| }; | ||
| flags.insert(key, value); |
There was a problem hiding this comment.
Reject unknown flags instead of silently accepting them
The parser accepts any --<key> and stores it, but resource handlers only read known keys and never fail on extras. That means typoed optional flags (for example --reminder-minute instead of --reminder-minutes) are silently ignored while the command still returns success JSON, which can corrupt automation workflows by hiding failed intent. Unknown flags should be validated per action and surfaced as errors.
Useful? React with 👍 / 👎.
Motivation
Description
src/bin/solverforge-calendar-cli.rsimplementing a JSON-first CLI that supportscalendars,projects,events,dependencies, andgoogle syncwithlist|get|create|update|deleteactions, flag parsing, validation, and pretty JSON output.src/db.rswith multiple helper functions includingload_events,get_calendar,insert/update/soft_deletefor calendars and projects,get_event,get_dependency,insert/update/deletefor dependencies,now_timestamp, and wiring for event-range queries and single-row fetches.google::sync::sync_calendar.README.mdto document the new CLI usage, examples and supported CRUD groups, and add a short note about the JSON-first semantics for automation.Testing
cargo build --binswhich completed successfully.cargo testwhich completed successfully (no failing tests reported).solverforge-calendar-cli help) to verify usage output and JSON formatting logic was reachable.Codex Task