Skip to content
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

APP-7232 Fix fragment usage protos #607

Merged
merged 2 commits into from
Dec 19, 2024
Merged

Conversation

ehhong
Copy link
Member

@ehhong ehhong commented Dec 17, 2024

Overview

Bozo move here. Fixing some mistakes that were not caught during review. These values are not being used anywhere yet so breaking change should be okay.

@ehhong ehhong requested a review from mcous December 17, 2024 23:00
@github-actions github-actions bot added the safe to test committer is a member of this org label Dec 17, 2024
int32 fragment_id = 1;
int64 organizations = 2;
int64 machines = 3;
int64 machines_in_current_org = 4;
Copy link
Member Author

Choose a reason for hiding this comment

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

@michaellee1019 do we have a standard on when we're using int32 versus int64? seems pretty inconsistent right now. i realized that int64 casts to a string in the frontend protos, which forces us to do a cast to use the values. i'm leaning towards using int32 unless we're convinced we really need int64

Copy link
Member

Choose a reason for hiding this comment

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

Huh I did not realize that. I've used int64 for other things and this never came up. I believe you and fine to move to int32. We have quite a while before 2.1 Billion machines use a fragment. I'm optimistic though. Max length is really only the reason.

Copy link
Member

@mcous mcous Dec 19, 2024

Choose a reason for hiding this comment

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

FWIW long_type_string a buf configuration option that we could choose to disable. IIRC int64 it will be a BigInt if we turn this off. BigInt has it's own issues, I agree that int32 is probably fine and not going to be the thing that breaks first as we scale

https://github.com/viamrobotics/app/blob/4af3eb4a1e3acd6c97346a63aca49a8b9fb92e4b/web-client/buf.gen.yaml#L5

version: v1
plugins:
  - name: ts
    out: .
    opt: generate_dependencies,force_optimize_code_size,long_type_string,ts_nocheck
    strategy: all

Copy link
Member Author

@ehhong ehhong Dec 19, 2024

Choose a reason for hiding this comment

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

i think for this use case we should stick with int32, but good to know for the future

Copy link
Member

Choose a reason for hiding this comment

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

Also @mcous do you think at some point we could use the TS SDK directly? The SDK is already correctly using bigint for example: https://ts.viam.dev/classes/appApi.RegistryItem.html#totalExternalRobotUsage

@ehhong ehhong added the ready-for-protos add this when you want protos to compile on every commit label Dec 18, 2024
@ehhong ehhong removed the ready-for-protos add this when you want protos to compile on every commit label Dec 18, 2024
@stevebriskin stevebriskin merged commit 17d5c5b into main Dec 19, 2024
2 of 3 checks passed
@ehhong ehhong deleted the APP-7232/ehhong/fragment-usage branch December 19, 2024 16:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
protos-compiled safe to test committer is a member of this org
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants