Skip to content

Improve SwiftData repo init and controller input handling - #4

Merged
nafields merged 2 commits into
mainfrom
main_bug_hunt
Apr 10, 2026
Merged

Improve SwiftData repo init and controller input handling#4
nafields merged 2 commits into
mainfrom
main_bug_hunt

Conversation

@nafields

@nafields nafields commented Apr 9, 2026

Copy link
Copy Markdown
Owner

Add configurable SwiftData repository store path and robust initialization: SwiftDataLibraryRepository gains makeModelContainer to create parent directories, handle unreadable/incompatible on-disk stores by removing sqlite artifacts (-shm/-wal) and retrying, and helper methods to ensure directories. LibraryHydrationWorker and LibraryController now accept/produce an explicit repository store URL. MetadataCacheStore.cacheURL ensures cache directories exist. LibraryPersistenceCoordinator clears legacy swiftdata artifacts when wiping caches. Closes #2

WIP: Refactor input plumbing to use StreamingSessionFacade: StreamRuntimeAttachmentService and StreamController pass the session instead of an InputQueue, and InputController now accepts a session, reports gamepad connection state via a session callback, and runs a MainActor polling task to enqueue gamepad frames continuously (with idle/frame suppression logic). Tests updated and new SwiftDataLibraryRepository tests added for unreadable-store reset and parent directory creation. Closes #3

nafields and others added 2 commits April 9, 2026 11:23
Add configurable SwiftData repository store path and robust initialization: SwiftDataLibraryRepository gains makeModelContainer to create parent directories, handle unreadable/incompatible on-disk stores by removing sqlite artifacts (-shm/-wal) and retrying, and helper methods to ensure directories. LibraryHydrationWorker and LibraryController now accept/produce an explicit repository store URL. MetadataCacheStore.cacheURL ensures cache directories exist. LibraryPersistenceCoordinator clears legacy swiftdata artifacts when wiping caches.

Refactor input plumbing to use StreamingSessionFacade: StreamRuntimeAttachmentService and StreamController pass the session instead of an InputQueue, and InputController now accepts a session, reports gamepad connection state via a session callback, and runs a MainActor polling task to enqueue gamepad frames continuously (with idle/frame suppression logic). Tests updated and new SwiftDataLibraryRepository tests added for unreadable-store reset and parent directory creation.
Replace controller polling with an explicit active streaming session binding and simplify controller observation: store the active StreamingSessionFacade, use its inputQueue for injected frames, and call setGamepadConnectionState on the session instead of an external callback. Remove the controller polling loop and related enqueue logic, and enqueue idle frames in suppressing branches to avoid sending unwanted input.

Add raw outbound input packet logging to InputChannel (limited emission count, hex dump and concise summary extraction) and wire the new shouldLogRawOutboundPackets hook through StreamingRuntime and tests. Also add a diagnostic log when flushing pending gamepad registration updates and make resetTransientState optionally preserve desiredGamepadConnectionState across a reconnect.

Adjust SwiftData repository initialization to use a .swiftdata store URL (delete original extension and append .swiftdata) and update tests and call sites to match the parameter label change for setupControllerObservation. Minor Xcode scheme XML reorder for TestPlans.

Temporary patches

Co-Authored-By: nafields <2613057+nafields@users.noreply.github.com>
@nafields
nafields merged commit ab67cb7 into main Apr 10, 2026
6 of 9 checks passed
@nafields
nafields deleted the main_bug_hunt branch April 10, 2026 00:40
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.

[Bug]: Controllers not working [Bug]: No launch on AppleTV 4k

1 participant