From e2c868084a1d9cf6781bafa87f1aff853c02f34b Mon Sep 17 00:00:00 2001 From: AIPass Date: Thu, 16 Apr 2026 12:58:53 -0700 Subject: [PATCH] =?UTF-8?q?feat(system):=20chore(lint):=20ruff=20auto-fix?= =?UTF-8?q?=20sweep=20=E2=80=94=20303=20errors=20across=20178=20files=20(F?= =?UTF-8?q?401=20unused=20imports=20+=20F541=20f-string=20placeholders=20+?= =?UTF-8?q?=20F811=20redefined);=20restored=20report=5Ferror=20re-export?= =?UTF-8?q?=20+=20added=20logger=20call=20in=20errors.py=20(#333)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * feat(system): fix(windows-ci): combine pip bootstrap fix + venv activation in Verify step Combines both fixes needed to get windows-test.yml actually passing: 1. setup.sh: stop swallowing ensurepip errors (quiet + 2>/dev/null + || true was hiding real failures — pip was silently not installed). Add get-pip.py fallback and hard pip verification. 2. windows-test.yml: add 'source .venv/Scripts/activate' to Verify step. Each CI step gets a fresh shell — setup.sh's venv activation doesn't carry over, so drone wasn't on PATH in the subsequent step. Together, these should take Windows CI from the 'silent failure every run since creation' state to actually green. Supersedes PRs #330 and #331 which had the fixes on separate branches (neither green alone). Co-Authored-By: @devpulse * feat(system): chore(lint): ruff auto-fix sweep — 303 errors across 178 files (F401 unused imports + F541 f-string placeholders + F811 redefined); restored report_error re-export + added logger call in errors.py Co-Authored-By: @devpulse --------- Co-authored-by: @devpulse --- .github/workflows/windows-test.yml | 1 + setup.sh | 9 ++++++++- src/aipass/ai_mail/apps/ai_mail.py | 2 +- src/aipass/ai_mail/apps/handlers/email/contacts.py | 1 - src/aipass/ai_mail/apps/handlers/email/delivery.py | 2 -- src/aipass/ai_mail/apps/handlers/email/header.py | 1 - .../ai_mail/apps/handlers/json_utils/json_handler.py | 2 +- src/aipass/ai_mail/apps/modules/email.py | 6 +++--- src/aipass/ai_mail/tests/test_cli_routing.py | 1 - src/aipass/ai_mail/tests/test_contacts.py | 1 - src/aipass/ai_mail/tests/test_daemon.py | 1 - src/aipass/ai_mail/tests/test_dispatch_status.py | 1 - src/aipass/ai_mail/tests/test_identity.py | 1 - src/aipass/ai_mail/tests/test_inbox_ops.py | 1 - src/aipass/ai_mail/tests/test_json_handler.py | 2 +- src/aipass/ai_mail/tests/test_notify.py | 2 +- src/aipass/ai_mail/tests/test_registry_read.py | 1 - src/aipass/ai_mail/tests/test_wake.py | 2 -- src/aipass/api/apps/handlers/auth/keys.py | 1 - src/aipass/api/apps/modules/google_client.py | 1 - src/aipass/api/apps/modules/openrouter_client.py | 12 ++++++------ src/aipass/api/tests/test_api_key.py | 3 +-- src/aipass/api/tests/test_caller.py | 1 - src/aipass/api/tests/test_cli_routing.py | 7 +------ src/aipass/api/tests/test_config_provider.py | 3 +-- src/aipass/api/tests/test_critical_paths.py | 2 -- src/aipass/api/tests/test_google_client.py | 2 +- src/aipass/api/tests/test_openrouter_client.py | 2 +- src/aipass/api/tests/test_provision.py | 1 - src/aipass/api/tests/test_usage_tracker.py | 3 +-- src/aipass/cli/apps/cli.py | 3 +-- src/aipass/cli/apps/modules/display.py | 2 +- src/aipass/cli/apps/modules/init_project.py | 8 ++++---- src/aipass/cli/tests/test_bootstrap.py | 1 - src/aipass/cli/tests/test_display.py | 1 - src/aipass/cli/tests/test_init_project.py | 3 +-- src/aipass/cli/tests/test_templates.py | 3 +-- src/aipass/devpulse/apps/handlers/feedback/inbox.py | 1 - src/aipass/devpulse/apps/modules/feedback.py | 2 -- src/aipass/devpulse/tests/test_feedback_compose.py | 1 - src/aipass/devpulse/tests/test_feedback_inbox.py | 2 -- src/aipass/devpulse/tests/test_feedback_module.py | 3 +-- src/aipass/devpulse/tests/test_watchdog_registry.py | 1 - src/aipass/devpulse/tests/test_watchdog_timer.py | 1 - src/aipass/drone/apps/drone.py | 2 +- src/aipass/drone/apps/handlers/router_handler.py | 2 +- src/aipass/drone/apps/modules/commands.py | 2 -- src/aipass/drone/apps/modules/registry.py | 2 +- src/aipass/drone/tests/test_activation.py | 1 - src/aipass/drone/tests/test_hook_sounds.py | 2 -- src/aipass/flow/apps/flow.py | 2 +- src/aipass/flow/apps/handlers/plan/close_ops.py | 2 +- src/aipass/flow/apps/handlers/plan/display.py | 2 +- src/aipass/flow/apps/modules/aggregate_central.py | 3 +-- src/aipass/flow/apps/modules/registry_monitor.py | 8 ++++---- src/aipass/flow/tests/conftest.py | 2 +- src/aipass/flow/tests/test_aggregate_central.py | 3 +-- src/aipass/flow/tests/test_aggregate_ops.py | 3 +-- src/aipass/flow/tests/test_close_ops.py | 2 -- src/aipass/flow/tests/test_close_plan.py | 3 +-- src/aipass/flow/tests/test_command_parser.py | 3 +-- src/aipass/flow/tests/test_create_plan.py | 3 +-- src/aipass/flow/tests/test_display.py | 2 -- src/aipass/flow/tests/test_list_plans.py | 2 +- src/aipass/flow/tests/test_monitor_registry.py | 3 +-- src/aipass/flow/tests/test_plan_handlers.py | 1 - src/aipass/flow/tests/test_restore_ops.py | 3 +-- src/aipass/flow/tests/test_template_manager.py | 2 +- src/aipass/memory/apps/handlers/archive/indexer.py | 1 - src/aipass/memory/apps/handlers/central_writer.py | 1 - src/aipass/memory/apps/handlers/dashboard_push.py | 1 - src/aipass/memory/apps/handlers/json/memory_files.py | 1 - src/aipass/memory/apps/handlers/learnings/manager.py | 1 - src/aipass/memory/apps/handlers/monitor/detector.py | 1 - .../memory/apps/handlers/monitor/memory_watcher.py | 7 +++---- .../memory/apps/handlers/rollover/extractor.py | 3 +-- src/aipass/memory/apps/handlers/schema/normalize.py | 1 - .../memory/apps/handlers/search/vector_search.py | 1 - src/aipass/memory/apps/handlers/storage/chroma.py | 1 - src/aipass/memory/apps/handlers/templates/differ.py | 2 +- .../memory/apps/handlers/tracking/line_counter.py | 1 - src/aipass/memory/apps/handlers/vector/embedder.py | 2 -- src/aipass/memory/apps/memory.py | 4 +--- src/aipass/memory/apps/modules/rollover.py | 1 - src/aipass/memory/apps/modules/symbolic.py | 2 +- src/aipass/memory/tests/test_archive.py | 1 - src/aipass/memory/tests/test_central_writer.py | 2 +- src/aipass/memory/tests/test_dashboard_push.py | 2 +- src/aipass/memory/tests/test_intake.py | 4 +--- src/aipass/memory/tests/test_json_handler.py | 7 ++----- src/aipass/memory/tests/test_learnings.py | 4 +--- src/aipass/memory/tests/test_memory_files.py | 2 -- src/aipass/memory/tests/test_rollover.py | 1 - src/aipass/memory/tests/test_symbolic.py | 1 - src/aipass/memory/tests/test_verify.py | 1 - src/aipass/prax/apps/handlers/central/reader.py | 1 - .../prax/apps/handlers/config/ignore_patterns.py | 1 - src/aipass/prax/apps/handlers/logging/lifecycle.py | 4 +--- src/aipass/prax/apps/handlers/logging/monitoring.py | 1 - src/aipass/prax/apps/handlers/logging/operations.py | 1 - src/aipass/prax/apps/handlers/logging/override.py | 1 - .../prax/apps/handlers/logging/terminal/filtering.py | 1 - .../apps/handlers/logging/terminal/formatting.py | 1 - .../prax/apps/handlers/monitoring/event_queue.py | 1 - src/aipass/prax/apps/handlers/registry/load.py | 1 - src/aipass/prax/apps/handlers/registry/save.py | 1 - src/aipass/prax/apps/handlers/watcher/monitor.py | 3 +-- src/aipass/prax/apps/modules/logger.py | 3 +-- src/aipass/prax/apps/modules/monitor.py | 1 - src/aipass/prax/apps/prax.py | 2 +- src/aipass/prax/tests/test_central.py | 4 ---- src/aipass/prax/tests/test_config.py | 3 --- src/aipass/prax/tests/test_discovery.py | 2 +- src/aipass/prax/tests/test_event_queue.py | 1 - src/aipass/prax/tests/test_json_handler.py | 4 +--- src/aipass/prax/tests/test_log_watcher.py | 1 - src/aipass/prax/tests/test_logging.py | 3 --- src/aipass/prax/tests/test_monitor_module.py | 2 -- src/aipass/prax/tests/test_monitoring_filters.py | 1 - src/aipass/prax/tests/test_registry.py | 5 +---- src/aipass/prax/tests/test_watcher.py | 1 - .../handlers/aipass_standards/architecture_check.py | 3 +-- .../apps/handlers/aipass_standards/cli_check.py | 1 - .../handlers/aipass_standards/cli_flags_check.py | 1 - .../handlers/aipass_standards/dead_code_check.py | 1 - .../apps/handlers/aipass_standards/handlers_check.py | 1 - .../handlers/aipass_standards/handlers_content.py | 2 -- .../handlers/aipass_standards/log_handler_check.py | 1 - .../handlers/aipass_standards/log_level_check.py | 1 - .../aipass_standards/log_visibility_check.py | 1 - .../aipass_standards/log_visibility_content.py | 2 -- .../apps/handlers/aipass_standards/modules_check.py | 1 - .../aipass_standards/permission_flags_check.py | 1 - .../apps/handlers/aipass_standards/readme_check.py | 1 - .../apps/handlers/aipass_standards/readme_content.py | 2 -- .../handlers/aipass_standards/trigger_content.py | 2 -- .../seedgo/apps/handlers/audit/audit_display.py | 12 +++++------- .../apps/handlers/diagnostics/diagnostics_check.py | 2 +- .../seedgo/apps/handlers/readme/readme_generator.py | 2 +- src/aipass/seedgo/apps/handlers/readme/readme_ops.py | 1 - src/aipass/seedgo/apps/modules/diagnostics_audit.py | 3 --- src/aipass/seedgo/apps/modules/proof_query.py | 2 +- src/aipass/seedgo/apps/modules/standards_audit.py | 2 +- .../seedgo/templates/test_conftest_template.py | 1 - src/aipass/seedgo/tests/test_aipass_standards.py | 1 - src/aipass/seedgo/tests/test_bypass.py | 1 - src/aipass/seedgo/tests/test_checkers_batch1.py | 1 - src/aipass/seedgo/tests/test_checkers_batch2.py | 1 - src/aipass/seedgo/tests/test_checkers_batch3.py | 1 - src/aipass/seedgo/tests/test_checkers_batch4.py | 1 - src/aipass/seedgo/tests/test_checklist.py | 1 - src/aipass/seedgo/tests/test_diagnostics.py | 1 - src/aipass/seedgo/tests/test_json.py | 4 +--- src/aipass/seedgo/tests/test_proof_query.py | 1 - src/aipass/seedgo/tests/test_readme.py | 2 -- src/aipass/seedgo/tests/test_readme_update.py | 1 - src/aipass/seedgo/tests/test_standards_audit.py | 3 +-- src/aipass/seedgo/tests/test_standards_query.py | 1 - src/aipass/spawn/apps/handlers/delete_ops.py | 1 - src/aipass/spawn/apps/handlers/sync_registry_ops.py | 2 +- src/aipass/spawn/apps/handlers/update_ops.py | 2 +- src/aipass/spawn/apps/modules/passport.py | 2 +- src/aipass/spawn/apps/spawn.py | 4 ++-- src/aipass/spawn/tests/conftest.py | 2 +- src/aipass/spawn/tests/test_cli_routing.py | 5 +---- src/aipass/spawn/tests/test_handlers.py | 1 - src/aipass/spawn/tests/test_update.py | 4 +--- src/aipass/trigger/apps/handlers/__init__.py | 2 +- src/aipass/trigger/apps/handlers/error_registry.py | 3 +-- src/aipass/trigger/apps/handlers/events/memory.py | 1 - .../apps/handlers/events/memory_template_updated.py | 1 - .../handlers/events/memory_threshold_exceeded.py | 1 - src/aipass/trigger/apps/handlers/events/registry.py | 1 - .../trigger/apps/handlers/events/warning_logged.py | 1 - .../trigger/apps/handlers/json/json_handler.py | 2 +- src/aipass/trigger/apps/modules/branch_log_events.py | 2 -- src/aipass/trigger/apps/modules/errors.py | 7 +++---- src/aipass/trigger/apps/modules/log_events.py | 1 - src/aipass/trigger/apps/modules/medic.py | 1 - src/aipass/trigger/tests/test_errors.py | 2 +- 180 files changed, 105 insertions(+), 282 deletions(-) diff --git a/.github/workflows/windows-test.yml b/.github/workflows/windows-test.yml index f2cb84fc..6a2af8fa 100644 --- a/.github/workflows/windows-test.yml +++ b/.github/workflows/windows-test.yml @@ -32,6 +32,7 @@ jobs: - name: Verify drone CLI shell: bash run: | + source .venv/Scripts/activate export PYTHONUTF8=1 drone --version drone systems diff --git a/setup.sh b/setup.sh index 707dba92..57d7d913 100755 --- a/setup.sh +++ b/setup.sh @@ -85,7 +85,14 @@ if [ "$IS_WINDOWS" -eq 1 ] && [ -f ".venv/Scripts/python.exe" ]; then # Bootstrap pip if missing (--without-pip on Windows) if ! "$VENV_PYTHON" -m pip --version &>/dev/null 2>&1; then echo "Bootstrapping pip in venv ..." - "$VENV_PYTHON" -m ensurepip --default-pip --quiet 2>/dev/null || true + "$VENV_PYTHON" -m ensurepip --default-pip || true + if ! "$VENV_PYTHON" -m pip --version &>/dev/null 2>&1; then + echo "ensurepip did not install pip — falling back to get-pip.py" + "$VENV_PYTHON" -c "import urllib.request; urllib.request.urlretrieve('https://bootstrap.pypa.io/get-pip.py', 'get-pip.py')" + "$VENV_PYTHON" get-pip.py + rm -f get-pip.py + fi + "$VENV_PYTHON" -m pip --version || { echo "ERROR: pip still missing after bootstrap" >&2; exit 1; } fi else source .venv/bin/activate diff --git a/src/aipass/ai_mail/apps/ai_mail.py b/src/aipass/ai_mail/apps/ai_mail.py index 8125ce37..15e949b5 100644 --- a/src/aipass/ai_mail/apps/ai_mail.py +++ b/src/aipass/ai_mail/apps/ai_mail.py @@ -19,7 +19,7 @@ import importlib import argparse import signal from pathlib import Path -from typing import Dict, Any, Optional, List +from typing import Any, List # Handle broken pipe gracefully (e.g. output piped to head) # SIGPIPE does not exist on Windows diff --git a/src/aipass/ai_mail/apps/handlers/email/contacts.py b/src/aipass/ai_mail/apps/handlers/email/contacts.py index 852cb1cb..aa81e8f7 100644 --- a/src/aipass/ai_mail/apps/handlers/email/contacts.py +++ b/src/aipass/ai_mail/apps/handlers/email/contacts.py @@ -15,7 +15,6 @@ Solves the BRANCH DETECTION FAILED problem when external projects call drone """ from datetime import datetime -from pathlib import Path from typing import Dict, Optional from aipass.prax.apps.modules.logger import system_logger as logger diff --git a/src/aipass/ai_mail/apps/handlers/email/delivery.py b/src/aipass/ai_mail/apps/handlers/email/delivery.py index d99c82af..45867053 100644 --- a/src/aipass/ai_mail/apps/handlers/email/delivery.py +++ b/src/aipass/ai_mail/apps/handlers/email/delivery.py @@ -16,12 +16,10 @@ Independent handler - no module dependencies. import json import os import uuid -import subprocess from pathlib import Path from typing import Dict, Tuple, List, Optional, Callable from aipass.prax.apps.modules.logger import system_logger as logger -from aipass.ai_mail.apps.handlers.json_utils.json_handler import load_json, save_json from aipass.ai_mail.apps.handlers.json import json_handler from aipass.ai_mail.apps.handlers.paths import find_repo_root from aipass.ai_mail.apps.handlers.registry.read import get_all_branches diff --git a/src/aipass/ai_mail/apps/handlers/email/header.py b/src/aipass/ai_mail/apps/handlers/email/header.py index 12f7d9b4..b8c4f827 100644 --- a/src/aipass/ai_mail/apps/handlers/email/header.py +++ b/src/aipass/ai_mail/apps/handlers/email/header.py @@ -6,7 +6,6 @@ # Modified: 2026-02-04 # ============================================= -from pathlib import Path from aipass.ai_mail.apps.handlers.json import json_handler diff --git a/src/aipass/ai_mail/apps/handlers/json_utils/json_handler.py b/src/aipass/ai_mail/apps/handlers/json_utils/json_handler.py index 65a8e499..3121af9f 100644 --- a/src/aipass/ai_mail/apps/handlers/json_utils/json_handler.py +++ b/src/aipass/ai_mail/apps/handlers/json_utils/json_handler.py @@ -16,7 +16,7 @@ Never manually create JSONs - they build themselves. import json from pathlib import Path from datetime import datetime -from typing import Dict, List, Any, Optional +from typing import Dict, Any, Optional import inspect from aipass.prax.apps.modules.logger import system_logger as logger diff --git a/src/aipass/ai_mail/apps/modules/email.py b/src/aipass/ai_mail/apps/modules/email.py index deec0f65..5b14ba9c 100644 --- a/src/aipass/ai_mail/apps/modules/email.py +++ b/src/aipass/ai_mail/apps/modules/email.py @@ -28,7 +28,7 @@ _AI_MAIL_DIR = Path(__file__).resolve().parents[2] _REPO_ROOT = _AI_MAIL_DIR.parents[2] from aipass.prax import logger -from aipass.cli.apps.modules import console, error, success +from aipass.cli.apps.modules import console, error from aipass.trigger.apps.modules.core import trigger # Handlers - business logic providers @@ -38,7 +38,7 @@ from aipass.ai_mail.apps.handlers.email.create import create_email_file, load_em from aipass.ai_mail.apps.handlers.email.format import format_email_list_item, format_email_header from aipass.ai_mail.apps.handlers.email.inbox_ops import load_inbox from aipass.ai_mail.apps.handlers.email.inbox_cleanup import ( - mark_read_and_archive, mark_all_read_and_archive, + mark_all_read_and_archive, mark_as_opened, mark_as_closed_and_archive ) from aipass.ai_mail.apps.handlers.email.reply import get_email_by_id, send_reply @@ -218,7 +218,7 @@ def _send_direct(to_branch, subject, message, auto_execute=False, deliver_email_to_branch, _delivery_callback, json_handler.log_operation, update_central) if success: - label = f"\\[dispatch: queued for daemon]" if auto_execute else "" + label = "\\[dispatch: queued for daemon]" if auto_execute else "" console.print(f"[green]Email sent to {to_branch} {label}[/green]") if auto_execute: _fire_dispatch_trigger(to_branch, subject) diff --git a/src/aipass/ai_mail/tests/test_cli_routing.py b/src/aipass/ai_mail/tests/test_cli_routing.py index f72695f7..6542f084 100644 --- a/src/aipass/ai_mail/tests/test_cli_routing.py +++ b/src/aipass/ai_mail/tests/test_cli_routing.py @@ -19,7 +19,6 @@ from aipass.ai_mail.apps.ai_mail import ( print_introspection, route_command, main, - discover_modules, ) diff --git a/src/aipass/ai_mail/tests/test_contacts.py b/src/aipass/ai_mail/tests/test_contacts.py index 839534dc..0db0d6cd 100644 --- a/src/aipass/ai_mail/tests/test_contacts.py +++ b/src/aipass/ai_mail/tests/test_contacts.py @@ -10,7 +10,6 @@ import json import pytest -from pathlib import Path from unittest.mock import patch import aipass.ai_mail.apps.handlers.email.contacts as contacts_mod diff --git a/src/aipass/ai_mail/tests/test_daemon.py b/src/aipass/ai_mail/tests/test_daemon.py index 36b794db..deb26d7b 100644 --- a/src/aipass/ai_mail/tests/test_daemon.py +++ b/src/aipass/ai_mail/tests/test_daemon.py @@ -10,7 +10,6 @@ import json import pytest -from pathlib import Path from datetime import datetime, date, timedelta from unittest.mock import patch diff --git a/src/aipass/ai_mail/tests/test_dispatch_status.py b/src/aipass/ai_mail/tests/test_dispatch_status.py index 217ba5ac..1693355d 100644 --- a/src/aipass/ai_mail/tests/test_dispatch_status.py +++ b/src/aipass/ai_mail/tests/test_dispatch_status.py @@ -10,7 +10,6 @@ import json import pytest -from pathlib import Path from datetime import datetime, timedelta import aipass.ai_mail.apps.handlers.dispatch.status as status_mod diff --git a/src/aipass/ai_mail/tests/test_identity.py b/src/aipass/ai_mail/tests/test_identity.py index 986ae1cd..2ad57f8c 100644 --- a/src/aipass/ai_mail/tests/test_identity.py +++ b/src/aipass/ai_mail/tests/test_identity.py @@ -13,7 +13,6 @@ Bypass entries for architecture and encapsulation are in .seedgo/bypass.json. import json import pytest -from pathlib import Path from unittest.mock import patch from aipass.ai_mail.apps.handlers.email.identity import ( diff --git a/src/aipass/ai_mail/tests/test_inbox_ops.py b/src/aipass/ai_mail/tests/test_inbox_ops.py index 84cdbdcb..bfbac955 100644 --- a/src/aipass/ai_mail/tests/test_inbox_ops.py +++ b/src/aipass/ai_mail/tests/test_inbox_ops.py @@ -10,7 +10,6 @@ import json import pytest -from pathlib import Path from unittest.mock import patch from aipass.ai_mail.apps.handlers.email.inbox_ops import load_inbox diff --git a/src/aipass/ai_mail/tests/test_json_handler.py b/src/aipass/ai_mail/tests/test_json_handler.py index c39ee277..daf42969 100644 --- a/src/aipass/ai_mail/tests/test_json_handler.py +++ b/src/aipass/ai_mail/tests/test_json_handler.py @@ -13,7 +13,7 @@ import sys import importlib import pytest from pathlib import Path -from unittest.mock import patch, MagicMock +from unittest.mock import MagicMock import aipass.ai_mail.apps.handlers.json_utils.json_handler as jh_mod from aipass.ai_mail.apps.handlers.json_utils.json_handler import ( diff --git a/src/aipass/ai_mail/tests/test_notify.py b/src/aipass/ai_mail/tests/test_notify.py index 84b52afd..80b44cc2 100644 --- a/src/aipass/ai_mail/tests/test_notify.py +++ b/src/aipass/ai_mail/tests/test_notify.py @@ -10,7 +10,7 @@ import subprocess import pytest -from unittest.mock import MagicMock, patch, call +from unittest.mock import MagicMock import aipass.ai_mail.apps.handlers.notify as mod diff --git a/src/aipass/ai_mail/tests/test_registry_read.py b/src/aipass/ai_mail/tests/test_registry_read.py index 9510436b..0cbbbd14 100644 --- a/src/aipass/ai_mail/tests/test_registry_read.py +++ b/src/aipass/ai_mail/tests/test_registry_read.py @@ -10,7 +10,6 @@ import json import pytest -from pathlib import Path from unittest.mock import patch import aipass.ai_mail.apps.handlers.registry.read as read_mod diff --git a/src/aipass/ai_mail/tests/test_wake.py b/src/aipass/ai_mail/tests/test_wake.py index e9323ca1..79d7d5d5 100644 --- a/src/aipass/ai_mail/tests/test_wake.py +++ b/src/aipass/ai_mail/tests/test_wake.py @@ -11,7 +11,6 @@ import json import os import pytest -from pathlib import Path from datetime import datetime, timedelta import aipass.ai_mail.apps.handlers.dispatch.wake as wake_mod @@ -400,7 +399,6 @@ def test_clean_zombies_none_found(monkeypatch): def test_clean_zombies_subprocess_error(monkeypatch): """Returns 0 on subprocess failure.""" - import subprocess monkeypatch.setattr( "subprocess.run", _raise_subprocess_error, diff --git a/src/aipass/api/apps/handlers/auth/keys.py b/src/aipass/api/apps/handlers/auth/keys.py index bfd3d947..e1264e84 100644 --- a/src/aipass/api/apps/handlers/auth/keys.py +++ b/src/aipass/api/apps/handlers/auth/keys.py @@ -20,7 +20,6 @@ Functions: """ # Standard library -import sys from pathlib import Path from typing import Optional, Dict, Any diff --git a/src/aipass/api/apps/modules/google_client.py b/src/aipass/api/apps/modules/google_client.py index 05e11710..176dcf7a 100644 --- a/src/aipass/api/apps/modules/google_client.py +++ b/src/aipass/api/apps/modules/google_client.py @@ -31,7 +31,6 @@ Thread-safe pattern (for concurrent workers): import sys from typing import List, Optional -from aipass.prax.apps.modules.logger import system_logger as logger # noqa: F811 from aipass.cli.apps.modules import console, header, success, error, warning from aipass.api.apps.handlers.json import json_handler import aipass.api.apps.handlers.google.auth as google_auth diff --git a/src/aipass/api/apps/modules/openrouter_client.py b/src/aipass/api/apps/modules/openrouter_client.py index d1a7e07f..b323436f 100644 --- a/src/aipass/api/apps/modules/openrouter_client.py +++ b/src/aipass/api/apps/modules/openrouter_client.py @@ -297,23 +297,23 @@ def check_status(): if api_key: masked = api_key[:8] + "..." + api_key[-4:] - console.print(f" [cyan]Key configured:[/cyan] [green]yes[/green]") + console.print(" [cyan]Key configured:[/cyan] [green]yes[/green]") console.print(f" [cyan]Key:[/cyan] {masked}") else: - console.print(f" [cyan]Key configured:[/cyan] [red]no[/red]") + console.print(" [cyan]Key configured:[/cyan] [red]no[/red]") diagnosis = keys.diagnose_key("openrouter") console.print(f" [cyan]Reason:[/cyan] {diagnosis}") - console.print(f" [cyan]Provider:[/cyan] OpenRouter") - console.print(f" [cyan]Base URL:[/cyan] https://openrouter.ai/api/v1") + console.print(" [cyan]Provider:[/cyan] OpenRouter") + console.print(" [cyan]Base URL:[/cyan] https://openrouter.ai/api/v1") # OpenAI SDK availability try: import openai # noqa: F401 - console.print(f" [cyan]OpenAI SDK:[/cyan] [green]available[/green]") + console.print(" [cyan]OpenAI SDK:[/cyan] [green]available[/green]") except ImportError: logger.warning("OpenAI SDK not installed") - console.print(f" [cyan]OpenAI SDK:[/cyan] [red]missing[/red]") + console.print(" [cyan]OpenAI SDK:[/cyan] [red]missing[/red]") # Client cache stats cache_stats = client.get_cache_stats() diff --git a/src/aipass/api/tests/test_api_key.py b/src/aipass/api/tests/test_api_key.py index 495b0335..c425fa89 100644 --- a/src/aipass/api/tests/test_api_key.py +++ b/src/aipass/api/tests/test_api_key.py @@ -21,8 +21,7 @@ Tests: - json_handler.log_operation called on valid commands """ -from unittest.mock import patch, MagicMock, call -from pathlib import Path +from unittest.mock import patch, MagicMock import pytest diff --git a/src/aipass/api/tests/test_caller.py b/src/aipass/api/tests/test_caller.py index cdad7bdc..6114ddd9 100644 --- a/src/aipass/api/tests/test_caller.py +++ b/src/aipass/api/tests/test_caller.py @@ -18,7 +18,6 @@ Tests: from unittest.mock import patch, MagicMock from pathlib import Path -import pytest from aipass.api.apps.handlers.openrouter.caller import detect_caller_category diff --git a/src/aipass/api/tests/test_cli_routing.py b/src/aipass/api/tests/test_cli_routing.py index df07f3ef..8721a84f 100644 --- a/src/aipass/api/tests/test_cli_routing.py +++ b/src/aipass/api/tests/test_cli_routing.py @@ -17,13 +17,8 @@ Covers 9 items: return_bool, print_help, print_introspection, output_capture """ -import importlib -import sys -import types -from pathlib import Path -from unittest.mock import patch, MagicMock +from unittest.mock import patch -import pytest from aipass.api.apps.modules import api_key diff --git a/src/aipass/api/tests/test_config_provider.py b/src/aipass/api/tests/test_config_provider.py index 139d3b3b..560092b1 100644 --- a/src/aipass/api/tests/test_config_provider.py +++ b/src/aipass/api/tests/test_config_provider.py @@ -18,9 +18,8 @@ Tests: - get_validation_rules unknown provider returns None """ -from unittest.mock import patch, MagicMock +from unittest.mock import patch -import pytest from aipass.api.apps.handlers.config import provider as config_provider diff --git a/src/aipass/api/tests/test_critical_paths.py b/src/aipass/api/tests/test_critical_paths.py index 1ed34a54..2220d998 100644 --- a/src/aipass/api/tests/test_critical_paths.py +++ b/src/aipass/api/tests/test_critical_paths.py @@ -20,10 +20,8 @@ All external dependencies are mocked. File-based tests use tmp_path. """ import json -from pathlib import Path from unittest.mock import patch, MagicMock -import pytest # ============================================= diff --git a/src/aipass/api/tests/test_google_client.py b/src/aipass/api/tests/test_google_client.py index d3fda8b8..df58463d 100644 --- a/src/aipass/api/tests/test_google_client.py +++ b/src/aipass/api/tests/test_google_client.py @@ -21,7 +21,7 @@ Tests: - is_ssl_error() delegation """ -from unittest.mock import patch, MagicMock, call +from unittest.mock import patch, MagicMock import pytest diff --git a/src/aipass/api/tests/test_openrouter_client.py b/src/aipass/api/tests/test_openrouter_client.py index d7bc438a..795354cb 100644 --- a/src/aipass/api/tests/test_openrouter_client.py +++ b/src/aipass/api/tests/test_openrouter_client.py @@ -19,7 +19,7 @@ Tests: - get_response delegation to client handler """ -from unittest.mock import patch, MagicMock, call +from unittest.mock import patch, MagicMock import pytest diff --git a/src/aipass/api/tests/test_provision.py b/src/aipass/api/tests/test_provision.py index a1ed5ea6..8c2cc136 100644 --- a/src/aipass/api/tests/test_provision.py +++ b/src/aipass/api/tests/test_provision.py @@ -20,7 +20,6 @@ import json from pathlib import Path from unittest.mock import patch -import pytest from aipass.api.apps.handlers.openrouter.provision import ( create_caller_config, diff --git a/src/aipass/api/tests/test_usage_tracker.py b/src/aipass/api/tests/test_usage_tracker.py index 05a317d1..65e9aa30 100644 --- a/src/aipass/api/tests/test_usage_tracker.py +++ b/src/aipass/api/tests/test_usage_tracker.py @@ -17,8 +17,7 @@ Tests: - cleanup_data success/failure, default/custom days """ -from pathlib import Path -from unittest.mock import patch, MagicMock, call +from unittest.mock import patch, MagicMock import pytest diff --git a/src/aipass/cli/apps/cli.py b/src/aipass/cli/apps/cli.py index 1fdc0626..50377c15 100755 --- a/src/aipass/cli/apps/cli.py +++ b/src/aipass/cli/apps/cli.py @@ -34,12 +34,11 @@ from aipass.prax.apps.modules.logger import system_logger as logger # Rich library components from rich.table import Table -from rich.columns import Columns from rich.panel import Panel from rich import box # CLI modules (showcasing our own services!) -from aipass.cli.apps.modules.display import console as CONSOLE, header, success, error, warning, section +from aipass.cli.apps.modules.display import console as CONSOLE, header, error VERSION = "2.0.0" CLI_ROOT = Path(__file__).parent diff --git a/src/aipass/cli/apps/modules/display.py b/src/aipass/cli/apps/modules/display.py index eb5c8a84..c9c930db 100755 --- a/src/aipass/cli/apps/modules/display.py +++ b/src/aipass/cli/apps/modules/display.py @@ -202,7 +202,7 @@ def print_help(): _cli_root = _display_path.parents[2] # display.py -> modules -> apps -> cli CONSOLE.print(f" [yellow]Module:[/yellow] [dim]{_display_path}[/dim]") CONSOLE.print(f" [yellow]Handlers:[/yellow] [dim]{_cli_root / 'apps' / 'handlers' / 'display'}[/dim]") - CONSOLE.print(f" [yellow]Standards:[/yellow] [dim]See CODE_STANDARDS/cli.md[/dim]") + CONSOLE.print(" [yellow]Standards:[/yellow] [dim]See CODE_STANDARDS/cli.md[/dim]") CONSOLE.print() CONSOLE.print("─" * 70) CONSOLE.print() diff --git a/src/aipass/cli/apps/modules/init_project.py b/src/aipass/cli/apps/modules/init_project.py index 11be5785..69f76197 100644 --- a/src/aipass/cli/apps/modules/init_project.py +++ b/src/aipass/cli/apps/modules/init_project.py @@ -263,7 +263,7 @@ def _handle_init(args: List[str]) -> bool: if result.get("aipass_home"): console.print() console.print(f"[bold cyan]AIPASS_HOME:[/bold cyan] [yellow]{result['aipass_home']}[/yellow]") - console.print(f"[dim]For terminal usage, add to your shell profile:[/dim]") + console.print("[dim]For terminal usage, add to your shell profile:[/dim]") console.print(f" [green]export AIPASS_HOME={result['aipass_home']}[/green]") json_handler.log_operation("aipass_init", { @@ -275,9 +275,9 @@ def _handle_init(args: List[str]) -> bool: # Next steps console.print() console.print("[bold cyan]Next steps:[/bold cyan]") - console.print(f" [green]1.[/green] Create your first agent: [yellow]aipass init agent [/yellow]") - console.print(f" [green]2.[/green] Start a session: [dim]cd src// && claude[/dim]") - console.print(f" [green]3.[/green] Read the docs: [dim]cat README.md[/dim]") + console.print(" [green]1.[/green] Create your first agent: [yellow]aipass init agent [/yellow]") + console.print(" [green]2.[/green] Start a session: [dim]cd src// && claude[/dim]") + console.print(" [green]3.[/green] Read the docs: [dim]cat README.md[/dim]") console.print() return True diff --git a/src/aipass/cli/tests/test_bootstrap.py b/src/aipass/cli/tests/test_bootstrap.py index 3ba17d42..fcdf819b 100644 --- a/src/aipass/cli/tests/test_bootstrap.py +++ b/src/aipass/cli/tests/test_bootstrap.py @@ -7,7 +7,6 @@ use tmp_path to stay fully isolated from the live filesystem. import json import uuid from datetime import date -from pathlib import Path import pytest diff --git a/src/aipass/cli/tests/test_display.py b/src/aipass/cli/tests/test_display.py index 52aa138c..b7aedd87 100644 --- a/src/aipass/cli/tests/test_display.py +++ b/src/aipass/cli/tests/test_display.py @@ -9,7 +9,6 @@ import pytest from rich.console import Console from aipass.cli.apps.modules import display -from aipass.cli.apps.modules.display import header, success, error, warning, section, fatal # ============================================================================= diff --git a/src/aipass/cli/tests/test_init_project.py b/src/aipass/cli/tests/test_init_project.py index 79dde362..f378c1e5 100644 --- a/src/aipass/cli/tests/test_init_project.py +++ b/src/aipass/cli/tests/test_init_project.py @@ -1,8 +1,7 @@ """Tests for the CLI init_project module — aipass command routing and init orchestration.""" from io import StringIO -from pathlib import Path -from unittest.mock import patch, MagicMock +from unittest.mock import patch import pytest from rich.console import Console diff --git a/src/aipass/cli/tests/test_templates.py b/src/aipass/cli/tests/test_templates.py index db553729..bb787e64 100644 --- a/src/aipass/cli/tests/test_templates.py +++ b/src/aipass/cli/tests/test_templates.py @@ -2,13 +2,12 @@ import pytest from io import StringIO -from unittest.mock import patch, MagicMock +from unittest.mock import patch from rich.console import Console from aipass.cli.apps.modules import templates from aipass.cli.apps.modules import display -from aipass.cli.apps.modules.templates import operation_start, operation_complete @pytest.fixture diff --git a/src/aipass/devpulse/apps/handlers/feedback/inbox.py b/src/aipass/devpulse/apps/handlers/feedback/inbox.py index 43f4c953..133128d6 100644 --- a/src/aipass/devpulse/apps/handlers/feedback/inbox.py +++ b/src/aipass/devpulse/apps/handlers/feedback/inbox.py @@ -13,7 +13,6 @@ devpulse's personal feedback mailbox. from rich.console import Console from rich.table import Table -from aipass.prax import logger from aipass.devpulse.apps.handlers.feedback.storage import load_inbox, save_inbox console = Console(stderr=True) diff --git a/src/aipass/devpulse/apps/modules/feedback.py b/src/aipass/devpulse/apps/modules/feedback.py index 1962a5ef..7780ce3f 100644 --- a/src/aipass/devpulse/apps/modules/feedback.py +++ b/src/aipass/devpulse/apps/modules/feedback.py @@ -10,11 +10,9 @@ Auto-discovered by devpulse.py via handle_command() convention. Routes feedback subcommands to the appropriate handler functions. """ -import shlex from rich.console import Console -from aipass.prax import logger from aipass.devpulse.apps.handlers.feedback.inbox import ( list_messages, view_message, diff --git a/src/aipass/devpulse/tests/test_feedback_compose.py b/src/aipass/devpulse/tests/test_feedback_compose.py index 27a3b3bd..f14607f7 100644 --- a/src/aipass/devpulse/tests/test_feedback_compose.py +++ b/src/aipass/devpulse/tests/test_feedback_compose.py @@ -6,7 +6,6 @@ """Tests for feedback compose — send, reply, ai_mail delivery.""" import json -from pathlib import Path from unittest.mock import patch import pytest diff --git a/src/aipass/devpulse/tests/test_feedback_inbox.py b/src/aipass/devpulse/tests/test_feedback_inbox.py index 1b9364d9..8138e726 100644 --- a/src/aipass/devpulse/tests/test_feedback_inbox.py +++ b/src/aipass/devpulse/tests/test_feedback_inbox.py @@ -5,8 +5,6 @@ """Tests for feedback inbox — list, view, clear, summary.""" -import json -from pathlib import Path from unittest.mock import patch import pytest diff --git a/src/aipass/devpulse/tests/test_feedback_module.py b/src/aipass/devpulse/tests/test_feedback_module.py index 4194472f..d758ca1d 100644 --- a/src/aipass/devpulse/tests/test_feedback_module.py +++ b/src/aipass/devpulse/tests/test_feedback_module.py @@ -5,8 +5,7 @@ """Tests for feedback module — command routing via handle_command().""" -import json -from unittest.mock import patch, MagicMock +from unittest.mock import patch import pytest diff --git a/src/aipass/devpulse/tests/test_watchdog_registry.py b/src/aipass/devpulse/tests/test_watchdog_registry.py index 9d3ab9f8..213bc632 100644 --- a/src/aipass/devpulse/tests/test_watchdog_registry.py +++ b/src/aipass/devpulse/tests/test_watchdog_registry.py @@ -13,7 +13,6 @@ import os import subprocess import sys import time -from pathlib import Path from unittest.mock import patch import pytest diff --git a/src/aipass/devpulse/tests/test_watchdog_timer.py b/src/aipass/devpulse/tests/test_watchdog_timer.py index a02d3dc9..fa9670b0 100644 --- a/src/aipass/devpulse/tests/test_watchdog_timer.py +++ b/src/aipass/devpulse/tests/test_watchdog_timer.py @@ -11,7 +11,6 @@ import json import sys import time -from pathlib import Path from unittest.mock import patch import pytest diff --git a/src/aipass/drone/apps/drone.py b/src/aipass/drone/apps/drone.py index 35da5a32..06ee3b4a 100644 --- a/src/aipass/drone/apps/drone.py +++ b/src/aipass/drone/apps/drone.py @@ -26,7 +26,7 @@ from aipass.prax import logger from aipass.cli.apps.modules import console, err_console from aipass.drone.apps.modules import BranchNotFoundError, CommandExecutionError, RegistryError from aipass.drone.apps.modules.discovery import get_help -from aipass.drone.apps.modules.resolver import get_all_branches, list_branches +from aipass.drone.apps.modules.resolver import get_all_branches from aipass.drone.apps.modules.router import route_command from aipass.drone.apps.modules.module_registry import ( is_module, diff --git a/src/aipass/drone/apps/handlers/router_handler.py b/src/aipass/drone/apps/handlers/router_handler.py index 5841ac96..a7f36e99 100644 --- a/src/aipass/drone/apps/handlers/router_handler.py +++ b/src/aipass/drone/apps/handlers/router_handler.py @@ -17,7 +17,7 @@ import json import os import sys from pathlib import Path -from typing import Dict, List, Optional +from typing import List, Optional from aipass.prax.apps.modules.logger import system_logger from .exceptions import CommandExecutionError diff --git a/src/aipass/drone/apps/modules/commands.py b/src/aipass/drone/apps/modules/commands.py index 24bef30a..eb58b4ed 100644 --- a/src/aipass/drone/apps/modules/commands.py +++ b/src/aipass/drone/apps/modules/commands.py @@ -21,9 +21,7 @@ from aipass.cli.apps.modules import console from aipass.drone.apps.handlers.json import json_handler from aipass.drone.apps.handlers.command_registry.ops import ( add_command as _add_command, - command_exists as _command_exists, remove_command as _remove_command, - update_command as _update_command, ) from aipass.drone.apps.handlers.command_registry.lookup import ( list_commands as _list_commands, diff --git a/src/aipass/drone/apps/modules/registry.py b/src/aipass/drone/apps/modules/registry.py index 6bf49973..a76236d1 100644 --- a/src/aipass/drone/apps/modules/registry.py +++ b/src/aipass/drone/apps/modules/registry.py @@ -13,7 +13,7 @@ Thin orchestrator that delegates to registry_handler for all registry loading and querying operations. """ -from typing import Any, Dict, List, Optional +from typing import List, Optional from aipass.prax import logger from aipass.drone.apps.handlers.json import json_handler diff --git a/src/aipass/drone/tests/test_activation.py b/src/aipass/drone/tests/test_activation.py index 2fd64895..680e0ad1 100644 --- a/src/aipass/drone/tests/test_activation.py +++ b/src/aipass/drone/tests/test_activation.py @@ -19,7 +19,6 @@ Covers: from __future__ import annotations -import json from pathlib import Path from typing import Any from unittest.mock import MagicMock, patch diff --git a/src/aipass/drone/tests/test_hook_sounds.py b/src/aipass/drone/tests/test_hook_sounds.py index 1ad6b65b..2cc961bb 100644 --- a/src/aipass/drone/tests/test_hook_sounds.py +++ b/src/aipass/drone/tests/test_hook_sounds.py @@ -2,13 +2,11 @@ from __future__ import annotations -from pathlib import Path from unittest.mock import patch import pytest from aipass.drone.apps.plugins.hook_sounds.hook_sounds_plugin import ( - MUTE_FLAG, handle_command, is_muted, mute, diff --git a/src/aipass/flow/apps/flow.py b/src/aipass/flow/apps/flow.py index 1cd981e7..84bc30b0 100755 --- a/src/aipass/flow/apps/flow.py +++ b/src/aipass/flow/apps/flow.py @@ -34,7 +34,7 @@ if hasattr(signal, 'SIGPIPE'): from aipass.prax.apps.modules.logger import system_logger as logger # CLI services for formatted output -from aipass.cli.apps.modules import console, header, success, error, warning +from aipass.cli.apps.modules import console, header, error # ============================================================================= # MODULE DISCOVERY diff --git a/src/aipass/flow/apps/handlers/plan/close_ops.py b/src/aipass/flow/apps/handlers/plan/close_ops.py index 7d809068..6f6d51d7 100644 --- a/src/aipass/flow/apps/handlers/plan/close_ops.py +++ b/src/aipass/flow/apps/handlers/plan/close_ops.py @@ -22,7 +22,7 @@ import sys import subprocess from pathlib import Path from datetime import datetime, timezone -from typing import Callable, Dict, Any, List, Tuple +from typing import Dict, Any, List from aipass.prax import logger # logger imported from aipass.prax diff --git a/src/aipass/flow/apps/handlers/plan/display.py b/src/aipass/flow/apps/handlers/plan/display.py index 2a84be82..013e8bd2 100644 --- a/src/aipass/flow/apps/handlers/plan/display.py +++ b/src/aipass/flow/apps/handlers/plan/display.py @@ -387,7 +387,7 @@ def format_statistics_summary(stats: Dict[str, Any]) -> str: """ lines = [ "", - f"[bold]Summary:[/bold]", + "[bold]Summary:[/bold]", f" Total plans: {stats['total_plans']}", f" Open: {stats['open_plans']}", f" Closed: {stats['closed_plans']}" diff --git a/src/aipass/flow/apps/modules/aggregate_central.py b/src/aipass/flow/apps/modules/aggregate_central.py index 7ca4dcde..417e3e00 100755 --- a/src/aipass/flow/apps/modules/aggregate_central.py +++ b/src/aipass/flow/apps/modules/aggregate_central.py @@ -31,13 +31,12 @@ Standalone: import sys from pathlib import Path -from typing import Dict, Any, List +from typing import List # INFRASTRUCTURE IMPORT PATTERN _PKG_ROOT = Path(__file__).resolve().parents[3] # file.py -> modules/ -> apps/ -> flow/ -> aipass/ FLOW_ROOT = _PKG_ROOT / "flow" -from aipass.prax.apps.modules.logger import system_logger as logger from aipass.cli.apps.modules import console # JSON handler for operation tracking diff --git a/src/aipass/flow/apps/modules/registry_monitor.py b/src/aipass/flow/apps/modules/registry_monitor.py index 77642d99..926281a8 100644 --- a/src/aipass/flow/apps/modules/registry_monitor.py +++ b/src/aipass/flow/apps/modules/registry_monitor.py @@ -192,11 +192,11 @@ def handle_command(command: str, args: List[str]) -> bool: ) if subcommand in ["scan", "heal"]: - console.print(f"[bold]Scanning for PLAN files...[/bold]") + console.print("[bold]Scanning for PLAN files...[/bold]") result = scan_plan_files() console.print() - console.print(f"[green]✓[/green] Scan complete") + console.print("[green]✓[/green] Scan complete") console.print(f" • Total plans: {result['total_plans']}") console.print(f" • Added: {len(result['added'])}") console.print(f" • Updated: {len(result['updated'])}") @@ -207,13 +207,13 @@ def handle_command(command: str, args: List[str]) -> bool: change_count = len(result['added']) + len(result['updated']) + len(result['removed']) warning(f"Registry scan found {change_count} mismatch(es) — trigger event handlers not wired, no changes applied") else: - console.print(f"\n[dim]No changes needed - registry is healthy[/dim]") + console.print("\n[dim]No changes needed - registry is healthy[/dim]") console.print() return True elif subcommand == "start": - console.print(f"[bold]Starting registry monitor...[/bold]") + console.print("[bold]Starting registry monitor...[/bold]") console.print() # Run initial scan before starting monitor diff --git a/src/aipass/flow/tests/conftest.py b/src/aipass/flow/tests/conftest.py index 0e224003..612a1d94 100644 --- a/src/aipass/flow/tests/conftest.py +++ b/src/aipass/flow/tests/conftest.py @@ -12,7 +12,7 @@ import json import shutil from pathlib import Path from typing import Generator -from unittest.mock import MagicMock, patch +from unittest.mock import patch # Pre-import modules so patch() path resolution works. # Without these imports, the intermediate packages lack the sub-module diff --git a/src/aipass/flow/tests/test_aggregate_central.py b/src/aipass/flow/tests/test_aggregate_central.py index 0240b33f..ee00d4ac 100644 --- a/src/aipass/flow/tests/test_aggregate_central.py +++ b/src/aipass/flow/tests/test_aggregate_central.py @@ -1,8 +1,7 @@ """Tests for aggregate_central module -- handle_command routing and orchestration.""" -from unittest.mock import MagicMock, patch +from unittest.mock import patch -import pytest # ─── Patch targets ─────────────────────────────────────── diff --git a/src/aipass/flow/tests/test_aggregate_ops.py b/src/aipass/flow/tests/test_aggregate_ops.py index 6ad1e676..ac615312 100644 --- a/src/aipass/flow/tests/test_aggregate_ops.py +++ b/src/aipass/flow/tests/test_aggregate_ops.py @@ -2,9 +2,8 @@ import json from pathlib import Path -from unittest.mock import MagicMock, patch +from unittest.mock import patch -import pytest # ─── Patch targets ─────────────────────────────────────── diff --git a/src/aipass/flow/tests/test_close_ops.py b/src/aipass/flow/tests/test_close_ops.py index 42ee7152..0eb0817b 100644 --- a/src/aipass/flow/tests/test_close_ops.py +++ b/src/aipass/flow/tests/test_close_ops.py @@ -1,9 +1,7 @@ """Tests for close_ops handler — plan closure business logic.""" -from pathlib import Path from unittest.mock import MagicMock, patch -import pytest # ─── Helpers ───────────────────────────────────────────── diff --git a/src/aipass/flow/tests/test_close_plan.py b/src/aipass/flow/tests/test_close_plan.py index 47e7e76a..1f3cdb8f 100644 --- a/src/aipass/flow/tests/test_close_plan.py +++ b/src/aipass/flow/tests/test_close_plan.py @@ -1,8 +1,7 @@ """Tests for close_plan module -- handle_command routing.""" -from unittest.mock import MagicMock, patch +from unittest.mock import patch -import pytest # ─── Patch targets ─────────────────────────────────────── diff --git a/src/aipass/flow/tests/test_command_parser.py b/src/aipass/flow/tests/test_command_parser.py index 2ad6d982..beff1e09 100644 --- a/src/aipass/flow/tests/test_command_parser.py +++ b/src/aipass/flow/tests/test_command_parser.py @@ -3,8 +3,7 @@ Covers parse_create_plan_args, parse_close_command_args, and parse_restore_command_args from apps/handlers/plan/command_parser.py. """ -import pytest -from unittest.mock import patch, MagicMock +from unittest.mock import patch # --------------------------------------------------------------------------- diff --git a/src/aipass/flow/tests/test_create_plan.py b/src/aipass/flow/tests/test_create_plan.py index 8ab6dab4..68572349 100644 --- a/src/aipass/flow/tests/test_create_plan.py +++ b/src/aipass/flow/tests/test_create_plan.py @@ -1,8 +1,7 @@ """Tests for create_plan module -- handle_command routing.""" -from unittest.mock import MagicMock, patch +from unittest.mock import patch -import pytest # ─── Patch targets ─────────────────────────────────────── diff --git a/src/aipass/flow/tests/test_display.py b/src/aipass/flow/tests/test_display.py index e2f6adab..d0a96ab3 100644 --- a/src/aipass/flow/tests/test_display.py +++ b/src/aipass/flow/tests/test_display.py @@ -1,8 +1,6 @@ """Tests for plan display handler -- formatting and display functions.""" -from unittest.mock import MagicMock, patch -import pytest # ─── Helpers ───────────────────────────────────────────── diff --git a/src/aipass/flow/tests/test_list_plans.py b/src/aipass/flow/tests/test_list_plans.py index 4ee6b0bc..42655755 100644 --- a/src/aipass/flow/tests/test_list_plans.py +++ b/src/aipass/flow/tests/test_list_plans.py @@ -9,7 +9,7 @@ """Tests for the list_plans module -- command routing and orchestration.""" import pytest -from unittest.mock import MagicMock, patch, call +from unittest.mock import patch # --------------------------------------------------------------------------- # Module-level patch targets (patch where used, not where defined) diff --git a/src/aipass/flow/tests/test_monitor_registry.py b/src/aipass/flow/tests/test_monitor_registry.py index 77072a98..eccc7725 100644 --- a/src/aipass/flow/tests/test_monitor_registry.py +++ b/src/aipass/flow/tests/test_monitor_registry.py @@ -6,9 +6,8 @@ import time import types from collections.abc import Mapping, Sequence from pathlib import Path -from unittest.mock import MagicMock, patch, PropertyMock +from unittest.mock import MagicMock, patch -import pytest # ─── Import helpers ─────────────────────────────────────── diff --git a/src/aipass/flow/tests/test_plan_handlers.py b/src/aipass/flow/tests/test_plan_handlers.py index d3fcab38..e346c4f6 100644 --- a/src/aipass/flow/tests/test_plan_handlers.py +++ b/src/aipass/flow/tests/test_plan_handlers.py @@ -11,7 +11,6 @@ from datetime import datetime, timezone from pathlib import Path from unittest.mock import MagicMock, patch -import pytest # --------------------------------------------------------------------------- # Module imports diff --git a/src/aipass/flow/tests/test_restore_ops.py b/src/aipass/flow/tests/test_restore_ops.py index 59a81903..fd078a7e 100644 --- a/src/aipass/flow/tests/test_restore_ops.py +++ b/src/aipass/flow/tests/test_restore_ops.py @@ -1,9 +1,8 @@ """Tests for restore_ops handler -- plan restore business logic.""" from pathlib import Path -from unittest.mock import MagicMock, patch, mock_open +from unittest.mock import MagicMock, patch -import pytest # ─── Helpers ───────────────────────────────────────────── diff --git a/src/aipass/flow/tests/test_template_manager.py b/src/aipass/flow/tests/test_template_manager.py index 99b8b35e..736425e1 100644 --- a/src/aipass/flow/tests/test_template_manager.py +++ b/src/aipass/flow/tests/test_template_manager.py @@ -9,7 +9,7 @@ """Tests for the template_manager module -- prefix suggestion, command routing.""" import pytest -from unittest.mock import MagicMock, patch +from unittest.mock import patch # --------------------------------------------------------------------------- # Module-level patch targets (patch where used, not where defined) diff --git a/src/aipass/memory/apps/handlers/archive/indexer.py b/src/aipass/memory/apps/handlers/archive/indexer.py index c9e626da..37b02fd1 100644 --- a/src/aipass/memory/apps/handlers/archive/indexer.py +++ b/src/aipass/memory/apps/handlers/archive/indexer.py @@ -19,7 +19,6 @@ No vectorization - just a searchable catalog. import ast import json -import logging from pathlib import Path from datetime import datetime from typing import Dict, Any, List diff --git a/src/aipass/memory/apps/handlers/central_writer.py b/src/aipass/memory/apps/handlers/central_writer.py index 1fd2be91..cd81f9e5 100644 --- a/src/aipass/memory/apps/handlers/central_writer.py +++ b/src/aipass/memory/apps/handlers/central_writer.py @@ -17,7 +17,6 @@ Purpose: Provide current stats to dashboard """ -import logging from json import load as json_load, dump as json_dump from pathlib import Path from datetime import datetime diff --git a/src/aipass/memory/apps/handlers/dashboard_push.py b/src/aipass/memory/apps/handlers/dashboard_push.py index 22d7588d..f6462ff2 100644 --- a/src/aipass/memory/apps/handlers/dashboard_push.py +++ b/src/aipass/memory/apps/handlers/dashboard_push.py @@ -18,7 +18,6 @@ branch dashboards (every branch benefits from knowing system memory health). """ import sys -import logging import subprocess from json import loads as json_loads from pathlib import Path diff --git a/src/aipass/memory/apps/handlers/json/memory_files.py b/src/aipass/memory/apps/handlers/json/memory_files.py index dbfe77bb..907f4274 100644 --- a/src/aipass/memory/apps/handlers/json/memory_files.py +++ b/src/aipass/memory/apps/handlers/json/memory_files.py @@ -31,7 +31,6 @@ import os import tempfile from pathlib import Path from typing import Dict, Any, Optional -from datetime import datetime from aipass.prax.apps.modules.logger import get_system_logger from aipass.memory.apps.handlers.json import json_handler diff --git a/src/aipass/memory/apps/handlers/learnings/manager.py b/src/aipass/memory/apps/handlers/learnings/manager.py index 7fc7f85f..624b45cf 100644 --- a/src/aipass/memory/apps/handlers/learnings/manager.py +++ b/src/aipass/memory/apps/handlers/learnings/manager.py @@ -27,7 +27,6 @@ Format: import sys import re import json -import logging import subprocess from pathlib import Path from typing import Dict, Any, List, Tuple diff --git a/src/aipass/memory/apps/handlers/monitor/detector.py b/src/aipass/memory/apps/handlers/monitor/detector.py index 6205d8ec..b16a3119 100644 --- a/src/aipass/memory/apps/handlers/monitor/detector.py +++ b/src/aipass/memory/apps/handlers/monitor/detector.py @@ -21,7 +21,6 @@ Independence: """ import json -import logging from pathlib import Path from typing import List, Dict, Any from dataclasses import dataclass diff --git a/src/aipass/memory/apps/handlers/monitor/memory_watcher.py b/src/aipass/memory/apps/handlers/monitor/memory_watcher.py index 01ee5d56..5f01c041 100644 --- a/src/aipass/memory/apps/handlers/monitor/memory_watcher.py +++ b/src/aipass/memory/apps/handlers/monitor/memory_watcher.py @@ -24,11 +24,10 @@ Independence: import logging from pathlib import Path -from typing import TYPE_CHECKING, Optional, Dict, Any +from typing import TYPE_CHECKING, Dict, Any if TYPE_CHECKING: - from watchdog.observers import Observer as _ObserverType - from watchdog.events import FileSystemEventHandler as _HandlerType + pass # Temporary logger for module-level import guards (overwritten below by get_system_logger) logger = logging.getLogger(__name__) @@ -680,7 +679,7 @@ if __name__ == "__main__": status = get_watcher_status() if status['active']: - print(f"Watcher is ACTIVE") + print("Watcher is ACTIVE") print(f"Watching {status['watched_directories']} directories:") for path in status['paths']: print(f" - {path}") diff --git a/src/aipass/memory/apps/handlers/rollover/extractor.py b/src/aipass/memory/apps/handlers/rollover/extractor.py index ab440859..f46b2166 100644 --- a/src/aipass/memory/apps/handlers/rollover/extractor.py +++ b/src/aipass/memory/apps/handlers/rollover/extractor.py @@ -27,9 +27,8 @@ Strategy: """ import shutil -import logging from pathlib import Path -from typing import Dict, List, Any, Tuple +from typing import Dict, Any from datetime import datetime # Handler imports (relative within package) diff --git a/src/aipass/memory/apps/handlers/schema/normalize.py b/src/aipass/memory/apps/handlers/schema/normalize.py index 3f086812..fdbbacfa 100644 --- a/src/aipass/memory/apps/handlers/schema/normalize.py +++ b/src/aipass/memory/apps/handlers/schema/normalize.py @@ -22,7 +22,6 @@ Supports two schema versions: """ import json -import logging from pathlib import Path from typing import Dict, Any from datetime import datetime diff --git a/src/aipass/memory/apps/handlers/search/vector_search.py b/src/aipass/memory/apps/handlers/search/vector_search.py index eea60afe..df310eca 100644 --- a/src/aipass/memory/apps/handlers/search/vector_search.py +++ b/src/aipass/memory/apps/handlers/search/vector_search.py @@ -28,7 +28,6 @@ Dependencies (optional): - torch """ -import logging from typing import List, Dict, Any from pathlib import Path diff --git a/src/aipass/memory/apps/handlers/storage/chroma.py b/src/aipass/memory/apps/handlers/storage/chroma.py index 68eec48a..fa87bb93 100644 --- a/src/aipass/memory/apps/handlers/storage/chroma.py +++ b/src/aipass/memory/apps/handlers/storage/chroma.py @@ -27,7 +27,6 @@ Dependencies (optional): - chromadb """ -import logging from typing import List, Dict, Any from pathlib import Path from datetime import datetime diff --git a/src/aipass/memory/apps/handlers/templates/differ.py b/src/aipass/memory/apps/handlers/templates/differ.py index eabfbc25..8652e659 100644 --- a/src/aipass/memory/apps/handlers/templates/differ.py +++ b/src/aipass/memory/apps/handlers/templates/differ.py @@ -25,7 +25,7 @@ Independence: import json import copy from pathlib import Path -from typing import Dict, Any, List, Optional +from typing import Dict, Any, List from aipass.prax import logger from aipass.memory.apps.handlers.json import json_handler diff --git a/src/aipass/memory/apps/handlers/tracking/line_counter.py b/src/aipass/memory/apps/handlers/tracking/line_counter.py index f4fbb64c..f359aaa5 100644 --- a/src/aipass/memory/apps/handlers/tracking/line_counter.py +++ b/src/aipass/memory/apps/handlers/tracking/line_counter.py @@ -20,7 +20,6 @@ Independence: Uses json_handler for safe, atomic metadata updates """ -import logging from pathlib import Path from typing import Dict, Any from datetime import datetime diff --git a/src/aipass/memory/apps/handlers/vector/embedder.py b/src/aipass/memory/apps/handlers/vector/embedder.py index e7234ab4..77d83f62 100644 --- a/src/aipass/memory/apps/handlers/vector/embedder.py +++ b/src/aipass/memory/apps/handlers/vector/embedder.py @@ -28,9 +28,7 @@ Dependencies (optional): - torch """ -import logging from typing import List, Dict, Any -from pathlib import Path from aipass.prax.apps.modules.logger import get_system_logger from aipass.memory.apps.handlers.json import json_handler diff --git a/src/aipass/memory/apps/memory.py b/src/aipass/memory/apps/memory.py index 244c168f..888784fb 100755 --- a/src/aipass/memory/apps/memory.py +++ b/src/aipass/memory/apps/memory.py @@ -250,9 +250,7 @@ def start_watch() -> None: """ from ..handlers.monitor.memory_watcher import ( # type: ignore[import-not-found] start_memory_watcher, - stop_memory_watcher, - is_memory_watcher_active, - get_watcher_status + stop_memory_watcher ) from ..handlers.monitor.detector import get_rollover_stats # type: ignore[import-not-found] diff --git a/src/aipass/memory/apps/modules/rollover.py b/src/aipass/memory/apps/modules/rollover.py index 07835d22..c1e2b6b9 100755 --- a/src/aipass/memory/apps/modules/rollover.py +++ b/src/aipass/memory/apps/modules/rollover.py @@ -41,7 +41,6 @@ from ..handlers.rollover.orchestrator import ( execute_rollover as _handler_execute_rollover, sync_line_counts as _handler_sync_line_counts, ) -from ..handlers.monitor.memory_watcher import check_and_rollover # ============================================================================= diff --git a/src/aipass/memory/apps/modules/symbolic.py b/src/aipass/memory/apps/modules/symbolic.py index e917db8f..24652276 100644 --- a/src/aipass/memory/apps/modules/symbolic.py +++ b/src/aipass/memory/apps/modules/symbolic.py @@ -1118,7 +1118,7 @@ def search_fragments_cli(args: List[str]) -> None: if meta_text: panel_content += f"\n\n[dim]{meta_text}[/dim]" - schema_tag = f"v2" if metadata.get('schema_version') == 'v2' else "v1" + schema_tag = "v2" if metadata.get('schema_version') == 'v2' else "v1" tier_tag = f" [{tier}]" if tier else "" panel_title = f"Result {i} ({schema_tag}) - Relevance: {relevance:.2%}{tier_tag} (via {', '.join(sources)})" diff --git a/src/aipass/memory/tests/test_archive.py b/src/aipass/memory/tests/test_archive.py index 2cf37d75..250e36a8 100644 --- a/src/aipass/memory/tests/test_archive.py +++ b/src/aipass/memory/tests/test_archive.py @@ -18,7 +18,6 @@ All tests use mocks/tmp_path -- no live filesystem or infrastructure access. import json import sys from pathlib import Path -from unittest.mock import MagicMock # --------------------------------------------------------------------------- diff --git a/src/aipass/memory/tests/test_central_writer.py b/src/aipass/memory/tests/test_central_writer.py index 51d94f53..5be6e389 100644 --- a/src/aipass/memory/tests/test_central_writer.py +++ b/src/aipass/memory/tests/test_central_writer.py @@ -20,7 +20,7 @@ import json import sqlite3 import sys from pathlib import Path -from unittest.mock import MagicMock, patch +from unittest.mock import MagicMock # --------------------------------------------------------------------------- diff --git a/src/aipass/memory/tests/test_dashboard_push.py b/src/aipass/memory/tests/test_dashboard_push.py index 9a5e358a..43a44a2d 100644 --- a/src/aipass/memory/tests/test_dashboard_push.py +++ b/src/aipass/memory/tests/test_dashboard_push.py @@ -26,7 +26,7 @@ All tests use mocks/tmp_path -- no live filesystem or infrastructure access. import json import sys from pathlib import Path -from unittest.mock import MagicMock, patch +from unittest.mock import MagicMock # --------------------------------------------------------------------------- diff --git a/src/aipass/memory/tests/test_intake.py b/src/aipass/memory/tests/test_intake.py index 99097395..a409b682 100644 --- a/src/aipass/memory/tests/test_intake.py +++ b/src/aipass/memory/tests/test_intake.py @@ -24,9 +24,7 @@ All tests use mocks/tmp_path -- no live filesystem or infrastructure access. import json import sys -import time -from pathlib import Path -from unittest.mock import MagicMock, patch +from unittest.mock import MagicMock # --------------------------------------------------------------------------- diff --git a/src/aipass/memory/tests/test_json_handler.py b/src/aipass/memory/tests/test_json_handler.py index ba2e8850..561c51f0 100644 --- a/src/aipass/memory/tests/test_json_handler.py +++ b/src/aipass/memory/tests/test_json_handler.py @@ -30,8 +30,6 @@ import json import sys from io import StringIO from pathlib import Path -from typing import Any -from unittest.mock import MagicMock import pytest @@ -52,7 +50,7 @@ def _fresh_json_handler(monkeypatch): saved_mf = sys.modules.pop("aipass.memory.apps.handlers.json.memory_files", None) try: - import aipass.memory.apps.handlers.json # noqa: F811 + pass # noqa: F811 except Exception: if saved_json_pkg is not None: sys.modules["aipass.memory.apps.handlers.json"] = saved_json_pkg @@ -63,7 +61,6 @@ def _fresh_json_handler(monkeypatch): importlib.reload(existing) else: sys.modules.pop(jh_key, None) - import aipass.memory.apps.handlers.json.json_handler # noqa: F811 yield @@ -77,7 +74,7 @@ def _get_memory_files(): """Import and return the memory_files module.""" mf_key = "aipass.memory.apps.handlers.json.memory_files" if mf_key not in sys.modules: - import aipass.memory.apps.handlers.json.memory_files # noqa: F811 + pass # noqa: F811 return sys.modules[mf_key] diff --git a/src/aipass/memory/tests/test_learnings.py b/src/aipass/memory/tests/test_learnings.py index 1b7e4a79..c236f68a 100644 --- a/src/aipass/memory/tests/test_learnings.py +++ b/src/aipass/memory/tests/test_learnings.py @@ -18,11 +18,9 @@ Covers: All tests use mocks or tmp_path -- no live filesystem or infrastructure access. """ -import json import sys from datetime import datetime, timedelta -from pathlib import Path -from unittest.mock import MagicMock, patch +from unittest.mock import MagicMock import pytest diff --git a/src/aipass/memory/tests/test_memory_files.py b/src/aipass/memory/tests/test_memory_files.py index 5e451007..6fba3080 100644 --- a/src/aipass/memory/tests/test_memory_files.py +++ b/src/aipass/memory/tests/test_memory_files.py @@ -59,7 +59,6 @@ def _fresh_memory_files(monkeypatch): try: # Import the real package so memory_files can be found - import aipass.memory.apps.handlers.json # noqa: F811 real_json_pkg = sys.modules.get("aipass.memory.apps.handlers.json") except Exception: # If we can't import the real package, restore the mock @@ -73,7 +72,6 @@ def _fresh_memory_files(monkeypatch): importlib.reload(existing) else: sys.modules.pop(mem_files_key, None) - import aipass.memory.apps.handlers.json.memory_files # noqa: F811 yield diff --git a/src/aipass/memory/tests/test_rollover.py b/src/aipass/memory/tests/test_rollover.py index bd5a5477..f7dce021 100644 --- a/src/aipass/memory/tests/test_rollover.py +++ b/src/aipass/memory/tests/test_rollover.py @@ -15,7 +15,6 @@ All tests use mocks or tmp_path — no live filesystem or infrastructure access. """ import sys -from pathlib import Path from unittest.mock import MagicMock, patch diff --git a/src/aipass/memory/tests/test_symbolic.py b/src/aipass/memory/tests/test_symbolic.py index 8a776240..bacb720a 100644 --- a/src/aipass/memory/tests/test_symbolic.py +++ b/src/aipass/memory/tests/test_symbolic.py @@ -140,7 +140,6 @@ def _import_symbolic(): Must also clear the parent package's cached attribute so Python re-executes the module code with fresh mocks. """ - import importlib # Remove from sys.modules if still present sys.modules.pop("aipass.memory.apps.modules.symbolic", None) diff --git a/src/aipass/memory/tests/test_verify.py b/src/aipass/memory/tests/test_verify.py index 5c434594..4cc92b8e 100644 --- a/src/aipass/memory/tests/test_verify.py +++ b/src/aipass/memory/tests/test_verify.py @@ -18,7 +18,6 @@ import sys from pathlib import Path from unittest.mock import MagicMock -import pytest # --------------------------------------------------------------------------- diff --git a/src/aipass/prax/apps/handlers/central/reader.py b/src/aipass/prax/apps/handlers/central/reader.py index 53f30d47..fb3f6f86 100644 --- a/src/aipass/prax/apps/handlers/central/reader.py +++ b/src/aipass/prax/apps/handlers/central/reader.py @@ -16,7 +16,6 @@ Used by dashboard/refresh.py to populate branch dashboards. """ import json -from pathlib import Path from typing import Dict from aipass.prax.apps.modules.logger import get_direct_logger diff --git a/src/aipass/prax/apps/handlers/config/ignore_patterns.py b/src/aipass/prax/apps/handlers/config/ignore_patterns.py index 6b22bb1e..958a2560 100755 --- a/src/aipass/prax/apps/handlers/config/ignore_patterns.py +++ b/src/aipass/prax/apps/handlers/config/ignore_patterns.py @@ -28,7 +28,6 @@ Usage: import json import logging -from pathlib import Path from typing import Set from aipass.prax.apps.handlers.config.load import PRAX_ROOT diff --git a/src/aipass/prax/apps/handlers/logging/lifecycle.py b/src/aipass/prax/apps/handlers/logging/lifecycle.py index aa00f632..b61bfae7 100644 --- a/src/aipass/prax/apps/handlers/logging/lifecycle.py +++ b/src/aipass/prax/apps/handlers/logging/lifecycle.py @@ -14,9 +14,7 @@ continuous logging. Extracted from modules/logger.py to follow the 3-tier architecture (modules = orchestration, handlers = implementation). """ -import sys -import time -from typing import Dict, Any, Callable +from typing import Dict, Any from aipass.prax.apps.handlers.json import json_handler from aipass.prax.apps.handlers.logging.setup import ( diff --git a/src/aipass/prax/apps/handlers/logging/monitoring.py b/src/aipass/prax/apps/handlers/logging/monitoring.py index 7fd9e582..cc9fc0d4 100755 --- a/src/aipass/prax/apps/handlers/logging/monitoring.py +++ b/src/aipass/prax/apps/handlers/logging/monitoring.py @@ -17,7 +17,6 @@ This is the thick implementation that modules/logger.py calls. import sys import time -from pathlib import Path from typing import Callable, Dict, Any from aipass.prax.apps.modules.logger import system_logger as logger diff --git a/src/aipass/prax/apps/handlers/logging/operations.py b/src/aipass/prax/apps/handlers/logging/operations.py index 70c9ed95..055d289c 100755 --- a/src/aipass/prax/apps/handlers/logging/operations.py +++ b/src/aipass/prax/apps/handlers/logging/operations.py @@ -12,7 +12,6 @@ PRAX Logging Operations Operation logging and configuration management for prax logger. """ -from pathlib import Path import json from datetime import datetime, timezone diff --git a/src/aipass/prax/apps/handlers/logging/override.py b/src/aipass/prax/apps/handlers/logging/override.py index 75a8fbfd..014da76f 100755 --- a/src/aipass/prax/apps/handlers/logging/override.py +++ b/src/aipass/prax/apps/handlers/logging/override.py @@ -13,7 +13,6 @@ Global logging.getLogger() override for automatic log routing. Intercepts logging.getLogger() calls and routes to module-specific logs. """ -from pathlib import Path import logging import sys diff --git a/src/aipass/prax/apps/handlers/logging/terminal/filtering.py b/src/aipass/prax/apps/handlers/logging/terminal/filtering.py index 9ce523ab..79a07e0d 100755 --- a/src/aipass/prax/apps/handlers/logging/terminal/filtering.py +++ b/src/aipass/prax/apps/handlers/logging/terminal/filtering.py @@ -14,7 +14,6 @@ Filters terminal output to reduce noise from internal modules. import logging logger = logging.getLogger(__name__) -from pathlib import Path import json from typing import Set, Optional diff --git a/src/aipass/prax/apps/handlers/logging/terminal/formatting.py b/src/aipass/prax/apps/handlers/logging/terminal/formatting.py index 437e2577..aec83765 100755 --- a/src/aipass/prax/apps/handlers/logging/terminal/formatting.py +++ b/src/aipass/prax/apps/handlers/logging/terminal/formatting.py @@ -13,7 +13,6 @@ Terminal output formatting with branch-aware display. """ import sys -from pathlib import Path import logging from typing import Optional diff --git a/src/aipass/prax/apps/handlers/monitoring/event_queue.py b/src/aipass/prax/apps/handlers/monitoring/event_queue.py index 464a6ef7..28d9a58d 100644 --- a/src/aipass/prax/apps/handlers/monitoring/event_queue.py +++ b/src/aipass/prax/apps/handlers/monitoring/event_queue.py @@ -8,7 +8,6 @@ """Thread-safe event coordination for monitoring system""" -from pathlib import Path from queue import Empty, PriorityQueue from dataclasses import dataclass, field from datetime import datetime diff --git a/src/aipass/prax/apps/handlers/registry/load.py b/src/aipass/prax/apps/handlers/registry/load.py index 4b5fc0c3..ccd561bd 100755 --- a/src/aipass/prax/apps/handlers/registry/load.py +++ b/src/aipass/prax/apps/handlers/registry/load.py @@ -27,7 +27,6 @@ Usage: import json import logging -from pathlib import Path from typing import Dict, Any from aipass.prax.apps.handlers.config.load import PRAX_ROOT diff --git a/src/aipass/prax/apps/handlers/registry/save.py b/src/aipass/prax/apps/handlers/registry/save.py index 608e3ede..5cd50326 100755 --- a/src/aipass/prax/apps/handlers/registry/save.py +++ b/src/aipass/prax/apps/handlers/registry/save.py @@ -28,7 +28,6 @@ Usage: import json import logging -from pathlib import Path from datetime import datetime, timezone from typing import Dict, Any diff --git a/src/aipass/prax/apps/handlers/watcher/monitor.py b/src/aipass/prax/apps/handlers/watcher/monitor.py index 3200c446..eff02503 100755 --- a/src/aipass/prax/apps/handlers/watcher/monitor.py +++ b/src/aipass/prax/apps/handlers/watcher/monitor.py @@ -14,8 +14,7 @@ Monitors all files (including __pycache__, .pyc, etc.) to provide complete visibility into branch modifications. """ -from pathlib import Path -from typing import List, Callable, Optional, TYPE_CHECKING, Any +from typing import List, Callable, Any from aipass.prax.apps.modules.logger import get_direct_logger from aipass.prax.apps.handlers.json import json_handler diff --git a/src/aipass/prax/apps/modules/logger.py b/src/aipass/prax/apps/modules/logger.py index 5187cfb4..16432dfa 100755 --- a/src/aipass/prax/apps/modules/logger.py +++ b/src/aipass/prax/apps/modules/logger.py @@ -39,7 +39,6 @@ __all__ = [ ] import logging -import sys import threading from typing import Dict, Any @@ -57,7 +56,7 @@ from aipass.prax.apps.handlers.logging.setup import ( enable_terminal_output as _enable_terminal, disable_terminal_output as _disable_terminal, ) -from aipass.prax.apps.handlers.logging.introspection import get_calling_module, get_caller_info +from aipass.prax.apps.handlers.logging.introspection import get_caller_info from aipass.prax.apps.handlers.logging.override import ( is_override_active ) diff --git a/src/aipass/prax/apps/modules/monitor.py b/src/aipass/prax/apps/modules/monitor.py index 1e94485a..ae7407c9 100755 --- a/src/aipass/prax/apps/modules/monitor.py +++ b/src/aipass/prax/apps/modules/monitor.py @@ -18,7 +18,6 @@ Usage: drone @prax monitor run # Monitor all branches """ -import signal import sys import argparse import threading diff --git a/src/aipass/prax/apps/prax.py b/src/aipass/prax/apps/prax.py index c188015f..ae44f145 100755 --- a/src/aipass/prax/apps/prax.py +++ b/src/aipass/prax/apps/prax.py @@ -25,7 +25,7 @@ from typing import List, Callable from aipass.prax.apps.modules.logger import system_logger as logger # CLI services -from aipass.cli.apps.modules import console, header, success, error, warning +from aipass.cli.apps.modules import console, error, warning # ============================================================================= # MODULE DISCOVERY diff --git a/src/aipass/prax/tests/test_central.py b/src/aipass/prax/tests/test_central.py index bc333beb..77b2ba58 100644 --- a/src/aipass/prax/tests/test_central.py +++ b/src/aipass/prax/tests/test_central.py @@ -14,10 +14,6 @@ malformed JSON, mixed valid/invalid files, service name derivation. import json import sys -import importlib -import pytest -from pathlib import Path -from unittest.mock import patch, MagicMock # ============================================= diff --git a/src/aipass/prax/tests/test_config.py b/src/aipass/prax/tests/test_config.py index e1aec7f8..c31bcce3 100644 --- a/src/aipass/prax/tests/test_config.py +++ b/src/aipass/prax/tests/test_config.py @@ -13,10 +13,7 @@ get_debug_prints_enabled, load_log_config) and ignore_patterns.py import json import sys -import importlib -import pytest from pathlib import Path -from unittest.mock import patch, MagicMock # ============================================= diff --git a/src/aipass/prax/tests/test_discovery.py b/src/aipass/prax/tests/test_discovery.py index aa0b1752..54e0addd 100644 --- a/src/aipass/prax/tests/test_discovery.py +++ b/src/aipass/prax/tests/test_discovery.py @@ -15,7 +15,7 @@ and scanner.discover_python_modules. import importlib import sys from pathlib import Path -from unittest.mock import MagicMock, patch +from unittest.mock import MagicMock import pytest diff --git a/src/aipass/prax/tests/test_event_queue.py b/src/aipass/prax/tests/test_event_queue.py index ff1044d5..03516a84 100644 --- a/src/aipass/prax/tests/test_event_queue.py +++ b/src/aipass/prax/tests/test_event_queue.py @@ -9,7 +9,6 @@ """Tests for the thread-safe event queue used by the monitoring system.""" import importlib -import time import threading from datetime import datetime, timedelta diff --git a/src/aipass/prax/tests/test_json_handler.py b/src/aipass/prax/tests/test_json_handler.py index 4720d787..a009b456 100644 --- a/src/aipass/prax/tests/test_json_handler.py +++ b/src/aipass/prax/tests/test_json_handler.py @@ -13,9 +13,7 @@ import json import sys import pytest from pathlib import Path -from unittest.mock import MagicMock, patch -from io import StringIO -import importlib +from unittest.mock import MagicMock # ============================================= diff --git a/src/aipass/prax/tests/test_log_watcher.py b/src/aipass/prax/tests/test_log_watcher.py index 528dadbb..e72f2bdd 100644 --- a/src/aipass/prax/tests/test_log_watcher.py +++ b/src/aipass/prax/tests/test_log_watcher.py @@ -21,7 +21,6 @@ from pathlib import Path from types import ModuleType from unittest.mock import MagicMock, patch -import pytest # --------------------------------------------------------------------------- diff --git a/src/aipass/prax/tests/test_logging.py b/src/aipass/prax/tests/test_logging.py index 773bb9f2..a133f90c 100644 --- a/src/aipass/prax/tests/test_logging.py +++ b/src/aipass/prax/tests/test_logging.py @@ -10,10 +10,7 @@ and template placeholder replacement.""" import copy -import importlib import sys -import pytest -from pathlib import Path from unittest.mock import MagicMock, patch diff --git a/src/aipass/prax/tests/test_monitor_module.py b/src/aipass/prax/tests/test_monitor_module.py index e8e1bac6..7b5b16d0 100644 --- a/src/aipass/prax/tests/test_monitor_module.py +++ b/src/aipass/prax/tests/test_monitor_module.py @@ -15,10 +15,8 @@ Covers: import json import sys -from pathlib import Path from unittest.mock import MagicMock, patch -import pytest # --------------------------------------------------------------------------- diff --git a/src/aipass/prax/tests/test_monitoring_filters.py b/src/aipass/prax/tests/test_monitoring_filters.py index 8dd0476e..6b1e50c3 100644 --- a/src/aipass/prax/tests/test_monitoring_filters.py +++ b/src/aipass/prax/tests/test_monitoring_filters.py @@ -14,7 +14,6 @@ filter_log_content, and apply_content_filter. from pathlib import Path -import pytest # ============================================= diff --git a/src/aipass/prax/tests/test_registry.py b/src/aipass/prax/tests/test_registry.py index e61d8f80..51f087d0 100644 --- a/src/aipass/prax/tests/test_registry.py +++ b/src/aipass/prax/tests/test_registry.py @@ -15,10 +15,7 @@ creates directory, round-trip with load, error handling). import json import sys -import importlib -import pytest -from pathlib import Path -from unittest.mock import patch, MagicMock +from unittest.mock import MagicMock # ============================================= diff --git a/src/aipass/prax/tests/test_watcher.py b/src/aipass/prax/tests/test_watcher.py index 72ea8fca..849996cc 100644 --- a/src/aipass/prax/tests/test_watcher.py +++ b/src/aipass/prax/tests/test_watcher.py @@ -15,7 +15,6 @@ import sys from pathlib import Path from unittest.mock import MagicMock, patch -import pytest # ============================================================================ diff --git a/src/aipass/seedgo/apps/handlers/aipass_standards/architecture_check.py b/src/aipass/seedgo/apps/handlers/aipass_standards/architecture_check.py index 967e13cb..21fa98f6 100644 --- a/src/aipass/seedgo/apps/handlers/aipass_standards/architecture_check.py +++ b/src/aipass/seedgo/apps/handlers/aipass_standards/architecture_check.py @@ -14,7 +14,6 @@ Checks 3-layer pattern, handler independence, file size, domain organization. For entry points, also verifies entire branch structure against template baseline. """ -import sys import json from pathlib import Path from typing import Dict, List, Optional @@ -195,7 +194,7 @@ def check_layer_location(module_path: str, is_entry_point: bool, is_module: bool return { 'name': '3-layer pattern', 'passed': False, - 'message': f'File not in standard 3-layer structure (apps/, apps/modules/, apps/handlers/)' + 'message': 'File not in standard 3-layer structure (apps/, apps/modules/, apps/handlers/)' } diff --git a/src/aipass/seedgo/apps/handlers/aipass_standards/cli_check.py b/src/aipass/seedgo/apps/handlers/aipass_standards/cli_check.py index 1fa8ada4..0aa7cfe1 100644 --- a/src/aipass/seedgo/apps/handlers/aipass_standards/cli_check.py +++ b/src/aipass/seedgo/apps/handlers/aipass_standards/cli_check.py @@ -13,7 +13,6 @@ Validates module compliance with AIPass CLI standards. Checks console.print() usage, CLI service imports, handler separation. """ -import sys import re from pathlib import Path from typing import Dict, List, Optional diff --git a/src/aipass/seedgo/apps/handlers/aipass_standards/cli_flags_check.py b/src/aipass/seedgo/apps/handlers/aipass_standards/cli_flags_check.py index eab971de..c2f0b186 100644 --- a/src/aipass/seedgo/apps/handlers/aipass_standards/cli_flags_check.py +++ b/src/aipass/seedgo/apps/handlers/aipass_standards/cli_flags_check.py @@ -21,7 +21,6 @@ apps/handlers/ or apps/modules/). Non-entry-point files are skipped with a pass. """ -import sys import re from pathlib import Path from typing import Dict, List diff --git a/src/aipass/seedgo/apps/handlers/aipass_standards/dead_code_check.py b/src/aipass/seedgo/apps/handlers/aipass_standards/dead_code_check.py index e4b408e8..08641ba2 100644 --- a/src/aipass/seedgo/apps/handlers/aipass_standards/dead_code_check.py +++ b/src/aipass/seedgo/apps/handlers/aipass_standards/dead_code_check.py @@ -20,7 +20,6 @@ Score: referenced_files / total_files * 100, threshold 75%. import re from pathlib import Path -from typing import Dict from aipass.prax import logger from aipass.seedgo.apps.handlers.json import json_handler diff --git a/src/aipass/seedgo/apps/handlers/aipass_standards/handlers_check.py b/src/aipass/seedgo/apps/handlers/aipass_standards/handlers_check.py index d5798bca..c795ba32 100644 --- a/src/aipass/seedgo/apps/handlers/aipass_standards/handlers_check.py +++ b/src/aipass/seedgo/apps/handlers/aipass_standards/handlers_check.py @@ -13,7 +13,6 @@ Validates handler compliance with AIPass handler standards. Checks handler independence, auto-detection pattern, no orchestration. """ -import sys import re from pathlib import Path from typing import Dict, List, Optional diff --git a/src/aipass/seedgo/apps/handlers/aipass_standards/handlers_content.py b/src/aipass/seedgo/apps/handlers/aipass_standards/handlers_content.py index 2be6d184..f8941434 100644 --- a/src/aipass/seedgo/apps/handlers/aipass_standards/handlers_content.py +++ b/src/aipass/seedgo/apps/handlers/aipass_standards/handlers_content.py @@ -6,8 +6,6 @@ # Modified: 2026-03-05 # ============================================= -import sys -from pathlib import Path """ Handlers Standards Content Handler diff --git a/src/aipass/seedgo/apps/handlers/aipass_standards/log_handler_check.py b/src/aipass/seedgo/apps/handlers/aipass_standards/log_handler_check.py index 9924bf8b..b490a524 100644 --- a/src/aipass/seedgo/apps/handlers/aipass_standards/log_handler_check.py +++ b/src/aipass/seedgo/apps/handlers/aipass_standards/log_handler_check.py @@ -20,7 +20,6 @@ THE STANDARD: - Prax's own logging infrastructure is exempt (it IS the implementation) """ -import sys import re from pathlib import Path from typing import Dict, List diff --git a/src/aipass/seedgo/apps/handlers/aipass_standards/log_level_check.py b/src/aipass/seedgo/apps/handlers/aipass_standards/log_level_check.py index 190d31c5..2b1ead50 100644 --- a/src/aipass/seedgo/apps/handlers/aipass_standards/log_level_check.py +++ b/src/aipass/seedgo/apps/handlers/aipass_standards/log_level_check.py @@ -20,7 +20,6 @@ THE STANDARD: - INFO = Normal operations, successful completions, discoveries """ -import sys import re from pathlib import Path from typing import Dict, List, Optional diff --git a/src/aipass/seedgo/apps/handlers/aipass_standards/log_visibility_check.py b/src/aipass/seedgo/apps/handlers/aipass_standards/log_visibility_check.py index a9eada43..5c803a2d 100644 --- a/src/aipass/seedgo/apps/handlers/aipass_standards/log_visibility_check.py +++ b/src/aipass/seedgo/apps/handlers/aipass_standards/log_visibility_check.py @@ -20,7 +20,6 @@ TWO CHECKS: Prax logging infrastructure and test files are exempt from both checks. """ -import sys import re from pathlib import Path from typing import Dict, List diff --git a/src/aipass/seedgo/apps/handlers/aipass_standards/log_visibility_content.py b/src/aipass/seedgo/apps/handlers/aipass_standards/log_visibility_content.py index d3306f22..17ccc619 100644 --- a/src/aipass/seedgo/apps/handlers/aipass_standards/log_visibility_content.py +++ b/src/aipass/seedgo/apps/handlers/aipass_standards/log_visibility_content.py @@ -12,8 +12,6 @@ Log Visibility Standards Content Provides Rich-formatted reference text for the log visibility standard. """ -import sys -from pathlib import Path from aipass.seedgo.apps.handlers.json import json_handler diff --git a/src/aipass/seedgo/apps/handlers/aipass_standards/modules_check.py b/src/aipass/seedgo/apps/handlers/aipass_standards/modules_check.py index b85f593b..5692d245 100644 --- a/src/aipass/seedgo/apps/handlers/aipass_standards/modules_check.py +++ b/src/aipass/seedgo/apps/handlers/aipass_standards/modules_check.py @@ -13,7 +13,6 @@ Validates module compliance with AIPass module standards. Checks handle_command pattern, thin orchestration, file size guidelines. """ -import sys import re import ast from pathlib import Path diff --git a/src/aipass/seedgo/apps/handlers/aipass_standards/permission_flags_check.py b/src/aipass/seedgo/apps/handlers/aipass_standards/permission_flags_check.py index 96f3899d..da4bf10c 100644 --- a/src/aipass/seedgo/apps/handlers/aipass_standards/permission_flags_check.py +++ b/src/aipass/seedgo/apps/handlers/aipass_standards/permission_flags_check.py @@ -21,7 +21,6 @@ THE STANDARD: - Documentation files that mention these flags for reference are exempt """ -import sys import re from pathlib import Path from typing import Dict, List diff --git a/src/aipass/seedgo/apps/handlers/aipass_standards/readme_check.py b/src/aipass/seedgo/apps/handlers/aipass_standards/readme_check.py index 1cf10aa5..14d3d049 100644 --- a/src/aipass/seedgo/apps/handlers/aipass_standards/readme_check.py +++ b/src/aipass/seedgo/apps/handlers/aipass_standards/readme_check.py @@ -22,7 +22,6 @@ Checks: import os import re -import sys from datetime import datetime from pathlib import Path from typing import Dict, List, Optional diff --git a/src/aipass/seedgo/apps/handlers/aipass_standards/readme_content.py b/src/aipass/seedgo/apps/handlers/aipass_standards/readme_content.py index 36c90b93..a5faa2cb 100644 --- a/src/aipass/seedgo/apps/handlers/aipass_standards/readme_content.py +++ b/src/aipass/seedgo/apps/handlers/aipass_standards/readme_content.py @@ -12,8 +12,6 @@ README Standards Content Provides Rich-formatted reference text for the README standard. """ -import sys -from pathlib import Path from aipass.seedgo.apps.handlers.json import json_handler diff --git a/src/aipass/seedgo/apps/handlers/aipass_standards/trigger_content.py b/src/aipass/seedgo/apps/handlers/aipass_standards/trigger_content.py index 1d80f06e..f28b5832 100644 --- a/src/aipass/seedgo/apps/handlers/aipass_standards/trigger_content.py +++ b/src/aipass/seedgo/apps/handlers/aipass_standards/trigger_content.py @@ -13,8 +13,6 @@ Provides formatted Trigger event bus standards content. Module orchestrates, handler implements. """ -import sys -from pathlib import Path from aipass.seedgo.apps.handlers.json import json_handler diff --git a/src/aipass/seedgo/apps/handlers/audit/audit_display.py b/src/aipass/seedgo/apps/handlers/audit/audit_display.py index c59008d0..8c07de87 100644 --- a/src/aipass/seedgo/apps/handlers/audit/audit_display.py +++ b/src/aipass/seedgo/apps/handlers/audit/audit_display.py @@ -13,7 +13,6 @@ Formats and prints audit results to console. Module-level display logic for audit output. """ -from pathlib import Path from typing import List, Dict from collections import defaultdict @@ -25,7 +24,6 @@ from collections import defaultdict # ============================================================================= # Prax logger (system-wide, always first) -from aipass.prax import logger # CLI services (display/output formatting) from aipass.cli import console, header @@ -154,7 +152,7 @@ def _render_type_errors(audit_result: dict, console_obj) -> None: msg = diag.get('message', '')[:60] console_obj.print(f" [dim]L{diag.get('line', '?')}: {msg}[/dim]") elif files_checked > 0: - console_obj.print(f" [green]✓[/green] No type errors") + console_obj.print(" [green]✓[/green] No type errors") def _render_test_map(audit_result: dict, console_obj) -> None: @@ -291,7 +289,7 @@ def print_system_summary(audit_results: List[Dict]): if total_type_errors > 0: console.print(f" [red]Type errors: {total_type_errors} ({branches_with_type_errors} branches)[/red]") else: - console.print(f" Type errors: [green]0 ✓[/green]") + console.print(" Type errors: [green]0 ✓[/green]") console.print() # Calculate standard averages @@ -375,7 +373,7 @@ def print_bypass_audit(bypass_results: List[Dict]): if would_pass: console.print(f" [green]✓[/green] {file_name} [{standard}] → {score}%") - console.print(f" [green]PASSES NOW - bypass can be removed![/green]") + console.print(" [green]PASSES NOW - bypass can be removed![/green]") console.print(f" [dim]Reason was: {reason}[/dim]") removable_count += 1 else: @@ -388,13 +386,13 @@ def print_bypass_audit(bypass_results: List[Dict]): console.print(f" [red]Error: {r.get('error', 'Unknown')}[/red]") else: console.print(f" [dim]?[/dim] {file_name} [{standard}]") - console.print(f" [dim]Unknown standard or status[/dim]") + console.print(" [dim]Unknown standard or status[/dim]") console.print() # Summary console.print("─" * 70) - console.print(f"[bold]BYPASS SUMMARY:[/bold]") + console.print("[bold]BYPASS SUMMARY:[/bold]") console.print(f" Total bypasses: {total_count}") console.print(f" Can be removed: {removable_count} [green]{'← clean these up!' if removable_count > 0 else ''}[/green]") console.print(f" Still needed: {total_count - removable_count}") diff --git a/src/aipass/seedgo/apps/handlers/diagnostics/diagnostics_check.py b/src/aipass/seedgo/apps/handlers/diagnostics/diagnostics_check.py index 808ee38b..55eceb69 100644 --- a/src/aipass/seedgo/apps/handlers/diagnostics/diagnostics_check.py +++ b/src/aipass/seedgo/apps/handlers/diagnostics/diagnostics_check.py @@ -557,7 +557,7 @@ if __name__ == '__main__': if result['total_errors'] > 0: console.print(f" [red]Total errors: {result['total_errors']}[/red]") else: - console.print(f" [green]Total errors: 0[/green]") + console.print(" [green]Total errors: 0[/green]") if result['total_warnings'] > 0: console.print(f" [yellow]Total warnings: {result['total_warnings']}[/yellow]") diff --git a/src/aipass/seedgo/apps/handlers/readme/readme_generator.py b/src/aipass/seedgo/apps/handlers/readme/readme_generator.py index 2b30ca0b..2b96204c 100644 --- a/src/aipass/seedgo/apps/handlers/readme/readme_generator.py +++ b/src/aipass/seedgo/apps/handlers/readme/readme_generator.py @@ -28,7 +28,7 @@ import subprocess import sys from datetime import datetime from pathlib import Path -from typing import Dict, List, Optional +from typing import List, Optional from aipass.prax import logger from aipass.seedgo.apps.handlers.json import json_handler diff --git a/src/aipass/seedgo/apps/handlers/readme/readme_ops.py b/src/aipass/seedgo/apps/handlers/readme/readme_ops.py index 16195721..a973255b 100644 --- a/src/aipass/seedgo/apps/handlers/readme/readme_ops.py +++ b/src/aipass/seedgo/apps/handlers/readme/readme_ops.py @@ -14,7 +14,6 @@ generator loading, and target resolution. Returns data structures for the module to display. """ -import sys import json import importlib.util from pathlib import Path diff --git a/src/aipass/seedgo/apps/modules/diagnostics_audit.py b/src/aipass/seedgo/apps/modules/diagnostics_audit.py index 607153c1..c4ef6da6 100644 --- a/src/aipass/seedgo/apps/modules/diagnostics_audit.py +++ b/src/aipass/seedgo/apps/modules/diagnostics_audit.py @@ -24,17 +24,14 @@ from typing import Dict, List from aipass.prax import logger # CLI service from aipass.cli import console -from aipass.cli import header from aipass.cli.apps.modules import error, warning # JSON handler for logging from aipass.seedgo.apps.handlers.json import json_handler # Drone services for @ resolution -from aipass.drone.apps.modules import normalize_branch_arg # Diagnostics handlers -from aipass.seedgo.apps.handlers.diagnostics.discovery import discover_branches def print_branch_diagnostics(result: Dict): diff --git a/src/aipass/seedgo/apps/modules/proof_query.py b/src/aipass/seedgo/apps/modules/proof_query.py index 67347e81..c3426daf 100644 --- a/src/aipass/seedgo/apps/modules/proof_query.py +++ b/src/aipass/seedgo/apps/modules/proof_query.py @@ -31,7 +31,7 @@ from aipass.prax import logger # CLI services (display/output formatting) from aipass.cli import console, header -from aipass.cli.apps.modules import error, warning +from aipass.cli.apps.modules import warning # JSON handler for tracking from aipass.seedgo.apps.handlers.json import json_handler diff --git a/src/aipass/seedgo/apps/modules/standards_audit.py b/src/aipass/seedgo/apps/modules/standards_audit.py index a4734975..e9659a1a 100755 --- a/src/aipass/seedgo/apps/modules/standards_audit.py +++ b/src/aipass/seedgo/apps/modules/standards_audit.py @@ -41,7 +41,7 @@ from aipass.seedgo.apps.handlers.json import json_handler # Audit handlers (implementation) from aipass.seedgo.apps.handlers.audit.discovery import discover_branches, _is_branch_private, check_internal_access from aipass.seedgo.apps.handlers.audit.branch_audit import audit_branch -from aipass.seedgo.apps.handlers.audit.audit_display import print_branch_summary, print_system_summary, print_bypass_audit +from aipass.seedgo.apps.handlers.audit.audit_display import print_branch_summary, print_system_summary # Bypass system from aipass.seedgo.apps.handlers.bypass.bypass_handler import load_bypass_rules diff --git a/src/aipass/seedgo/templates/test_conftest_template.py b/src/aipass/seedgo/templates/test_conftest_template.py index b2a3130b..6b424c57 100644 --- a/src/aipass/seedgo/templates/test_conftest_template.py +++ b/src/aipass/seedgo/templates/test_conftest_template.py @@ -23,7 +23,6 @@ These fixtures establish a consistent test environment across all branches. """ import importlib -import json import logging import sys import types diff --git a/src/aipass/seedgo/tests/test_aipass_standards.py b/src/aipass/seedgo/tests/test_aipass_standards.py index a999377d..b13c9ffe 100644 --- a/src/aipass/seedgo/tests/test_aipass_standards.py +++ b/src/aipass/seedgo/tests/test_aipass_standards.py @@ -10,7 +10,6 @@ import pytest from unittest.mock import MagicMock -from pathlib import Path # --------------------------------------------------------------------------- diff --git a/src/aipass/seedgo/tests/test_bypass.py b/src/aipass/seedgo/tests/test_bypass.py index b8a02982..7a31ae8d 100644 --- a/src/aipass/seedgo/tests/test_bypass.py +++ b/src/aipass/seedgo/tests/test_bypass.py @@ -11,7 +11,6 @@ import json import pytest from unittest.mock import MagicMock -from pathlib import Path # --------------------------------------------------------------------------- diff --git a/src/aipass/seedgo/tests/test_checkers_batch1.py b/src/aipass/seedgo/tests/test_checkers_batch1.py index 3686e3e9..e162524d 100644 --- a/src/aipass/seedgo/tests/test_checkers_batch1.py +++ b/src/aipass/seedgo/tests/test_checkers_batch1.py @@ -10,7 +10,6 @@ import pytest from unittest.mock import MagicMock -from pathlib import Path # --------------------------------------------------------------------------- diff --git a/src/aipass/seedgo/tests/test_checkers_batch2.py b/src/aipass/seedgo/tests/test_checkers_batch2.py index bc950c0a..cbed43ec 100644 --- a/src/aipass/seedgo/tests/test_checkers_batch2.py +++ b/src/aipass/seedgo/tests/test_checkers_batch2.py @@ -14,7 +14,6 @@ Tests for 8 seedgo checker handlers: Each checker gets 3 tests: clean pass, violation caught, bypass respected. """ -import pytest from pathlib import Path from aipass.seedgo.apps.handlers.aipass_standards.error_handling_check import ( diff --git a/src/aipass/seedgo/tests/test_checkers_batch3.py b/src/aipass/seedgo/tests/test_checkers_batch3.py index 90c41667..66826e8f 100644 --- a/src/aipass/seedgo/tests/test_checkers_batch3.py +++ b/src/aipass/seedgo/tests/test_checkers_batch3.py @@ -16,7 +16,6 @@ silent_catch_check. Each checker gets 3 tests: clean pass, violation caught, bypass respected. """ -import os import sys import textwrap import pytest diff --git a/src/aipass/seedgo/tests/test_checkers_batch4.py b/src/aipass/seedgo/tests/test_checkers_batch4.py index 2e716694..da78fa3e 100644 --- a/src/aipass/seedgo/tests/test_checkers_batch4.py +++ b/src/aipass/seedgo/tests/test_checkers_batch4.py @@ -11,7 +11,6 @@ from pathlib import Path from unittest.mock import patch -import pytest from aipass.seedgo.apps.handlers.aipass_standards.stderr_routing_check import ( check_module as stderr_check_module, diff --git a/src/aipass/seedgo/tests/test_checklist.py b/src/aipass/seedgo/tests/test_checklist.py index be308b52..aec778ca 100644 --- a/src/aipass/seedgo/tests/test_checklist.py +++ b/src/aipass/seedgo/tests/test_checklist.py @@ -10,7 +10,6 @@ import pytest from unittest.mock import MagicMock -from pathlib import Path # --------------------------------------------------------------------------- diff --git a/src/aipass/seedgo/tests/test_diagnostics.py b/src/aipass/seedgo/tests/test_diagnostics.py index 5eb8c671..44b05000 100644 --- a/src/aipass/seedgo/tests/test_diagnostics.py +++ b/src/aipass/seedgo/tests/test_diagnostics.py @@ -10,7 +10,6 @@ import pytest from unittest.mock import MagicMock -from pathlib import Path # --------------------------------------------------------------------------- diff --git a/src/aipass/seedgo/tests/test_json.py b/src/aipass/seedgo/tests/test_json.py index 443857db..03c946ed 100644 --- a/src/aipass/seedgo/tests/test_json.py +++ b/src/aipass/seedgo/tests/test_json.py @@ -8,10 +8,8 @@ # Modified: 2026-03-24 # ============================================= -import json import pytest -from unittest.mock import MagicMock, patch -from pathlib import Path +from unittest.mock import MagicMock # --------------------------------------------------------------------------- diff --git a/src/aipass/seedgo/tests/test_proof_query.py b/src/aipass/seedgo/tests/test_proof_query.py index 13386bf2..37c44738 100644 --- a/src/aipass/seedgo/tests/test_proof_query.py +++ b/src/aipass/seedgo/tests/test_proof_query.py @@ -10,7 +10,6 @@ import pytest from unittest.mock import MagicMock -from pathlib import Path # --------------------------------------------------------------------------- diff --git a/src/aipass/seedgo/tests/test_readme.py b/src/aipass/seedgo/tests/test_readme.py index d55a30ba..d742d3e8 100644 --- a/src/aipass/seedgo/tests/test_readme.py +++ b/src/aipass/seedgo/tests/test_readme.py @@ -8,10 +8,8 @@ # Modified: 2026-03-24 # ============================================= -import json import pytest from unittest.mock import MagicMock -from pathlib import Path # --------------------------------------------------------------------------- diff --git a/src/aipass/seedgo/tests/test_readme_update.py b/src/aipass/seedgo/tests/test_readme_update.py index a1eac038..44ea4a9b 100644 --- a/src/aipass/seedgo/tests/test_readme_update.py +++ b/src/aipass/seedgo/tests/test_readme_update.py @@ -10,7 +10,6 @@ import pytest from unittest.mock import MagicMock -from pathlib import Path # --------------------------------------------------------------------------- diff --git a/src/aipass/seedgo/tests/test_standards_audit.py b/src/aipass/seedgo/tests/test_standards_audit.py index 3cc3c757..48b821b0 100644 --- a/src/aipass/seedgo/tests/test_standards_audit.py +++ b/src/aipass/seedgo/tests/test_standards_audit.py @@ -9,7 +9,7 @@ # ============================================= import pytest -from unittest.mock import patch, MagicMock, PropertyMock +from unittest.mock import MagicMock from pathlib import Path @@ -226,7 +226,6 @@ def test_help_text_at_prefix_consistency(): patterns that should use @ prefix but don't. """ import re - from pathlib import Path branch_root = Path(__file__).resolve().parents[1] files_to_check = [ diff --git a/src/aipass/seedgo/tests/test_standards_query.py b/src/aipass/seedgo/tests/test_standards_query.py index e6cda48b..5a876e6b 100644 --- a/src/aipass/seedgo/tests/test_standards_query.py +++ b/src/aipass/seedgo/tests/test_standards_query.py @@ -10,7 +10,6 @@ import pytest from unittest.mock import MagicMock -from pathlib import Path # --------------------------------------------------------------------------- diff --git a/src/aipass/spawn/apps/handlers/delete_ops.py b/src/aipass/spawn/apps/handlers/delete_ops.py index 155bd316..ca6ae252 100644 --- a/src/aipass/spawn/apps/handlers/delete_ops.py +++ b/src/aipass/spawn/apps/handlers/delete_ops.py @@ -14,7 +14,6 @@ directories, removing from registry, and safety checks for protected branches. import shutil from datetime import datetime -from pathlib import Path from aipass.prax.apps.modules.logger import system_logger as logger diff --git a/src/aipass/spawn/apps/handlers/sync_registry_ops.py b/src/aipass/spawn/apps/handlers/sync_registry_ops.py index 71939f3b..5795ecc9 100644 --- a/src/aipass/spawn/apps/handlers/sync_registry_ops.py +++ b/src/aipass/spawn/apps/handlers/sync_registry_ops.py @@ -180,7 +180,7 @@ def sync_registry(fix: bool = False) -> dict: "name": name.upper(), "path": rel_path, "profile": "library", - "description": f"Auto-registered branch", + "description": "Auto-registered branch", "email": f"@{name}", "status": "active", "created": today, diff --git a/src/aipass/spawn/apps/handlers/update_ops.py b/src/aipass/spawn/apps/handlers/update_ops.py index 1978089e..27006532 100644 --- a/src/aipass/spawn/apps/handlers/update_ops.py +++ b/src/aipass/spawn/apps/handlers/update_ops.py @@ -116,7 +116,7 @@ def update_branch(branch_name: str, dry_run: bool = False, trace: bool = False) if first_time: if trace: - logger.info(f"[update] No branch_meta found — generating initial metadata (adoption)") + logger.info("[update] No branch_meta found — generating initial metadata (adoption)") branch_meta = generate_branch_meta(branch_dir, template_registry) if not dry_run: save_branch_meta(branch_dir, branch_meta) diff --git a/src/aipass/spawn/apps/modules/passport.py b/src/aipass/spawn/apps/modules/passport.py index bcfe58a9..9c754ebb 100644 --- a/src/aipass/spawn/apps/modules/passport.py +++ b/src/aipass/spawn/apps/modules/passport.py @@ -158,7 +158,7 @@ def handle_passport(args: list[str]) -> int: json_handler.log_operation("passport_granted", data={"branch": result["branch_name"]}) console.print() console.print(f"[green]Passport granted: {result['branch_name']}[/green]") - console.print(f" Class: birthright") + console.print(" Class: birthright") console.print(f" Path: {result['path']}") console.print(f" Files: {result['files_copied']}") console.print(f" Registry: {'updated' if result['registry_updated'] else 'not updated'}") diff --git a/src/aipass/spawn/apps/spawn.py b/src/aipass/spawn/apps/spawn.py index 896aebae..82baaf3a 100644 --- a/src/aipass/spawn/apps/spawn.py +++ b/src/aipass/spawn/apps/spawn.py @@ -170,10 +170,10 @@ def _dry_run_create(target_path, citizen_class, parsed): dir_count = sum(1 for d in template.rglob("*") if d.is_dir() and "__pycache__" not in str(d)) console.print() - console.print(f" [bold cyan]Would create:[/bold cyan]") + console.print(" [bold cyan]Would create:[/bold cyan]") console.print(f" Files: ~{file_count}") console.print(f" Directories: ~{dir_count}") - console.print(f" Registry: add to AIPASS_REGISTRY.json") + console.print(" Registry: add to AIPASS_REGISTRY.json") console.print() console.print(" [dim]No files were created. Remove --dry-run to execute.[/dim]") console.print() diff --git a/src/aipass/spawn/tests/conftest.py b/src/aipass/spawn/tests/conftest.py index 3607036e..760b2163 100644 --- a/src/aipass/spawn/tests/conftest.py +++ b/src/aipass/spawn/tests/conftest.py @@ -11,7 +11,7 @@ import json import shutil import pytest from pathlib import Path -from unittest.mock import patch, MagicMock +from unittest.mock import patch # --------------------------------------------------------------------------- diff --git a/src/aipass/spawn/tests/test_cli_routing.py b/src/aipass/spawn/tests/test_cli_routing.py index 6f196d6b..a19a76fe 100644 --- a/src/aipass/spawn/tests/test_cli_routing.py +++ b/src/aipass/spawn/tests/test_cli_routing.py @@ -8,10 +8,7 @@ """Tests for spawn CLI routing, help output, and introspection.""" -import sys -import pytest -from unittest.mock import patch, MagicMock -from io import StringIO +from unittest.mock import patch class TestCliRouting: diff --git a/src/aipass/spawn/tests/test_handlers.py b/src/aipass/spawn/tests/test_handlers.py index ee75b52e..a710cd78 100644 --- a/src/aipass/spawn/tests/test_handlers.py +++ b/src/aipass/spawn/tests/test_handlers.py @@ -8,7 +8,6 @@ """Tests for spawn handler modules: meta_ops, reconcile, change_detection, json_ops.""" -import json import pytest from pathlib import Path diff --git a/src/aipass/spawn/tests/test_update.py b/src/aipass/spawn/tests/test_update.py index 1e161475..40577aad 100644 --- a/src/aipass/spawn/tests/test_update.py +++ b/src/aipass/spawn/tests/test_update.py @@ -13,9 +13,7 @@ JSON deep merge, first-time adoption, and self-skip logic. """ import json -import os -from pathlib import Path -from unittest.mock import patch, MagicMock +from unittest.mock import patch import pytest diff --git a/src/aipass/trigger/apps/handlers/__init__.py b/src/aipass/trigger/apps/handlers/__init__.py index 56e8611f..78112610 100644 --- a/src/aipass/trigger/apps/handlers/__init__.py +++ b/src/aipass/trigger/apps/handlers/__init__.py @@ -53,7 +53,7 @@ def _guard_branch_access(): return # Allow command-line Python through return - if f"/trigger/" in caller_file.replace("\\", "/"): + if "/trigger/" in caller_file.replace("\\", "/"): return caller_branch = _extract_branch_name(caller_file) diff --git a/src/aipass/trigger/apps/handlers/error_registry.py b/src/aipass/trigger/apps/handlers/error_registry.py index 4df4b78d..3db126e1 100644 --- a/src/aipass/trigger/apps/handlers/error_registry.py +++ b/src/aipass/trigger/apps/handlers/error_registry.py @@ -40,8 +40,7 @@ import time import uuid from dataclasses import asdict, dataclass, field from datetime import datetime, timedelta -from pathlib import Path -from typing import Any, Dict, List, Optional +from typing import Dict, List, Optional from aipass.prax.apps.modules.logger import get_direct_logger diff --git a/src/aipass/trigger/apps/handlers/events/memory.py b/src/aipass/trigger/apps/handlers/events/memory.py index 3985047b..a2252dbc 100644 --- a/src/aipass/trigger/apps/handlers/events/memory.py +++ b/src/aipass/trigger/apps/handlers/events/memory.py @@ -11,7 +11,6 @@ Placeholder for future memory event handling. """ -from pathlib import Path from aipass.trigger.apps.handlers.json import json_handler diff --git a/src/aipass/trigger/apps/handlers/events/memory_template_updated.py b/src/aipass/trigger/apps/handlers/events/memory_template_updated.py index 84187c65..78026b47 100644 --- a/src/aipass/trigger/apps/handlers/events/memory_template_updated.py +++ b/src/aipass/trigger/apps/handlers/events/memory_template_updated.py @@ -18,7 +18,6 @@ Event data expected: - timestamp: When the update occurred (optional) """ -from pathlib import Path from typing import Any from aipass.trigger.apps.handlers.json import json_handler diff --git a/src/aipass/trigger/apps/handlers/events/memory_threshold_exceeded.py b/src/aipass/trigger/apps/handlers/events/memory_threshold_exceeded.py index b8973271..1e7758b5 100644 --- a/src/aipass/trigger/apps/handlers/events/memory_threshold_exceeded.py +++ b/src/aipass/trigger/apps/handlers/events/memory_threshold_exceeded.py @@ -25,7 +25,6 @@ Event data expected: """ from datetime import datetime, timezone -from pathlib import Path from typing import Any from aipass.trigger.apps.config import TRIGGER_ROOT diff --git a/src/aipass/trigger/apps/handlers/events/registry.py b/src/aipass/trigger/apps/handlers/events/registry.py index a0c4a5db..113eef13 100644 --- a/src/aipass/trigger/apps/handlers/events/registry.py +++ b/src/aipass/trigger/apps/handlers/events/registry.py @@ -8,7 +8,6 @@ """Event Handler Registry - Setup all event handlers on startup""" -from pathlib import Path from datetime import datetime, timezone diff --git a/src/aipass/trigger/apps/handlers/events/warning_logged.py b/src/aipass/trigger/apps/handlers/events/warning_logged.py index 026ab0fd..5548a450 100644 --- a/src/aipass/trigger/apps/handlers/events/warning_logged.py +++ b/src/aipass/trigger/apps/handlers/events/warning_logged.py @@ -23,7 +23,6 @@ Event data expected: - level: Log level (always 'warning' for this handler) """ -from pathlib import Path from typing import Any from aipass.trigger.apps.handlers.json import json_handler diff --git a/src/aipass/trigger/apps/handlers/json/json_handler.py b/src/aipass/trigger/apps/handlers/json/json_handler.py index 70a837b2..5b7db677 100644 --- a/src/aipass/trigger/apps/handlers/json/json_handler.py +++ b/src/aipass/trigger/apps/handlers/json/json_handler.py @@ -10,7 +10,7 @@ import json import os from pathlib import Path from datetime import datetime, timezone -from typing import Dict, List, Any, Optional +from typing import Dict, Any, Optional import inspect from aipass.trigger.apps.config import atomic_write_json diff --git a/src/aipass/trigger/apps/modules/branch_log_events.py b/src/aipass/trigger/apps/modules/branch_log_events.py index b029330b..9c7cf134 100644 --- a/src/aipass/trigger/apps/modules/branch_log_events.py +++ b/src/aipass/trigger/apps/modules/branch_log_events.py @@ -28,7 +28,6 @@ from aipass.trigger.apps.handlers.log_watcher import ( set_event_callback, start_branch_log_watcher, stop_branch_log_watcher, - is_branch_log_watcher_active, get_watcher_status, clear_seen_hashes ) @@ -211,7 +210,6 @@ def handle_command(command: str, args: list) -> bool: if __name__ == "__main__": import argparse - from aipass.cli.apps.modules import console if len(sys.argv) == 1 or sys.argv[1] in ['--help', '-h', 'help']: print_help() diff --git a/src/aipass/trigger/apps/modules/errors.py b/src/aipass/trigger/apps/modules/errors.py index 42b04727..dd17e450 100644 --- a/src/aipass/trigger/apps/modules/errors.py +++ b/src/aipass/trigger/apps/modules/errors.py @@ -22,7 +22,6 @@ Architecture: Module orchestrates, error_registry handler manages data import json import sys import time -from pathlib import Path from typing import Optional @@ -33,7 +32,7 @@ from aipass.trigger.apps.handlers.error_registry import ( get_circuit_breaker_status, circuit_breaker_reset, update_source_fix_status, ) -from aipass.trigger.apps.handlers.error_reporter import ( +from aipass.trigger.apps.handlers.error_reporter import ( # noqa: F401 report_error, send_source_fix_email as _send_source_fix_email, ) @@ -245,6 +244,7 @@ def _cmd_detail(console, args: list) -> bool: try: entry = _find_by_id_or_fp(args[0]) except (json.JSONDecodeError, TypeError, KeyError) as exc: + logger.warning("Failed to read error registry for '%s': %s", args[0], exc) error(f"Failed to read error registry: {exc}", suggestion="Registry may be corrupted — try 'drone @trigger errors list' first") return True @@ -308,7 +308,7 @@ def _cmd_suppress(console, args: list) -> bool: console.print(f" [cyan]Source fix email sent to @{updated_entry.get('component', '?').lower()}[/cyan]") else: update_source_fix_status(fp, "pending_fix") - console.print(f" [dim]Source fix email could not be sent (status: pending_fix)[/dim]") + console.print(" [dim]Source fix email could not be sent (status: pending_fix)[/dim]") else: console.print(f"[red]Failed to suppress error[/red] {args[0]}") return True @@ -421,7 +421,6 @@ def _cmd_circuit_breaker(console, args: list) -> bool: if __name__ == "__main__": - from aipass.cli.apps.modules import console if len(sys.argv) == 1 or sys.argv[1] in ['--help', '-h', 'help']: print_help() diff --git a/src/aipass/trigger/apps/modules/log_events.py b/src/aipass/trigger/apps/modules/log_events.py index 45f03ee2..481aa559 100644 --- a/src/aipass/trigger/apps/modules/log_events.py +++ b/src/aipass/trigger/apps/modules/log_events.py @@ -176,7 +176,6 @@ def handle_command(command: str, args: list) -> bool: if __name__ == "__main__": import argparse - from aipass.cli.apps.modules import console if len(sys.argv) == 1 or sys.argv[1] in ['--help', '-h', 'help']: print_help() diff --git a/src/aipass/trigger/apps/modules/medic.py b/src/aipass/trigger/apps/modules/medic.py index 136fa018..df81af2b 100644 --- a/src/aipass/trigger/apps/modules/medic.py +++ b/src/aipass/trigger/apps/modules/medic.py @@ -340,7 +340,6 @@ def handle_command(command: str, args: list) -> bool: if __name__ == "__main__": - from aipass.cli.apps.modules import console if len(sys.argv) == 1 or sys.argv[1] in ['--help', '-h', 'help']: print_help() diff --git a/src/aipass/trigger/tests/test_errors.py b/src/aipass/trigger/tests/test_errors.py index 44b74ac4..fd911318 100644 --- a/src/aipass/trigger/tests/test_errors.py +++ b/src/aipass/trigger/tests/test_errors.py @@ -16,7 +16,7 @@ error_reporter, cli display) is mocked via sys.modules before import. import sys from typing import Any -from unittest.mock import MagicMock, call +from unittest.mock import MagicMock import pytest