Skip to content

Add snapshot crash safety and consolidate run command#204

Open
7layermagik wants to merge 2 commits intodevfrom
fix/snapshot-safety
Open

Add snapshot crash safety and consolidate run command#204
7layermagik wants to merge 2 commits intodevfrom
fix/snapshot-safety

Conversation

@7layermagik
Copy link

Summary

  • 08b63d8 — Add --end-slot and --num-slots flags to mithril run, remove verify-range and verify-live: run now supports bounded replay via --end-slot / --num-slots, making verify-range and verify-live redundant. Both commands removed along with their dedicated config fields (load_from_snapshot, load_from_accounts_db). Config bindings for replay.num_slots and replay.end_slot already existed in the shared initConfigAndBindFlags, so TOML config works automatically.

  • 175ff12 — Add crash safety for snapshot downloads with .partial suffix: HTTP snapshot downloads now write to <filename>.partial first, then atomically os.Rename to the final path only after the entire tar stream is successfully processed. Prevents a crash mid-download from leaving a corrupted snapshot that the next run would treat as valid. CleanSnapshotDownloadDir removes leftover .partial files on startup, and detectExistingSnapshots skips them.

🤖 Generated with Claude Code

7layermagik and others added 2 commits February 8, 2026 00:42
…nge and verify-live

Allows bounded replay in run mode with all production features
(modern bootstrap, cluster safety, file logging, genesis validation).

Removes verify-range and verify-live commands — run mode now covers
all functionality via --end-slot / --num-slots.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Downloads now write to .partial files first, then atomically rename
on successful completion. This prevents corrupted snapshots from
crashes mid-download being treated as valid on the next run.

- Write to .partial suffix during HTTP downloads
- FinalizePartialDownload() atomically renames after success
- CleanupPartialDownload() removes partials on error/cancellation
- Skip .partial files in detectExistingSnapshots()
- Clean .partial files in CleanSnapshotDownloadDir() on startup

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Copy link
Collaborator

@palmerlao palmerlao left a comment

Choose a reason for hiding this comment

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

I haven't tested it but LGTM

name := entry.Name()

// Skip partial downloads (incomplete files from crashed runs)
if strings.HasSuffix(name, ".partial") {
Copy link
Collaborator

Choose a reason for hiding this comment

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

if strings.HasSuffix(name, snapshot.PartialSuffix) {?

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.

2 participants