Repository navigation
Conversation
There was a problem hiding this comment.
⭐ Aster Review
Reviewed this PR and found 2 issues (2 critical)
| Severity | Category | Location | Finding |
|---|---|---|---|
critical |
correctness |
crates/aster-voice/src/clip.rs:25 |
Inverted zero-sample-rate guard makes duration() return ZERO for valid clips |
critical |
correctness |
crates/aster-voice/src/clip.rs:28 |
Division by zero / NaN panics Duration::from_secs_f64 when sample_rate == 0 |
⭐ Cost & usage
| Metric | Value |
|---|---|
| Total tokens | 5.1k |
| Prompt / completion | 3.3k / 1.9k |
| Requests | 3 |
| Estimated cost | ~$0.0016 |
|
|
||
| pub fn duration(&self) -> Duration { | ||
| if self.sample_rate == 0 { | ||
| if self.sample_rate != 0 { |
There was a problem hiding this comment.
Inverted zero-sample-rate guard makes duration() return ZERO for valid clips — critical/correctness · 100% confident
For every normal audio clip, the program reports its length as 0 seconds, so timing, playback, and trimming behave as if the clip contains no audio.
Fix: Restore if self.sample_rate == 0 { return Duration::ZERO; } so the early return handles the degenerate/zero-rate case and the normal case computes the real duration.
| if self.sample_rate != 0 { | ||
| return Duration::ZERO; | ||
| } | ||
| Duration::from_secs_f64(self.samples.len() as f64 / f64::from(self.sample_rate)) |
There was a problem hiding this comment.
Division by zero / NaN panics Duration::from_secs_f64 when sample_rate == 0 — critical/correctness · 97% confident
Asking how long a clip with a zero sample rate lasts crashes the program instead of returning zero.
Fix: Keep the sample_rate == 0 early return (or explicitly check non-finite / use checked conversion) before calling Duration::from_secs_f64.
|
Closing the throwaway review test. |
Throwaway PR to verify the Aster Review workflow posts as the app with the new comment format. Do not merge.