-
Notifications
You must be signed in to change notification settings - Fork 113
chore: clean up api-public #2922
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
base: main
Are you sure you want to change the base?
Conversation
…en disconnected/reconnecting
The latest updates on your projects. Learn more about Vercel for GitHub.
1 Skipped Deployment
|
Claude encountered an error —— View job I'll analyze this and get back to you. |
commit: |
bb798a4
to
e92e865
Compare
Claude encountered an error —— View job I'll analyze this and get back to you. |
pub async fn list(ctx: ApiCtx, path: ListPath, query: ListQuery) -> Result<ListResponse> { | ||
let namespace = ctx | ||
.op(namespace::ops::resolve_for_name_global::Input { | ||
name: query.namespace.clone(), | ||
}) | ||
.await? | ||
.ok_or_else(|| namespace::errors::Namespace::NotFound.build())?; | ||
|
||
if query.runner_name.is_empty() { | ||
let runner_configs = ctx | ||
.op(namespace::ops::runner_config::get_local::Input { | ||
runners: query | ||
.runner_name | ||
.iter() | ||
.map(|name| (namespace.namespace_id, name.clone())) | ||
.collect(), | ||
}) | ||
.await?; | ||
|
||
Ok(ListResponse { | ||
// TODO: Implement ComposeSchema for FakeMap so we don't have to reallocate | ||
runner_configs: runner_configs | ||
.into_iter() | ||
.map(|c| (c.name, c.config)) | ||
.collect(), | ||
pagination: Pagination { cursor: None }, | ||
}) | ||
} else { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There appears to be a logic error in the conditional. The code checks if query.runner_name.is_empty()
but then proceeds to use query.runner_name
inside that block to fetch specific runner configs. This logic should be inverted - if query.runner_name
is NOT empty, then get those specific configs, otherwise list all configs with pagination.
The current implementation will attempt to map over an empty collection when the condition is true, which won't produce the expected results.
pub async fn list(ctx: ApiCtx, path: ListPath, query: ListQuery) -> Result<ListResponse> { | |
let namespace = ctx | |
.op(namespace::ops::resolve_for_name_global::Input { | |
name: query.namespace.clone(), | |
}) | |
.await? | |
.ok_or_else(|| namespace::errors::Namespace::NotFound.build())?; | |
if query.runner_name.is_empty() { | |
let runner_configs = ctx | |
.op(namespace::ops::runner_config::get_local::Input { | |
runners: query | |
.runner_name | |
.iter() | |
.map(|name| (namespace.namespace_id, name.clone())) | |
.collect(), | |
}) | |
.await?; | |
Ok(ListResponse { | |
// TODO: Implement ComposeSchema for FakeMap so we don't have to reallocate | |
runner_configs: runner_configs | |
.into_iter() | |
.map(|c| (c.name, c.config)) | |
.collect(), | |
pagination: Pagination { cursor: None }, | |
}) | |
} else { | |
pub async fn list(ctx: ApiCtx, path: ListPath, query: ListQuery) -> Result<ListResponse> { | |
let namespace = ctx | |
.op(namespace::ops::resolve_for_name_global::Input { | |
name: query.namespace.clone(), | |
}) | |
.await? | |
.ok_or_else(|| namespace::errors::Namespace::NotFound.build())?; | |
if !query.runner_name.is_empty() { | |
let runner_configs = ctx | |
.op(namespace::ops::runner_config::get_local::Input { | |
runners: query | |
.runner_name | |
.iter() | |
.map(|name| (namespace.namespace_id, name.clone())) | |
.collect(), | |
}) | |
.await?; | |
Ok(ListResponse { | |
// TODO: Implement ComposeSchema for FakeMap so we don't have to reallocate | |
runner_configs: runner_configs | |
.into_iter() | |
.map(|c| (c.name, c.config)) | |
.collect(), | |
pagination: Pagination { cursor: None }, | |
}) | |
} else { |
Spotted by Diamond
Is this helpful? React 👍 or 👎 to let us know.
@MasterPtato i'll let you figure out how to resolve these conflicts, very confused here |
No description provided.