Skip to content
This repository was archived by the owner on Sep 30, 2024. It is now read-only.

site-admin: Always order code host sync errors in status messages#48722

Merged
indradhanush merged 3 commits into
mainfrom
ig/status-message-ordering
Mar 6, 2023
Merged

site-admin: Always order code host sync errors in status messages#48722
indradhanush merged 3 commits into
mainfrom
ig/status-message-ordering

Conversation

@indradhanush

@indradhanush indradhanush commented Mar 6, 2023

Copy link
Copy Markdown
Contributor

Buggy behaviour:

Ordering of sync errors will change on subsequent API requests
https://user-images.githubusercontent.com/2682729/223110004-e7baef93-930e-4e9c-8aa0-a47c4f925163.mp4

Updated behaviour
Ordering of sync errors remains constant on subsequent API requests
https://user-images.githubusercontent.com/2682729/223108826-5bd696e6-c102-4126-8a7a-f73f1f0d8381.mp4

Test plan

  • Tested locally
  • Updated tests
  • Builds should pass

Co-authored-by: Thorsten Ball <mrnugget@gmail.com>
@cla-bot cla-bot Bot added the cla-signed label Mar 6, 2023
@indradhanush indradhanush requested a review from a team March 6, 2023 12:28
@indradhanush indradhanush self-assigned this Mar 6, 2023
@indradhanush indradhanush added site-admin Site admin experience site-admin-ux Issues related to site-admin UX: bugs, papercuts, design, ... labels Mar 6, 2023

@mrnugget mrnugget left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

All good, but

  1. Left one suggestion for nice refactor while we're here
  2. Dumb comments about saving newlines that I'm 51% serious about

Comment thread internal/database/external_services.go Outdated

if err := rows.Err(); err != nil {
return nil, err
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@indradhanush here's something cool that makes up for the asdf troubles we can into: you can remove 30lines here by using the basestore.NewSliceScanner thing. Take a look at the Scan []horse section here: https://docs.sourcegraph.com/dev/background-information/basestore#using-basestore-helpers-for-scanning

Comment thread internal/database/external_services_test.go Outdated
Comment thread internal/database/external_services_test.go Outdated

@sashaostrikov sashaostrikov left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks
good
to
me
(except
new
lines
of
course)

@indradhanush indradhanush requested a review from mrnugget March 6, 2023 13:13

@mrnugget mrnugget left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

beautiful

Comment thread internal/database/external_services.go Outdated
}

return messages, nil
return scanSyncErrors(rows, err)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I'm 99% this works, saving you another 4 lines:

Suggested change
return scanSyncErrors(rows, err)
return scanSyncErrors(e.Query)

@indradhanush indradhanush enabled auto-merge (squash) March 6, 2023 13:40
@sourcegraph-bot

Copy link
Copy Markdown
Contributor

Codenotify: Notifying subscribers in CODENOTIFY files for diff ae9fd93...e19e718.

Notify File(s)
@eseliger internal/database/external_services.go
internal/database/external_services_test.go
@sashaostrikov internal/repos/status_messages.go
internal/repos/status_messages_test.go

@indradhanush indradhanush merged commit 91b3082 into main Mar 6, 2023
@indradhanush indradhanush deleted the ig/status-message-ordering branch March 6, 2023 14:15
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

cla-signed site-admin Site admin experience site-admin-ux Issues related to site-admin UX: bugs, papercuts, design, ...

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants