Skip to content

Conversation

@aadamgough
Copy link
Contributor

Description

Custom cron expression wasn't working. Added cronExpression field in utils.ts and fixed formatting displayed to the user.

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)

How Has This Been Tested?

Verified custom cron expressions were setting properly by testing with: 0 0 1 */3 *, */15 * * * *, 0 0 1 1,7 *, and 0 0 1 2-12/2 *.

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have added tests that prove my fix is effective or that my feature works
  • All tests pass locally and in CI (bun run test)
  • My changes generate no new warnings
  • Any dependent changes have been merged and published in downstream modules
  • I have updated version numbers as needed (if needed)
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

Security Considerations:

  • My changes do not introduce any new security vulnerabilities
  • I have considered the security implications of my changes

@vercel
Copy link

vercel bot commented Jul 16, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
sim ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 16, 2025 2:59am
1 Skipped Deployment
Name Status Preview Comments Updated (UTC)
docs ⬜️ Skipped (Inspect) Jul 16, 2025 2:59am

@delve-auditor
Copy link

delve-auditor bot commented Jul 16, 2025

No security or compliance issues detected. Reviewed everything up to 15e4e04.

Security Overview
  • 🔎 Scanned files: 3 changed file(s)
Detected Code Changes
Change Type Relevant files
Enhancement ► route.ts
    Added cron expression validation
► utils.ts
    Implemented cron expression validation function
    Enhanced cron parsing functionality
► utils.test.ts
    Added tests for cron expression validation

Reply to this PR with @delve-auditor followed by a description of what change you want and we'll auto-submit a change to this PR to implement it.

@vercel vercel bot temporarily deployed to Preview – docs July 16, 2025 00:44 Inactive
@aadamgough aadamgough marked this pull request as ready for review July 16, 2025 00:47
Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

Greptile Summary

This PR fixes a bug in the scheduling system's handling of custom cron expressions. The key changes are:

  1. Added a cronExpression field to the scheduleValues object returned by getScheduleTimeValues
  2. Improved the custom cron expression handling in generateCronExpression by directly accessing the new field instead of using type casting
  3. Enhanced cron pattern parsing for better display formatting

The changes make the custom scheduling feature more robust by properly integrating cron expressions into the type system instead of relying on type assertions.

Confidence score: 4/5

  1. This PR is safe to merge as it improves type safety and includes comprehensive tests
  2. The score reflects strong test coverage and clear implementation, but complex cron patterns warrant some post-merge monitoring
  3. Files that need attention:
    • apps/sim/lib/schedules/utils.ts: Verify that all edge cases for custom cron expressions are handled
    • apps/sim/lib/schedules/utils.test.ts: Consider adding more complex cron pattern test cases

2 files reviewed, no comments
Edit PR Review Bot Settings | Greptile

@vercel vercel bot temporarily deployed to Preview – docs July 16, 2025 02:56 Inactive
@waleedlatif1 waleedlatif1 merged commit 19ca9c7 into staging Jul 16, 2025
6 checks passed
@waleedlatif1 waleedlatif1 deleted the fix/schedule branch July 16, 2025 03:42
arenadeveloper02 pushed a commit to arenadeveloper02/p2-sim that referenced this pull request Sep 19, 2025
* fix: added cronExpression field and fixed formatting

* fix: modified the test.ts file simstudioai#699

* added additional validation

---------

Co-authored-by: Adam Gough <adamgough@Mac.attlocal.net>
Co-authored-by: Waleed Latif <walif6@gmail.com>
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.

3 participants