Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion src/core/validations/cast_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,12 @@ mod tests {
.iter()
.map(|p| *p as u32)
.collect(),
r#type: if body.cast_type == "CAST" { 0 } else { 1 },
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),
},
Comment on lines +107 to +112

Copilot AI Apr 30, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
parent: body.parent_cast_id.map(|p| {
cast_add_body::Parent::ParentCastId(crate::proto::CastId {
fid: p.fid,
Expand Down
Loading