Skip to content

JobSchedule.Cron uses a raw String; Every accepts non-positive durations #34

Description

@sideeffffect

Severity: low · Category: design / type-safety

Evidence

  • src/Models.scala:218case Cron(expression: String); :221case Every(period: FiniteDuration). Consumed unvalidated at src/internal/JobsCapabilityImpl.scala:66 (JJobSchedule.fromString(expr)).

Problem
The cron expression is the one payload-ish value not given the opaque-type / parse-don't-validate treatment used for every other domain string in the library; a blank or malformed expression (or a zero/negative Every period) is only caught downstream by the sidecar.

Suggested fix
Introduce a CronExpr opaque type (non-empty at minimum, ideally a light 6-field shape check) used by Cron; optionally require Every's period to be strictly positive (matching DaprDuration's non-negativity guard).

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestlowLow importance

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions