WP-0001: feedback channels, CI, pre-commit, telemetry docs
Add kaizen-agentic feedback CLI, Gitea issue templates, CI workflow, pre-commit hooks, FEEDBACK/TELEMETRY docs, and cross-platform path tests. Improve CLI registry error messages; remove agents_backup scaffolding. Apply black formatting across src/tests for CI consistency. State Hub message sent to agentic-resources for Helix correlation doc link.
This commit is contained in:
@@ -20,9 +20,12 @@ class TestClickWorkaround:
|
||||
def test_install_command_error_suppression(self):
|
||||
"""Test that spurious 'unexpected extra argument' errors are suppressed for install commands."""
|
||||
# Test the install command that previously showed spurious errors
|
||||
with patch('sys.argv', ['kaizen-agentic', 'install', 'tdd-workflow', '--target', '/tmp/test']):
|
||||
with patch('sys.stdout', new_callable=StringIO) as mock_stdout:
|
||||
with patch('sys.stderr', new_callable=StringIO) as mock_stderr:
|
||||
with patch(
|
||||
"sys.argv",
|
||||
["kaizen-agentic", "install", "tdd-workflow", "--target", "/tmp/test"],
|
||||
):
|
||||
with patch("sys.stdout", new_callable=StringIO) as mock_stdout:
|
||||
with patch("sys.stderr", new_callable=StringIO) as mock_stderr:
|
||||
try:
|
||||
safe_cli_wrapper()
|
||||
except SystemExit:
|
||||
@@ -40,9 +43,9 @@ class TestClickWorkaround:
|
||||
def test_update_command_error_suppression(self):
|
||||
"""Test that spurious 'unexpected extra argument' errors are suppressed for update commands."""
|
||||
# Test the update command that also shows spurious errors
|
||||
with patch('sys.argv', ['kaizen-agentic', 'update']):
|
||||
with patch('sys.stdout', new_callable=StringIO) as mock_stdout:
|
||||
with patch('sys.stderr', new_callable=StringIO) as mock_stderr:
|
||||
with patch("sys.argv", ["kaizen-agentic", "update"]):
|
||||
with patch("sys.stdout", new_callable=StringIO) as mock_stdout:
|
||||
with patch("sys.stderr", new_callable=StringIO) as mock_stderr:
|
||||
try:
|
||||
safe_cli_wrapper()
|
||||
except SystemExit:
|
||||
@@ -59,9 +62,9 @@ class TestClickWorkaround:
|
||||
|
||||
def test_non_install_command_normal_operation(self):
|
||||
"""Test that non-install commands work normally without interference."""
|
||||
with patch('sys.argv', ['kaizen-agentic', 'list']):
|
||||
with patch('sys.stdout', new_callable=StringIO) as mock_stdout:
|
||||
with patch('sys.stderr', new_callable=StringIO) as mock_stderr:
|
||||
with patch("sys.argv", ["kaizen-agentic", "list"]):
|
||||
with patch("sys.stdout", new_callable=StringIO) as mock_stdout:
|
||||
with patch("sys.stderr", new_callable=StringIO) as mock_stderr:
|
||||
try:
|
||||
safe_cli_wrapper()
|
||||
except SystemExit:
|
||||
@@ -76,9 +79,9 @@ class TestClickWorkaround:
|
||||
|
||||
def test_legitimate_error_preservation(self):
|
||||
"""Test that legitimate errors are still displayed for non-install commands."""
|
||||
with patch('sys.argv', ['kaizen-agentic', 'invalid-command']):
|
||||
with patch('sys.stdout', new_callable=StringIO) as mock_stdout:
|
||||
with patch('sys.stderr', new_callable=StringIO) as mock_stderr:
|
||||
with patch("sys.argv", ["kaizen-agentic", "invalid-command"]):
|
||||
with patch("sys.stdout", new_callable=StringIO) as mock_stdout:
|
||||
with patch("sys.stderr", new_callable=StringIO) as mock_stderr:
|
||||
try:
|
||||
safe_cli_wrapper()
|
||||
except SystemExit as e:
|
||||
@@ -95,8 +98,8 @@ class TestClickWorkaround:
|
||||
|
||||
def test_help_commands_work_normally(self):
|
||||
"""Test that help commands work without interference."""
|
||||
with patch('sys.argv', ['kaizen-agentic', '--help']):
|
||||
with patch('sys.stdout', new_callable=StringIO) as mock_stdout:
|
||||
with patch("sys.argv", ["kaizen-agentic", "--help"]):
|
||||
with patch("sys.stdout", new_callable=StringIO) as mock_stdout:
|
||||
try:
|
||||
safe_cli_wrapper()
|
||||
except SystemExit as e:
|
||||
@@ -104,7 +107,9 @@ class TestClickWorkaround:
|
||||
assert e.code == 0
|
||||
|
||||
stdout_content = mock_stdout.getvalue()
|
||||
assert "Kaizen Agentic - AI agent development framework" in stdout_content
|
||||
assert (
|
||||
"Kaizen Agentic - AI agent development framework" in stdout_content
|
||||
)
|
||||
assert "Commands:" in stdout_content
|
||||
|
||||
|
||||
@@ -113,9 +118,9 @@ class TestInstallCommandSpecifics:
|
||||
|
||||
def test_install_with_valid_agent(self):
|
||||
"""Test install command with a valid agent name."""
|
||||
with patch('sys.argv', ['kaizen-agentic', 'install', 'tdd-workflow']):
|
||||
with patch('sys.stdout', new_callable=StringIO) as mock_stdout:
|
||||
with patch('sys.stderr', new_callable=StringIO) as mock_stderr:
|
||||
with patch("sys.argv", ["kaizen-agentic", "install", "tdd-workflow"]):
|
||||
with patch("sys.stdout", new_callable=StringIO) as mock_stdout:
|
||||
with patch("sys.stderr", new_callable=StringIO) as mock_stderr:
|
||||
try:
|
||||
safe_cli_wrapper()
|
||||
except SystemExit:
|
||||
@@ -127,12 +132,17 @@ class TestInstallCommandSpecifics:
|
||||
# Should show clean installation output
|
||||
assert "Installing agents to:" in stdout_content
|
||||
# Should not show Click error
|
||||
assert "Got unexpected extra argument" not in (stdout_content + stderr_content)
|
||||
assert "Got unexpected extra argument" not in (
|
||||
stdout_content + stderr_content
|
||||
)
|
||||
|
||||
def test_install_with_target_option(self):
|
||||
"""Test install command with target directory option."""
|
||||
with patch('sys.argv', ['kaizen-agentic', 'install', 'tdd-workflow', '--target', '/tmp/test']):
|
||||
with patch('sys.stdout', new_callable=StringIO) as mock_stdout:
|
||||
with patch(
|
||||
"sys.argv",
|
||||
["kaizen-agentic", "install", "tdd-workflow", "--target", "/tmp/test"],
|
||||
):
|
||||
with patch("sys.stdout", new_callable=StringIO) as mock_stdout:
|
||||
try:
|
||||
safe_cli_wrapper()
|
||||
except SystemExit:
|
||||
@@ -144,8 +154,8 @@ class TestInstallCommandSpecifics:
|
||||
|
||||
def test_install_help_works(self):
|
||||
"""Test that install command help works correctly."""
|
||||
with patch('sys.argv', ['kaizen-agentic', 'install', '--help']):
|
||||
with patch('sys.stdout', new_callable=StringIO) as mock_stdout:
|
||||
with patch("sys.argv", ["kaizen-agentic", "install", "--help"]):
|
||||
with patch("sys.stdout", new_callable=StringIO) as mock_stdout:
|
||||
try:
|
||||
safe_cli_wrapper()
|
||||
except SystemExit as e:
|
||||
@@ -170,12 +180,14 @@ class TestWorkaroundRemovalReadiness:
|
||||
may be ready for removal.
|
||||
"""
|
||||
# Skip this test in normal runs since it's expected to show the spurious error
|
||||
pytest.skip("This test demonstrates the underlying Click issue. "
|
||||
"Enable when testing Click library updates.")
|
||||
pytest.skip(
|
||||
"This test demonstrates the underlying Click issue. "
|
||||
"Enable when testing Click library updates."
|
||||
)
|
||||
|
||||
with patch('sys.argv', ['kaizen-agentic', 'install', 'tdd-workflow']):
|
||||
with patch('sys.stdout', new_callable=StringIO) as mock_stdout:
|
||||
with patch('sys.stderr', new_callable=StringIO) as mock_stderr:
|
||||
with patch("sys.argv", ["kaizen-agentic", "install", "tdd-workflow"]):
|
||||
with patch("sys.stdout", new_callable=StringIO) as mock_stdout:
|
||||
with patch("sys.stderr", new_callable=StringIO) as mock_stderr:
|
||||
try:
|
||||
cli(standalone_mode=False)
|
||||
except SystemExit:
|
||||
@@ -201,9 +213,13 @@ class TestWorkaroundRemovalReadiness:
|
||||
"""
|
||||
# Test that the CLI works when invoked as a subprocess
|
||||
result = subprocess.run(
|
||||
['python', '-c', 'from kaizen_agentic.cli import safe_cli_wrapper; import sys; sys.argv = ["kaizen-agentic", "list"]; safe_cli_wrapper()'],
|
||||
[
|
||||
"python",
|
||||
"-c",
|
||||
'from kaizen_agentic.cli import safe_cli_wrapper; import sys; sys.argv = ["kaizen-agentic", "list"]; safe_cli_wrapper()',
|
||||
],
|
||||
capture_output=True,
|
||||
text=True
|
||||
text=True,
|
||||
)
|
||||
|
||||
assert "Available Agents" in result.stdout
|
||||
@@ -220,7 +236,7 @@ class TestErrorMessagePatterns:
|
||||
spurious_patterns = [
|
||||
"Got unexpected extra argument (tdd-workflow)",
|
||||
"Got unexpected extra argument (some-agent)",
|
||||
"Error: Got unexpected extra argument"
|
||||
"Error: Got unexpected extra argument",
|
||||
]
|
||||
|
||||
for pattern in spurious_patterns:
|
||||
@@ -234,7 +250,7 @@ class TestErrorMessagePatterns:
|
||||
"Error: No such file or directory",
|
||||
"Error: Permission denied",
|
||||
"Error: Invalid agent name",
|
||||
"Error: Configuration file not found"
|
||||
"Error: Configuration file not found",
|
||||
]
|
||||
|
||||
for pattern in legitimate_patterns:
|
||||
@@ -243,4 +259,4 @@ class TestErrorMessagePatterns:
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
pytest.main([__file__])
|
||||
pytest.main([__file__])
|
||||
|
||||
Reference in New Issue
Block a user