Skip to content

fix(cron): accept bare cron-expression string in Schedule deserializer (Sentry CORE-RUST-FY)#2874

Merged
M3gA-Mind merged 2 commits into
tinyhumansai:mainfrom
M3gA-Mind:fix/cron-update-bare-schedule-string
May 28, 2026
Merged

fix(cron): accept bare cron-expression string in Schedule deserializer (Sentry CORE-RUST-FY)#2874
M3gA-Mind merged 2 commits into
tinyhumansai:mainfrom
M3gA-Mind:fix/cron-update-bare-schedule-string

Conversation

@M3gA-Mind
Copy link
Copy Markdown
Contributor

Summary

Rebased version of #2868 by @graycyrus on the latest upstream/main.

The original PR's branch included a cherry-picked observability commit (fix(observability): classify Embedding API 401 Invalid-token as SessionExpired) that was independently merged to main as PR #2869. This caused a merge conflict (mergeable_state: dirty) that blocked CI from running.

This PR contains only the two cron-fix commits from #2868, cleanly applied on top of current main:

  1. fix(cron): accept bare cron-expression string in Schedule deserializer
  2. style(cron): apply cargo fmt to Schedule deserializer

No functional changes from #2868. The fix and tests are identical.


Root cause (Sentry CORE-RUST-FY / #2866): openhuman.cron_update deserializes schedule as an internally-tagged Schedule enum. Agents and some frontend callers send a bare string like "0 9 * * 1" instead of {"kind":"cron","expr":"0 9 * * 1"}. Serde rejected this with: invalid type: string, expected internally tagged enum Schedule.

Fix: Custom Deserialize impl for Schedule in src/openhuman/cron/types.rs. A bare string → Schedule::Cron { expr, tz: None, active_hours: None }. The full object form is handled by visit_map delegating to an inner #[derive(Deserialize)] tagged enum via MapAccessDeserializer. Serialization unchanged.

Tests: 4 unit tests — bare string, 5-field */5, CronJobPatch with bare string (exact failing payload), regression guard for the structured object form.

Closes #2868.

Test plan

  • cargo test --lib openhuman::cron::types — all 20 pass
  • cargo check — clean
  • Diff coverage ≥ 80% — all new branches exercised by the 4 tests

graycyrus and others added 2 commits May 29, 2026 03:30
Fixes Sentry issue CORE-RUST-FY (closes tinyhumansai#2866).

The `openhuman.cron_update` RPC deserializes the `schedule` field as an
internally-tagged `Schedule` enum.  Agents and some frontend callers were
sending a bare string like `"0 9 * * 1"` instead of the structured object
`{"kind":"cron","expr":"0 9 * * 1"}`, causing serde to reject with:
  "invalid type: string, expected internally tagged enum Schedule"

Fix: add a custom `Deserialize` impl for `Schedule` that routes a bare
string to `Schedule::Cron { expr, tz: None, active_hours: None }`, while
still delegating the full object form to the existing tagged-enum logic.
Serialization is unchanged (always emits the object form).

New tests:
- `schedule_deserializes_bare_cron_string`
- `schedule_deserializes_bare_5_field_cron_string`
- `cron_job_patch_accepts_bare_schedule_string` (the exact failing shape)
- `cron_job_patch_still_accepts_structured_schedule_object` (regression)
@M3gA-Mind M3gA-Mind requested a review from a team May 28, 2026 22:00
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 28, 2026

Warning

Review limit reached

@M3gA-Mind, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 13 minutes and 13 seconds. Learn how PR review limits work.

Your organization has run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: b7c80f2c-66d7-4ba4-9f73-83ff2aa6759c

📥 Commits

Reviewing files that changed from the base of the PR and between 94f8e4e and d92a7bd.

📒 Files selected for processing (1)
  • src/openhuman/cron/types.rs

Comment @coderabbitai help to get the list of available commands and usage tips.

@M3gA-Mind M3gA-Mind merged commit 3833f97 into tinyhumansai:main May 28, 2026
28 checks passed
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