chitralverma opened a new pull request, #7879:
URL: https://github.com/apache/opendal/pull/7879

   # Which issue does this PR close?
   
   No tracking issue. Follow-up to the layers refactor (#7878), addressing 
review feedback on `RetryLayer` input handling.
   
   # Rationale for this change
   
   `RetryLayer.__new__` forwarded user-provided floats straight to the core 
backoff builder without validation, so out-of-range values were silently 
accepted and produced degenerate behavior:
   
   - `factor` below `1.0` (or `NaN`/`inf`) yields a nonsensical backoff (the 
core docs even mark `factor < 1.0` as unsupported).
   - Negative or `NaN` `max_delay`/`min_delay` silently clamp to `0` via the 
`(x * 1_000_000.0) as u64` cast.
   
   # What changes are included in this PR?
   
   - Validate inputs in `RetryLayer.__new__` and raise `ConfigInvalid` for 
out-of-range values: `factor` must be finite and `>= 1.0`; `max_delay` and 
`min_delay` must be finite and non-negative.
   - Document the accepted ranges and the `ConfigInvalid` behavior in the 
docstring (and regenerated stub).
   - Add `tests/test_layers.py` covering the invalid cases, the boundary-valid 
cases (`factor=1.0`, `delay=0.0`), and functional use.
   
   # Are there any user-facing changes?
   
   Yes. Constructing `RetryLayer` with an out-of-range `factor`, `max_delay`, 
or `min_delay` now raises `ConfigInvalid` instead of being silently accepted. 
Valid configurations are unaffected.
   
   # AI Usage Statement
   
   Implemented with an AI coding agent (opencode, Claude Opus). Validated with 
`cargo clippy`/`fmt`, `ruff`, `ty`, `pytest`.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to