Skip to content

Add generic FfiInstruction base classes, simplify 8 instruction types#231

Merged
MaxHeimbrock merged 2 commits intomainfrom
max/generic-ffi-instruction
Apr 13, 2026
Merged

Add generic FfiInstruction base classes, simplify 8 instruction types#231
MaxHeimbrock merged 2 commits intomainfrom
max/generic-ffi-instruction

Conversation

@MaxHeimbrock
Copy link
Copy Markdown
Contributor

Summary

  • Introduce FfiInstruction<TCallback> and FfiStreamInstruction<TCallback> as generic base classes in Runtime/Scripts/Internal/FfiInstruction.cs for the common one-shot FFI callback pattern (register callback, check error, set IsDone).
  • Replace 8 boilerplate instruction classes (SetLocalMetadataInstruction, SetLocalNameInstruction, SetLocalAttributesInstruction, UnpublishTrackInstruction, and the WriteInstruction/CloseInstruction pairs in both TextStreamWriter and ByteStreamWriter) with thin subclasses that delegate to the generic base.
  • Net reduction of ~120 lines of duplicated code with no behavioral change.

Test plan

  • Verify existing unit/integration tests pass (the 8 simplified instruction types have identical runtime behavior)
  • Confirm SetMetadata, SetName, SetAttributes, UnpublishTrack still work in a live room
  • Confirm text/byte stream Write and Close operations still complete correctly

🤖 Generated with Claude Code

MaxHeimbrock and others added 2 commits April 9, 2026 13:56
Introduce FfiInstruction<TCallback> and FfiStreamInstruction<TCallback>
as generic base classes for the common one-shot FFI callback pattern.
Replace 8 identical instruction classes with thin subclasses that
delegate to the base, eliminating ~200 lines of duplicated boilerplate.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@MaxHeimbrock MaxHeimbrock merged commit b62484d into main Apr 13, 2026
14 checks passed
@MaxHeimbrock MaxHeimbrock deleted the max/generic-ffi-instruction branch April 13, 2026 07:48
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