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

Report the correct number of pushes on the feeds #16811

Merged
merged 3 commits into from
Aug 25, 2021

Conversation

zeripath
Copy link
Contributor

@zeripath zeripath commented Aug 24, 2021

Unfortunately #16282 contained a regression whereby it was assumed that the []*Commits in PushCommits retained its full length and therefore the Len field was dropped.

This has led to the incorrect reporting of the number of commits in pushes which are larger than setting.UI.FeedMaxCommitNum.

Prior to #16282 the Len was reported on the push commits so mostly we can just drop back to using this, and restart adding it back in.

However, for pushes after this - AFAICS this information is lost and is not recalcuable. Therefore these pushes will be limited to FeedMaxCommitNum.

Fix #16804

Signed-off-by: Andrew Thornton art27@cantab.net

Since the number of commits in the Action table has been limited to 5
the number of commits reported on the feeds page is now incorrectly also
limited to 5. The correct number is available as the Len and this PR
changes this to report this.

Fix go-gitea#16804

Signed-off-by: Andrew Thornton <art27@cantab.net>
@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Aug 24, 2021
@zeripath

This comment has been minimized.

@codecov-commenter
Copy link

codecov-commenter commented Aug 25, 2021

Codecov Report

Merging #16811 (7129981) into main (28ac4a7) will increase coverage by 0.00%.
The diff coverage is 77.77%.

Impacted file tree graph

@@           Coverage Diff           @@
##             main   #16811   +/-   ##
=======================================
  Coverage   45.46%   45.47%           
=======================================
  Files         762      762           
  Lines       86019    86027    +8     
=======================================
+ Hits        39111    39122   +11     
+ Misses      40593    40591    -2     
+ Partials     6315     6314    -1     
Impacted Files Coverage Δ
modules/templates/helper.go 51.36% <0.00%> (-0.18%) ⬇️
modules/repository/commits.go 82.85% <100.00%> (+1.03%) ⬆️
services/pull/pull.go 41.78% <0.00%> (-0.41%) ⬇️
modules/queue/unique_queue_disk_channel.go 48.63% <0.00%> (+1.36%) ⬆️
modules/queue/workerpool.go 55.72% <0.00%> (+1.90%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 28ac4a7...7129981. Read the comment docs.

@zeripath
Copy link
Contributor Author

zeripath commented Aug 25, 2021

I could write a migration to "backfill" and attempt to recalculate Len but I'm not certain if it's the right thing - as it won't necessarily be right. It would also be very slow.

I suppose we could actually make the Len field a string, so that for any actions that represent commits/pushes but don't contain a Len whilst do have len(Commits) >= setting.UI.FeedMaxCommitNum we set the Len to "≥" + setting.UI.FeedMaxCommitNum but I'm not certain it's entirely worth it - this could also be done at the template level.

@KN4CK3R
Copy link
Member

KN4CK3R commented Aug 25, 2021

I don't think we should restrict the commit list in pushUpdates.

actionNotifier.NotifyPushCommits uses the commits and it may be reasonable to limit the list
indexerNotifier.NotifyPushCommits does not use the commits and it may be an error if the list was stripped
webhookNotifier.NotifyPushCommits uses the commits and it may be reasonable to limit the list

Now the question is if both limits should be identical. Personally I think webhooks should get more data than the ui notification.
For webhooks Github [1] and Gitlab [2] deliver 20 commits. Gitlab adds a total_commits_count attribute with the real count.
So it may be good to limit the list inside NotifyPushCommits only and provide a TotalCommitsCount for the receivers.

[1] https://docs.github.com/en/developers/webhooks-and-events/webhooks/webhook-events-and-payloads#push
[2] https://docs.gitlab.com/ee/user/project/integrations/webhooks.html#push-events

@zeripath
Copy link
Contributor Author

zeripath commented Aug 25, 2021

We still need to use and create Len because we're not going to be able to rely on this not being truncated.

@GiteaBot GiteaBot added lgtm/need 1 This PR needs approval from one additional maintainer to be merged. and removed lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. labels Aug 25, 2021
@GiteaBot GiteaBot added lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. and removed lgtm/need 1 This PR needs approval from one additional maintainer to be merged. labels Aug 25, 2021
@techknowlogick techknowlogick merged commit ba6baff into go-gitea:main Aug 25, 2021
@zeripath zeripath deleted the fix-16804-report-the-len branch August 25, 2021 23:50
techknowlogick added a commit to techknowlogick/gitea that referenced this pull request Aug 26, 2021
* Report the correct number of pushes on the feeds

Since the number of commits in the Action table has been limited to 5
the number of commits reported on the feeds page is now incorrectly also
limited to 5. The correct number is available as the Len and this PR
changes this to report this.

Fix go-gitea#16804

Signed-off-by: Andrew Thornton <art27@cantab.net>

* Update templates/user/dashboard/feeds.tmpl

Co-authored-by: techknowlogick <techknowlogick@gitea.io>
@techknowlogick techknowlogick added the backport/done All backports for this PR have been created label Aug 26, 2021
@techknowlogick
Copy link
Member

backported here: #16822

techknowlogick added a commit that referenced this pull request Aug 26, 2021
* Report the correct number of pushes on the feeds

Since the number of commits in the Action table has been limited to 5
the number of commits reported on the feeds page is now incorrectly also
limited to 5. The correct number is available as the Len and this PR
changes this to report this.

Fix #16804

Signed-off-by: Andrew Thornton <art27@cantab.net>

* Update templates/user/dashboard/feeds.tmpl

Co-authored-by: techknowlogick <techknowlogick@gitea.io>

Co-authored-by: zeripath <art27@cantab.net>
zeripath added a commit to zeripath/gitea that referenced this pull request Sep 2, 2021
## [1.15.1](https://github.com/go-gitea/gitea/releases/tag/v1.15.1) - 2021-09-02

* BUGFIXES
  * Allow BASIC authentication access to /:owner/:repo/releases/download/* (go-gitea#16916) (go-gitea#16923)
  * Prevent leave changes dialogs due to autofill fields (go-gitea#16912) (go-gitea#16920)
  * Ignore review comment when ref commit is missed (go-gitea#16905) (go-gitea#16919)
  * Fix wrong attachment removal (go-gitea#16915) (go-gitea#16917)
  * Gitlab Migrator: dont ignore reactions of last request (go-gitea#16903) (go-gitea#16913)
  * Correctly return the number of Repositories for Organizations (go-gitea#16807) (go-gitea#16911)
  * Test if LFS object is accessible (go-gitea#16865) (go-gitea#16904)
  * Fix git.Blob.DataAsync(): close pipe since we return a NopCloser (go-gitea#16899) (go-gitea#16900)
  * Fix dump and restore respository (go-gitea#16698) (go-gitea#16898)
  * Repare and Improve GetDiffRangeWithWhitespaceBehavior (go-gitea#16894) (go-gitea#16895)
  * Fix wiki raw commit diff/patch view (go-gitea#16891) (go-gitea#16892)
  * Ensure wiki repos are all closed (go-gitea#16886) (go-gitea#16888)
  * List limited and private orgs if authenticated on API (go-gitea#16866) (go-gitea#16879)
  * Simplify split diff view generation and remove JS dependency (go-gitea#16775) (go-gitea#16863)
  * Ensure that the default visibility is set on the user create page (go-gitea#16845) (go-gitea#16862)
  * In Render tolerate not being passed a context (go-gitea#16842) (go-gitea#16858)
  * Upgrade xorm to v1.2.2 (go-gitea#16663) & Add test to ensure that dumping of login sources remains correct (go-gitea#16847) (go-gitea#16848)
  * Report the correct number of pushes on the feeds (go-gitea#16811) (go-gitea#16822)
  * Add primary_key to issue_index (go-gitea#16813) (go-gitea#16820)
  * Prevent NPE on empty commit (go-gitea#16812) (go-gitea#16819)
  * Fix branch pagination error (go-gitea#16805) (go-gitea#16816)
  * Add missing return to handleSettingRemoteAddrError (go-gitea#16794) (go-gitea#16795)
  * Remove spurious / from issues.opened_by (go-gitea#16793)
  * Ensure that template compilation panics are sent to the logs (go-gitea#16788) (go-gitea#16792)
  * Update caddyserver/certmagic (go-gitea#16789) (go-gitea#16790)

Signed-off-by: Andrew Thornton <art27@cantab.net>
@zeripath zeripath mentioned this pull request Sep 2, 2021
zeripath added a commit that referenced this pull request Sep 2, 2021
## [1.15.1](https://github.com/go-gitea/gitea/releases/tag/v1.15.1) - 2021-09-02

* BUGFIXES
  * Allow BASIC authentication access to /:owner/:repo/releases/download/* (#16916) (#16923)
  * Prevent leave changes dialogs due to autofill fields (#16912) (#16920)
  * Ignore review comment when ref commit is missed (#16905) (#16919)
  * Fix wrong attachment removal (#16915) (#16917)
  * Gitlab Migrator: dont ignore reactions of last request (#16903) (#16913)
  * Correctly return the number of Repositories for Organizations (#16807) (#16911)
  * Test if LFS object is accessible (#16865) (#16904)
  * Fix git.Blob.DataAsync(): close pipe since we return a NopCloser (#16899) (#16900)
  * Fix dump and restore respository (#16698) (#16898)
  * Repare and Improve GetDiffRangeWithWhitespaceBehavior (#16894) (#16895)
  * Fix wiki raw commit diff/patch view (#16891) (#16892)
  * Ensure wiki repos are all closed (#16886) (#16888)
  * List limited and private orgs if authenticated on API (#16866) (#16879)
  * Simplify split diff view generation and remove JS dependency (#16775) (#16863)
  * Ensure that the default visibility is set on the user create page (#16845) (#16862)
  * In Render tolerate not being passed a context (#16842) (#16858)
  * Upgrade xorm to v1.2.2 (#16663) & Add test to ensure that dumping of login sources remains correct (#16847) (#16848)
  * Report the correct number of pushes on the feeds (#16811) (#16822)
  * Add primary_key to issue_index (#16813) (#16820)
  * Prevent NPE on empty commit (#16812) (#16819)
  * Fix branch pagination error (#16805) (#16816)
  * Add missing return to handleSettingRemoteAddrError (#16794) (#16795)
  * Remove spurious / from issues.opened_by (#16793)
  * Ensure that template compilation panics are sent to the logs (#16788) (#16792)
  * Update caddyserver/certmagic (#16789) (#16790)

Signed-off-by: Andrew Thornton <art27@cantab.net>
zeripath added a commit to zeripath/gitea that referenced this pull request Sep 2, 2021
## [1.15.1](https://github.com/go-gitea/gitea/releases/tag/v1.15.1) - 2021-09-02

* BUGFIXES
  * Allow BASIC authentication access to /:owner/:repo/releases/download/* (go-gitea#16916) (go-gitea#16923)
  * Prevent leave changes dialogs due to autofill fields (go-gitea#16912) (go-gitea#16920)
  * Ignore review comment when ref commit is missed (go-gitea#16905) (go-gitea#16919)
  * Fix wrong attachment removal (go-gitea#16915) (go-gitea#16917)
  * Gitlab Migrator: dont ignore reactions of last request (go-gitea#16903) (go-gitea#16913)
  * Correctly return the number of Repositories for Organizations (go-gitea#16807) (go-gitea#16911)
  * Test if LFS object is accessible (go-gitea#16865) (go-gitea#16904)
  * Fix git.Blob.DataAsync(): close pipe since we return a NopCloser (go-gitea#16899) (go-gitea#16900)
  * Fix dump and restore respository (go-gitea#16698) (go-gitea#16898)
  * Repare and Improve GetDiffRangeWithWhitespaceBehavior (go-gitea#16894) (go-gitea#16895)
  * Fix wiki raw commit diff/patch view (go-gitea#16891) (go-gitea#16892)
  * Ensure wiki repos are all closed (go-gitea#16886) (go-gitea#16888)
  * List limited and private orgs if authenticated on API (go-gitea#16866) (go-gitea#16879)
  * Simplify split diff view generation and remove JS dependency (go-gitea#16775) (go-gitea#16863)
  * Ensure that the default visibility is set on the user create page (go-gitea#16845) (go-gitea#16862)
  * In Render tolerate not being passed a context (go-gitea#16842) (go-gitea#16858)
  * Upgrade xorm to v1.2.2 (go-gitea#16663) & Add test to ensure that dumping of login sources remains correct (go-gitea#16847) (go-gitea#16848)
  * Report the correct number of pushes on the feeds (go-gitea#16811) (go-gitea#16822)
  * Add primary_key to issue_index (go-gitea#16813) (go-gitea#16820)
  * Prevent NPE on empty commit (go-gitea#16812) (go-gitea#16819)
  * Fix branch pagination error (go-gitea#16805) (go-gitea#16816)
  * Add missing return to handleSettingRemoteAddrError (go-gitea#16794) (go-gitea#16795)
  * Remove spurious / from issues.opened_by (go-gitea#16793)
  * Ensure that template compilation panics are sent to the logs (go-gitea#16788) (go-gitea#16792)
  * Update caddyserver/certmagic (go-gitea#16789) (go-gitea#16790)

Signed-off-by: Andrew Thornton <art27@cantab.net>
techknowlogick pushed a commit that referenced this pull request Sep 2, 2021
## [1.15.1](https://github.com/go-gitea/gitea/releases/tag/v1.15.1) - 2021-09-02

* BUGFIXES
  * Allow BASIC authentication access to /:owner/:repo/releases/download/* (#16916) (#16923)
  * Prevent leave changes dialogs due to autofill fields (#16912) (#16920)
  * Ignore review comment when ref commit is missed (#16905) (#16919)
  * Fix wrong attachment removal (#16915) (#16917)
  * Gitlab Migrator: dont ignore reactions of last request (#16903) (#16913)
  * Correctly return the number of Repositories for Organizations (#16807) (#16911)
  * Test if LFS object is accessible (#16865) (#16904)
  * Fix git.Blob.DataAsync(): close pipe since we return a NopCloser (#16899) (#16900)
  * Fix dump and restore respository (#16698) (#16898)
  * Repare and Improve GetDiffRangeWithWhitespaceBehavior (#16894) (#16895)
  * Fix wiki raw commit diff/patch view (#16891) (#16892)
  * Ensure wiki repos are all closed (#16886) (#16888)
  * List limited and private orgs if authenticated on API (#16866) (#16879)
  * Simplify split diff view generation and remove JS dependency (#16775) (#16863)
  * Ensure that the default visibility is set on the user create page (#16845) (#16862)
  * In Render tolerate not being passed a context (#16842) (#16858)
  * Upgrade xorm to v1.2.2 (#16663) & Add test to ensure that dumping of login sources remains correct (#16847) (#16848)
  * Report the correct number of pushes on the feeds (#16811) (#16822)
  * Add primary_key to issue_index (#16813) (#16820)
  * Prevent NPE on empty commit (#16812) (#16819)
  * Fix branch pagination error (#16805) (#16816)
  * Add missing return to handleSettingRemoteAddrError (#16794) (#16795)
  * Remove spurious / from issues.opened_by (#16793)
  * Ensure that template compilation panics are sent to the logs (#16788) (#16792)
  * Update caddyserver/certmagic (#16789) (#16790)

Signed-off-by: Andrew Thornton <art27@cantab.net>
@go-gitea go-gitea locked and limited conversation to collaborators Oct 19, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
backport/done All backports for this PR have been created lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. type/bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Number of commits from push listed on the start page is wrong
6 participants