-
Notifications
You must be signed in to change notification settings - Fork 4
Add kit directory validation during installation #352
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
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 |
|---|---|---|
|
|
@@ -209,6 +209,76 @@ write_installation_record() { | |
| # Write installation record | ||
| write_installation_record | ||
|
|
||
| # Validate kit directories specified in templates | ||
| echo "" | ||
| echo "Validating kit directories..." | ||
|
|
||
| missing_kits=() | ||
| config_dir=$(readlink -f "config") | ||
|
|
||
| for template_file in config/*_template.yml; do | ||
| # Skip if no files match the pattern | ||
| [ -e "$template_file" ] || continue | ||
|
|
||
| template_name=$(basename "$template_file") | ||
|
|
||
| # Extract upload_extra value using yq | ||
| upload_extra=$(yq -r '.upload_extra // "none"' "$template_file" 2>/dev/null || echo "none") | ||
|
Comment on lines
+225
to
+226
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. 2. Yq not on path The validation calls yq immediately after installing it via pip3 --user, but the script never adds the user bin dir to PATH. If yq is not already on PATH, the validation silently treats all templates as having no upload_extra, defeating the PR’s goal. Agent Prompt
|
||
|
|
||
| # Skip if upload_extra is 'none', empty, or null | ||
| if [[ "$upload_extra" == "none" ]] || [[ -z "$upload_extra" ]] || [[ "$upload_extra" == "null" ]]; then | ||
| continue | ||
| fi | ||
|
|
||
| # Check if upload_extra is an array or a string | ||
| is_array=$(yq -r '.upload_extra | type' "$template_file" 2>/dev/null || echo "null") | ||
|
|
||
| if [[ "$is_array" == "array" ]]; then | ||
| # It's an array, process each element | ||
| while IFS= read -r path; do | ||
| if [[ "$path" != "none" ]] && [[ -n "$path" ]]; then | ||
| if [[ ! -e "$path" ]]; then | ||
| missing_kits+=("$template_name:$path") | ||
| fi | ||
| fi | ||
| done < <(yq -r '.upload_extra[]' "$template_file" 2>/dev/null) | ||
| else | ||
| # It's a string, split by spaces | ||
| IFS=' ' read -ra paths <<< "$upload_extra" | ||
| for path in "${paths[@]}"; do | ||
|
Comment on lines
+246
to
+248
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. 3. Comma parsing mismatch For string-valued upload_extra, the validation splits only on spaces. This conflicts with existing docs and runtime parsing which treat upload_extra as a comma-separated list; comma-separated strings will be treated as a single path and incorrectly reported missing. Agent Prompt
|
||
| if [[ "$path" != "none" ]] && [[ -n "$path" ]]; then | ||
| if [[ ! -e "$path" ]]; then | ||
| missing_kits+=("$template_name:$path") | ||
| fi | ||
| fi | ||
| done | ||
| fi | ||
| done | ||
|
|
||
| # Display warning if there are missing kits | ||
| if [ ${#missing_kits[@]} -gt 0 ]; then | ||
| echo "" | ||
| echo "======================================================================" | ||
| echo "WARNING: Missing Kit Directories" | ||
| echo "======================================================================" | ||
| echo "" | ||
| echo "The following kit files/directories specified in templates do not exist:" | ||
| echo "" | ||
| for entry in "${missing_kits[@]}"; do | ||
| template=$(echo "$entry" | cut -d':' -f1) | ||
| path=$(echo "$entry" | cut -d':' -f2-) | ||
| echo " - $template: $path" | ||
| done | ||
| echo "" | ||
| echo "These kits are required for certain benchmarks to run properly." | ||
| echo "Wrappers depending on these kits may fail until they are provided." | ||
| echo "" | ||
| echo "Please ensure the required kits are placed at the specified locations" | ||
| echo "or update the template files in $config_dir to reflect the correct paths." | ||
| echo "======================================================================" | ||
| echo "" | ||
| fi | ||
|
Comment on lines
+212
to
+280
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. 1. /home/uploads check missing The installer changes add kit-path validation but do not check whether /home/uploads exists or emit the required non-blocking warning message. This fails the required installer visibility behavior when /home/uploads is missing. Agent Prompt
|
||
|
|
||
| echo "Before you can run Zathras:" | ||
| echo "****Ensure ~/.local/bin is in your path" | ||
| echo "****Set up a scenario file" | ||
|
|
||
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.
4. Config path assumption
🐞 Bug⛯ ReliabilityAgent Prompt
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools