Skip to content

fix(ci): speed up snapshot downloading on CI#6592

Merged
hanabi1224 merged 6 commits intomainfrom
hm/ci-speed-up-snap-download
Feb 13, 2026
Merged

fix(ci): speed up snapshot downloading on CI#6592
hanabi1224 merged 6 commits intomainfrom
hm/ci-speed-up-snap-download

Conversation

@hanabi1224
Copy link
Contributor

@hanabi1224 hanabi1224 commented Feb 12, 2026

Summary of changes

This PR tries to mitigate #3715 on CI

Changes introduced in this pull request:

Reference issue to close (if applicable)

Closes

Other information and links

Change checklist

  • I have performed a self-review of my own code,
  • I have made corresponding changes to the documentation. All new code adheres to the team's documentation standards,
  • I have added tests that prove my fix is effective or that my feature works (if possible),
  • I have made sure the CHANGELOG is up-to-date. All user-facing changes should be reflected in this document.

Outside contributions

  • I have read and agree to the CONTRIBUTING document.
  • I have read and agree to the AI Policy document. I understand that failure to comply with the guidelines will lead to rejection of the pull request.

Summary by CodeRabbit

  • New Features

    • Added an environment variable to override the snapshot download path for the auto-download flow.
    • Pre-launch setup now respects that override and will fetch the specified snapshot before starting the node.
  • Documentation

    • Added docs and examples for the new snapshot path environment variable.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 12, 2026

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

Walkthrough

Adds FOREST_AUTO_DOWNLOAD_SNAPSHOT_PATH and wires it through CI, test harness scripts, and daemon startup so the auto-download snapshot path can be overridden when preparing or starting a Forest node.

Changes

Cohort / File(s) Summary
CI workflow
.github/workflows/forest.yml
Added global env FOREST_AUTO_DOWNLOAD_SNAPSHOT_PATH set to /var/tmp/forest_snapshot_calibnet_latest.forest.car.zst.
Documentation
docs/docs/users/reference/env_variables.md
Documented FOREST_AUTO_DOWNLOAD_SNAPSHOT_PATH (type, default, example, description).
Test scripts
scripts/tests/calibnet_kademlia_check.sh, scripts/tests/calibnet_no_discovery_check.sh, scripts/tests/calibnet_stateless_mode_check.sh
Inserted calls to handle_auto_download_snapshot_env before launching the Forest node.
Test harness
scripts/tests/harness.sh
Added handle_auto_download_snapshot_env function; invoked from forest_download_and_import_snapshot to create directories and download snapshot when env var is set.
Daemon logic
src/daemon/mod.rs
maybe_set_snapshot_path now prefers FOREST_AUTO_DOWNLOAD_SNAPSHOT_PATH when set; otherwise falls back to existing URL-derived behavior.

Sequence Diagram(s)

sequenceDiagram
    participant CI as CI Workflow
    participant Harness as Test Harness
    participant Downloader as aria2c (Downloader)
    participant Daemon as Forest Daemon

    CI->>Harness: set FOREST_AUTO_DOWNLOAD_SNAPSHOT_PATH
    Harness->>Harness: handle_auto_download_snapshot_env()
    alt env var set
        Harness->>Downloader: download snapshot to specified path
        Downloader-->>Harness: snapshot file saved
    end
    Harness->>Daemon: start node (with --auto-download-snapshot / path)
    Daemon->>Daemon: maybe_set_snapshot_path reads env var
    alt env var present
        Daemon-->>Daemon: use provided snapshot path
    else
        Daemon-->>Daemon: resolve default snapshot URL
    end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested reviewers

  • LesnyRumcajs
  • akaladarshi
🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: adding environment variable support and tooling to speed up snapshot downloading on CI infrastructure.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Merge Conflict Detection ✅ Passed ✅ No merge conflicts detected when merging into main

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch hm/ci-speed-up-snap-download

No actionable comments were generated in the recent review. 🎉


Comment @coderabbitai help to get the list of available commands and usage tips.

@hanabi1224 hanabi1224 marked this pull request as ready for review February 12, 2026 12:17
@hanabi1224 hanabi1224 requested a review from a team as a code owner February 12, 2026 12:17
@hanabi1224 hanabi1224 requested review from LesnyRumcajs and removed request for a team February 12, 2026 12:17
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
.github/workflows/forest.yml (1)

28-39: ⚠️ Potential issue | 🔴 Critical

Confirmed CI regression: calibnet_db_migration.sh uses --auto-download-snapshot without pre-download

The global FOREST_AUTO_DOWNLOAD_SNAPSHOT_PATH override will cause calibnet_db_migration.sh to fail. This script runs --auto-download-snapshot in a Docker container without calling handle_auto_download_snapshot_env first, meaning it expects the snapshot file at the configured path but never pre-downloads it.

Other test scripts (calibnet_kademlia_check.sh, calibnet_no_discovery_check.sh, calibnet_stateless_mode_check.sh, and harness.sh) properly call handle_auto_download_snapshot_env before using the flag. Either scope FOREST_AUTO_DOWNLOAD_SNAPSHOT_PATH to specific jobs that pre-download, or add the pre-download step to calibnet_db_migration.sh.

🤖 Fix all issues with AI agents
In `@scripts/tests/harness.sh`:
- Around line 19-23: In handle_auto_download_snapshot_env replace the current
existence check with a non-empty check (e.g. [ -n
"${FOREST_AUTO_DOWNLOAD_SNAPSHOT_PATH:-}" ]), compute and quote the target
directory and filename into variables (dir="$(dirname
"${FOREST_AUTO_DOWNLOAD_SNAPSHOT_PATH}")" and file="$(basename
"${FOREST_AUTO_DOWNLOAD_SNAPSHOT_PATH}")"), create the directory if missing
(mkdir -p "$dir"), and call aria2c with quoted variables (aria2c -x5 -c
https://forest-archive.chainsafe.dev/latest/calibnet/ -d "$dir" -o "$file") so
empty values are guarded against and paths are properly handled in
handle_auto_download_snapshot_env.

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In `@scripts/tests/harness.sh`:
- Around line 27-28: There is an extra closing brace after the function
definition (a stray `}` following the function closed at line 27) that causes a
bash syntax error; remove the redundant `}` so the function ends with its single
matching `}` (ensure the function's closing brace is the only one present) and
re-run the script to confirm it sources without syntax errors.

@codecov
Copy link

codecov bot commented Feb 12, 2026

Codecov Report

❌ Patch coverage is 0% with 6 lines in your changes missing coverage. Please review.
✅ Project coverage is 63.38%. Comparing base (e7ad657) to head (a094d2b).
⚠️ Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
src/daemon/mod.rs 0.00% 6 Missing ⚠️
Additional details and impacted files
Files with missing lines Coverage Δ
src/daemon/mod.rs 29.13% <0.00%> (-0.22%) ⬇️

... and 2 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update e7ad657...a094d2b. Read the comment docs.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@hanabi1224 hanabi1224 added this pull request to the merge queue Feb 13, 2026
Merged via the queue into main with commit ca1ae7b Feb 13, 2026
46 checks passed
@hanabi1224 hanabi1224 deleted the hm/ci-speed-up-snap-download branch February 13, 2026 13:25
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