Add int-type Authz ID proto fields alongside any string-type proto fields#8754
Open
ezekiel wants to merge 2 commits into
Open
Add int-type Authz ID proto fields alongside any string-type proto fields#8754ezekiel wants to merge 2 commits into
ezekiel wants to merge 2 commits into
Conversation
This is stage one of normalizing Authz ID to be consistently int64-type.
ezekiel
commented
May 20, 2026
|
|
||
| // TODO(#8722): remove this whole thing when Authz IDs are int64-only | ||
| var authzID int64 | ||
| if len(strings.TrimSpace(req.AuthzID)) > 0 { |
Member
Author
There was a problem hiding this comment.
Maybe this would be better to just collapse into:
if authzID, err := strconv.ParseInt() {
?
aarongable
requested changes
May 20, 2026
Comment on lines
+272
to
+273
| ID string `json:"-"` | ||
| IDInt int64 `json:"-"` |
Contributor
There was a problem hiding this comment.
Rather than carrying these side-by-side, the in-memory core.Authorization should only have an int field. We'll use pb-marshalling.go to ensure that the int is always appropriately populated.
Suggested change
| ID string `json:"-"` | |
| IDInt int64 `json:"-"` | |
| ID int64 `json:"-"` |
Comment on lines
294
to
+295
| Id: authz.ID, | ||
| IdInt: authz.IDInt, |
Contributor
There was a problem hiding this comment.
Since core.Authorization now only has an int64 ID field, use that to populate both protobuf fields:
Suggested change
| Id: authz.ID, | |
| IdInt: authz.IDInt, | |
| Id: fmt.Sprintf("%d", authz.ID), | |
| IdInt: authz.ID, |
Comment on lines
320
to
+321
| ID: pb.Id, | ||
| IDInt: pb.IdInt, |
Contributor
There was a problem hiding this comment.
This one is harder, but what we want to do is:
- Try to populate ID from pb.IdInt;
- But if that's zero, instead try to parse pb.Id from a string to and int;
- But if that fails or is also zero, return an error.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is stage one of normalizing Authz ID to be consistently int64-type (#8722).