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

Make dep commit ids unique #77

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion buf/registry/module/v1beta1/upload_service.proto
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,10 @@ message UploadRequest {
//
// Commits should be unique by Module, that is no two dep_commit_ids should have the same Module but
// different Commit IDs.
repeated string dep_commit_ids = 2 [(buf.validate.field).repeated.items.string.uuid = true];
repeated string dep_commit_ids = 2 [
(buf.validate.field).repeated.unique = true,
Copy link
Member

Choose a reason for hiding this comment

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

We didn't use the unique validation throughout the API because it could be expensive - there's lot of other places we'd want to use it if we were going to be consistent. It's not actually enforcing the uniqueness we really need anyways - we need commits to be unique by module. A duplicate commit isn't actually an issue.

Copy link
Member Author

@unmultimedio unmultimedio Feb 26, 2024

Choose a reason for hiding this comment

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

Yeah I know the uniqueness is across modules (not commits), and I thought of making it at the code level, since I'm already looping through them anyway, but more of a conceptual question, is passing the same commit multiple times an error? May be not but I'm not sure how strict we want to be.

Copy link
Member

Choose a reason for hiding this comment

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

I don't think so - I think it's fine, we don't enforce this in other places, I'm not worried about it

(buf.validate.field).repeated.items.string.uuid = true
];
}

message UploadResponse {
Expand Down
Loading