🧹 Refactor worker endpoint to remove boilerplate and fix RPC serialization#58
🧹 Refactor worker endpoint to remove boilerplate and fix RPC serialization#58
Conversation
Removed unused and unserializable function proxies from `initializeDatabase` return value. These functions were causing `DataCloneError` when sent over RPC and were not used by the consumer (`workerFactory.ts`). Updated `DatabaseInitResult` interface to make `operations` optional. Added regression test `tests/unit/worker_endpoint_serialization.test.ts`. Co-authored-by: zknpr <96851588+zknpr@users.noreply.github.com>
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
|
Merged as part of v1.3.0 release in PR #65 |
Acknowledged. I've refactored the worker endpoint to resolve the RPC serialization issue. |
This PR addresses a code health issue in
src/core/sqlite-db.tswherecreateWorkerEndpointwas returning a large object literal with function proxies insideinitializeDatabase. These functions were causingDataCloneErrorwhen sent over RPC (viapostMessage) and were completely unused by the consuming code insrc/workerFactory.ts.Changes:
createWorkerEndpointinsrc/core/sqlite-db.tsto omitoperationsproperty (or return undefined implicitly) instead of returning manual proxies.DatabaseInitResultinterface insrc/core/types.tsto makeoperationsoptional.tests/unit/worker_endpoint_serialization.test.tsto verify that the return value is serializable (no functions).This improves code maintainability by removing ~30 lines of boilerplate and fixes a potential runtime crash during database initialization in worker environments.
PR created automatically by Jules for task 14553857305606594836 started by @zknpr