mirror of
https://github.com/block/buzz.git
synced 2026-11-04 00:12:02 +00:00
refactor(projects): remove unreachable command scaffolding
Signed-off-by: John Tennant <jtennant@squareup.com>
This commit is contained in:
@@ -28,7 +28,6 @@ async fn submit_related_channel_command(
|
||||
&project_coordinate.coordinate,
|
||||
channel_id,
|
||||
operation,
|
||||
None,
|
||||
)
|
||||
.map_err(sdk_error)?;
|
||||
let event = client.sign_event(builder)?;
|
||||
|
||||
@@ -535,9 +535,6 @@ fn required_scope_for_kind(kind: u32, event: &Event) -> Result<Scope, &'static s
|
||||
// actors are home-channel admins. Standard CLI auth includes
|
||||
// `channels:write`, not `repos:write`.
|
||||
KIND_PROJECT_RELATED_CHANNEL => Ok(Scope::ChannelsWrite),
|
||||
// Relay-derived read model. Clients are rejected by the relay-only gate;
|
||||
// this keeps the registered-kind scope map total.
|
||||
KIND_PROJECT_RELATED_CHANNELS_SNAPSHOT => Ok(Scope::ChannelsWrite),
|
||||
KIND_GIT_PATCH
|
||||
| KIND_GIT_PULL_REQUEST
|
||||
| KIND_GIT_PR_UPDATE
|
||||
@@ -5593,10 +5590,6 @@ mod postgres_tests {
|
||||
);
|
||||
assert!(is_global_only_kind(KIND_PROJECT_RELATED_CHANNEL));
|
||||
assert!(!requires_h_channel_scope(KIND_PROJECT_RELATED_CHANNEL));
|
||||
assert_eq!(
|
||||
required_scope_for_kind(KIND_PROJECT_RELATED_CHANNELS_SNAPSHOT, &dummy).unwrap(),
|
||||
Scope::ChannelsWrite
|
||||
);
|
||||
assert!(is_global_only_kind(KIND_PROJECT_RELATED_CHANNELS_SNAPSHOT));
|
||||
assert!(buzz_core::kind::is_relay_only_kind(
|
||||
KIND_PROJECT_RELATED_CHANNELS_SNAPSHOT
|
||||
|
||||
@@ -214,7 +214,6 @@ pub fn build_project_related_channel_command(
|
||||
project_coordinate: &str,
|
||||
channel_id: Uuid,
|
||||
operation: ProjectRelatedChannelOperation,
|
||||
auth: Option<Tag>,
|
||||
) -> Result<EventBuilder, SdkError> {
|
||||
let _ = ProjectRelatedChannelCoordinate::parse(project_coordinate)?;
|
||||
if channel_id.is_nil() {
|
||||
@@ -222,7 +221,7 @@ pub fn build_project_related_channel_command(
|
||||
"d target must not be the nil UUID".into(),
|
||||
));
|
||||
}
|
||||
let mut tags = vec![
|
||||
let tags = vec![
|
||||
Tag::parse(["a", project_coordinate])
|
||||
.map_err(|error| SdkError::InvalidTag(error.to_string()))?,
|
||||
Tag::parse(["op", operation.as_str()])
|
||||
@@ -230,16 +229,6 @@ pub fn build_project_related_channel_command(
|
||||
Tag::parse(["d", &channel_id.to_string()])
|
||||
.map_err(|error| SdkError::InvalidTag(error.to_string()))?,
|
||||
];
|
||||
if let Some(auth) = auth {
|
||||
let parts = auth.as_slice();
|
||||
if parts.len() != 4 || parts.first().map(String::as_str) != Some("auth") {
|
||||
return Err(SdkError::InvalidInput(
|
||||
"auth tag must have exactly four elements".into(),
|
||||
));
|
||||
}
|
||||
tags.push(auth);
|
||||
}
|
||||
|
||||
Ok(EventBuilder::new(Kind::Custom(KIND_PROJECT_RELATED_CHANNEL as u16), "").tags(tags))
|
||||
}
|
||||
|
||||
@@ -381,9 +370,9 @@ mod tests {
|
||||
&coordinate(&keys),
|
||||
Uuid::new_v4(),
|
||||
ProjectRelatedChannelOperation::Add,
|
||||
Some(auth),
|
||||
)
|
||||
.expect("build command")
|
||||
.tag(auth)
|
||||
.sign_with_keys(&keys)
|
||||
.expect("sign command");
|
||||
|
||||
@@ -399,7 +388,6 @@ mod tests {
|
||||
&coordinate(&keys),
|
||||
channel,
|
||||
ProjectRelatedChannelOperation::Remove,
|
||||
None,
|
||||
)
|
||||
.is_ok());
|
||||
|
||||
|
||||
Reference in New Issue
Block a user