Skip to content

controllers/owners: Resolve removal owner names in Rust - #14681

Merged
Turbo87 merged 2 commits into
rust-lang:mainfrom
Turbo87:owner-removal-resolver
Sep 16, 2026
Merged

Turbo87 merged 2 commits into
rust-lang:mainfrom
Turbo87:owner-removal-resolver

Conversation

@Turbo87

@Turbo87 Turbo87 commented Sep 14, 2026

Copy link
Copy Markdown
Member

The removal handler now resolves owner names against the initial owner list in Rust before passing user and team identities to a single database update. This separates name resolution from row removal, simplifies the SQL query and prepares the handler to support distinct crates.io: and github: namespaces in the next PR.

Related

@Turbo87
Turbo87 requested a review from a team September 14, 2026 19:39
@Turbo87 Turbo87 added the C-internal 🔧 Category: Nonessential work that would make the codebase more consistent or clear label Sep 14, 2026
Comment thread crates/crates_io_database/src/models/krate.rs
Comment thread crates/crates_io_database/tests/crate_owners.rs

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

Thanks! This seems to be a manageable way to do it in Diesel without writing raw SQL by hand so far.

View changes since this review

Turbo87 and others added 2 commits September 16, 2026 13:21
`Crate::remove_owners()` soft-deletes selected user and team identities
with one Diesel update scoped to the crate. Matching includes the owner
kind so users and teams with the same ID remain distinct.

Co-authored-by: moskirathe <tech@alphajiri.co>
Owner removals now resolve all supplied names against the initial owner
list before updating ownership rows in one query. Repeated names select
the same owners, and missing names fail before any updates.

The transaction still rejects removing every individual owner. The
name-based SQL removal method is no longer needed.

Co-authored-by: moskirathe <tech@alphajiri.co>
@Turbo87
Turbo87 force-pushed the owner-removal-resolver branch from 15801b3 to 35c4ad0 Compare September 16, 2026 11:21
@rustbot

rustbot commented Sep 16, 2026

Copy link
Copy Markdown
Collaborator

This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed.

Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers.

@Turbo87
Turbo87 merged commit 305d677 into rust-lang:main Sep 16, 2026
12 checks passed
@Turbo87
Turbo87 deleted the owner-removal-resolver branch September 16, 2026 12:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-backend ⚙️ C-internal 🔧 Category: Nonessential work that would make the codebase more consistent or clear

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants