Skip to content

internal/download: improve era file status messages #31933

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

ForrestKim42
Copy link

Summary

This PR improves the status messages displayed during era file downloads to provide clearer feedback to users about the file state.

Problem

Previously, all era files would show the generic message "is stale" regardless of whether the file was missing or had a hash mismatch. This caused confusion for users who couldn't distinguish between different file states.

Solution

Modified the DownloadFile function in internal/download/download.go to:

  • File not found: Display "not found, downloading..."
  • Hash mismatch: Display "is stale (hash mismatch)"
  • File up-to-date: Display "is up-to-date" (unchanged)

Changes

  • Modified internal/download/download.go:

    • Enhanced error handling in DownloadFile function
    • Added distinction between os.IsNotExist and hash mismatch errors
    • Improved user feedback with specific status messages
  • Added internal/download/download_test.go:

    • Comprehensive tests for all three file states
    • Tests for error type detection
    • Verification of correct download behavior

Testing

go test ./internal/download -v

All tests pass, covering:

  • File not found scenario
  • File exists with correct hash
  • File exists with wrong hash
  • Error type verification

Fixes

Closes #31917

@fjl fjl closed this May 29, 2025
@ForrestKim42 ForrestKim42 deleted the internal-download-improve-era-messages branch May 30, 2025 04:28
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.

era-download reports all files are stale
2 participants