Skip to content

Typed message protocol between UI and worker#101

Merged
csxark merged 2 commits into
csxark:mainfrom
Aditya8369:82
Jul 9, 2026
Merged

Typed message protocol between UI and worker#101
csxark merged 2 commits into
csxark:mainfrom
Aditya8369:82

Conversation

@Aditya8369

Copy link
Copy Markdown
Contributor

I have successfully completed implementing the Typed Message Protocol between the UI hook and the background Web Worker.

Summary of Changes
types/worker.ts (NEW):

Defined strict interfaces for WorkerRequest ({ type, requestId, payload }) and WorkerResponse ({ requestId, success, payload, timings }).
lib/hooks/useCipherWorker.ts:

Refactored the hook to compile and JSON-serialize the strictly structured request payload.
Refactored onmessage handling to validate and process responses conforming to WorkerResponse.
lib/workers/cipher.worker.ts:

Refactored parameters destructuring directly out of the typed payload request object.
Enforced total job execution timing tracking using performance.now().
Sent strictly structured response messages containing calculation results/errors and timings.
tests/unit/hooks/useCipherWorker.test.ts:

Refactored the unit test suite to fully type-check requests and responses. All unit tests successfully compiled and passed.

closes #82

@vercel

vercel Bot commented Jul 9, 2026

Copy link
Copy Markdown

@Aditya8369 is attempting to deploy a commit to the csxark's projects Team on Vercel.

A member of the Team first needs to authorize it.

@coderabbitai

coderabbitai Bot commented Jul 9, 2026

Copy link
Copy Markdown

Caution

Review failed

An error occurred during the review process. Please try again later.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@csxark csxark left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Great work @Aditya8369, and thank you for your contribution! 🎉I've reviewed the changes, and everything looks good. The requested fixes have been addressed correctly, and the implementation aligns well with the requirements. This is ready to be merged. Looking forward to your future contributions!

@csxark csxark added the ECSoC26 Elite Coders Summer of Code 2026 label Jul 9, 2026
@csxark csxark merged commit b81d93c into csxark:main Jul 9, 2026
2 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ECSoC26-L3 ECSoC26 Elite Coders Summer of Code 2026

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Typed message protocol between UI and worker

2 participants