Skip to content

Commit 99f5fa2

Browse files
committed
Apply the CodeRabbit recommendations
1 parent 321ea52 commit 99f5fa2

3 files changed

Lines changed: 60 additions & 7 deletions

File tree

ansible/roles/ovos_config/defaults/main.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ ovos_config_backup_paths_common:
1818
ovos_config_backup_paths: >-
1919
{{
2020
ovos_config_backup_paths_common
21-
+ ([ovos_installer_user_home + '/.config/systemd/user/*'] if ansible_facts.system == 'Linux' else [])
21+
+ ([ovos_installer_user_home + '/.config/systemd/user/*'] if (ansible_facts.system | default('')) == 'Linux' else [])
2222
}}
2323
ovos_config_backup_dest: "{{ ovos_installer_user_home }}/ovos-backup.tar.gz"
2424
ovos_config_backup_owner: "{{ ovos_installer_user }}"
@@ -33,7 +33,7 @@ ovos_config_container_dir_owner: "{{ ovos_installer_user }}"
3333
ovos_config_container_dir_group: "{{ ovos_installer_group }}"
3434
ovos_config_container_dir_mode: "0755"
3535
ovos_config_container_directories:
36-
- { path: "{{ ovos_installer_user_home }}/.config/systemd/user", enabled: "{{ ansible_facts.system == 'Linux' }}" }
36+
- { path: "{{ ovos_installer_user_home }}/.config/systemd/user", enabled: "{{ (ansible_facts.system | default('')) == 'Linux' }}" }
3737
- { path: "{{ ovos_installer_user_home }}/ovos", enabled: true }
3838
- { path: "{{ ovos_installer_user_home }}/ovos/config", enabled: true }
3939
- { path: "{{ ovos_installer_user_home }}/ovos/config/persona", enabled: true }
@@ -53,7 +53,7 @@ ovos_config_virtualenv_directories:
5353
- { path: "{{ ovos_installer_user_home }}/.local", enabled: true }
5454
- { path: "{{ ovos_installer_user_home }}/.local/bin", enabled: true }
5555
- { path: "{{ ovos_installer_user_home }}/.config/hivemind", enabled: "{{ ovos_installer_profile != 'ovos' }}" }
56-
- { path: "{{ ovos_installer_user_home }}/.config/systemd/user", enabled: "{{ ansible_facts.system == 'Linux' }}" }
56+
- { path: "{{ ovos_installer_user_home }}/.config/systemd/user", enabled: "{{ (ansible_facts.system | default('')) == 'Linux' }}" }
5757
- { path: "{{ ovos_installer_user_home }}/nltk_data", enabled: true }
5858

5959
ovos_config_geoip_url: "{{ ovos_installer_geoip_url }}"

ansible/roles/ovos_virtualenv/tasks/venv.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -290,6 +290,7 @@
290290
PATH: "{{ ovos_virtualenv_uv_exec_path }}"
291291
UV_CACHE_DIR: "{{ ovos_virtualenv_uv_cache_dir }}"
292292
when:
293+
- not (ovos_installer_cleaning | default(false) | bool)
293294
- ovos_installer_cpu_is_capable | bool
294295
- ansible_facts.system != 'Darwin'
295296

@@ -304,6 +305,7 @@
304305
PATH: "{{ ovos_virtualenv_uv_exec_path }}"
305306
UV_CACHE_DIR: "{{ ovos_virtualenv_uv_cache_dir }}"
306307
when:
308+
- not (ovos_installer_cleaning | default(false) | bool)
307309
- ansible_facts.system == 'Darwin' or not (ovos_installer_cpu_is_capable | bool)
308310

309311
- name: Install ggwave Python library
@@ -317,7 +319,9 @@
317319
HOME: "{{ ovos_installer_user_home }}"
318320
PATH: "{{ ovos_virtualenv_uv_exec_path }}"
319321
UV_CACHE_DIR: "{{ ovos_virtualenv_uv_cache_dir }}"
320-
when: ovos_installer_enable_ggwave | bool
322+
when:
323+
- not (ovos_installer_cleaning | default(false) | bool)
324+
- ovos_installer_enable_ggwave | bool
321325

322326
- name: Install Open Voice OS in Python venv
323327
become: true
@@ -367,6 +371,7 @@
367371
HOME: "{{ ovos_installer_user_home }}"
368372
PATH: "{{ ovos_virtualenv_uv_exec_path }}"
369373
UV_CACHE_DIR: "{{ ovos_virtualenv_uv_cache_dir }}"
374+
when: not (ovos_installer_cleaning | default(false) | bool)
370375

371376
- name: Ensure setuptools Python library is compatible with OVOS runtime
372377
become: true
@@ -379,6 +384,7 @@
379384
HOME: "{{ ovos_installer_user_home }}"
380385
PATH: "{{ ovos_virtualenv_uv_exec_path }}"
381386
UV_CACHE_DIR: "{{ ovos_virtualenv_uv_cache_dir }}"
387+
when: not (ovos_installer_cleaning | default(false) | bool)
382388

383389
- name: Check ovos virtualenv activate script exists
384390
ansible.builtin.stat:

tests/bats/code_quality.bats

Lines changed: 50 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -409,6 +409,25 @@ function setup() {
409409
assert_success
410410
}
411411

412+
@test "virtualenv_uv_bootstrap_and_runtime_installs_skip_cleaning" {
413+
local file="ansible/roles/ovos_virtualenv/tasks/venv.yml"
414+
415+
run bash -c "grep -A12 -F -- \"- name: Install tflite_runtime bootstrap package (non-macOS AVX/SIMD hosts)\" \"$file\" | grep -F -q -- 'not (ovos_installer_cleaning | default(false) | bool)'"
416+
assert_success
417+
418+
run bash -c "grep -A12 -F -- \"- name: Install wheel bootstrap package (macOS or non-AVX/SIMD hosts)\" \"$file\" | grep -F -q -- 'not (ovos_installer_cleaning | default(false) | bool)'"
419+
assert_success
420+
421+
run bash -c "grep -A12 -F -- \"- name: Install ggwave Python library\" \"$file\" | grep -F -q -- 'not (ovos_installer_cleaning | default(false) | bool)'"
422+
assert_success
423+
424+
run bash -c "grep -A12 -F -- \"- name: Ensure numpy Python library is installed\" \"$file\" | grep -F -q -- 'not (ovos_installer_cleaning | default(false) | bool)'"
425+
assert_success
426+
427+
run bash -c "grep -A12 -F -- \"- name: Ensure setuptools Python library is compatible with OVOS runtime\" \"$file\" | grep -F -q -- 'not (ovos_installer_cleaning | default(false) | bool)'"
428+
assert_success
429+
}
430+
412431
@test "virtualenv_repairs_ownership_before_python_package_installs" {
413432
local file="ansible/roles/ovos_virtualenv/tasks/venv.yml"
414433

@@ -428,6 +447,13 @@ function setup() {
428447
assert_success
429448
}
430449

450+
@test "ovos_config_defaults_guard_ansible_facts_system_references" {
451+
local file="ansible/roles/ovos_config/defaults/main.yml"
452+
453+
run grep -F -q "(ansible_facts.system | default('')) == 'Linux'" "$file"
454+
assert_success
455+
}
456+
431457
@test "macos_fann2_build_has_swig2_compatibility_shim" {
432458
run grep -q "Resolve swig binary path for fann2 builds (macOS)" ansible/roles/ovos_virtualenv/tasks/packages.yml
433459
assert_success
@@ -491,13 +517,13 @@ function setup() {
491517
run grep -q "ovos_config_backup_paths_common" ansible/roles/ovos_config/defaults/main.yml
492518
assert_success
493519

494-
run grep -q "ansible_facts.system == 'Linux'" ansible/roles/ovos_config/defaults/main.yml
520+
run grep -q "(ansible_facts.system | default('')) == 'Linux'" ansible/roles/ovos_config/defaults/main.yml
495521
assert_success
496522

497-
run grep -F -q '.config/systemd/user", enabled: "{{ ansible_facts.system == '\''Linux'\'' }}"' ansible/roles/ovos_config/defaults/main.yml
523+
run grep -F -q "enabled: \"{{ (ansible_facts.system | default('')) == 'Linux' }}\"" ansible/roles/ovos_config/defaults/main.yml
498524
assert_success
499525

500-
run grep -F -q "/.config/systemd/user/*'] if ansible_facts.system == 'Linux' else []" ansible/roles/ovos_config/defaults/main.yml
526+
run grep -F -q "/.config/systemd/user/*'] if (ansible_facts.system | default('')) == 'Linux' else []" ansible/roles/ovos_config/defaults/main.yml
501527
assert_success
502528
}
503529

@@ -676,6 +702,14 @@ function setup() {
676702
assert_failure
677703
}
678704

705+
@test "launchd_install_uses_collection_module_only" {
706+
run grep -q "community.general.launchd" ansible/roles/ovos_services/tasks/launchd.yml
707+
assert_success
708+
709+
run grep -q "launchctl" ansible/roles/ovos_services/tasks/launchd.yml
710+
assert_failure
711+
}
712+
679713
@test "launchd_uninstall_removes_plists_with_privilege_escalation" {
680714
run bash -c "grep -A4 -F -- \"- name: Remove OVOS launchd plist files\" ansible/roles/ovos_services/tasks/uninstall-launchd.yml | grep -q -- \"become: true\""
681715
assert_success
@@ -706,6 +740,19 @@ function setup() {
706740
assert_success
707741
}
708742

743+
@test "mycroft_conf_sanitizes_timezone_prefix" {
744+
run grep -F -q "regex_replace('(?i)^\\\\s*time\\\\s*zone\\\\s*:\\\\s*', '')" ansible/roles/ovos_config/templates/mycroft.conf.j2
745+
assert_success
746+
}
747+
748+
@test "macos_cpu_detection_queries_leaf7_only_on_intel" {
749+
run grep -q 'machine_arch="$(uname -m' utils/common.sh
750+
assert_success
751+
752+
run bash -c 'grep -A4 -F -- "if [ \"\$machine_arch\" = \"x86_64\" ]; then" utils/common.sh | grep -q "machdep.cpu.leaf7_features"'
753+
assert_success
754+
}
755+
709756
@test "macos_scenario_smoke_runs_on_intel_and_arm" {
710757
# Keep a generous context window because this job block may grow over time.
711758
# When GitHub retires macos-15-intel, update the Intel runner assertion below.

0 commit comments

Comments
 (0)