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

batches: exclude archived, deleted changesets from completion percentage calculation#46831

Merged
courier-new merged 4 commits into
mainfrom
kr/dont-count-archived-percent
Jan 26, 2023
Merged

batches: exclude archived, deleted changesets from completion percentage calculation#46831
courier-new merged 4 commits into
mainfrom
kr/dont-count-archived-percent

Conversation

@courier-new

@courier-new courier-new commented Jan 24, 2023

Copy link
Copy Markdown
Contributor

Closes https://github.com/sourcegraph/sourcegraph/issues/46830.

This was surfaced in Slack and felt like a reasonable change.

The completion percentage is now defined based on two values: the total "actionable changesets" as the denominator, which is defined as the total minus any archived and deleted changesets; and the total "completed changesets" as the numerator, which is defined as the sum of merged and closed changesets.

There's been confusion about how the completion percentage is calculated at times before, as well as confusion over what "archived" means and how that's factored in to this percentage. For this reason, I've added an info icon + tooltip and a short description to the top of the archived changesets list, in the style of several of our admin pages where the contents of the container are explained in brief just above it. This description includes a link to the docs, too. You can see these changes below:

image

cc @danielmarquespt

Open to wording suggestions. 🙂

Test plan

Updated storybooks to use control knobs to test how different changeset stats affect the percentage. As in the screenshot above, you can verify archived was not included in the batch change completion percentage.

App preview:

Check out the client app preview documentation to learn more.

@courier-new courier-new added the batch-changes Issues related to Batch Changes label Jan 24, 2023
@courier-new courier-new requested a review from a team January 24, 2023 07:43
@courier-new courier-new self-assigned this Jan 24, 2023
@cla-bot cla-bot Bot added the cla-signed label Jan 24, 2023
@sourcegraph-bot

sourcegraph-bot commented Jan 24, 2023

Copy link
Copy Markdown
Contributor

Codenotify: Notifying subscribers in CODENOTIFY files for diff f0d44cf...36c2299.

Notify File(s)
@BolajiOlajide client/web/src/enterprise/batches/close/BatchChangeClosePage.story.tsx
client/web/src/enterprise/batches/detail/BatchChangeDetailsTabs.tsx
client/web/src/enterprise/batches/detail/BatchChangeStatsCard.story.tsx
client/web/src/enterprise/batches/detail/BatchChangeStatsCard.tsx
client/web/src/integration/batches.test.ts
@eseliger client/web/src/enterprise/batches/close/BatchChangeClosePage.story.tsx
client/web/src/enterprise/batches/detail/BatchChangeDetailsTabs.tsx
client/web/src/enterprise/batches/detail/BatchChangeStatsCard.story.tsx
client/web/src/enterprise/batches/detail/BatchChangeStatsCard.tsx
client/web/src/integration/batches.test.ts

@sg-e2e-regression-test-bob

sg-e2e-regression-test-bob commented Jan 24, 2023

Copy link
Copy Markdown

Bundle size report 📦

Initial size Total size Async size Modules
0.00% (0.00 kb) 0.01% (+1.26 kb) 0.01% (+1.26 kb) 0.00% (0)

Look at the Statoscope report for a full comparison between the commits 36c2299 and 90ebc94 or learn more.

Open explanation
  • Initial size is the size of the initial bundle (the one that is loaded when you open the page)
  • Total size is the size of the initial bundle + all the async loaded chunks
  • Async size is the size of all the async loaded chunks
  • Modules is the number of modules in the initial bundle

@BolajiOlajide BolajiOlajide 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.

Approving to unblock.

Comment on lines +56 to +61
args.closed +
args.deleted +
args.merged +
args.draft +
args.open +
args.archived +

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.

Suggested change
args.closed +
args.deleted +
args.merged +
args.draft +
args.open +
args.archived +
args.merged +
args.draft +
args.open +

Should archived & deleted changesets still be part of the total here? I think it shouldn't.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I believe they should be here, actually. This is supposed to mirror the data we'd get from the backend, where total is literally just SELECT COUNT(*) FROM CHANGESETS.

@eseliger eseliger left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

actually approving to unblock 😛

Comment thread client/web/src/enterprise/batches/detail/BatchChangeDetailsTabs.tsx Outdated
const { changesetsStats: stats, diffStat } = batchChange
const percentComplete = stats.total === 0 ? 0 : ((stats.closed + stats.merged + stats.deleted) / stats.total) * 100
const isCompleted = stats.closed + stats.merged + stats.deleted === stats.total
const percentComplete =

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I wonder if at this point this should move in the backend, seems fairly complex logic needs to be applied in the frontend to get that value :D

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

You're probably right. 🙂 I'm too lazy to do that right now but I'll leave a note!

@courier-new courier-new enabled auto-merge (squash) January 26, 2023 07:19
@courier-new courier-new merged commit 5af62f4 into main Jan 26, 2023
@courier-new courier-new deleted the kr/dont-count-archived-percent branch January 26, 2023 07:33
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

batch-changes Issues related to Batch Changes cla-signed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

batches: don't count archived changesets towards completion percentage

5 participants