From e3659f74bed62c98a9efd0e076c0ec6d43d19632 Mon Sep 17 00:00:00 2001 From: lberrymage Date: Fri, 16 Oct 2026 02:41:56 +0000 Subject: [PATCH] Use `int64` for counts/sizes by default Until now, we've been using uint32 to represent "small", non-negative values in our protobuf schema. However, there are a couple of issues with doing this: - Multiple languages including Kotlin/Java (which we use extensively on both our main client and server) don't have unsigned integer types either in the language or in protobuf generated code, forcing us to transfer unsigned values in and out of signed integer types and perform fallible conversions when interoperating with other code. - "small" is not well-defined, and while unlikely for many fields, it is quite possible for us to outgrow a uint32 for certain APIs. int64 has the same wire encoding as uint32 while mostly resolving the first issue and clearly resolving the second, so it seems to make sense to use it instead of uint32 everywhere (with appropriate protovalidate annotations to forbid negative values). Admittedly, one downside of int64 over int32 is that it isn't the "native" collection size type on the JVM on in JavaScript, so conversions might be necessary in some places. However, int32 -> int64 conversion is lossless, TypeScript/JavaScript have bigint literals for convenience, and overall it looks like using int64 by default across the API will reduce the number of conversions we have to do in our code, though we might need slightly more in TypeScript code. The "by default" is because some fields clearly have a different integer type which is defined by some external system and so should be represented similarly in our API for better interoperability. For example, right now AppPackage.target_sdk is still int32 because that's the type defined by the Android platform. --- .../v1/list_app_draft_listings_request.proto | 2 +- .../console/v1/list_app_drafts_request.proto | 2 +- .../v1/list_app_edit_listings_request.proto | 2 +- .../console/v1/list_app_edits_request.proto | 2 +- .../v1/list_app_listings_request.proto | 2 +- accrescent/console/v1/list_apps_request.proto | 2 +- accrescent/console/v1/organization.proto | 20 +++++++++++++++---- 7 files changed, 22 insertions(+), 10 deletions(-) diff --git a/accrescent/console/v1/list_app_draft_listings_request.proto b/accrescent/console/v1/list_app_draft_listings_request.proto index e9bf0bc..b0c8b8b 100644 --- a/accrescent/console/v1/list_app_draft_listings_request.proto +++ b/accrescent/console/v1/list_app_draft_listings_request.proto @@ -19,7 +19,7 @@ message ListAppDraftListingsRequest { // The maximum number of app draft listings to return in the response. If // unspecified, defaults to 50. All requests with a higher page size will be // capped to 50. - optional uint32 page_size = 2 [(buf.validate.field).uint32.gt = 0]; + optional int64 page_size = 2 [(buf.validate.field).int64.gt = 0]; // An opaque page continuation token returned in a previous // ListAppDraftListingsResponse. If unspecified, the first page is returned. diff --git a/accrescent/console/v1/list_app_drafts_request.proto b/accrescent/console/v1/list_app_drafts_request.proto index e9a1f25..4a6c669 100644 --- a/accrescent/console/v1/list_app_drafts_request.proto +++ b/accrescent/console/v1/list_app_drafts_request.proto @@ -18,7 +18,7 @@ message ListAppDraftsRequest { // The maximum number of app drafts to return in the response. If unspecified, // defaults to 50. All requests with a higher page size will be capped to 50. - optional uint32 page_size = 2 [(buf.validate.field).uint32.gt = 0]; + optional int64 page_size = 2 [(buf.validate.field).int64.gt = 0]; // An opaque page continuation token returned in a previous // ListAppDraftsResponse. If unspecified, the first page is returned. diff --git a/accrescent/console/v1/list_app_edit_listings_request.proto b/accrescent/console/v1/list_app_edit_listings_request.proto index 58edeac..a2b11d2 100644 --- a/accrescent/console/v1/list_app_edit_listings_request.proto +++ b/accrescent/console/v1/list_app_edit_listings_request.proto @@ -19,7 +19,7 @@ message ListAppEditListingsRequest { // The maximum number of app edit listings to return in the response. If // unspecified, defaults to 50. All requests with a higher page size will be // capped to 50. - optional uint32 page_size = 2 [(buf.validate.field).uint32.gt = 0]; + optional int64 page_size = 2 [(buf.validate.field).int64.gt = 0]; // An opaque page continuation token returned in a previous // ListAppEditListingsResponse. If unspecified, the first page is returned. diff --git a/accrescent/console/v1/list_app_edits_request.proto b/accrescent/console/v1/list_app_edits_request.proto index 555682a..a28686c 100644 --- a/accrescent/console/v1/list_app_edits_request.proto +++ b/accrescent/console/v1/list_app_edits_request.proto @@ -18,7 +18,7 @@ message ListAppEditsRequest { // The maximum number of app edits to return in the response. If unspecified, // defaults to 50. All requests with a higher page size will be capped to 50. - optional uint32 page_size = 2 [(buf.validate.field).uint32.gt = 0]; + optional int64 page_size = 2 [(buf.validate.field).int64.gt = 0]; // An opaque page continuation token returned in a previous // ListAppEditsResponse. If unspecified, the first page is returned. diff --git a/accrescent/console/v1/list_app_listings_request.proto b/accrescent/console/v1/list_app_listings_request.proto index 8eefb88..4504457 100644 --- a/accrescent/console/v1/list_app_listings_request.proto +++ b/accrescent/console/v1/list_app_listings_request.proto @@ -19,7 +19,7 @@ message ListAppListingsRequest { // The maximum number of app listings to return in the response. If // unspecified, defaults to 50. All requests with a higher page size will be // capped to 50. - optional uint32 page_size = 2 [(buf.validate.field).uint32.gt = 0]; + optional int64 page_size = 2 [(buf.validate.field).int64.gt = 0]; // An opaque page continuation token returned in a previous // ListAppListingsResponse. If unspecified, the first page is returned. diff --git a/accrescent/console/v1/list_apps_request.proto b/accrescent/console/v1/list_apps_request.proto index 8655730..5721fb3 100644 --- a/accrescent/console/v1/list_apps_request.proto +++ b/accrescent/console/v1/list_apps_request.proto @@ -18,7 +18,7 @@ message ListAppsRequest { // The maximum number of apps to return in the response. If unspecified, // defaults to 50. All requests with a higher page size will be capped to 50. - optional uint32 page_size = 2 [(buf.validate.field).uint32.gt = 0]; + optional int64 page_size = 2 [(buf.validate.field).int64.gt = 0]; // An opaque page continuation token returned in a previous ListAppsResponse. // If unspecified, the first page is returned. diff --git a/accrescent/console/v1/organization.proto b/accrescent/console/v1/organization.proto index fdcbf71..9935211 100644 --- a/accrescent/console/v1/organization.proto +++ b/accrescent/console/v1/organization.proto @@ -17,14 +17,26 @@ message Organization { optional string id = 1 [(buf.validate.field).required = true]; // The maximum number of published apps allowed to exist under this organization. - optional uint32 published_app_limit = 2 [(buf.validate.field).required = true]; + optional int64 published_app_limit = 2 [ + (buf.validate.field).required = true, + (buf.validate.field).int64.gte = 0 + ]; // The current number of published apps in this organization. - optional uint32 published_app_count = 3 [(buf.validate.field).required = true]; + optional int64 published_app_count = 3 [ + (buf.validate.field).required = true, + (buf.validate.field).int64.gte = 0 + ]; // The maximum number of active app drafts allowed to exist under this organization. - optional uint32 active_app_draft_limit = 4 [(buf.validate.field).required = true]; + optional int64 active_app_draft_limit = 4 [ + (buf.validate.field).required = true, + (buf.validate.field).int64.gte = 0 + ]; // The current number of active app drafts in this organization. - optional uint32 active_app_draft_count = 5 [(buf.validate.field).required = true]; + optional int64 active_app_draft_count = 5 [ + (buf.validate.field).required = true, + (buf.validate.field).int64.gte = 0 + ]; }