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

batches: add a publish bulk action#22908

Merged
LawnGnome merged 15 commits intomainfrom
aharvey/publish-bulk-actions
Jul 16, 2021
Merged

batches: add a publish bulk action#22908
LawnGnome merged 15 commits intomainfrom
aharvey/publish-bulk-actions

Conversation

@LawnGnome
Copy link
Copy Markdown
Contributor

This is part seven of #18277. Many thanks to @eseliger for pointing me at some prior art, and everyone else on the team for signing on to this plan.

I've reused the hedged "attempt to X" wording from the close changesets bulk action: I know we didn't all love it, but it's more technically correct than saying we're definitely going to publish. I've also made this fairly forgiving: you can try to publish things that you can't publish, and you only get bulk operation errors rather than hard failures when you try to execute the bulk operation in the first place.

At one point, I had this implemented with a glorious single query. (Seriously, look at that. It's beautiful. I totally ripped off another query in this file, but I think I made it my own.) Unfortunately, doing so kind of breaks the assumptions of bulk operations: I could easily fake a changeset job with the IDs in the payload and have it operate, but the UI would be wrong when it showed the number of affected changesets. I toyed with adding a concept of a chunked changeset job, or making changeset jobs have a many-to-many relationship with changesets, but ultimately it felt like I was paddling upstream, so I reverted back to a simpler approach mimicking the other bulk actions.

Practically, this doesn't have much effect: there's a bit more scope for conflicting operations, but nothing should break even if the UI and spec publication states are changed repeatedly and in conflict. (I tried.) Mostly, it'll just make things a bit slower, and it means that updating a scheduled changeset will put it to the back of the queue. (Which is a hell of a corner case: you'd have to have a UI draft changeset and then change it to UI published while it was scheduled, but it's technically valid.)

@LawnGnome LawnGnome requested a review from a team July 16, 2021 05:26
className,
}) => (
<div className={classNames(iconClassNames, className)} data-tooltip="Set published: true to publish to code host">
<div className={classNames(iconClassNames, className)}>
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.

We could try to propagate the changeset spec down to figure out what message to show, but since this was already kind of inaccurate (drafts exist!), I think I'd rather deal with this in documentation.

@sourcegraph-bot
Copy link
Copy Markdown
Contributor

sourcegraph-bot commented Jul 16, 2021

Notifying subscribers in CODENOTIFY files for diff 3329cdf...ba410f8.

Notify File(s)
@eseliger client/web/src/enterprise/batches/detail/backend.ts
client/web/src/enterprise/batches/detail/bulk-operations/BulkOperationNode.tsx
client/web/src/enterprise/batches/detail/changesets/ChangesetSelectRow.tsx
client/web/src/enterprise/batches/detail/changesets/ChangesetStatusCell.tsx
client/web/src/enterprise/batches/detail/changesets/PublishChangesetsModal.story.tsx
client/web/src/enterprise/batches/detail/changesets/PublishChangesetsModal.tsx
cmd/frontend/graphqlbackend/batches.go
enterprise/internal/batches/background/bulk_processor.go
enterprise/internal/batches/background/bulk_processor_test.go
enterprise/internal/batches/resolvers/bulk_operation.go
enterprise/internal/batches/resolvers/resolver.go
enterprise/internal/batches/resolvers/resolver_test.go
enterprise/internal/batches/service/service_test.go
enterprise/internal/batches/store/changeset_jobs.go
enterprise/internal/batches/types/changeset_job.go

Comment thread enterprise/internal/batches/background/bulk_processor_test.go Outdated
Comment thread enterprise/internal/batches/background/bulk_processor_test.go Outdated
Comment thread enterprise/internal/batches/background/bulk_processor_test.go
Comment thread client/web/src/enterprise/batches/detail/changesets/PublishChangesetsModal.tsx Outdated
Comment thread enterprise/internal/batches/background/bulk_processor.go
Copy link
Copy Markdown
Member

@eseliger eseliger left a comment

Choose a reason for hiding this comment

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

LGTM 🌟 Thanks for changing this so quickly after yesterdays discussions!

We should get back to Thorstens comment as a follow-up but we needed to do that anyways and it's not worse than before so I don't have any problem merging this.

Comment thread enterprise/internal/batches/background/bulk_processor.go
@LawnGnome LawnGnome merged commit fd661df into main Jul 16, 2021
@LawnGnome LawnGnome deleted the aharvey/publish-bulk-actions branch July 16, 2021 16:21
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants