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

Router clean up #5778

Merged
merged 6 commits into from
Sep 11, 2024
Merged

Router clean up #5778

merged 6 commits into from
Sep 11, 2024

Conversation

saledjenic
Copy link
Contributor

@saledjenic saledjenic commented Aug 28, 2024

Reviewing this PR is much easier if commit by commit is reviewed since all changes are logically split into 4 commits.

Within the clean-up and files/code reorganizational job, the following changes were conducted:

old router logic removed

Old code removed, necessary from the old file functions moved to new files.

removed v2 mark from api endpoints, structs and files marked as router v2

Breaking change!

Since the old router logic has been removed, there is no need to have files and structures marked as v2.

Renamed endpoints:

  • GetSuggestedRoutesV2 to GetSuggestedRoutes
  • GetSuggestedRoutesV2Async to GetSuggestedRoutesAsync
  • StopSuggestedRoutesV2AsyncCalcualtion to StopSuggestedRoutesAsyncCalculation

router code organization improvements

Breaking change!

The list of mapped old error codes:

  • "WR-001" is now "WRR-001"

  • "WR-002" is now "WRR-002"

  • "WR-003" is now "WRR-003"

  • "WR-004" is now "WRR-004"

  • "WR-005" is now "WRR-005"

  • "WR-006" is now "WRR-006"

  • "WR-007" is now "WRR-007"

  • "WR-008" is now "WRR-008"

  • "WR-009" is now "WRR-009"

  • "WR-010" is now "WRR-010"

  • "WR-011" is now "WRR-011"

  • "WR-012" is now "WRR-012"

  • "WR-013" is now "WRR-013"

  • "WR-014" is now "WRR-014"

  • "WR-015" is now "WRR-015"

  • "WR-019" is now "WRR-016"

  • "WR-020" is now "WRR-017"

  • "WR-021" is now "WRR-018"

  • "WR-025" is now "WRR-019"

  • "WR-016" is now "WR-001"

  • "WR-017" is now "WR-002"

  • "WR-018" is now "WR-003"

  • "WR-022" is now "WR-004"

  • "WR-023" is now "WR-005"

  • "WR-024" is now "WR-006"

  • "WR-026" is now "WR-007"

  • "WR-027" is now "WR-008"

Other changes:

  • RouteInputParams type moved to requests package and code updated accordingly
  • SuggestedFees type moved to a new fees package and code updated accordingly
  • SendType type moved to a new sendtype package and code updated accordingly
  • the following functions moved to common package
  • ArrayContainsElement
  • ArraysWithSameElements
  • SameSingleChainTransfer
  • CopyMapGeneric
  • GweiToEth
  • WeiToGwei
  • the following consts moved to common package
  • HexAddressLength
  • SupportedNetworks
  • SupportedTestNetworks

router response moved to wallet responses location

Following our approach for keeping requests at the same location, these changes introduce new location for responses. SuggestedRoutesResponse is moved there and renamed to
RouterSuggestedRoutes and the code is updated accordingly.

A new type Route is defined (since a single route is composed of zero or more paths).

Types Route, Path, Graph and Node belong to a new routes package now.

Copy link

Thank you for opening this pull request!

Looks like you have BREAKING CHANGES in your PR.
Please make sure to update status-desktop and status-mobile clients accordingly.

@status-im-auto
Copy link
Member

status-im-auto commented Aug 28, 2024

Jenkins Builds

Click to see older builds (61)
Commit #️⃣ Finished (UTC) Duration Platform Result
✔️ a759fe6 #1 2024-08-28 11:31:26 ~2 min tests-rpc 📄log
✔️ a759fe6 #1 2024-08-28 11:32:55 ~3 min linux 📦zip
✔️ a759fe6 #1 2024-08-28 11:33:49 ~4 min ios 📦zip
✔️ a759fe6 #1 2024-08-28 11:34:25 ~5 min android 📦aar
✔️ a759fe6 #1 2024-08-28 12:01:42 ~32 min tests 📄log
✔️ e57bf22 #2 2024-08-28 12:10:16 ~2 min tests-rpc 📄log
✔️ e57bf22 #2 2024-08-28 12:11:52 ~4 min linux 📦zip
✔️ e57bf22 #2 2024-08-28 12:12:56 ~5 min android 📦aar
✔️ e57bf22 #2 2024-08-28 12:15:14 ~7 min ios 📦zip
✔️ e57bf22 #2 2024-08-28 12:39:10 ~31 min tests 📄log
✔️ e8fafb0 #3 2024-08-30 08:01:28 ~2 min tests-rpc 📄log
✔️ e8fafb0 #3 2024-08-30 08:01:41 ~2 min linux 📦zip
✔️ e8fafb0 #3 2024-08-30 08:01:42 ~2 min android 📦aar
✔️ e8fafb0 #3 2024-08-30 08:02:39 ~3 min ios 📦zip
✔️ e8fafb0 #3 2024-08-30 08:30:49 ~31 min tests 📄log
✔️ d31695a #4 2024-08-30 12:54:25 ~2 min android 📦aar
✔️ d31695a #4 2024-08-30 12:54:25 ~2 min linux 📦zip
✔️ d31695a #4 2024-08-30 12:54:54 ~2 min tests-rpc 📄log
✔️ d31695a #4 2024-08-30 12:55:55 ~3 min ios 📦zip
✔️ d31695a #4 2024-08-30 13:25:04 ~32 min tests 📄log
✔️ 2abacca #5 2024-08-30 13:21:35 ~2 min android 📦aar
✔️ 2abacca #5 2024-08-30 13:21:40 ~2 min linux 📦zip
✔️ 2abacca #5 2024-08-30 13:21:50 ~2 min tests-rpc 📄log
✔️ 2abacca #5 2024-08-30 13:23:00 ~3 min ios 📦zip
✔️ 2abacca #5 2024-08-30 13:57:54 ~32 min tests 📄log
✔️ f870d5c #6 2024-08-30 17:34:36 ~2 min tests-rpc 📄log
✔️ f870d5c #6 2024-08-30 17:35:41 ~3 min ios 📦zip
✔️ f870d5c #6 2024-08-30 17:36:13 ~3 min linux 📦zip
✔️ f870d5c #6 2024-08-30 17:38:02 ~5 min android 📦aar
✔️ f870d5c #6 2024-08-30 18:03:54 ~31 min tests 📄log
✔️ 5704939 #7 2024-09-02 14:57:17 ~2 min tests-rpc 📄log
✔️ 5704939 #7 2024-09-02 14:57:27 ~2 min android 📦aar
✔️ 5704939 #7 2024-09-02 14:57:32 ~2 min linux 📦zip
✔️ 5704939 #7 2024-09-02 14:58:41 ~3 min ios 📦zip
✔️ 5704939 #7 2024-09-02 15:26:08 ~30 min tests 📄log
✔️ 0e20c00 #8 2024-09-02 15:00:52 ~2 min android 📦aar
✔️ 0e20c00 #8 2024-09-02 15:00:57 ~2 min linux 📦zip
✔️ 0e20c00 #8 2024-09-02 15:01:06 ~2 min tests-rpc 📄log
✔️ 0e20c00 #8 2024-09-02 15:02:27 ~3 min ios 📦zip
✔️ 0e20c00 #8 2024-09-02 15:58:37 ~32 min tests 📄log
✔️ f655fa5 #9 2024-09-03 12:54:55 ~2 min tests-rpc 📄log
✔️ f655fa5 #9 2024-09-03 12:54:56 ~2 min android 📦aar
✔️ f655fa5 #9 2024-09-03 12:55:05 ~2 min linux 📦zip
✔️ f655fa5 #9 2024-09-03 12:56:43 ~3 min ios 📦zip
✔️ f655fa5 #9 2024-09-03 13:24:10 ~31 min tests 📄log
✔️ 7e6d19f #10 2024-09-04 11:10:35 ~1 min android 📦aar
✔️ 7e6d19f #10 2024-09-04 11:10:57 ~1 min linux 📦zip
✔️ 7e6d19f #10 2024-09-04 11:11:12 ~2 min tests-rpc 📄log
✔️ 7e6d19f #10 2024-09-04 11:12:15 ~3 min ios 📦zip
✖️ 7e6d19f #10 2024-09-04 11:39:41 ~30 min tests 📄log
✔️ 1242ab7 #11 2024-09-04 14:32:50 ~1 min android 📦aar
✔️ 1242ab7 #11 2024-09-04 14:33:16 ~2 min linux 📦zip
✔️ 1242ab7 #11 2024-09-04 14:33:43 ~2 min tests-rpc 📄log
✔️ 1242ab7 #11 2024-09-04 14:34:32 ~3 min ios 📦zip
✔️ 1242ab7 #11 2024-09-04 15:02:58 ~31 min tests 📄log
✔️ 557c4f7 #12 2024-09-05 07:07:46 ~2 min android 📦aar
✔️ 557c4f7 #12 2024-09-05 07:07:54 ~2 min linux 📦zip
✔️ 557c4f7 #12 2024-09-05 07:08:19 ~2 min tests-rpc 📄log
✔️ 557c4f7 #12 2024-09-05 07:09:18 ~3 min ios 📦zip
✔️ 557c4f7 #12 2024-09-05 07:36:45 ~30 min tests 📄log
✔️ 557c4f7 #1 2024-09-05 08:20:14 ~1 min tests-rpc 📄log
Commit #️⃣ Finished (UTC) Duration Platform Result
✔️ cbb74b7 #13 2024-09-09 11:23:04 ~2 min tests-rpc 📄log
✔️ cbb74b7 #13 2024-09-09 11:23:26 ~2 min android 📦aar
✔️ cbb74b7 #13 2024-09-09 11:23:33 ~2 min linux 📦zip
✔️ cbb74b7 #13 2024-09-09 11:24:28 ~3 min ios 📦zip
✖️ cbb74b7 #13 2024-09-09 11:52:12 ~31 min tests 📄log
✔️ 900ad9b #14 2024-09-10 07:35:06 ~2 min tests-rpc 📄log
✔️ 900ad9b #14 2024-09-10 07:35:24 ~2 min android 📦aar
✔️ 900ad9b #14 2024-09-10 07:36:18 ~3 min ios 📦zip
✔️ 900ad9b #14 2024-09-10 07:36:36 ~3 min linux 📦zip
✔️ 900ad9b #14 2024-09-10 08:04:12 ~31 min tests 📄log

return false
}
for _, el := range ar1 {
if !ArrayContainsElement(el, ar2) {
Copy link
Contributor

Choose a reason for hiding this comment

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

not using isEqual

Copy link
Contributor Author

Choose a reason for hiding this comment

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

What do you mean isEqual here? I am checking if an element el of type T is in an array of elements []T.

Copy link
Contributor

Choose a reason for hiding this comment

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

you've got an argument isEqual func(T, T) bool in function ArraysWithSameElements which is not getting used. I'm assuming you want that for cases where you have arrays of pointers, to do a "deep" comparison instead of just comparing the pointers themselves.

Maybe the same can be achieved using https://pkg.go.dev/reflect#DeepEqual in ArrayContainsElement instead of ==

Copy link
Contributor

Choose a reason for hiding this comment

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

Well actually I think the whole function is unused after the rebase, you can remove ArraysWithSameElements

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ahh I see what you mean, so my intention was to provide isEqual to ArraysWithSameElements and then pass it to ArrayContainsElement to compare any type using a custom isEqual function, but later when I removed it from ArrayContainsElement, forgot to remove it from ArraysWithSameElements.

But yes, it's not in use anymore, removed now.

@@ -0,0 +1,67 @@
package routs
Copy link
Contributor

Choose a reason for hiding this comment

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

did you mean routes here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Exactly that! :)

@dlipicar
Copy link
Contributor

Thumbs up for better code organization into packages and old code removal.
The two breaking changes were IMO not super necessary...
I think it's better not to reuse old error codes with new meanings, just use new ones. Reading logs from different versions will get confusing otherwise :D

@saledjenic
Copy link
Contributor Author

The two breaking changes were IMO not super necessary...

Was thinking about that, but two reasons made me make this change:

  • cyclic dependency if I used errors from the place where they were in requests package
  • we're not using V2 mark anymore, cause no need for that, and if we don't remove them now properly they will either stay or be removed later which will cause breaking change later, so better sooner than later

I think it's better not to reuse old error codes with new meanings, just use new ones.

  • errors that I moved refer only to validating input params and are not used in the rest of the router package, they logically belong to the place where they are now, keeping them at the old place without being used anywhere and adding the same errors just bloats the code, unnecessarily. I was thinking about keeping them at the old place and commenting them out and adding @reserved label, to make future maintainers aware of codes used in the past, something like this
// @reserved
// ErrENSRegisterRequiresUsernameAndPubKey      = &errors.ErrorResponse{Code: errors.ErrorCode("WR-001"), Details: "username and public key are required for ENSRegister"}

but then decided for this, cleaner way, since it's not a big deal at this moment.

services/wallet/requests/router_input_params.go Outdated Show resolved Hide resolved
Copy link
Collaborator

Choose a reason for hiding this comment

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

I don't understand why is this needed.

  • When we're release WakuV2, we don't forget WakuV1 and rename WakuV2 to WakuV1.
  • What if we release a newer version of router? Will it be RouterV2 or RouterV3 then?

I believe this breaking change is very unnecessary.
Same about renaming files. Why?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Router V2 was just a replacement for the old router, to not mess up with the code, while we're improving it. Also I don't like V2 in endpoint names, if we really want to have versioning then it should be done another way and passed as a property of input params.

Copy link
Collaborator

Choose a reason for hiding this comment

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

if we really want to have versioning then it should be done another way and passed as a property of input params.

Or even have a separate service for this 🤔


Not a big deal. If the desktop/mobile will be adapted then it's 90% ok IMO.
Just in general, it's important to have a mindset of not introducing any breaking changes, I guess that's my point

@@ -488,31 +488,6 @@ func gweiToWei(val *big.Float) *big.Int {
return res
}

func (api *API) GetSuggestedRoutes(
Copy link
Collaborator

Choose a reason for hiding this comment

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

Just mark it as deprecated and return an error for now. And remove the function when the clients are updated.
No need for such destructive actions 😄

Copy link
Contributor Author

Choose a reason for hiding this comment

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

But I wanted to clean the api, not to keep things around, that's why we added the same names with V2 suffixes, to not make breaking changes. Also I plan to sync with @alwx (actually we already chat in the wallet channel) on this and don't plan to merge this before mobile is ready for this change, then we will sync and merge changes at the same time.

@@ -131,7 +111,11 @@ func (s SendType) canUseProcessor(p pathprocessor.PathProcessor) bool {
}
}

func (s SendType) processZeroAmountInProcessor(amountIn *big.Int, amountOut *big.Int, processorName string) bool {
func (s SendType) SimpleTransfer(p pathprocessor.PathProcessor) bool {
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this is unused now. Moreover, we normally call these something like isSimpleTransfer

Copy link
Contributor

@dlipicar dlipicar Aug 30, 2024

Choose a reason for hiding this comment

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

@igor-sirotin I thought the linter checked unused functions and function parameters 🤔 did we disable that or did I just make that up?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Correct, after rebase, not needed.

Copy link
Collaborator

Choose a reason for hiding this comment

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

@igor-sirotin I thought the linter checked unused functions and function parameters 🤔 did we disable that or did I just make that up?

Indeed I think it was there. We need to review linter checks and ensure it's there 👍

@saledjenic
Copy link
Contributor Author

The desktop PR that handles these changes is here:

@ilmotta
Copy link
Contributor

ilmotta commented Sep 3, 2024

FYI @shivekkhurana there are breaking changes as described in the PR and we should prepare mobile develop for them.

@saledjenic @shivekkhurana for a larger PR like this one, before merging, it's paramount to get the PR tested on the mobile client too by our QAs. The idea being to keep status-go develop releasable on every revision cc @status-im/mobile-qa

@saledjenic
Copy link
Contributor Author

@ilmotta yes, sure, mobile QAs can start testing after @alwx integrates these changes into the mobile app.

Just for context... yes, some commits are marked as breaking changes, but that's due to the API endpoints name change, so changes should not affect anything especially (referring to clean-up changes, the other two commits are from other PR, which is about updating fees, but they should break anything)

@saledjenic saledjenic force-pushed the router-clean-up branch 5 times, most recently from 557c4f7 to cbb74b7 Compare September 9, 2024 11:20
…as router v2

Breaking change!

Since the old router logic is removed, there is no need to have files and structs marked as v2.

Renamed endpoints:
- `GetSuggestedRoutesV2` to `GetSuggestedRoutes`
- `GetSuggestedRoutesV2Async` to `GetSuggestedRoutesAsync`
- `StopSuggestedRoutesV2AsyncCalcualtion` to `StopSuggestedRoutesAsyncCalcualtion`
It's a breaking change due to errors' changes, the list of mapped old error codes:
- `"WR-001"` is now `"WRR-001"`
- `"WR-002"` is now `"WRR-002"`
- `"WR-003"` is now `"WRR-003"`
- `"WR-004"` is now `"WRR-004"`
- `"WR-005"` is now `"WRR-005"`
- `"WR-006"` is now `"WRR-006"`
- `"WR-007"` is now `"WRR-007"`
- `"WR-008"` is now `"WRR-008"`
- `"WR-009"` is now `"WRR-009"`
- `"WR-010"` is now `"WRR-010"`
- `"WR-011"` is now `"WRR-011"`
- `"WR-012"` is now `"WRR-012"`
- `"WR-013"` is now `"WRR-013"`
- `"WR-014"` is now `"WRR-014"`
- `"WR-015"` is now `"WRR-015"`
- `"WR-019"` is now `"WRR-016"`
- `"WR-020"` is now `"WRR-017"`
- `"WR-021"` is now `"WRR-018"`
- `"WR-025"` is now `"WRR-019"`

- `"WR-016"` is now `"WR-001"`
- `"WR-017"` is now `"WR-002"`
- `"WR-018"` is now `"WR-003"`
- `"WR-022"` is now `"WR-004"`
- `"WR-023"` is now `"WR-005"`
- `"WR-024"` is now `"WR-006"`
- `"WR-026"` is now `"WR-007"`
- `"WR-027"` is now `"WR-008"`

Other changes:
- `RouteInputParams` type moved to `requests` package and code updated accordingly
- `SuggestedFees` type moved to a new `fees` package and code updated accordingly
- `SendType` type moved to a new `sendtype` package and code updated accordingly
- the following functions moved to `common` package
  - `ArrayContainsElement`
  - `ArraysWithSameElements`
  - `SameSingleChainTransfer`
  - `CopyMapGeneric`
  - `GweiToEth`
  - `WeiToGwei`
- the following consts moved to `common` package
  - `HexAddressLength`
  - `SupportedNetworks`
  - `SupportedTestNetworks`
Following the approach we did for keeping requests at the same location, these changes introduce
new location for responses. `SuggestedRoutesResponse` is moved there and renamed to
`RouterSuggestedRoutes` and code is updated accordingly.

New type `Route` defined (since a single route is composed of zero or more paths).

Types `Route`, `Path`, `Graph` and `Node` belong to a new `routs` package now.
@ilmotta
Copy link
Contributor

ilmotta commented Sep 10, 2024

@ilmotta yes, sure, mobile QAs can start testing after @alwx integrates these changes into the mobile app.

Just for context... yes, some commits are marked as breaking changes, but that's due to the API endpoints name change, so changes should not affect anything especially (referring to clean-up changes, the other two commits are from other PR, which is about updating fees, but they should break anything)

Hi @saledjenic, I came across this PR again today and I would like to take this opportunity to raise some concerns and ideas for future PRs. We should generally avoid large PRs like this one, especially in status-go (but not exclusively). It's tempting to create large PRs to avoid the overhead of reviews + QA, but large PRs can be counterproductive.

A few reasons:

  • The quality of feedback from reviewers tends to drop, often significantly. High-quality reviews require more than just reading diffs.
  • The PR author may become frustrated by slow responses from reviewers and testers, leading to pressure to push changes through.
  • The PR author's willingness to address review feedback can diminish, especially when feedback involves significant changes to the solution. While this may not be the case with this PR, I've seen large PRs merge dubious solutions because both reviewers & author couldn't tackle everything in one go.
  • The likelihood of regressions increases. Almost every PR that introduces regressions didn't intend to, but it happens anyway.
  • There's a higher risk of introducing regressions due to incorrect rebases (for both the PR author and other collaborators).

Probably a few other reasons I couldn't think of now.

One of our main goals should be to ensure that status-go's develop branch is always releasable. Currently, the mobile team is aiming for another release, but the QA team has already identified regressions in develop, creating friction and waste to re-test too many areas of the app on every release. A large PR like this one can easily cause regressions if not carefully tested.

There's almost always a way to make incremental changes that simplify testing and can result in a higher-quality results in the product. This PR could have been split into smaller ones.

Perhaps the @status-im/status-go-guild will be able to define more clear guidelines about the points I'm raising here? On a more personal level, in the status-mobile repo I have a tendency to immediately reject very large PRs (they are rare thankfully) and ask the author to make safer incremental changes in separate PRs.

We all opened our fair share of large PRs in life 🥶, but in status-go and with the ever increasing complexity of the repo I think we should plainly avoid them.

@saledjenic
Copy link
Contributor Author

@ilmotta I understand what you're saying, but there are 2 PRs:

  • the first, this one, is about "cleaning up the router" which is about removing the old router code that is not in use anymore split into 4 logical commits to be easier for review and so should be very easy for review since the majority of changes are because of renaming
  • the other one, the last 2 commits are coming from this PR feat_: recalculate route fees with every new block #5783 which is also not hard to review since it's about a single thing there, about updating fees with every new block

The important thing is that both PRs were reviewed separately and then the second was merged into the first one. So basically those were 2 simple PRs for review.

Also since it's about removing unused code and renaming only, I don't expect any incompatibilities on the client sides (at least there were none on the desktop app side). Changes in this PR are marked as breaking changes, just because of endpoints renaming.

@ilmotta
Copy link
Contributor

ilmotta commented Sep 10, 2024

@ilmotta I understand what you're saying, but there are 2 PRs:

  • the first, this one, is about "cleaning up the router" which is about removing the old router code that is not in use anymore split into 4 logical commits to be easier for review and so should be very easy for review since the majority of changes are because of renaming
  • the other one, the last 2 commits are coming from this PR feat_: recalculate route fees with every new block #5783 which is also not hard to review since it's about a single thing there, about updating fees with every new block

The important thing is that both PRs were reviewed separately and then the second was merged into the first one. So basically those were 2 simple PRs for review.

Also since it's about removing unused code and renaming only, I don't expect any incompatibilities on the client sides (at least there were none on the desktop app side). Changes in this PR are marked as breaking changes, just because of endpoints renaming.

Thanks for sharing the specifics @saledjenic. I'm aware of some of these details. My comment is about the perspective that large PRs cause more trouble than benefit, so should be avoided if there are potentially more downsides than upsides. I'm not sharing these concerns only for this PR. In other words, is the increased risk of regressions, slower turnaround to merge, increased time requested from reviewers & QAs, and (likely) reduced review quality worth the trouble?

Smaller PRs are helpful to diagnose where regressions come from. Many times I had to checkout commits in status-go to identify where a bug was first introduced. Because we squash when merging, large squashed commits become quite difficult to comprehend. Just an example for this PR: renames and file moves could've been done in a separate PR from feat commits and breaking changes.

@saledjenic
Copy link
Contributor Author

Just an example for this PR: renames and file moves could've been done in a separate PR from feat commits and breaking changes.

Hi @ilmotta, I appreciate your perspective, but I see things a bit differently. In my opinion, it's perfectly fine to have logically split commits within a single PR, but creating a new PR for every logical unit might become a bit cumbersome and burdensome at the same time. Of course, I'm open to further discussion.

Because we squash when merging, large squashed commits become quite difficult to comprehend.

Yes, I agree it's hard to find the culprit for some regression looking at a large commit if all commits were squashed at the moment of merging into the develop branch, but I didn't know that's what people do?!? All my PRs (branches) are rebased on the develop branch with commits like people see them in the PR.

Also when one is searching for a regression, he is checking a certain commit and doesn't care if it's coming from a PR with a single commit only or PR that has 10 commits. That's why it's important to have every single commit for a single logical change and see them in the develop branch as they are in PRs.

@alaibe
Copy link
Collaborator

alaibe commented Sep 11, 2024

@ilmotta
While this is an important discussion, I feel that a PR might not be the best place for it. It could be more productive to address it outside of chat as well, perhaps in a meeting

Having multiple working commits seems perfectly fine to me. I'd say it even simplify things. Now most PR will have 1 commit, but if there is more and the PR is still consistent, why not? Is there a specific concern with that approach?

I understand that additional commits were added because the first one contained breaking changes. It's natural to avoid working on outdated code, so I think the question worth asking is what might be causing the renaming of three functions to take longer than expected (two weeks so far).

Go can be verbose, and as a result, code changes may appear larger. However, the real factor to consider is complexity, not just size. Initially, the task was to remove old code

@saledjenic
Copy link
Contributor Author

Confirmed here:
status-im/status-mobile#21235 (comment)

@saledjenic saledjenic merged commit 0235889 into develop Sep 11, 2024
10 of 11 checks passed
@saledjenic saledjenic deleted the router-clean-up branch September 11, 2024 11:51
@ilmotta
Copy link
Contributor

ilmotta commented Sep 11, 2024

While this is an important discussion, I feel that a PR might not be the best place for it

@alaibe As a starting point for the discussion I think the PR is the best place because it is a live example of a problem. Now that there's some disagreement on the best approach yes, it seems natural to move outside the PR the discussion.

Having multiple working commits seems perfectly fine to me. I'd say it even simplify things. Now most PR will have 1 commit,

but I see things a bit differently. In my opinion, it's perfectly fine to have logically split commits within a single PR

I agree with you all on that @saledjenic @alaibe, but that's not what I said. The problem I raised is about large PRs and that they can create more downsides than upsides. I ask you to reconsider the problem from the general perspective of keeping status-go releasable and reduce the risks of regressions per unit of PR because this is a serious problem in status-go. Short-lived branches sliced in a smart way can help a lot. At no point I said one commit per PR is good, that'd be absurd 👍🏼

renaming of three functions to take longer than expected (two weeks so far)

This point I don't fully understand. Do you mean it took too long to rename on the client? The cause is probably of mismatched expectations between the PR author and the client developers who would apply the patch. They didn't agree about the urgency, and naturally adjusting client code to refactors in status-go can easily go lower in priority against bugs. So both parties should talk more/better.

Initially, the task was to remove old code

Precisely, removing old code can be done in a separate PR, very low risk, much quicker to review and merge if not mixed in with other changes that require manual QA.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants