test(service): fix E0283 in list_games mock tests to unbreak Backend CI - #947
Open
abdulwaarith0 wants to merge 1 commit into
Open
test(service): fix E0283 in list_games mock tests to unbreak Backend CI#947abdulwaarith0 wants to merge 1 commit into
abdulwaarith0 wants to merge 1 commit into
Conversation
The count result set in test_list_games_query_structure and test_list_games_with_cursor was an untyped empty `vec![]`. Under sea-orm 1.1.20 the added IntoMockRow impls make the element type ambiguous, so `append_query_results` fails to compile with E0283 (type annotations needed) — breaking `cargo test` for the whole service module and turning Backend CI red on main and every PR. Type the empty count set as `Vec::<game::Model>::new()` so `T: IntoMockRow` is inferable. Behavior is unchanged: count() on an empty mock result resolves to 0 and execution continues to the data query, so both queries still run (transaction_log.len() == 2). Verified against sea-orm 1.1.20 in isolation.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
cargo testfor theservicemodule currently fails to compile, turning Backend CI red onmainand on every open PR. The error:Root cause
In
test_list_games_query_structureandtest_list_games_with_cursor, the count query's mock result set is an untyped emptyvec![]. Under sea-orm 1.1.20 the additionalIntoMockRowimpls make the element type of an empty vec ambiguous, soappend_query_results::<T, _, _>can no longer inferT. (Introduced when the count query result set was added in the pagination work — the data-query set compiles fine becausegame::Modelpins its type.)Fix
Type the empty count set as
Vec::<game::Model>::new()soT: IntoMockRowis inferable. No behavior change —count()on an empty mock result resolves to0and execution continues to the data query, so both queries still run andtransaction_log.len() == 2still holds.Verification
Built in isolation against sea-orm 1.1.20 (the workspace can't build the full
servicecrate locally due to an unrelated OpenSSL dev-dep). A minimal entity reproducing the exact flow confirms:i.e. the typed empty set compiles,
count()returns 0 without error, and both the count and data queries execute — matching each test's assertions.