Strict raw JSON check in RPC snapshot tests#7335
Conversation
🚥 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 13 files with indirect coverage changes Continue to review full report in Codecov by Harness.
🚀 New features to boost your workflow:
|
|
|
||
| /// JSON fields removed from both actual and expected responses before the | ||
| /// strict raw-JSON snapshot comparison. See each group below for why. | ||
| const SKIPPED_COMPARISON_FIELDS: &[&str] = &[ |
There was a problem hiding this comment.
It's not great to globally ignore fields with a given name. The ignores should be scoped to given methods.
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
Bug Fixes
Tests