Skip to content
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

docs/node: Switch Archive Snapshots to new Multipart ones #523

Merged
merged 5 commits into from
Dec 23, 2024

Conversation

julianrubino
Copy link
Member

@julianrubino julianrubino commented Dec 20, 2024

We have transitioned to a Multipart Archive schema to address static storage limitations.

The syncing page has been refactored to support and display these new multipart archive snapshots.

Summary by CodeRabbit

  • New Features

    • Enhanced NodeSnapshots component with new functionality for displaying snapshot sizes and links.
    • Introduced multipart archive snapshots with options for individual downloads and automated scripts.
  • Documentation

    • Updated "Syncing a Node" document to clarify the availability of multipart archive snapshots and instructions for downloading.

@julianrubino julianrubino requested review from a team as code owners December 20, 2024 21:39
Copy link

vercel bot commented Dec 20, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
docs-v2 ✅ Ready (Inspect) Visit Preview Dec 23, 2024 3:34pm

Copy link
Contributor

coderabbitai bot commented Dec 20, 2024

📝 Walkthrough
📝 Walkthrough

Walkthrough

The pull request introduces modifications to the NodeSnapshots component and the "Syncing a Node" documentation. The changes primarily focus on enhancing the snapshot data handling and presentation in the user interface, with updates to the component's functionality for displaying and interacting with node snapshots. The documentation is updated to provide clearer guidance on downloading multipart archive snapshots.

Changes

File Change Summary
src/components/Docs/components/NodeSnapshots.tsx - Updated Snapshot interface with optional size, links, and instructions properties
- Added dropdownOpen state for managing link visibility
- Modified endpoint URLs to use archive-multipart
- Enhanced rendering with new size formatting and download link handling
src/pages/nodes/start-here/syncing.mdx - Replaced warning alert with information about multipart archive snapshots
- Added details about POSIX download script for snapshot retrieval
- Maintained existing structure and instructions

Sequence Diagram

sequenceDiagram
    participant User
    participant NodeSnapshots
    participant API
    
    User->>NodeSnapshots: Request Snapshots
    NodeSnapshots->>API: Fetch Snapshot Data
    API-->>NodeSnapshots: Return Snapshot Details
    NodeSnapshots->>User: Display Snapshots
    User->>NodeSnapshots: Toggle Dropdown
    NodeSnapshots->>User: Show/Hide Additional Links
    User->>NodeSnapshots: Select Download
    NodeSnapshots->>API: Retrieve Snapshot Part
    API-->>User: Provide Snapshot Download
Loading

The sequence diagram illustrates the interaction between the user, the NodeSnapshots component, and the API for fetching and downloading multipart snapshots, highlighting the new dropdown functionality and download process.


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

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

🧹 Nitpick comments (3)
src/pages/nodes/start-here/syncing.mdx (1)

29-32: Fix typo in "Snaphhots"

There's a typo in the warning message that should be corrected.

-  Snaphhots database backend is **pebbledb**. Ensure that your node is configured to
+  Snapshots database backend is **pebbledb**. Ensure that your node is configured to
src/components/Docs/components/NodeSnapshots.tsx (2)

128-135: Enhance size formatting for better readability

The size formatting logic could be improved for maintainability and readability.

-                    {
-                    snapshot.size
-                      ? snapshot.size >= 1024 ** 4
-                      ? (snapshot.size / (1024 ** 4)).toFixed(1) + "TB"
-                      : (snapshot.size / (1024 ** 3)).toFixed(1) + "GB"
-                      : ""
-                    }
+                    {formatSize(snapshot.size)}

Consider extracting the formatting logic into a utility function:

const formatSize = (size?: number): string => {
  if (!size) return "";
  const TB = 1024 ** 4;
  const GB = 1024 ** 3;
  return size >= TB 
    ? `${(size / TB).toFixed(1)}TB`
    : `${(size / GB).toFixed(1)}GB`;
};
🧰 Tools
🪛 eslint

[error] 128-129: Delete ⏎····················

(prettier/prettier)


[error] 131-131: Replace ······················?·(snapshot.size·/·(1024·**·4) with ························?·(snapshot.size·/·1024·**·4

(prettier/prettier)


[error] 132-132: Replace ······················:·(snapshot.size·/·(1024·**·3) with ························:·(snapshot.size·/·1024·**·3

(prettier/prettier)


[error] 133-134: Delete ⏎····················

(prettier/prettier)


161-167: Consider enhancing script copy feedback

The copy functionality should provide visual feedback to users when the script is copied.

 <CopyToClipboard
   getValue={() =>
     snapshot.instructions || "No instructions available"
   }
+  onCopy={() => {
+    // Consider adding a toast notification or temporary visual feedback
+    console.log('Script copied to clipboard');
+  }}
 />
🧰 Tools
🪛 eslint

[error] 161-161: Insert ··

(prettier/prettier)


[error] 162-166: Replace ····························<CopyToClipboard⏎······························getValue={()·=>⏎································snapshot.instructions·||·"No·instructions·available"⏎······························}⏎··························· with ······························<CopyToClipboard·getValue={()·=>·snapshot.instructions·||·"No·instructions·available"}

(prettier/prettier)


[error] 167-167: Insert ··

(prettier/prettier)

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 7aa56db and ab053a8.

📒 Files selected for processing (2)
  • src/components/Docs/components/NodeSnapshots.tsx (5 hunks)
  • src/pages/nodes/start-here/syncing.mdx (1 hunks)
🧰 Additional context used
🪛 eslint
src/components/Docs/components/NodeSnapshots.tsx

[error] 128-129: Delete ⏎····················

(prettier/prettier)


[error] 131-131: Replace ······················?·(snapshot.size·/·(1024·**·4) with ························?·(snapshot.size·/·1024·**·4

(prettier/prettier)


[error] 132-132: Replace ······················:·(snapshot.size·/·(1024·**·3) with ························:·(snapshot.size·/·1024·**·3

(prettier/prettier)


[error] 133-134: Delete ⏎····················

(prettier/prettier)


[error] 136-136: Delete ··

(prettier/prettier)


[error] 137-137: Insert ··

(prettier/prettier)


[error] 138-138: Insert ··

(prettier/prettier)


[error] 139-139: Insert ··

(prettier/prettier)


[error] 140-140: Replace ···················· with ······················

(prettier/prettier)


[error] 141-141: Insert ··

(prettier/prettier)


[error] 142-142: Insert ··

(prettier/prettier)


[error] 143-143: Insert ··

(prettier/prettier)


[error] 144-144: Replace ························ with ··························

(prettier/prettier)


[error] 145-145: Insert ··

(prettier/prettier)


[error] 146-146: Insert ··

(prettier/prettier)


[error] 147-147: Insert ··

(prettier/prettier)


[error] 148-148: Insert ··

(prettier/prettier)


[error] 149-149: Insert ··

(prettier/prettier)


[error] 150-150: Insert ··

(prettier/prettier)


[error] 151-151: Insert ··

(prettier/prettier)


[error] 152-152: Insert ··

(prettier/prettier)


[error] 153-153: Insert ··

(prettier/prettier)


[error] 154-154: Insert ··

(prettier/prettier)


[error] 155-155: Replace ·································· with ····································

(prettier/prettier)


[error] 156-156: Insert ··

(prettier/prettier)


[error] 157-157: Insert ··

(prettier/prettier)


[error] 158-158: Insert ··

(prettier/prettier)


[error] 159-159: Replace ·························· with ····························

(prettier/prettier)


[error] 160-160: Insert ··

(prettier/prettier)


[error] 161-161: Insert ··

(prettier/prettier)


[error] 162-166: Replace ····························<CopyToClipboard⏎······························getValue={()·=>⏎································snapshot.instructions·||·"No·instructions·available"⏎······························}⏎··························· with ······························<CopyToClipboard·getValue={()·=>·snapshot.instructions·||·"No·instructions·available"}

(prettier/prettier)


[error] 167-167: Insert ··

(prettier/prettier)


[error] 168-168: Replace ························ with ··························

(prettier/prettier)


[error] 169-169: Insert ··

(prettier/prettier)


[error] 170-170: Insert ··

(prettier/prettier)


[error] 171-171: Insert ··

(prettier/prettier)

🔇 Additional comments (3)
src/pages/nodes/start-here/syncing.mdx (1)

22-27: LGTM! Clear and comprehensive instructions for multipart snapshots.

The alert effectively communicates the new multipart snapshot functionality and provides clear guidance for both manual and automated approaches.

src/components/Docs/components/NodeSnapshots.tsx (2)

19-23: LGTM! Well-structured interface updates.

The Snapshot interface has been properly extended to support multipart functionality with clear, optional properties.


37-37: LGTM! Endpoint updates align with new architecture.

The endpoint URLs have been correctly updated to use the new multipart archive structure.

Also applies to: 39-39

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

🧹 Nitpick comments (1)
src/components/Docs/components/NodeSnapshots.tsx (1)

30-30: Consider parameterizing snapshot types

The endpoint paths contain hardcoded strings like "fullnode" and "archive-multipart". Consider extracting these as constants or configuration values for better maintainability.

+const SNAPSHOT_TYPES = {
+  FULLNODE: 'fullnode',
+  ARCHIVE_MULTIPART: 'archive-multipart'
+} as const;

 const endpoints = [
-  `${apiUrl}/testnet/fullnode/latest.json`,
-  `${apiUrl}/testnet/archive-multipart/latest.json`,
-  `${apiUrl}/mainnet/fullnode/latest.json`,
-  `${apiUrl}/mainnet/archive-multipart/latest.json`,
+  `${apiUrl}/testnet/${SNAPSHOT_TYPES.FULLNODE}/latest.json`,
+  `${apiUrl}/testnet/${SNAPSHOT_TYPES.ARCHIVE_MULTIPART}/latest.json`,
+  `${apiUrl}/mainnet/${SNAPSHOT_TYPES.FULLNODE}/latest.json`,
+  `${apiUrl}/mainnet/${SNAPSHOT_TYPES.ARCHIVE_MULTIPART}/latest.json`,
 ];

Also applies to: 36-36, 38-38

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between ab053a8 and 7c75539.

📒 Files selected for processing (2)
  • src/components/Docs/components/NodeSnapshots.tsx (5 hunks)
  • src/pages/nodes/start-here/syncing.mdx (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/pages/nodes/start-here/syncing.mdx
🔇 Additional comments (3)
src/components/Docs/components/NodeSnapshots.tsx (3)

5-7: LGTM: Clean interface updates for multipart support

The new interface fields and imports are well-structured and properly typed to support the multipart archive functionality.

Also applies to: 18-22


91-91: LGTM: Simplified date formatting

The date formatting change appropriately simplifies the display to show only the date portion.


167-174: Hardcoded base URL needs to be parameterized

The snapshot API URL is still hardcoded. This issue was previously identified and should be addressed.

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

🧹 Nitpick comments (2)
src/pages/nodes/start-here/syncing.mdx (2)

22-27: Enhance clarity of snapshot download instructions

While the instructions are generally clear, consider adding these essential details for a more complete user experience:

  1. Mention the expected total download size
  2. Indicate where the POSIX script will save the downloaded files
  3. Add a note about disk space requirements for both download and extraction
  Our **archive snapshots** are now available in a **multipart** format. You can download each part individually by
  clicking **"Show Parts"** and selecting the desired one. Alternatively, you can streamline the process by copying the
  provided **POSIX download script**. This script automates **downloading, packing, and extracting** the full snapshot.
  Simply click the **"Copy to Clipboard"** icon below the parts list to copy the one-liner command and run it on a
- terminal.
+ terminal. Ensure you have sufficient disk space for both downloading (~SIZE GB) and extraction (~SIZE GB) in your
+ ~/.zetacored directory.

29-31: Add context about database backend compatibility

The warning about the database backend is clear but could benefit from additional context about potential issues if mismatched.

<Alert variant="warning">
  Snapshots database backend is **pebbledb**. Ensure that your node is configured to use the same backend to utilize our
- snapshots.
+ snapshots. Using a different backend will result in snapshot restoration failure and may require you to start the sync
+ process from scratch.
</Alert>
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 7c75539 and 3072829.

📒 Files selected for processing (1)
  • src/pages/nodes/start-here/syncing.mdx (1 hunks)
🔇 Additional comments (1)
src/pages/nodes/start-here/syncing.mdx (1)

22-27: Verify UI element references

Let's verify that the UI elements mentioned in the documentation match the actual implementation in the NodeSnapshots component.

✅ Verification successful

The previous search was too specific. Let's try a broader search to find the relevant UI components and their text content. The new search will:

  1. Locate files containing NodeSnapshots component
  2. Search for case-insensitive patterns related to the UI elements mentioned in the docs

Let's examine the actual implementation of the NodeSnapshots component to verify the UI elements mentioned in the documentation. The previous command revealed the location of the component, now we'll inspect its contents.


UI elements match implementation

The documentation accurately reflects the actual UI implementation in the NodeSnapshots component:

  • The "Show Parts" button is present (toggles to "Hide Parts" when clicked)
  • The "Copy to Clipboard" functionality is implemented via the CopyToClipboard component
  • Both elements appear in the correct context of the multipart snapshot download interface
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify UI elements in NodeSnapshots component

# Search for UI elements in the NodeSnapshots component
ast-grep --pattern 'Show Parts' 
ast-grep --pattern 'Copy to Clipboard'

Length of output: 74


Script:

#!/bin/bash
# Search for files containing NodeSnapshots component
fd -e tsx -e jsx -e ts -e js NodeSnapshots

# Search for text patterns in the codebase that might indicate UI elements
rg -i "show.*parts|copy.*clipboard" --type ts --type tsx --type jsx

Length of output: 191


Script:

#!/bin/bash
# Let's examine the NodeSnapshots component content
cat src/components/Docs/components/NodeSnapshots.tsx

# Also search for any text content in the component using ripgrep
# Note: Using --type-add to properly handle TypeScript files
rg -i "show.*parts|copy.*clipboard" --type-add 'typescript:*.{ts,tsx}' --type typescript

Length of output: 7970

@julianrubino julianrubino merged commit 7611280 into main Dec 23, 2024
6 checks passed
@julianrubino julianrubino deleted the archive-multipart-snapshots branch December 23, 2024 16:02
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