Skip to content

fix: flaky cast validation test#872

Open
topocount wants to merge 1 commit into
mainfrom
kjs/flaky-cast-validation-test-fix
Open

fix: flaky cast validation test#872
topocount wants to merge 1 commit into
mainfrom
kjs/flaky-cast-validation-test-fix

Conversation

@topocount
Copy link
Copy Markdown
Contributor

No description provided.

@vercel
Copy link
Copy Markdown

vercel Bot commented Apr 30, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
snapchain-docs Ready Ready Preview, Comment Apr 30, 2026 3:15pm

Request Review

@github-actions
Copy link
Copy Markdown

Diff Coverage

Diff: origin/main...HEAD, staged and unstaged changes

No lines with coverage information in this diff.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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-CAST mapping with an explicit mapping for CAST, LONG_CAST, and TEN_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.

Comment on lines +107 to +112
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),
},
Copy link

Copilot AI Apr 30, 2026

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants