feat(system): S65 night shift — fix 14 branches from fresh-eyes CLI testing (#147)
* docs: update HERALD.md — S63-S64, standards 32, fresh-eyes CLI results Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * feat(system): S65 night shift — fix 14 branches from fresh-eyes CLI testing (FPLAN-0154) 14 branches dispatched across 3 phases, all fixes verified. Phase 1 (critical): backup dry-run flag check, ai_mail per-ID branch detection, flow introspection gate removal, drone atomic writes + empty file guard, commons 3-strategy caller detection. Phase 2 (patterns): spawn argparse --help + create --dry-run, skills create --help, api introspection routing fix (6 commands), trigger empty JSON guard, seedgo @ prefix consistency + conftest. Phase 3 (polish): prax ghost module archived + real status output, daemon update digest + 13 error cascade fixes + branch-health all-branches, memory search timeout message + hidden modules in help, cli drone_adapter archived + standalone verified. 3,410 tests (+80), seedgo 99% avg, 0 failures. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.6
parent
a9b30e9e51
commit
26bb4a3157
@@ -1,26 +1,23 @@
|
||||
# =================== AIPass ====================
|
||||
# Name: tests/test_integration.py
|
||||
# Description: Integration tests for CLI main() flow and drone_adapter
|
||||
# Version: 1.0.0
|
||||
# Description: Integration tests for CLI main() flow
|
||||
# Version: 2.0.0
|
||||
# Created: 2026-03-29
|
||||
# Modified: 2026-03-29
|
||||
# Modified: 2026-03-30
|
||||
# =============================================
|
||||
|
||||
"""Integration tests for CLI main() entry point and drone_adapter bridge."""
|
||||
"""Integration tests for CLI main() entry point."""
|
||||
|
||||
import subprocess
|
||||
import sys
|
||||
from io import StringIO
|
||||
from unittest.mock import patch
|
||||
|
||||
import pytest
|
||||
from rich.console import Console
|
||||
|
||||
from aipass.cli.apps import cli as cli_module
|
||||
from aipass.cli.apps.cli import main
|
||||
from aipass.cli.apps.modules import display
|
||||
from aipass.cli import drone_adapter
|
||||
from aipass.cli.drone_adapter import handle_command, get_help, get_introspective
|
||||
|
||||
|
||||
# =============================================================================
|
||||
@@ -122,61 +119,6 @@ class TestMainFlow:
|
||||
assert result == 0
|
||||
|
||||
|
||||
# =============================================================================
|
||||
# drone_adapter tests
|
||||
# =============================================================================
|
||||
|
||||
class TestDroneAdapter:
|
||||
"""Integration tests for the drone_adapter bridge."""
|
||||
|
||||
def test_handle_command_returns_dict(self):
|
||||
"""handle_command returns a dict with stdout, stderr, exit_code keys."""
|
||||
result = handle_command("--help")
|
||||
assert isinstance(result, dict)
|
||||
assert "stdout" in result
|
||||
assert "stderr" in result
|
||||
assert "exit_code" in result
|
||||
|
||||
def test_handle_command_help_exit_code_zero(self):
|
||||
"""--help returns exit_code 0."""
|
||||
result = handle_command("--help")
|
||||
assert result["exit_code"] == 0
|
||||
|
||||
def test_handle_command_unknown_returns_one(self):
|
||||
"""Unknown command returns exit_code 1."""
|
||||
result = handle_command("nonexistent_cmd_xyz")
|
||||
assert result["exit_code"] == 1
|
||||
|
||||
def test_handle_command_restores_argv(self):
|
||||
"""sys.argv is restored after handle_command call."""
|
||||
original_argv = sys.argv.copy()
|
||||
handle_command("--version")
|
||||
assert sys.argv == original_argv
|
||||
|
||||
def test_get_help_returns_string(self):
|
||||
"""get_help returns a non-empty string."""
|
||||
result = get_help()
|
||||
assert isinstance(result, str)
|
||||
assert len(result) > 0
|
||||
|
||||
def test_get_introspective_returns_string(self):
|
||||
"""get_introspective returns a non-empty string with 'CLI' in it."""
|
||||
result = get_introspective()
|
||||
assert isinstance(result, str)
|
||||
assert len(result) > 0
|
||||
assert "CLI" in result
|
||||
|
||||
def test_handle_command_captures_stdout(self):
|
||||
"""stdout contains expected output for --version."""
|
||||
result = handle_command("--version")
|
||||
assert result["exit_code"] == 0
|
||||
# The version output goes through Rich console which writes to real stdout,
|
||||
# but drone_adapter captures sys.stdout. Verify we get something back.
|
||||
# Note: Rich Console writes to its own file= target, so stdout capture
|
||||
# may be empty. The key contract is exit_code and dict shape.
|
||||
assert isinstance(result["stdout"], str)
|
||||
|
||||
|
||||
# =============================================================================
|
||||
# __main__.py test — verify module is runnable
|
||||
# =============================================================================
|
||||
|
||||
Reference in New Issue
Block a user