Skip to content

feat: startup snapshot writing card and progress bars#382

Merged
asuzuki-jumptrading merged 1 commit into
mainfrom
asuzuki/startup-snapshot
Jul 6, 2026
Merged

feat: startup snapshot writing card and progress bars#382
asuzuki-jumptrading merged 1 commit into
mainfrom
asuzuki/startup-snapshot

Conversation

@asuzuki-jumptrading

@asuzuki-jumptrading asuzuki-jumptrading commented Jul 2, 2026

Copy link
Copy Markdown
Collaborator
  • and snapshot writing card on startup snapshot page
  • add progress bar for startup snapshot cards
  • fix sparkline shifting bug after completing

@asuzuki-jumptrading asuzuki-jumptrading marked this pull request as ready for review July 2, 2026 20:30
@greptile-jt

greptile-jt Bot commented Jul 2, 2026

Copy link
Copy Markdown
Prompt To Fix All With AI
This 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

Comment thread src/features/StartupProgress/Firedancer/Snapshot/SnapshotReadingCard.tsx Outdated
@asuzuki-jumptrading asuzuki-jumptrading force-pushed the asuzuki/startup-snapshot branch from 8507d3e to 53f0abc Compare July 2, 2026 20:52
@greptile-jt

greptile-jt Bot commented Jul 2, 2026

Copy link
Copy Markdown

Reviews (2): Last reviewed commit: "feat: startup snapshot progress bars" | Re-trigger Greptile

@asuzuki-jumptrading asuzuki-jumptrading force-pushed the asuzuki/startup-snapshot branch from 53f0abc to 5c1f0d7 Compare July 2, 2026 21:07
@asuzuki-jumptrading asuzuki-jumptrading changed the base branch from asuzuki/snapshot-progress to asuzuki/startup-accounts July 2, 2026 21:08
@greptile-jt

This comment was marked as resolved.

@asuzuki-jumptrading asuzuki-jumptrading force-pushed the asuzuki/startup-snapshot branch from 5c1f0d7 to 43b5e06 Compare July 2, 2026 21:34
@greptile-jt

greptile-jt Bot commented Jul 2, 2026

Copy link
Copy Markdown

Reviews (4): Last reviewed commit: "feat: startup snapshot progress bars" | Re-trigger Greptile

@asuzuki-jumptrading asuzuki-jumptrading force-pushed the asuzuki/startup-snapshot branch from 43b5e06 to 1fc37b5 Compare July 2, 2026 22:02
@asuzuki-jumptrading asuzuki-jumptrading changed the base branch from asuzuki/startup-accounts to main July 2, 2026 22:02
@greptile-jt

greptile-jt Bot commented Jul 2, 2026

Copy link
Copy Markdown
Prompt To Fix All With AI
This 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

Comment thread src/features/StartupProgress/Firedancer/Snapshot/SnapshotWritingCard.tsx Outdated
@asuzuki-jumptrading asuzuki-jumptrading force-pushed the asuzuki/startup-snapshot branch from 1fc37b5 to f8694a6 Compare July 2, 2026 23:36
@asuzuki-jumptrading asuzuki-jumptrading changed the title feat: startup snapshot progress bars feat: startup snapshot writing card and progress bars Jul 2, 2026
@greptile-jt

greptile-jt Bot commented Jul 2, 2026

Copy link
Copy Markdown
Prompt To Fix All With AI
This 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

Comment thread src/features/StartupProgress/Firedancer/Snapshot/utils.ts Outdated
@asuzuki-jumptrading asuzuki-jumptrading force-pushed the asuzuki/startup-snapshot branch from 385280b to 266b23a Compare July 2, 2026 23:54
@greptile-jt

greptile-jt Bot commented Jul 2, 2026

Copy link
Copy Markdown
Prompt To Fix All With AI
This 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

Comment thread src/features/StartupProgress/Firedancer/Snapshot/index.tsx
Comment thread src/features/StartupProgress/Firedancer/Snapshot/SnapshotBarsCard.tsx Outdated
Comment thread src/features/StartupProgress/Firedancer/Snapshot/index.tsx Outdated
Comment thread src/features/StartupProgress/Firedancer/Snapshot/index.tsx Outdated
@asuzuki-jumptrading asuzuki-jumptrading force-pushed the asuzuki/startup-snapshot branch from 266b23a to 2d93ebf Compare July 6, 2026 16:35
@greptile-jt

greptile-jt Bot commented Jul 6, 2026

Copy link
Copy Markdown

Reviews (8): Last reviewed commit: "feat: startup snapshot writing card" | Re-trigger Greptile

@asuzuki-jumptrading asuzuki-jumptrading merged commit 246d77d into main Jul 6, 2026
2 checks passed
@asuzuki-jumptrading asuzuki-jumptrading deleted the asuzuki/startup-snapshot branch July 6, 2026 16:53
@greptile-jt

greptile-jt Bot commented Jul 6, 2026

Copy link
Copy Markdown
Prompt To Fix All 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.

Reviews (9): Last reviewed commit: "feat: startup snapshot writing card" | Re-trigger Greptile

return {
isComplete,
progressPct:
completed == null || !total ? undefined : (completed / total) * 100,

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 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:

Suggested change
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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants