-
Notifications
You must be signed in to change notification settings - Fork 11
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
hotfix: Shapefile 用のフィールド名辞書を更新する #545
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -283,7 +283,10 @@ | |
}); | ||
|
||
// wait for the pipeline to finish | ||
handle.join(); | ||
if let Err(msg) = handle.join() { | ||
log::error!("Pipeline thread panicked: {:?}", msg); | ||
} | ||
|
||
Comment on lines
+286
to
+289
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Tip Codebase Verification
Analysis chain
Scripts ExecutedThe following scripts were executed for the analysis: Script: #!/bin/bash
# Description: Verify if the new line is covered by tests.
# Test: Search for the test coverage of the line. Expect: Coverage report showing the line.
rg --type rust $'if let Err(msg) = handle.join()' nusamai/src/main.rs
Length of output: 70 Script: #!/bin/bash
# Description: Search for test functions related to thread operations and joining threads.
# Find all Rust test functions in the codebase.
rg --type rust --pattern '#\[test\]' --context 10
# Specifically look for thread operations and joining threads in test files.
rg --type rust 'thread::spawn' --context 10
rg --type rust 'handle.join()' --context 10
Length of output: 6594 Script: #!/bin/bash
# Description: Search for test functions that include `handle.join()` and handle errors.
# Find all Rust test functions that include `handle.join()`.
rg --type rust 'handle.join()' --context 10 | rg --type rust '#\[test\]' --context 10
Length of output: 1122 |
||
if canceller.lock().unwrap().is_canceled() { | ||
log::info!("Pipeline canceled"); | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -110,16 +110,29 @@ | |
|
||
impl PipelineHandle { | ||
// Wait for the pipeline to terminate | ||
pub fn join(self) { | ||
if self.source_thread_handle.join().is_err() { | ||
log::error!("Source thread panicked"); | ||
pub fn join(self) -> Result<(), String> { | ||
fn report_error(stage: &str, err: Box<dyn std::any::Any + Send>) -> String { | ||
let msg = if let Some(message) = err.downcast_ref::<&str>() { | ||
format!("{stage} thread panicked with message: {}", message) | ||
} else if let Some(string) = err.downcast_ref::<String>() { | ||
format!("{stage} thread panicked with message: {}", string) | ||
} else { | ||
format!("{stage} thread panicked with an unknown type.") | ||
}; | ||
log::error!("{}", msg); | ||
msg.to_string() | ||
} | ||
if self.transformer_thread_handle.join().is_err() { | ||
log::error!("Transformer thread panicked"); | ||
|
||
if let Err(err) = self.source_thread_handle.join() { | ||
return Err(report_error("Source", err)); | ||
} | ||
if let Err(err) = self.transformer_thread_handle.join() { | ||
return Err(report_error("Transformer", err)); | ||
} | ||
if self.sink_thread_handle.join().is_err() { | ||
log::error!("Sink thread panicked"); | ||
if let Err(err) = self.sink_thread_handle.join() { | ||
return Err(report_error("Sink", err)); | ||
} | ||
Ok(()) | ||
Comment on lines
+113
to
+135
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Tip Codebase Verification
以下の点を確認する必要があります:
このためには、エラーハンドリングロジックをテストするための新しいテストケースを追加することをお勧めします。
Analysis chain
Scripts ExecutedThe following scripts were executed for the analysis: Script: #!/bin/bash
# Description: Verify if the new lines are covered by tests.
# Test: Search for the test coverage of the lines. Expect: Coverage report showing the lines.
rg --type rust $'pub fn join(self) -> Result<(), String>' nusamai/src/pipeline/runner.rs
Length of output: 89 Script: #!/bin/bash
# Search for test functions that call the `join` method in the codebase.
rg 'join\(\)' --type rust --glob '*_test.rs'
# Search for test files that might include tests for `PipelineHandle`.
rg 'PipelineHandle' --type rust --glob '*_test.rs'
Length of output: 395 Script: #!/bin/bash
# Locate all test files in the repository.
fd --type f --glob '*_test.rs'
# Search for the `join` method in the located test files.
fd --type f --glob '*_test.rs' --exec rg 'join\(\)'
# Search for `PipelineHandle` in the located test files.
fd --type f --glob '*_test.rs' --exec rg 'PipelineHandle'
Length of output: 144 Script: #!/bin/bash
# List all files in the repository to identify potential test files.
fd --type f
# Search for the `join` method in all Rust files to ensure we are not missing any test files.
rg 'join\(\)' --type rust
# Search for `PipelineHandle` in all Rust files to ensure we are not missing any test files.
rg 'PipelineHandle' --type rust
Length of output: 58092 Script: #!/bin/bash
# Extract and review the relevant test functions in `nusamai/tests/sink.rs` and `nusamai/tests/pipeline.rs`.
# Extract test functions from `nusamai/tests/sink.rs` that call `join`.
rg -A 10 'handle.join\(\)' nusamai/tests/sink.rs
# Extract test functions from `nusamai/tests/pipeline.rs` that call `join`.
rg -A 10 'handle.join\(\)' nusamai/tests/pipeline.rs
Length of output: 606 |
||
} | ||
} | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,7 +24,10 @@ | |
}; | ||
|
||
for (field_name, attr) in attributes { | ||
let name = field_name.as_str().try_into().unwrap(); // FIXME: handle errors | ||
let Ok(name) = field_name.as_str().try_into() else { | ||
log::error!("Field name '{}' cannot be used in Shapefile", field_name); | ||
continue; | ||
}; | ||
Comment on lines
+27
to
+30
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Tip Codebase Verification
Analysis chain
Scripts ExecutedThe following scripts were executed for the analysis: Script: #!/bin/bash
# Description: Verify if the new lines are covered by tests.
# Test: Search for the test coverage of the lines. Expect: Coverage report showing the lines.
rg --type rust $'let Ok(name) = field_name.as_str().try_into()' nusamai/src/sink/shapefile/attributes.rs
Length of output: 105 Script: #!/bin/bash
# Description: Search for test functions that might cover the `make_table_builder` function.
# Find all test files in the repository
test_files=$(fd --type f --extension rs --exec rg --files-with-matches 'fn test' {} +)
# Search for invocations of `make_table_builder` in the test files
for file in $test_files; do
rg 'make_table_builder' $file
done
Length of output: 14593 Script: #!/bin/bash
# Description: Search for test functions in `nusamai/src/sink/shapefile/mod.rs` that might cover `make_table_builder`.
# Search for test functions in the file
rg 'fn test' nusamai/src/sink/shapefile/mod.rs
Length of output: 94 Script: #!/bin/bash
# Description: Search for invocations of `make_table_builder` within the `test_toplevel_cityobj_multipolygon` function.
# Search for the `test_toplevel_cityobj_multipolygon` function definition and its body
rg -A 20 'fn test_toplevel_cityobj_multipolygon' nusamai/src/sink/shapefile/mod.rs | rg 'make_table_builder'
Length of output: 108 |
||
let key = field_name.to_string(); | ||
|
||
match attr.type_ref { | ||
|
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -162,5 +162,5 @@ fn test_run_pipeline() { | |
}); | ||
|
||
// wait for the pipeline to finish | ||
handle.join(); | ||
handle.join().unwrap(); | ||
} |
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.
Tip
Codebase Verification
run_conversion
関数のhandle.join()
エラーハンドリングがテストでカバーされていないようです。この新しいエラーハンドリングロジックをカバーするために、特定のテストケースを追加することをお勧めします。run_conversion
関数のhandle.join()
エラーハンドリングをカバーするテストケースを追加してください。Analysis chain
run_conversion
関数に追加されたhandle.join()
のエラーハンドリングにより、スレッドの結合中に発生する可能性のあるエラーを適切に処理できるようになりました。この変更は、エラーハンドリングを強化するというプルリクエストの目的に合致しています。Scripts Executed
The following scripts were executed for the analysis:
Script:
Length of output: 76
Script:
Length of output: 25084
Script:
Length of output: 25426