feat(smoke): add canonical SDK smoke against sdk_demo_backend#10
Merged
Conversation
Adds smoke_tests/smoke.dart implementing the three canonical scenarios defined in widgrensit/sdk_demo_backend/SMOKE.md (auth + WS connect, matchmaker -> match.matched, match.input -> match.state with x > x_initial + 10). The smoke imports only from package:flame_asobi/flame_asobi.dart so a green run also proves the bridge package's re-export contract holds for AsobiClient, AsobiRealtime, and the realtime event streams. The Flame mixins (HasAsobi, HasAsobiInput, AsobiNetworkSync, ...) require a running FlameGame loop and are not exercised here. Adds a GitHub Actions workflow (.github/workflows/smoke.yml) that checks out widgrensit/sdk_demo_backend, brings up its docker compose stack, runs the smoke against http://localhost:8084, dumps backend logs on failure, and tears the stack down. Pins asobi to a git ref on main until asobi-dart publishes the post-PR-#14 release that drops typed MatchInput in favour of Map<String, dynamic>; revert to a pub.dev version (>= 0.2.0) once published.
flame_asobi transitively imports `package:flame`, which depends on `dart:ui`. The standalone Dart VM does not expose `dart:ui`, so `dart run smoke_tests/smoke.dart` fails at compile time. The Flutter test VM does expose `dart:ui`, so wrapping the smoke in a `test()` block and invoking it through `flutter test` keeps the package:flame_asobi-only re-export contract intact while letting the binary actually compile and run. Functionally the smoke is unchanged: a single async test, identical canonical flow, exits non-zero on assertion or timeout. Verified locally against `widgrensit/sdk_demo_backend` running on localhost:8084: PASS.
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
Adds the canonical SDK smoke test from
sdk_demo_backend/SMOKE.mdand a CI workflow that brings up the demo backend and runs it on every PR + push to main.The smoke imports only from
package:flame_asobi/flame_asobi.dart, so a green run also proves the bridge package's re-export contract still works (AsobiClient,AsobiRealtime, the realtime event streams,PlayerState).The Flame mixins (
HasAsobi,HasAsobiInput,AsobiNetworkSync, ...) require a runningFlameGameloop and are out of scope for a headless smoke. Proving the underlying client contract holds is enough to gate releases on the upstream SDK contract.What the smoke verifies
Per SMOKE.md:
smoke_a_<ts>_<rand>,smoke_b_...), open WebSockets.match.matched— both queue with mode"demo", both receive amatch.matchedevent with the samematch_idwithin 10 s.match.input->match.state— capturex_initialfrom the firstmatch.state, send{move_x: 1, move_y: 0}viarealtime.sendMatchInput({...}), assert a subsequentmatch.stateshowsx > x_initial + 10within 3 s.asobi dependency
Pinned to a git ref on
main:The smoke depends on the post-PR-#14
sendMatchInput(Map<String, dynamic>)signature (typedMatchInputwas removed). asobi-dart0.1.0on pub.dev still has the old typed API. The git pin should be reverted to a pub.dev version (>= 0.2.0) once asobi-dart cuts a release.Out of scope
test/(class -> mixin migration). Untouched.0.1.0and the git dep is intentional for now; a follow-up PR should swap to a pub.dev version before the next release.CI
.github/workflows/smoke.ymlchecks out flame_asobi +widgrensit/sdk_demo_backend, brings updocker compose, sets up Flutter (needed because flame_asobi transitively importspackage:flutter), runsdart run smoke_tests/smoke.dartagainsthttp://localhost:8084, and dumps backend logs on failure.Test plan
cd ../sdk_demo_backend && docker compose up -d && cd - && ASOBI_URL=http://localhost:8084 dart run smoke_tests/smoke.dart->[smoke] PASS.