[codex] Add timeout option helper#65
Merged
Merged
Conversation
Expose fx.timeoutOption as a timeout-as-value helper over Effect.timeoutOption. Add runtime coverage for fast and slow task behavior, type-level coverage for result/error/dependency inference, and document when to prefer the helper over fx.timeout or fx.timeoutFail.
Greptile SummaryThis PR adds
Confidence Score: 5/5Purely additive helper with no changes to existing behavior; safe to merge. The change is a small, isolated addition that delegates directly to a well-tested Effect primitive. All existing exports are untouched, the return type is explicitly annotated, both runtime and type-level tests are present, and docs plus a changeset are included. No files require special attention.
|
| Filename | Overview |
|---|---|
| src/concurrency.ts | Adds timeoutOption helper with explicit return type, Option import, and correct delegation to Effect.timeoutOption. |
| src/index.ts | Exports timeoutOption from the public fx object alongside the other timeout helpers. |
| test/runtime.test.ts | Adds two runtime tests for the slow (None) and fast (Some) paths of fx.timeoutOption. |
| test/types.test.ts | Adds type-level tests verifying result, error, and dependency inference for fx.timeoutOption. |
| docs/retry-timeout.md | Adds documentation for fx.timeoutOption with usage guidance and comparison to fx.timeout/fx.timeoutFail. |
| docs/api-reference.md | Adds fx.timeoutOption entry to the API reference table. |
| .changeset/timeout-option-helper.md | Correct minor-version changeset for the new public helper. |
Reviews (2): Last reviewed commit: "fix: declare timeout option return type" | Re-trigger Greptile
Import Option and annotate fx.timeoutOption with its public Task<Option.Option<A>, E, R> contract. This matches the exported helper style used throughout the concurrency module and addresses the PR review feedback.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds
fx.timeoutOptionfor timeout-as-value boundary workflows without changing existingfx.timeoutsemantics. The helper delegates to Effect'stimeoutOption, returningOption.some(value)when the task completes in time andOption.none()when the timeout wins while preserving original task errors and dependency requirements.Closes #54.
Changes
fx.timeoutOptionfrom the publicfxAPI.fx.timeoutOptionversusfx.timeoutandfx.timeoutFail.Validation
bun fmtbun lint:fixbun lintbun testbun typecheck