Skip to content

Add Cron.format for cron expression conversion - #7097

Merged
tim-smart merged 6 commits into
mainfrom
agent/codex-engineer/33c902ad
Aug 6, 2026
Merged

Add Cron.format for cron expression conversion#7097
tim-smart merged 6 commits into
mainfrom
agent/codex-engineer/33c902ad

Conversation

@tim-smart

@tim-smart tim-smart commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

Summary

  • add Cron.format with compact range and step syntax
  • omit the default zero-seconds field while retaining six fields for non-default seconds
  • support { includeSeconds: true } to force a six-field expression without changing default output
  • document that formatting drops timezone information and the days/weekdays and restriction
  • add focused coverage for compact arithmetic runs, unrestricted fields, and seconds handling
  • add an effect patch changeset

Testing

  • nix develop -c pnpm vitest run packages/effect/test/Cron.test.ts
  • nix develop -c pnpm --filter effect check
  • nix develop -c pnpm lint
  • nix develop -c pnpm doctest packages/effect/src/Cron.ts --run
  • nix develop -c pnpm changeset status --since origin/main

Closes EFF-534

@changeset-bot

changeset-bot Bot commented Aug 6, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: e77bc1d

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 30 packages
Name Type
effect Patch
@effect/ai-anthropic Patch
@effect/ai-openai Patch
@effect/ai-openai-compat Patch
@effect/ai-openrouter Patch
@effect/atom-react Patch
@effect/atom-solid Patch
@effect/atom-vue Patch
@effect/docgen Patch
@effect/doctest Patch
@effect/openapi-generator Patch
@effect/opentelemetry Patch
@effect/platform-browser Patch
@effect/platform-bun Patch
@effect/platform-deno Patch
@effect/platform-node Patch
@effect/platform-node-shared Patch
@effect/sql-clickhouse Patch
@effect/sql-d1 Patch
@effect/sql-libsql Patch
@effect/sql-mssql Patch
@effect/sql-mysql2 Patch
@effect/sql-pg Patch
@effect/sql-pglite Patch
@effect/sql-sqlite-bun Patch
@effect/sql-sqlite-do Patch
@effect/sql-sqlite-node Patch
@effect/sql-sqlite-react-native Patch
@effect/sql-sqlite-wasm Patch
@effect/vitest Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@effect-slopcop effect-slopcop Bot added 4.0 enhancement New feature or request labels Aug 6, 2026
Comment thread packages/effect/src/Cron.ts Outdated
Comment thread packages/effect/test/Cron.test.ts

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Important

This PR introduces a new public API (Cron.format) but does not include a changeset. Please add one before merging.

Reviewed changes

  • packages/effect/src/Cron.ts: Added Cron.format and a formatSegment helper; renamed the Formatter import to formatValue to avoid shadowing the new export.
  • packages/effect/test/Cron.test.ts: Added focused tests for compact ranges, non-uniform values, and default/non-default/unrestricted seconds.

⚠️ Missing changeset for new public API

The repository requires a changeset for exported API changes.

Technical details
# Missing changeset for Cron.format

## Affected sites
- `.changeset/` — no changeset file was added for the new `Cron.format` export

## Required outcome
- Add a changeset describing the new `Cron.format` API.

## Suggested approach
- Create `.changeset/<name>.md` with:
  ```md
  ---
  "effect": minor
  ---

  Add `Cron.format` for converting a `Cron` instance back to a cron expression.
  ```

Pullfrog  | ⚠️ this action is pinned to a commit SHA, which freezes the cleanup step — switch to @v0 or keep the SHA fresh with Dependabot | Fix all ➔Fix 👍s ➔View workflow run | Using Kimi K2 (free via Pullfrog for OSS) | 𝕏

Comment thread packages/effect/src/Cron.ts Outdated
Comment thread packages/effect/src/Cron.ts

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

✅ No new issues found.

The prior review feedback has been addressed: the changeset is now present and the Cron.format JSDoc uses the repository-standard **Gotchas** heading while documenting both dropped timezone information and the dropped days/weekdays and restriction.

Reviewed changes

  • Added an effect patch changeset describing the new Cron.format API in .changeset/warm-clocks-format.md.
  • Updated the Cron.format JSDoc to use **Gotchas** and to warn that formatting loses timezone information and the days/weekdays and restriction, so reparsing may not yield an equivalent schedule.

Pullfrog  | ⚠️ this action is pinned to a commit SHA, which freezes the cleanup step — switch to @v0 or keep the SHA fresh with Dependabot | View workflow run | Using Kimi K2 (free via Pullfrog for OSS) | 𝕏

Comment thread packages/effect/src/Cron.ts Outdated
Comment thread packages/effect/src/Cron.ts Outdated

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

✅ No new issues found.

The new includeSeconds option is cleanly integrated: the JSDoc **Details** section explains the default omission behavior, the implementation correctly respects the option, and the added test covers the new path.

Reviewed changes

  • Added an { includeSeconds?: boolean } option to Cron.format in packages/effect/src/Cron.ts, forcing a six-field expression when true while keeping the default five-field output for {0} seconds.
  • Documented the seconds-field behavior in the JSDoc **Details** section and updated the runnable example to show both call shapes.
  • Updated the changeset in .changeset/warm-clocks-format.md to mention the seconds option.
  • Added focused test coverage in packages/effect/test/Cron.test.ts for includeSeconds: true.

Pullfrog  | ⚠️ this action is pinned to a commit SHA, which freezes the cleanup step — switch to @v0 or keep the SHA fresh with Dependabot | View workflow run | Using Kimi K2 (free via Pullfrog for OSS) | 𝕏

@tim-smart
tim-smart enabled auto-merge (squash) August 6, 2026 23:28

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

✅ No new issues found.

Widening includeSeconds to boolean | undefined is a sensible follow-up that lets callers pass through optional values without narrowing, and the change is purely type-level.

Reviewed changes

  • Widened includeSeconds to boolean | undefined in packages/effect/src/Cron.ts so callers can explicitly pass undefined without a type error.

Pullfrog  | ⚠️ this action is pinned to a commit SHA, which freezes the cleanup step — switch to @v0 or keep the SHA fresh with Dependabot | View workflow run | Using Kimi K2 (free via Pullfrog for OSS) | 𝕏

@github-actions

github-actions Bot commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

Bundle Size Analysis

Generated from PR build output; treat the content below as untrusted.

File Name Current Size Previous Size Difference
basic.ts 6.92 KB 6.92 KB 0.00 KB (0.00%)
batching.ts 9.72 KB 9.72 KB 0.00 KB (0.00%)
brand.ts 6.60 KB 6.60 KB 0.00 KB (0.00%)
cache.ts 10.59 KB 10.59 KB 0.00 KB (0.00%)
config.ts 20.83 KB 20.83 KB 0.00 KB (0.00%)
differ.ts 19.67 KB 19.67 KB 0.00 KB (0.00%)
http-client.ts 21.50 KB 21.50 KB 0.00 KB (0.00%)
logger.ts 10.81 KB 10.81 KB 0.00 KB (0.00%)
metric.ts 8.86 KB 8.86 KB 0.00 KB (0.00%)
optic.ts 6.68 KB 6.68 KB 0.00 KB (0.00%)
pubsub.ts 14.86 KB 14.86 KB 0.00 KB (0.00%)
queue.ts 11.54 KB 11.54 KB 0.00 KB (0.00%)
schedule.ts 10.71 KB 10.71 KB 0.00 KB (0.00%)
schema-class.ts 19.38 KB 19.38 KB 0.00 KB (0.00%)
schema-fromJsonSchemaDocument.ts 29.20 KB 29.20 KB 0.00 KB (0.00%)
schema-representation-roundtrip.ts 25.51 KB 25.51 KB 0.00 KB (0.00%)
schema-string-transformation.ts 13.49 KB 13.49 KB 0.00 KB (0.00%)
schema-string.ts 11.03 KB 11.03 KB 0.00 KB (0.00%)
schema-template-literal.ts 15.30 KB 15.30 KB 0.00 KB (0.00%)
schema-toArbitraryLazy.ts 21.43 KB 21.43 KB 0.00 KB (0.00%)
schema-toCodeDocument.ts 23.87 KB 23.87 KB 0.00 KB (0.00%)
schema-toCodecJson.ts 18.64 KB 18.64 KB 0.00 KB (0.00%)
schema-toEquivalence.ts 18.47 KB 18.47 KB 0.00 KB (0.00%)
schema-toFormatter.ts 18.32 KB 18.32 KB 0.00 KB (0.00%)
schema-toJsonSchemaDocument.ts 22.09 KB 22.09 KB 0.00 KB (0.00%)
schema-toRepresentation.ts 19.01 KB 19.01 KB 0.00 KB (0.00%)
schema.ts 18.62 KB 18.62 KB 0.00 KB (0.00%)
stm.ts 12.59 KB 12.59 KB 0.00 KB (0.00%)
stream.ts 9.67 KB 9.67 KB 0.00 KB (0.00%)

@tim-smart
tim-smart merged commit 8525f05 into main Aug 6, 2026
19 checks passed
@tim-smart
tim-smart deleted the agent/codex-engineer/33c902ad branch August 6, 2026 23:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

4.0 enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant