fix: various bugs#165
Conversation
unicode issues (try bt sync pull --window 1é)
|
Latest downloadable build artifacts for this PR commit
Available artifact names
|
|
Normal call, 1 slug is requested 1 function is seen: Buggy call, 2 slugs requested 3 functions seen: The API endpoint used to get functions only accepts 1 slug id. This code could be used if multiple requests are deemed better. diff --git a/src/functions/pull.rs b/src/functions/pull.rs
index 8f2e6de..4fa9ffa 100644
--- a/src/functions/pull.rs
+++ b/src/functions/pull.rs
@@ -185,16 +185,44 @@ pub async fn run(base: BaseArgs, args: PullArgs) -> Result<()> {
ProgressBar::hidden()
};
- let fetched = match fetch_all_function_rows(&auth_ctx.client, &query).await {
- Ok(fetched) => fetched,
- Err(err) => {
- spinner.finish_and_clear();
- return fail_pull(
- &base,
- &mut summary,
- HardFailureReason::PaginationUnsupported,
- err.to_string(),
- );
+ let fetched = if resolved_slugs.len() > 1 {
+ // Issue one request per slug so the server filters server-side.
+ let mut merged = FetchRowsResult {
+ rows: Vec::new(),
+ warnings: Vec::new(),
+ };
+ for slug in &resolved_slugs {
+ let mut slug_query = query.clone();
+ slug_query.slug = Some(slug.clone());
+ match fetch_all_function_rows(&auth_ctx.client, &slug_query).await {
+ Ok(result) => {
+ merged.rows.extend(result.rows);
+ merged.warnings.extend(result.warnings);
+ }
+ Err(err) => {
+ spinner.finish_and_clear();
+ return fail_pull(
+ &base,
+ &mut summary,
+ HardFailureReason::PaginationUnsupported,
+ err.to_string(),
+ );
+ }
+ }
+ }
+ merged
+ } else {
+ match fetch_all_function_rows(&auth_ctx.client, &query).await {
+ Ok(fetched) => fetched,
+ Err(err) => {
+ spinner.finish_and_clear();
+ return fail_pull(
+ &base,
+ &mut summary,
+ HardFailureReason::PaginationUnsupported,
+ err.to_string(),
+ );
+ }
}
};
summary.functions_seen = fetched.rows.len(); |
|
The server validates all the rows anyway but it's better to choose only the rows So not a bug per se but could have become one. |
|
These projects are from a personal org, you have to select different project ids if you want to test it yourself. The command to show the next page drops the Now does not drop the argument:
|
|
let's just make these all individual prs. easier to revert that way. |
Concurrency issue with multiple bt switch (although it seems unlikely it would have ever triggered)
Unicode issues causing thread panic (try
bt sync pull --window 1éon the main branch)bt functions pullcould ask for rows with invalid project idbt view logs/tracenext page hint lacked the--limitargumentReplace manual
.tmpfile write withtempfile::NamedTempFileDeduplicate
parse_duration_to_seconds