feat(system): audit cleanup: spawn (#168)

* 📝 docs(STATUS): update last sync timestamp

- update last sync timestamp to reflect recent status synchronization

* feat(trigger): audit cleanup — fix timestamp parsing, CLI formatting, bypass entries

- Fix log_watcher timestamp parsing: log warning once after all formats fail,
  not on each format attempt (was generating hundreds of warnings per scan)
- Standardize rich formatting in branch_log_events and log_events print_help()
  to match medic.py/errors.py Panel+rule style
- Add bypass entries for intentional silent catches (timestamp loop, error display)
- Remove unused Path imports

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* feat(memory): audit cleanup — handler tests + rollover timeout handling

- Add 32 handler-layer tests (extractor, line_counter, normalize) in test_handlers.py
- Add rollover run timeout message + try/except for graceful error handling
- Fix commons welcome_ops.py missing _get_unwelcomed_branches function

264 tests pass, 100% seedgo compliance.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* feat(system): audit cleanup: spawn

Co-Authored-By: @devpulse <devpulse@aipass>

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-authored-by: @devpulse <devpulse@aipass>
This commit is contained in:
AIPass
2026-04-01 00:59:34 -07:00
committed by GitHub
co-authored by Claude Opus 4.6 @devpulse
parent 21583669df
commit 6e705eeb8e
20 changed files with 845 additions and 240 deletions
+2 -4
View File
@@ -19,11 +19,9 @@ Functions:
get_validation_rules() - Get provider-specific validation rules
"""
# Infrastructure
from pathlib import Path
import sys
# Standard library
import sys
from pathlib import Path
from typing import Optional, Dict, Any
# Logging
@@ -21,10 +21,9 @@ Usage:
json_folder = caller_info['json_folder']
"""
from pathlib import Path
# Standard library imports
import inspect
from pathlib import Path
from typing import Dict, Any, Optional, Tuple
# Logging
@@ -9,20 +9,15 @@
"""
Caller Auto-Provisioning Handler
Internal-only handler — not wired as a CLI command.
Called automatically by client.get_response() via ensure_caller_config().
Business logic for provisioning OpenRouter API configs:
- Auto-create caller API configurations
- Provision JSON folder structure
- Set default model/temperature/max_tokens
- Initialize caller-specific tracking files
- Ensure caller has complete 3-file JSON structure
COMPLIANT STANDARDS:
- Uses prax logger for output (NO print() or console.print())
- Uses prax logger for operations
- Standalone functions (no class dependencies)
- Imports from caller handler for detection logic
- Complete docstrings with Args/Returns
- Under 300 lines
"""
from pathlib import Path
@@ -27,6 +27,9 @@ from aipass.prax import logger
# JSON handler
from aipass.api.apps.handlers.json import json_handler
# Default retention period
DEFAULT_RETENTION_DAYS = 30
def _read_json(file_path: Path) -> Optional[Dict]:
"""Read JSON file with error handling."""
@@ -52,7 +55,7 @@ def _write_json(file_path: Path, data: Dict) -> bool:
return False
def cleanup_old_data(data_file_path: Path, retention_days: int = 30) -> int:
def cleanup_old_data(data_file_path: Path, retention_days: int = DEFAULT_RETENTION_DAYS) -> int:
"""
Remove usage data older than retention period.
+3 -2
View File
@@ -24,6 +24,7 @@ from aipass.prax.apps.modules.logger import system_logger as logger
from aipass.cli.apps.modules import console, header, success, error, warning
from aipass.api.apps.handlers.json import json_handler
from aipass.api.apps.handlers.usage import tracking, aggregation, cleanup
from aipass.api.apps.handlers.usage.cleanup import DEFAULT_RETENTION_DAYS
def print_introspection():
@@ -114,7 +115,7 @@ EXAMPLES:
# cleanup command
cleanup_parser = subparsers.add_parser("cleanup", help="Clean up old usage data")
cleanup_parser.add_argument("days", nargs="?", default="30", help="Days to retain (default: 30)")
cleanup_parser.add_argument("days", nargs="?", default=str(DEFAULT_RETENTION_DAYS), help=f"Days to retain (default: {DEFAULT_RETENTION_DAYS})")
console.print(parser.format_help())
@@ -249,7 +250,7 @@ def show_caller_usage(args: List[str]):
def cleanup_data(args: List[str]):
"""Orchestrate cleanup workflow"""
days = int(args[0]) if args else 30
days = int(args[0]) if args else DEFAULT_RETENTION_DAYS
header(f"Cleanup Old Data (retain {days} days)")
console.print()