-
Notifications
You must be signed in to change notification settings - Fork 479
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: refactor protobufs and utils to remove grpc-js dependency #798
feat: refactor protobufs and utils to remove grpc-js dependency #798
Conversation
🦋 Changeset detectedLatest commit: f95eed5 The changes in this PR will be included in the next version bump. This PR includes changesets to release 5 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
@@ -0,0 +1,10 @@ | |||
--- | |||
'@farcaster/protobufs': minor |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ideally it's major change for protobufs and utils (interface not backward compatible). However, it seems that we haven't released major version of protobufs & utils yet, so I made it minor.
New dependency changes detected. Learn more about Socket for GitHub ↗︎ 👍 No new dependency issues detected in pull request Bot CommandsTo ignore an alert, reply with a comment starting with Pull request alert summary
📊 Modified Dependency Overview:
|
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## main #798 +/- ##
==========================================
- Coverage 73.03% 72.61% -0.43%
==========================================
Files 61 62 +1
Lines 5359 5379 +20
Branches 1216 1212 -4
==========================================
- Hits 3914 3906 -8
- Misses 1351 1373 +22
- Partials 94 100 +6
... and 1 file with indirect coverage changes Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report in Codecov by Sentry. |
@@ -47,6 +47,7 @@ | |||
"dependencies": { | |||
"@chainsafe/libp2p-gossipsub": "6.1.0", | |||
"@chainsafe/libp2p-noise": "^11.0.0 ", | |||
"@farcaster/hub-nodejs": "^0.6.0", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the process for package release here? We need to release and update dependency to new version in order:
protobuf, utils, hub-nodejs & hub-web, hubble app
Do we need to break this PR into multiple PRs for release purpose?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We use changesets for version control, so we can run yarn changeset version
and it will update all of these correctly.
any config to ignore the coverage for generated code? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Exciting! I think the most important question to answer is whether we want hubble to import anything from @farcaster/protobufs
or @farcaster/utils
rather than getting everything from @farcaster/hub-nodejs
. Right now it seems somewhat arbitrary which package a file picks for each import.
@@ -1,5 +1,6 @@ | |||
import * as protobufs from '@farcaster/protobufs'; | |||
import { Factories, getInsecureHubRpcClient, HubResult, HubRpcClient } from '@farcaster/utils'; | |||
import { Factories, HubResult } from '@farcaster/utils'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the reason to continue importing these from @farcaster/utils
vs from @farcaster/hub-nodejs
since hub-nodejs also exports everything from utils?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After thinking through I think it's cleaner and more consistent to just depend on hub-nodejs and use all imports there, refactored hubble
@@ -0,0 +1,124 @@ | |||
syntax = "proto3"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the reason for splitting rpc.proto into two files?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Personally feel this is slightly cleaner pattern: share whatever can be shared.
Where hub-nodejs and hub-web are different is the service/client generation part (exactly the rpc.proto after splitting). After splitting, we will be able to share like SyncIds and Empty from protobufs
@@ -18,7 +18,7 @@ | |||
"scripts": { | |||
"build": "tsup --config tsup.config.ts", | |||
"clean": "rimraf ./dist", | |||
"protoc": "protoc --plugin=./node_modules/.bin/protoc-gen-ts_proto --ts_proto_out=./src/generated/ --ts_proto_opt=esModuleInterop=true,exportCommonSymbols=false,outputServices=grpc-js,useOptionals=none,unrecognizedEnum=false,removeEnumPrefix=true --proto_path=./src/schemas ./src/schemas/*", | |||
"protoc": "protoc --plugin=./node_modules/.bin/protoc-gen-ts_proto --ts_proto_out=./src/generated/ --ts_proto_opt=esModuleInterop=true,exportCommonSymbols=false,outputServices=false,useOptionals=none,unrecognizedEnum=false,removeEnumPrefix=true --proto_path=./src/schemas ./src/schemas/*", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we get rid of @farcaster/protobufs
entirely and just add a protoc command to @farcaster/utils
to generate the non-service protobuf classes for itself?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes this is exactly next step: completely merge these two into a single package. Was planning to do it in separate PR.
@sds do you know how to let codecov/path and codecov/project skip generated code from grpc? I think now they're failing because of generated code. |
I didn't set this tool up, so I'm not familiar with it (honestly didn't even know this existed until now 🙂). It looks like we could specify the CC @pfletcherhill @varunsrin how much do we care about code coverage requirements being met? |
fine to merge without code coverage requirements, theyre not meant to be blocking just a guide but it would be nice if we added that to the ignore file to keep the code coverage metrics useful |
I
I think the codecov ignored the previous generated code in the protobufs package, but it's not in the codecov.yml. We should definitely fix so the metric is useful. |
c1a7796
to
511ef02
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me! One minor change and a question, otherwise ready to merge.
@@ -1,5 +1,5 @@ | |||
import * as protobufs from '@farcaster/protobufs'; | |||
import { Factories } from '@farcaster/utils'; | |||
import * as hub_nodejs from '@farcaster/hub-nodejs'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: can you camelCase this variable?
|
||
export * from './generated/rpc'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need to export from ./generated/request_response
too? Or does the export of that file from @farcaster/protobufs
work with the services exported from ./generated/rpc
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried locally using FidRequest (one of the request_response), so the export was from @farcaster/protobufs but things work well when I feed into rpc request.
Motivation
Part of #573, removed grpc-js dependency from protobufs (thus utils).
Change Summary
Merge Checklist
Choose all relevant options below by adding an
x
now or at any time before submitting for reviewAdditional Context