Skip to content

feat: physics2d Cardinal integration tests#881

Closed
AnthonyWadham wants to merge 1 commit intoAnthony/fix-archtypefrom
Anthony/physics-test
Closed

feat: physics2d Cardinal integration tests#881
AnthonyWadham wants to merge 1 commit intoAnthony/fix-archtypefrom
Anthony/physics-test

Conversation

@AnthonyWadham
Copy link
Copy Markdown
Contributor

@AnthonyWadham AnthonyWadham commented Mar 31, 2026

TL;DR

Removes detailed comment from physics collider field and adds comprehensive Cardinal-driven integration tests for the physics2d plugin.

What changed?

  • Removed detailed comment from GroupIndex field in ColliderShape struct, keeping only the field declaration
  • Created extensive Cardinal-driven integration tests (cardinal_integration_test.go) for the physics2d plugin that:
    • Tests a complete physics scene with floor, ball, sensor, walls, triangle, and compound bodies
    • Verifies contact/trigger events, query APIs (raycast, AABB overlap, circle sweep), and incremental reconciliation
    • Simulates crash scenarios with ResetRuntime() to test synthetic event generation
    • Validates entity creation, destruction, and transform updates during simulation
    • Uses reflection to access Cardinal's internal ECS world initialization for manual world driving

How to test?

Run the new integration test:

go test ./pkg/plugin/physics2d/test/

The test creates a Cardinal world, registers the physics plugin, runs 360+ ticks of simulation, and validates physics behavior including collision detection, query operations, and crash recovery scenarios.

Why make this change?

The comprehensive integration tests provide end-to-end validation of the physics2d plugin's integration with Cardinal, ensuring proper system event handling, query functionality, and crash recovery behavior that unit tests cannot cover. The tests verify the complete tick lifecycle (PreUpdate reconcile, Update step, PostUpdate) and validate that the plugin correctly handles ECS changes, entity lifecycle events, and runtime crashes with proper recovery.

Copy link
Copy Markdown
Contributor Author

AnthonyWadham commented Mar 31, 2026

Warning

This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
Learn more


How to use the Graphite Merge Queue

Add the label graphite/merge to this PR to add it to the merge queue.

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has enabled the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

This stack of pull requests is managed by Graphite. Learn more about stacking.

@AnthonyWadham AnthonyWadham changed the title feat: physics2D integration tests feat: add InitSchedulers method and physics2d Cardinal integration tests Mar 31, 2026
@AnthonyWadham AnthonyWadham changed the title feat: add InitSchedulers method and physics2d Cardinal integration tests feat: physics2d Cardinal integration tests Mar 31, 2026
@AnthonyWadham AnthonyWadham force-pushed the Anthony/physics2d-components branch from a306990 to 2a9db46 Compare March 31, 2026 23:21
@AnthonyWadham AnthonyWadham force-pushed the Anthony/physics2d-components branch from 2a9db46 to 349a200 Compare April 1, 2026 19:47
@AnthonyWadham AnthonyWadham force-pushed the Anthony/physics-test branch from 95b4e31 to b78a11e Compare April 1, 2026 19:47
@AnthonyWadham AnthonyWadham force-pushed the Anthony/physics2d-components branch from 349a200 to a46fb0f Compare April 1, 2026 19:57
@AnthonyWadham AnthonyWadham force-pushed the Anthony/physics-test branch from b78a11e to 827ef2b Compare April 1, 2026 19:57
@AnthonyWadham AnthonyWadham marked this pull request as ready for review April 1, 2026 20:02
@AnthonyWadham AnthonyWadham requested a review from rmrt1n April 1, 2026 20:02
@AnthonyWadham AnthonyWadham force-pushed the Anthony/physics2d-components branch from a46fb0f to e015af6 Compare April 1, 2026 20:06
@AnthonyWadham AnthonyWadham force-pushed the Anthony/physics-test branch 2 times, most recently from df02eeb to bfea11f Compare April 2, 2026 15:08
@AnthonyWadham AnthonyWadham changed the base branch from Anthony/physics2d-components to Anthony/fix-component-updates-post-step April 2, 2026 15:08
@AnthonyWadham AnthonyWadham force-pushed the Anthony/fix-component-updates-post-step branch from c66bed2 to 6bf8afb Compare April 2, 2026 18:31
@AnthonyWadham AnthonyWadham force-pushed the Anthony/physics-test branch 2 times, most recently from bbec663 to 95f7a23 Compare April 2, 2026 19:49
@AnthonyWadham AnthonyWadham changed the base branch from Anthony/fix-component-updates-post-step to Anthony/add-missing-shapes April 2, 2026 19:49
@codecov
Copy link
Copy Markdown

codecov bot commented Apr 2, 2026

❌ 2 Tests Failed:

Tests completed Failed Passed Skipped
193 2 191 4
View the top 2 failed test(s) by shortest run time
::TestMain
Stack Traces | 0s run time
to reproduce: TEST_SEED=0x69d6aeb2
panic: test timed out after 10m0s
	running tests:
		TestArchetype_ModelFuzz (10m0s)

goroutine 574757 [running]:
testing.(*M).startAlarm.func1()
	.../hostedtoolcache/go/1.25.5.../src/testing/testing.go:2682 +0x345
created by time.goFunc
	.../hostedtoolcache/go/1.25.5.../src/time/sleep.go:215 +0x2d

goroutine 1 [chan receive, 9 minutes]:
testing.tRunner.func1()
	.../hostedtoolcache/go/1.25.5.../src/testing/testing.go:1891 +0x451
testing.tRunner(0xc000182fc0, 0xc000235c70)
	.../hostedtoolcache/go/1.25.5.../src/testing/testing.go:1940 +0x123
testing.runTests(0xc0001aa288, {0xedf940, 0x18, 0x18}, {0x7?, 0xc0001ad3c0?, 0xee8fe0?})
	.../hostedtoolcache/go/1.25.5.../src/testing/testing.go:2475 +0x4b4
testing.(*M).Run(0xc0001a1040)
	.../hostedtoolcache/go/1.25.5.../src/testing/testing.go:2337 +0x63a
main.main()
	_testmain.go:101 +0x9b

goroutine 21 [runnable]:
math/rand/v2.(*Rand).uint64n(0xc0001a7300, 0x1)
	.../hostedtoolcache/go/1.25.5.../rand/v2/rand.go:81 +0xc5
math/rand/v2.(*Rand).IntN(...)
	.../hostedtoolcache/go/1.25.5.../rand/v2/rand.go:195
github..../cardinal/internal/ecs.TestArchetype_ModelFuzz(0xc000183180)
	.../internal/ecs/archetype_internal_test.go:86 +0x14b5
testing.tRunner(0xc000183180, 0xa4ed98)
	.../hostedtoolcache/go/1.25.5.../src/testing/testing.go:1934 +0xea
created by testing.(*T).Run in goroutine 1
	.../hostedtoolcache/go/1.25.5.../src/testing/testing.go:1997 +0x465
FAIL	github..../cardinal/internal/ecs	600.020s
github.com/argus-labs/world-engine/pkg/cardinal/internal/ecs::TestArchetype_ModelFuzz
Stack Traces | 0s run time
=== RUN   TestArchetype_ModelFuzz
=== PAUSE TestArchetype_ModelFuzz
=== CONT  TestArchetype_ModelFuzz

To view more test analytics, go to the Test Analytics Dashboard
📋 Got 3 mins? Take this short survey to help us improve Test Analytics.

@AnthonyWadham AnthonyWadham force-pushed the Anthony/add-missing-shapes branch from 9426240 to 407ce21 Compare April 7, 2026 16:03
@AnthonyWadham AnthonyWadham force-pushed the Anthony/physics-test branch from 95f7a23 to 0b4b860 Compare April 7, 2026 16:03
@AnthonyWadham AnthonyWadham changed the base branch from Anthony/add-missing-shapes to Anthony/fix-archtype April 7, 2026 16:03
@AnthonyWadham AnthonyWadham force-pushed the Anthony/fix-archtype branch from 82f0d7c to b84c1ad Compare April 7, 2026 16:05
@AnthonyWadham AnthonyWadham force-pushed the Anthony/physics-test branch from 0b4b860 to 0f421d7 Compare April 7, 2026 16:05
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.

1 participant