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 (#333)

* 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 <devpulse@aipass>

* 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 <devpulse@aipass>

---------

Co-authored-by: @devpulse <devpulse@aipass>
This commit is contained in:
AIPass
2026-04-16 12:58:53 -07:00
committed by GitHub
co-authored by @devpulse
parent bf1f37bf41
commit e2c868084a
180 changed files with 105 additions and 282 deletions
+1
View File
@@ -32,6 +32,7 @@ jobs:
- name: Verify drone CLI
shell: bash
run: |
source .venv/Scripts/activate
export PYTHONUTF8=1
drone --version
drone systems
+8 -1
View File
@@ -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
+1 -1
View File
@@ -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
@@ -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
@@ -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
@@ -6,7 +6,6 @@
# Modified: 2026-02-04
# =============================================
from pathlib import Path
from aipass.ai_mail.apps.handlers.json import json_handler
@@ -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
+3 -3
View File
@@ -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)
@@ -19,7 +19,6 @@ from aipass.ai_mail.apps.ai_mail import (
print_introspection,
route_command,
main,
discover_modules,
)
@@ -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
-1
View File
@@ -10,7 +10,6 @@
import json
import pytest
from pathlib import Path
from datetime import datetime, date, timedelta
from unittest.mock import patch
@@ -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
@@ -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 (
@@ -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
@@ -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 (
+1 -1
View File
@@ -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
@@ -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
-2
View File
@@ -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,
@@ -20,7 +20,6 @@ Functions:
"""
# Standard library
import sys
from pathlib import Path
from typing import Optional, Dict, Any
@@ -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
@@ -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()
+1 -2
View File
@@ -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
-1
View File
@@ -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
+1 -6
View File
@@ -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
+1 -2
View File
@@ -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
@@ -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
# =============================================
+1 -1
View File
@@ -21,7 +21,7 @@ Tests:
- is_ssl_error() delegation
"""
from unittest.mock import patch, MagicMock, call
from unittest.mock import patch, MagicMock
import pytest
@@ -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
-1
View File
@@ -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,
+1 -2
View File
@@ -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
+1 -2
View File
@@ -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
+1 -1
View File
@@ -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()
+4 -4
View File
@@ -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 <name>[/yellow]")
console.print(f" [green]2.[/green] Start a session: [dim]cd src/<name>/ && 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 <name>[/yellow]")
console.print(" [green]2.[/green] Start a session: [dim]cd src/<name>/ && claude[/dim]")
console.print(" [green]3.[/green] Read the docs: [dim]cat README.md[/dim]")
console.print()
return True
-1
View File
@@ -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
-1
View File
@@ -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
# =============================================================================
+1 -2
View File
@@ -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
+1 -2
View File
@@ -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
@@ -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)
@@ -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,
@@ -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
@@ -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
@@ -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
@@ -13,7 +13,6 @@ import os
import subprocess
import sys
import time
from pathlib import Path
from unittest.mock import patch
import pytest
@@ -11,7 +11,6 @@
import json
import sys
import time
from pathlib import Path
from unittest.mock import patch
import pytest
+1 -1
View File
@@ -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,
@@ -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
@@ -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,
+1 -1
View File
@@ -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
@@ -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
@@ -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,
+1 -1
View File
@@ -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
@@ -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
@@ -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']}"
@@ -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
@@ -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
+1 -1
View File
@@ -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
@@ -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 ───────────────────────────────────────
+1 -2
View File
@@ -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 ───────────────────────────────────────
-2
View File
@@ -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 ─────────────────────────────────────────────
+1 -2
View File
@@ -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 ───────────────────────────────────────
+1 -2
View File
@@ -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
# ---------------------------------------------------------------------------
+1 -2
View File
@@ -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 ───────────────────────────────────────
-2
View File
@@ -1,8 +1,6 @@
"""Tests for plan display handler -- formatting and display functions."""
from unittest.mock import MagicMock, patch
import pytest
# ─── Helpers ─────────────────────────────────────────────
+1 -1
View File
@@ -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)
@@ -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 ───────────────────────────────────────
@@ -11,7 +11,6 @@ from datetime import datetime, timezone
from pathlib import Path
from unittest.mock import MagicMock, patch
import pytest
# ---------------------------------------------------------------------------
# Module imports
+1 -2
View File
@@ -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 ─────────────────────────────────────────────
@@ -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)
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -21,7 +21,6 @@ Independence:
"""
import json
import logging
from pathlib import Path
from typing import List, Dict, Any
from dataclasses import dataclass
@@ -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}")
@@ -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)
@@ -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
@@ -28,7 +28,6 @@ Dependencies (optional):
- torch
"""
import logging
from typing import List, Dict, Any
from pathlib import Path
@@ -27,7 +27,6 @@ Dependencies (optional):
- chromadb
"""
import logging
from typing import List, Dict, Any
from pathlib import Path
from datetime import datetime
@@ -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
@@ -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
@@ -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
+1 -3
View File
@@ -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]
@@ -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
# =============================================================================
+1 -1
View File
@@ -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)})"
-1
View File
@@ -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
# ---------------------------------------------------------------------------
@@ -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
# ---------------------------------------------------------------------------
@@ -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
# ---------------------------------------------------------------------------
+1 -3
View File
@@ -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
# ---------------------------------------------------------------------------
+2 -5
View File
@@ -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]
+1 -3
View File
@@ -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
@@ -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
-1
View File
@@ -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
-1
View File
@@ -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)
-1
View File
@@ -18,7 +18,6 @@ import sys
from pathlib import Path
from unittest.mock import MagicMock
import pytest
# ---------------------------------------------------------------------------
@@ -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
@@ -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
@@ -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 (
@@ -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
@@ -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

Some files were not shown because too many files have changed in this diff Show More