fix: update sceme validation rules + tenderly types#211
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughJSON schema, TypeScript types, and normalization logic for state diffs were widened to allow Changes
Sequence Diagram(s)sequenceDiagram
participant Client
participant API
participant Validator
participant Normalizer
participant Repo
Client->>API: POST /simulateBundle with stateDiff
API->>Validator: validate request schema
Validator-->>API: validation result (accepts numbers/booleans/arrays)
API->>Normalizer: pass raw stateDiff entries
Normalizer->>Repo: normalized diffs (uses ?? / != null to keep falsy values)
Repo-->>API: stored/processed result
API-->>Client: response
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@libs/repositories/src/repos/SimulationRepository/tenderlyTypes.ts`:
- Around line 581-582: The widened types in tenderlyTypes (properties
diff.original and diff.dirty now allow 0/false) break downstream logic in
buildStateDiff.ts that uses truthy checks and ||; update the merge/guard logic
in libs/repositories/src/utils/buildStateDiff.ts to use explicit null/undefined
checks (e.g., diff.original !== undefined && diff.original !== null) and replace
usages of the || operator with nullish coalescing or explicit checks so valid
falsy values (0, false, empty string) are preserved when computing/merging
state; ensure any conditional like if (diff?.original && diff?.dirty) is changed
to test for non-null/undefined values instead.
🪄 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: defaults
Review profile: CHILL
Plan: Pro
Run ID: 0bd1daa8-cb77-4f19-ab0d-a84ecabd2f22
⛔ Files ignored due to path filters (1)
libs/repositories/src/gen/cow/cow-api-types.tsis excluded by!**/gen/**
📒 Files selected for processing (2)
apps/api/src/app/routes/__chainId/simulation/simulateBundle.tslibs/repositories/src/repos/SimulationRepository/tenderlyTypes.ts
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
| ): StateDiff[] { | ||
| // Handle regular diffs (with complete soltype, original, dirty data) | ||
| if (diff?.soltype && diff?.original && diff?.dirty) { | ||
| if (diff?.soltype != null && diff?.original != null && diff?.dirty != null) { |
There was a problem hiding this comment.
Nitpick: is it intentional to do a loose check instead of strict? (!= vs !==)
There was a problem hiding this comment.
yes, it checks null and undefined at the same moment, I will add comment
Tenderly simulation runs successfully, but when our BFF tries to serialize the response, Fastify's schema validation fails: The value of '#/items/properties/stateDiff/items/properties/original' does not match schema definition and it returns 500
Summary by CodeRabbit
Improvements
Bug Fixes