fix: flaky cast validation test#872
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Diff CoverageDiff: origin/main...HEAD, staged and unstaged changesNo lines with coverage information in this diff. |
There was a problem hiding this comment.
Pull request overview
Updates the cast validation integration test to correctly map API cast types to the corresponding protobuf CastType values, addressing a source of test flakiness when non-CAST messages are returned.
Changes:
- Replace a binary
CAST/non-CASTmapping with an explicit mapping forCAST,LONG_CAST, andTEN_K_CAST. - Add a panic on unknown API cast types to surface unexpected responses.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| r#type: match body.cast_type.as_str() { | ||
| "CAST" => 0, | ||
| "LONG_CAST" => 1, | ||
| "TEN_K_CAST" => 2, | ||
| other => panic!("unknown cast type from API: {}", other), | ||
| }, |
There was a problem hiding this comment.
Avoid hard-coding the numeric enum values (0/1/2) for CastType here. Since CastType is defined in proto/definitions/message.proto and used elsewhere via CastType::… as i32, it’s safer/clearer to map the API string to CastType (e.g., via a match to CastType::Cast/LongCast/TenKCast or CastType::from_str_name) and then cast to i32. This prevents accidental drift if the enum ever changes and makes the intent explicit.
No description provided.