Skip to content

chore: sort snapshot lists#6033

Merged
LesnyRumcajs merged 3 commits intomainfrom
sort-snapshot-lists
Sep 5, 2025
Merged

chore: sort snapshot lists#6033
LesnyRumcajs merged 3 commits intomainfrom
sort-snapshot-lists

Conversation

@LesnyRumcajs
Copy link
Copy Markdown
Member

@LesnyRumcajs LesnyRumcajs commented Sep 4, 2025

Summary of changes

Changes introduced in this pull request:

  • sorts the RPC snapshot lists + adds the check to CI

Reference issue to close (if applicable)

Closes #6001 (comment)

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.

Summary by CodeRabbit

  • Chores

    • Added a CI job to verify specified list files are lexicographically sorted and fail the build if not.
    • Added a Make target to sort and deduplicate designated list files.
  • Tests

    • Substantially expanded API command test snapshots, adding many state- and wallet-related entries and reindexing legacy ones.
    • Reordered one ignored API command entry without changing the set.
  • Impact

    • No user-facing functionality changes.

@LesnyRumcajs LesnyRumcajs requested a review from a team as a code owner September 4, 2025 16:06
@LesnyRumcajs LesnyRumcajs requested review from akaladarshi and elmattic and removed request for a team September 4, 2025 16:06
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Sep 4, 2025

Walkthrough

Adds a CI job that sorts and verifies snapshot list files, a Makefile target to lexicographically sort/deduplicate those files, and updates two snapshot list files (one with extensive content changes and reordering, one with a small reordering).

Changes

Cohort / File(s) Summary
CI: lists-lint job
.github/workflows/scripts-lint.yml
Adds lists-lint job running on ubuntu-24.04-arm that checks out the repo, runs make sort-lists, then runs git diff --exit-code.
Build: Makefile sorting
Makefile
Adds LIST_FILES (two snapshot files), new phony sort-lists target, per-file rule sort --unique $@ -o $@, and .PHONY declarations.
API snapshots update (major)
src/tool/subcommands/api_cmd/test_snapshots.txt
Replaces/expands the file with many new and updated snapshot entries and overall lexicographic reordering.
API snapshots ignored update (minor)
src/tool/subcommands/api_cmd/test_snapshots_ignored.txt
Reorders a single entry (Filecoin.EthSyncing) within the list; no additions or removals.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  actor GH as GitHub Actions
  participant Runner as ubuntu-24.04-arm
  participant Repo as Repository
  participant Make as make (sort-lists)
  participant Git as git (diff --exit-code)

  GH->>Runner: start lists-lint job
  Runner->>Repo: actions/checkout@v4
  Runner->>Make: run make sort-lists
  Note right of Make #DFF2E1: for each file in LIST_FILES\nrun `sort --unique $@ -o $@`
  Make-->>Runner: exit status
  Runner->>Git: git diff --exit-code
  alt no changes
    Git-->>Runner: exit 0
    Runner-->>GH: job success
  else changes detected
    Git-->>Runner: exit 1
    Runner-->>GH: job failure
  end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Assessment against linked issues

Objective Addressed Explanation
Fix lexicographical ordering in test_snapshots.txt (#6001)
Add CI check to prevent future ordering issues (#6001)

Assessment against linked issues: Out-of-scope changes

Code Change Explanation
Large additions/replacements in src/tool/subcommands/api_cmd/test_snapshots.txt File contains many new/updated snapshot entries beyond mere reordering; not required by the linked issue.
Reordering in src/tool/subcommands/api_cmd/test_snapshots_ignored.txt Changes an ignored-list entry order; the linked issue targeted test_snapshots.txt only.

Possibly related PRs

Suggested labels

RPC


📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 064c438 and 33e0012.

📒 Files selected for processing (3)
  • .github/workflows/scripts-lint.yml (1 hunks)
  • Makefile (1 hunks)
  • src/tool/subcommands/api_cmd/test_snapshots.txt (4 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • Makefile
🧰 Additional context used
🧠 Learnings (1)
📓 Common learnings
Learnt from: LesnyRumcajs
PR: ChainSafe/forest#5907
File: src/rpc/methods/state.rs:523-570
Timestamp: 2025-08-06T15:44:33.467Z
Learning: LesnyRumcajs prefers to rely on BufWriter's Drop implementation for automatic flushing rather than explicit flush() calls in Forest codebase.
🪛 GitHub Check: CodeQL
.github/workflows/scripts-lint.yml

[warning] 85-91: Workflow does not contain permissions
Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {{contents: read}}

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (9)
  • GitHub Check: Build Ubuntu
  • GitHub Check: cargo-publish-dry-run
  • GitHub Check: Build MacOS
  • GitHub Check: Build forest binaries on Linux AMD64
  • GitHub Check: All lint checks
  • GitHub Check: tests-release
  • GitHub Check: tests
  • GitHub Check: Analyze (rust)
  • GitHub Check: Analyze (go)
🔇 Additional comments (6)
src/tool/subcommands/api_cmd/test_snapshots.txt (6)

93-139: Miner decode-params block is strictly ordered.

Underscore variant (“miner_…”) correctly appears before “minergetbaseinfo” under C/ASCII ordering; numeric suffixes are increasing. No action needed.


147-167: Multisig/payment_channel/power/reward sections: OK.

Groups and intra-group ordering look consistent and stable under LC_ALL=C.


174-189: State decode-params block: OK; follows with stateget as expected.*

Shorter/prefix-vs-longer ordering and numeric tiebreakers are correct.


231-244: statereadstate ordering fixed (issue #6001).

Entries are now in strict lexicographic order; the previously out-of-order 1747857537534606 item is correctly placed among its neighbors.


245-256: statesearch/sector/verified*/vm/waitmsg sections: OK.**

Prefix vs longer-name ordering (e.g., statesearchmsg before statesearchmsglimited) is correct; overall sort holds.


273-280: Verified_reg and wallet sections: OK.

Numeric suffixes ascend; walletbalance < walletvalidateaddress < walletverify as expected.

✨ Finishing Touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch sort-snapshot-lists

🪧 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.
    • 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.
  • 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 the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbitai ignore or @coderabbit 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

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • 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.

Comment thread .github/workflows/scripts-lint.yml Fixed
Copy link
Copy Markdown
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: 6

🧹 Nitpick comments (2)
Makefile (1)

130-130: Don’t mark real files as phony targets.

Declaring the list files as .PHONY defeats make’s incremental logic and can cause unnecessary rewrites.

-.PHONY: sort-lists $(LIST_FILES)
+.PHONY: sort-lists
src/tool/subcommands/api_cmd/test_snapshots.txt (1)

1-289: Consider regenerating this file via the new make target to avoid manual drift.

Given multiple ordering slips, prefer “make sort-lists” (now enforced in CI) to keep this fixture canonical.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 7dc92b4 and e289a40.

📒 Files selected for processing (4)
  • .github/workflows/scripts-lint.yml (1 hunks)
  • Makefile (1 hunks)
  • src/tool/subcommands/api_cmd/test_snapshots.txt (4 hunks)
  • src/tool/subcommands/api_cmd/test_snapshots_ignored.txt (1 hunks)
🧰 Additional context used
🧠 Learnings (1)
📓 Common learnings
Learnt from: LesnyRumcajs
PR: ChainSafe/forest#5907
File: src/rpc/methods/state.rs:523-570
Timestamp: 2025-08-06T15:44:33.467Z
Learning: LesnyRumcajs prefers to rely on BufWriter's Drop implementation for automatic flushing rather than explicit flush() calls in Forest codebase.
🪛 actionlint (1.7.7)
.github/workflows/scripts-lint.yml

89-89: could not parse as YAML: yaml: line 89: could not find expected ':'

(syntax-check)

🪛 GitHub Check: CodeQL
.github/workflows/scripts-lint.yml

[warning] 85-85: Workflow does not contain permissions
Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {{contents: read}}

🪛 YAMLlint (1.37.1)
.github/workflows/scripts-lint.yml

[error] 90-90: syntax error: could not find expected ':'

(syntax)

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (10)
  • GitHub Check: Go lint checks
  • GitHub Check: cargo-publish-dry-run
  • GitHub Check: All lint checks
  • GitHub Check: Build MacOS
  • GitHub Check: Build Ubuntu
  • GitHub Check: tests-release
  • GitHub Check: tests
  • GitHub Check: Build forest binaries on Linux AMD64
  • GitHub Check: Analyze (go)
  • GitHub Check: Analyze (rust)
🔇 Additional comments (1)
src/tool/subcommands/api_cmd/test_snapshots_ignored.txt (1)

22-23: LGTM: ordering correction for EthSyncing.

The move places EthSyncing in proper lexicographic order between EthSubscribe and EthUnsubscribe.

Comment thread .github/workflows/scripts-lint.yml
Comment thread .github/workflows/scripts-lint.yml Outdated
Comment thread Makefile
Comment thread src/tool/subcommands/api_cmd/test_snapshots.txt Outdated
Comment thread src/tool/subcommands/api_cmd/test_snapshots.txt Outdated
Comment thread src/tool/subcommands/api_cmd/test_snapshots.txt Outdated
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Comment thread .github/workflows/scripts-lint.yml Fixed
Comment thread .github/workflows/scripts-lint.yml Dismissed
Copy link
Copy Markdown
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

♻️ Duplicate comments (1)
.github/workflows/scripts-lint.yml (1)

85-93: Harden GITHUB_TOKEN permissions for this job.

Add minimal permissions to satisfy CodeQL and least-privilege.

   lists-lint:
+    permissions:
+      contents: read
     runs-on: ubuntu-24.04-arm
🧹 Nitpick comments (1)
.github/workflows/scripts-lint.yml (1)

84-94: Align merge-queue behavior (optional).

python-lint skips gh-readonly-queue; consider mirroring for consistency, unless you explicitly want this job in the queue.

-  lists-lint:
+  lists-lint:
+    if: ${{ !startsWith(github.ref, 'refs/heads/gh-readonly-queue/') }}
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between e289a40 and 064c438.

📒 Files selected for processing (1)
  • .github/workflows/scripts-lint.yml (1 hunks)
🧰 Additional context used
🧠 Learnings (1)
📓 Common learnings
Learnt from: LesnyRumcajs
PR: ChainSafe/forest#5907
File: src/rpc/methods/state.rs:523-570
Timestamp: 2025-08-06T15:44:33.467Z
Learning: LesnyRumcajs prefers to rely on BufWriter's Drop implementation for automatic flushing rather than explicit flush() calls in Forest codebase.
🪛 GitHub Check: CodeQL
.github/workflows/scripts-lint.yml

[warning] 85-93: Workflow does not contain permissions
Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {{contents: read}}

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (9)
  • GitHub Check: tests-release
  • GitHub Check: Build MacOS
  • GitHub Check: tests
  • GitHub Check: cargo-publish-dry-run
  • GitHub Check: Build Ubuntu
  • GitHub Check: All lint checks
  • GitHub Check: Build forest binaries on Linux AMD64
  • GitHub Check: Analyze (rust)
  • GitHub Check: Analyze (go)
🔇 Additional comments (1)
.github/workflows/scripts-lint.yml (1)

84-94: Nice addition: deterministic sort check with locale pinned.

The lists-lint job and LC_ALL=C ensure stable, byte-wise ordering; the diff gate will catch regressions. LGTM.

@LesnyRumcajs LesnyRumcajs added this pull request to the merge queue Sep 5, 2025
Merged via the queue into main with commit 1767838 Sep 5, 2025
46 checks passed
@LesnyRumcajs LesnyRumcajs deleted the sort-snapshot-lists branch September 5, 2025 09:50
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.

Fix lexicographical ordering in test_snapshots.txt

4 participants