Skip to content

Batch 4: FFI boundary & memory coverage#254

Merged
MaxHeimbrock merged 3 commits into
mainfrom
max/more-test/batch-4
Apr 28, 2026
Merged

Batch 4: FFI boundary & memory coverage#254
MaxHeimbrock merged 3 commits into
mainfrom
max/more-test/batch-4

Conversation

@MaxHeimbrock
Copy link
Copy Markdown
Contributor

@MaxHeimbrock MaxHeimbrock commented Apr 20, 2026

Adds 5 tests covering FFI boundary behaviors that previously had no coverage:

EditMode (2 tests, Tests/EditMode/RoomDisconnectTests.cs):

  • Disconnect on a never-connected Room (no FFI handle) does not throw
  • Disconnect called twice on an unconnected Room is idempotent

PlayMode (3 tests, Tests/PlayMode/FfiBoundaryTests.cs):

  • Disconnect called twice on a connected Room is idempotent
  • PerformRpc with a 14 KiB ASCII payload round-trips correctly (tests large-payload marshaling in both directions: request payload and response string)
  • Three concurrent PerformRpc invocations dispatched without yielding between them all complete with their own distinct payloads, exercising the FFI request memory pool and confirming request_async_id uniqueness

@MaxHeimbrock MaxHeimbrock force-pushed the max/more-tests/batch-3 branch from c0d18b3 to 2cd8da6 Compare April 23, 2026 10:19
@MaxHeimbrock MaxHeimbrock force-pushed the max/more-test/batch-4 branch from 4b2ba78 to 402df21 Compare April 23, 2026 12:30
@MaxHeimbrock MaxHeimbrock marked this pull request as ready for review April 23, 2026 12:32
Copy link
Copy Markdown
Contributor

@ladvoc ladvoc left a comment

Choose a reason for hiding this comment

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

LGTM ✅

Comment thread Tests/PlayMode/FfiBoundaryTests.cs Outdated
}

[UnityTest, Category("E2E")]
public IEnumerator PerformRpc_NearLimitPayload_EchoesRoundTrip()
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

question: Should this go in a separate RPC test suite?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Agreed, will do that now.

@MaxHeimbrock MaxHeimbrock force-pushed the max/more-tests/batch-3 branch 2 times, most recently from ff54eae to a4b9e83 Compare April 27, 2026 10:03
@MaxHeimbrock MaxHeimbrock force-pushed the max/more-tests/batch-3 branch from a4b9e83 to 219a093 Compare April 27, 2026 15:08
MaxHeimbrock and others added 2 commits April 27, 2026 17:10
Adds 5 tests covering FFI boundary behaviors that previously had no coverage:

EditMode (2 tests, Tests/EditMode/RoomDisconnectTests.cs):
- Disconnect on a never-connected Room (no FFI handle) does not throw
- Disconnect called twice on an unconnected Room is idempotent

These exercise the `RoomHandle == null` early-return at Room.cs:186 so
client-side cleanup code can safely call Disconnect without tracking
connection state.

PlayMode (3 tests, Tests/PlayMode/FfiBoundaryTests.cs):
- Disconnect called twice on a connected Room is idempotent
- PerformRpc with a 14 KiB ASCII payload round-trips correctly (tests
  large-payload marshaling in both directions: request payload and
  response string)
- Three concurrent PerformRpc invocations dispatched without yielding
  between them all complete with their own distinct payloads, exercising
  the FFI request memory pool and confirming request_async_id uniqueness

Validation: EditMode 2/2 pass; PlayMode -n 5 * 3 tests = 15/15, zero flakes.

Originally-planned items from the coverage-expansion plan that were dropped
after inspection:
- Request cancellation path: CancelPendingCallback is internal cleanup API
  and cannot be triggered deterministically from tests without
  instrumentation.
- Isolated memory-pool behavior under sequential requests: no observable
  signal without instrumentation; concurrent RPC above exercises the pool
  indirectly and asserts correctness at the API level.
- Handle release variants: all touch FfiHandle disposal, which is CLT-2773
  territory and explicitly out of scope for this pass.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@MaxHeimbrock MaxHeimbrock force-pushed the max/more-test/batch-4 branch from 402df21 to 71d7245 Compare April 27, 2026 15:11
@MaxHeimbrock MaxHeimbrock changed the base branch from max/more-tests/batch-3 to main April 27, 2026 15:11
@MaxHeimbrock MaxHeimbrock merged commit 9d3e498 into main Apr 28, 2026
15 checks passed
@MaxHeimbrock MaxHeimbrock deleted the max/more-test/batch-4 branch April 28, 2026 06:01
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.

3 participants