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

WIP: Change all applicable IDs in the project from int --> long #2352

Closed
wants to merge 69 commits into from

Conversation

SeanKilleen
Copy link
Contributor

@SeanKilleen SeanKilleen commented Aug 23, 2021

It's been a long time coming. 😆

Resolves #2351.

⚠I assume this would mandate a breaking/major release.

My Approach

If I'm going to be honest, it's a little bit "search and destroy". I'm going for wholesale change in the project and ensuring that all IDs can be longs going forward. So I'm searching with a regex of int [^=]*Id and int\? [^=]*Id and going from there.

Work

  • Find ID values
  • Change said ID values to longs
  • Do it everywhere
  • Make sure the tests pass
  • Double check int [^=]*Id search
  • Double check int\? [^=]*Id
  • Do a search for int [^=]*number just in case
  • Do a search for int\? [^=]*number just in case
  • Ensure that that the int IDs I accidentally captured as long have been changed back.

Items To Confirm / Change based on feedback

  • PullRequestReview.Number Seems like it should remain int, given it's the display value and I don't think we're in danger of running out there) leaving alone for now per comments.
  • Account.DiskUsage should this remain an int? Need to double-check on how it's used. leaving alone per comments
  • GpgKey.PrimaryKeyId this is an int?. Not sure enough of the usage to change it right away Treating like an ID but ensuring it handles null. (Update: leaving this alone as API defines it a an int.)

@SeanKilleen SeanKilleen changed the title Change all IDs in the project from int --> long WIP": Change all IDs in the project from int --> long Aug 23, 2021
@SeanKilleen SeanKilleen changed the title WIP": Change all IDs in the project from int --> long WIP: Change all IDs in the project from int --> long Aug 23, 2021
@shiftkey
Copy link
Member

⚠I assume this would mandate a breaking/major release.

I worry about updating to 1.0 but am happy to do a big breaking changes note for this release.

@SeanKilleen
Copy link
Contributor Author

@shiftkey actually I think given the weight of 1.0 release and the current availability of maintainers, I'd keep it as the next 0.x and publicize the changes. We can make sure there's a good write-up in the release notes.

@SeanKilleen
Copy link
Contributor Author

SeanKilleen commented Aug 23, 2021

An update here -- it's clear at this point from the many "oops" commits that I misunderstood that many IDs in the API level are indeed intended to be ints even if I might expect them to exceed that boundary at some point. 😅

So, my next steps to get through this are:

  • Make the branch work, tests and all, with the changes I've already made
  • Go back through every change and ensure it is in line with the API v3 specifications, and correct where it's not
  • Once again ensure everything is building and passing.

At that point we should be back on the right track.

@SeanKilleen SeanKilleen changed the title WIP: Change all IDs in the project from int --> long WIP: Change all applicable IDs in the project from int --> long Aug 23, 2021
@SeanKilleen
Copy link
Contributor Author

SeanKilleen commented Aug 23, 2021

Sigh....this is on me. @shiftkey, the more I look at it, the more these IDs are correctly ints in the API docs and my mapping them to longs looks incorrect. I think I should have done more research before jumping into this. But I am not deterred. 😄

We have a few options:

  • Revert any IDs that aren't explicitly longs in the API docs
  • Convert IDs to longs regardless of API docs, for graceful upgrades in the future, given that since we're reading there's little chance of an issue cropping up.

I'm fine to proceed either way, including if I should close this out and start over to get rid of the mess. Let me know and I'll get it all wrapped up the way we want. 👍

@SeanKilleen
Copy link
Contributor Author

@shiftkey what do you think?

  1. Match the return types of the API (e.g. leave int if API specifies integer)
  2. Convert all IDs to long regardless of API type
  3. Convert all IDs -- and numbers -- to long regardless of API type

Happy to see this through, but realized I should probably get that clarification first.

JamieMagee added a commit to octokit/webhooks.net that referenced this pull request Jan 24, 2022
Migrates all integer types from `int` (32-bit) to `long` (64-bit).

Could I be a bit more directed with these changes? Probably. But the it's simpler and easier to migrate all `int`s to `long`s rather than debate how large a specific ID is going to be.

Closes #30

References:
  - #30
  - octokit/octokit.net#2351
  - octokit/octokit.net#2352
  - https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/builtin-types/integral-numeric-types
@github-actions
Copy link

👋 Hey Friends, this pull request has been automatically marked as stale because it has no recent activity. It will be closed if no further activity occurs. Please add the pinned label if you feel that this issue needs to remain open/active. Thank you for your contributions and help in keeping things tidy!

@github-actions github-actions bot added the Stale label May 22, 2022
@github-actions github-actions bot closed this May 29, 2022
@nickfloyd nickfloyd added Status: Stale Used by stalebot to clean house and removed Stale labels Oct 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Stale Used by stalebot to clean house
Projects
None yet
Development

Successfully merging this pull request may close these issues.

GitHub IDs have exceeded Int32.MaxValue; Octokit uses int
3 participants