feat: startup snapshot writing card and progress bars#382
Conversation
Prompt To Fix All With AIThis is a comment left during a code review.
Path: src/features/StartupProgress/Firedancer/Snapshot/SnapshotReadingCard.tsx
Line: 37
Comment:
**Missing division-by-zero guard**
If `total` is `0` (e.g., before the backend reports the actual snapshot size), this computes `0 / 0 = NaN` or `n / 0 = Infinity`. That value propagates to the `ProgressBar` where `pct.toFixed(0)` renders `"NaN%"` or `"Infinity%"`, and the Radix `<Progress>` component receives a non-finite value.
This same pattern appears in all four card files:
- `SnapshotDecompressingCard.tsx:48`
- `SnapshotInsertingCard.tsx:30`
- `SnapshotWritingCard.tsx:34`
Consider guarding against a zero denominator:
```suggestion
completed == null || total == null || total === 0 ? undefined : (completed / total) * 100;
```
How can I resolve this? If you propose a fix, please make it concise.Reviews (1): Last reviewed commit: "feat: startup snapshot progress bars" | Re-trigger Greptile |
8507d3e to
53f0abc
Compare
|
Reviews (2): Last reviewed commit: "feat: startup snapshot progress bars" | Re-trigger Greptile |
53f0abc to
5c1f0d7
Compare
This comment was marked as resolved.
This comment was marked as resolved.
5c1f0d7 to
43b5e06
Compare
|
Reviews (4): Last reviewed commit: "feat: startup snapshot progress bars" | Re-trigger Greptile |
43b5e06 to
1fc37b5
Compare
Prompt To Fix All With AIThis is a comment left during a code review.
Path: src/features/StartupProgress/Firedancer/Snapshot/SnapshotWritingCard.tsx
Line: 43
Comment:
**Redundant "Writing" throughput prefix**
The `prefix="Writing"` renders as "Writing X MB/sec" inside a card already titled "Writing". The other cards either omit the prefix (Reading, Inserting) or use a contextually different label like `"Output"` (Decompressing). Consider removing the prefix or changing it to something more descriptive.
```suggestion
<SnapshotThroughput throughput={throughputObj} />
```
How can I resolve this? If you propose a fix, please make it concise.Reviews (5): Last reviewed commit: "feat: startup snapshot writing card" | Re-trigger Greptile |
1fc37b5 to
f8694a6
Compare
Prompt To Fix All With AIThis is a comment left during a code review.
Path: src/features/StartupProgress/Firedancer/Snapshot/utils.ts
Line: 8
Comment:
**Duplicate null check — `total` is never validated**
`completed != null` is checked twice instead of also checking `total != null`. The second condition should be `total != null`. In practice this doesn't cause a wrong result today because the final `total === completed` implicitly fails when `total` is `null`/`undefined` and `completed` is a number, but the intent is clearly to guard both parameters.
```suggestion
completed != null && total != null && total === completed;
```
How can I resolve this? If you propose a fix, please make it concise.Reviews (6): Last reviewed commit: "feat: startup snapshot writing card" | Re-trigger Greptile |
385280b to
266b23a
Compare
Prompt To Fix All With AIThis is a comment left during a code review.
Path: src/features/StartupProgress/Firedancer/Snapshot/index.tsx
Line: 185-188
Comment:
**Progress fraction stuck at 0 when writing data is unavailable**
`phaseCompleteFraction2` evaluates to `0` whenever `writeOutDecompressedBytes` is `null`/`undefined` (e.g., the backend hasn't started reporting writing progress yet, or an older backend version doesn't include the `snapwr` fields). Since the overall fraction is `Math.min(phaseCompleteFraction1, phaseCompleteFraction2)`, this pins the entire `phaseCompleteFraction` to `0` even while inserting is actively progressing.
Concretely, once `totalDecompressedBytes > 0` (decompression has started) but `writeOutDecompressedBytes` is still null/undefined, `phaseCompleteFraction2 = 0`, making the PhaseHeader show 0% regardless of `phaseCompleteFraction1`.
Consider falling back to `phaseCompleteFraction1` when writing data is not yet available:
```suggestion
const phaseCompleteFraction =
writeOutDecompressedBytes == null
? phaseCompleteFraction1
: Math.min(phaseCompleteFraction1, phaseCompleteFraction2);
```
How can I resolve this? If you propose a fix, please make it concise.Reviews (7): Last reviewed commit: "feat: startup snapshot writing card" | Re-trigger Greptile |
2d93ebf
266b23a to
2d93ebf
Compare
|
Reviews (8): Last reviewed commit: "feat: startup snapshot writing card" | Re-trigger Greptile |
2d93ebf to
71eecd3
Compare
Prompt To Fix All With AIThis is a comment left during a code review.
Path: src/features/StartupProgress/Firedancer/Snapshot/utils.ts
Line: 12
Comment:
**`progressPct` can exceed 100%**
For the Inserting and Writing cards, `total` is `totalDecompressedBytes` — an estimate derived from the current compression ratio (`totalCompressedBytes * decompressDecompressedBytes / decompressCompressedBytes`). While decompression is still in progress, this estimate can temporarily be lower than the actual total. If `completed` (a real backend value) exceeds the estimate, `progressPct` can go above 100, causing the text to render e.g. "105%".
Consider clamping to 100:
```suggestion
completed == null || !total ? undefined : Math.min((completed / total) * 100, 100),
```
How can I resolve this? If you propose a fix, please make it concise.Reviews (9): Last reviewed commit: "feat: startup snapshot writing card" | Re-trigger Greptile |
| return { | ||
| isComplete, | ||
| progressPct: | ||
| completed == null || !total ? undefined : (completed / total) * 100, |
There was a problem hiding this comment.
For the Inserting and Writing cards, total is totalDecompressedBytes — an estimate derived from the current compression ratio (totalCompressedBytes * decompressDecompressedBytes / decompressCompressedBytes). While decompression is still in progress, this estimate can temporarily be lower than the actual total. If completed (a real backend value) exceeds the estimate, progressPct can go above 100, causing the text to render e.g. "105%".
Consider clamping to 100:
| completed == null || !total ? undefined : (completed / total) * 100, | |
| completed == null || !total ? undefined : Math.min((completed / total) * 100, 100), |
Prompt To Fix With AI
This is a comment left during a code review.
Path: src/features/StartupProgress/Firedancer/Snapshot/utils.ts
Line: 12
Comment:
**`progressPct` can exceed 100%**
For the Inserting and Writing cards, `total` is `totalDecompressedBytes` — an estimate derived from the current compression ratio (`totalCompressedBytes * decompressDecompressedBytes / decompressCompressedBytes`). While decompression is still in progress, this estimate can temporarily be lower than the actual total. If `completed` (a real backend value) exceeds the estimate, `progressPct` can go above 100, causing the text to render e.g. "105%".
Consider clamping to 100:
```suggestion
completed == null || !total ? undefined : Math.min((completed / total) * 100, 100),
```
How can I resolve this? If you propose a fix, please make it concise.
Uh oh!
There was an error while loading. Please reload this page.