Strict raw JSON check in RPC snapshot tests#7335
Conversation
WalkthroughThe RPC snapshot test runner recursively removes selected fields from successful actual and expected JSON values before comparison. The snapshot manifest references a newer chain-message snapshot file. ChangesRPC snapshot normalization
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related PRs
Suggested labels: Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
✨ Simplify code
Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/tool/subcommands/api_cmd/test_snapshot.rs (1)
84-101: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick winAdd focused tests for recursive field stripping.
Cover nested objects, arrays, exact key matching, and preservation of similarly named fields. This helper globally removes fields from every RPC response, so regression coverage is valuable for preventing over- or under-stripping.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/tool/subcommands/api_cmd/test_snapshot.rs` around lines 84 - 101, Add focused unit tests for strip_skipped_fields covering skipped fields in nested objects and array elements, exact key matching, and preservation of similarly named non-skipped fields. Use representative serde_json::Value inputs and assert the transformed values retain all unrelated data while removing only keys listed in SKIPPED_COMPARISON_FIELDS.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@src/tool/subcommands/api_cmd/test_snapshot.rs`:
- Around line 84-101: Add focused unit tests for strip_skipped_fields covering
skipped fields in nested objects and array elements, exact key matching, and
preservation of similarly named non-skipped fields. Use representative
serde_json::Value inputs and assert the transformed values retain all unrelated
data while removing only keys listed in SKIPPED_COMPARISON_FIELDS.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: a0eee4b3-7e2a-4c75-971a-2766b2a67736
📒 Files selected for processing (2)
src/tool/subcommands/api_cmd/test_snapshot.rssrc/tool/subcommands/api_cmd/test_snapshots.txt
🔗 Linked repositories identified
CodeRabbit considers these linked repositories for cross-repo context during reviews:
filecoin-project/lotus(manual)
Codecov Report❌ Patch coverage is
Additional details and impacted files
... and 10 files with indirect coverage changes Continue to review full report in Codecov by Harness.
🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/tool/subcommands/api_cmd/test_snapshot.rs`:
- Around line 94-110: The recursive filter_out_fields function removes Duration,
tt, and accessList from every nested object, masking regressions in transaction
and trace payloads. Replace the unrestricted recursive filtering with path-aware
exclusions limited to the intended response shapes, or preserve nested
occurrences for separate comparisons; keep unrelated fields unchanged.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: 06666847-b38d-46f2-b887-0884f2ad9f0c
📒 Files selected for processing (1)
src/tool/subcommands/api_cmd/test_snapshot.rs
🔗 Linked repositories identified
CodeRabbit considers these linked repositories for cross-repo context during reviews:
filecoin-project/lotus(manual)
Summary of changes
Changes introduced in this pull request:
tt,Duration) and known-divergent (accessList, lotus#12214) fields before comparing.Reference issue to close (if applicable)
Closes #7313
Other information and links
Change checklist
Outside contributions
Summary by CodeRabbit