<!-- CURSOR_SUMMARY --> > [!NOTE] > **Medium Risk** > Touches authentication/login flow, credentials-file permissions, and subprocess lifecycle behavior across platforms; while mostly defensive, regressions could impact login or process management on Windows/macOS runners. > > **Overview** > Improves Windows/cross-platform reliability across the CLI and MCP server: OAuth login now binds the callback server to `127.0.0.1`, avoids slow loopback reverse-DNS, adds a configurable callback timeout (`--timeout` + env default), and opens URLs via a Windows-friendly `_open_browser` to avoid flashing console windows. > > Centralizes CLI output via a shared `console` that forces UTF-8 on Windows, standardizes UTF-8 file reads/writes throughout, tightens credentials-file permissions on Windows using `icacls`, and adds shared Windows subprocess helpers for **no-window** process creation and graceful termination (used by `deploy`, MCP reload, and usage-tracking worker). > > Updates client configuration UX/robustness (Windows AppData resolution via `platformdirs`, Cursor config path fallbacks + compatibility writes, overwrite warnings, absolute `uv` path for GUI clients, safer path display) and improves `deploy` child-process handling to avoid pipe-buffer deadlocks while giving better debug-aware error messages. > > Expands CI to run tests on Linux/Windows/macOS, adds a no-auth CLI integration workflow, disables usage tracking in toolkits CI, and adds extensive regression tests for Windows signals, subprocess cleanup, UTF-8, and config-path edge cases; bumps `arcade-core` to `4.4.2` and `arcade-mcp-server` to `1.17.2` (with updated dependency pin). > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit 0fabd8ca1cd647039ba6ddbdf3f7809c330bab9e. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY -->
62 lines
2.2 KiB
Python
62 lines
2.2 KiB
Python
from io import StringIO
|
|
from pathlib import Path
|
|
|
|
import pytest
|
|
from arcade_cli.new import create_new_toolkit_minimal
|
|
from rich.console import Console
|
|
|
|
|
|
def test_create_new_toolkit_minimal_with_spaces(tmp_path: Path) -> None:
|
|
output_dir = tmp_path / "dir with spaces"
|
|
output_dir.mkdir()
|
|
|
|
create_new_toolkit_minimal(str(output_dir), "my_server")
|
|
|
|
server_root = output_dir / "my_server"
|
|
assert (server_root / "pyproject.toml").is_file()
|
|
assert (server_root / "src" / "my_server" / "server.py").is_file()
|
|
assert (server_root / "src" / "my_server" / ".env.example").is_file()
|
|
|
|
|
|
def test_create_new_toolkit_minimal_prints_next_steps(tmp_path: Path) -> None:
|
|
"""After scaffolding, the CLI should print 'Next steps' guidance."""
|
|
output_dir = tmp_path / "scaffold_test"
|
|
output_dir.mkdir()
|
|
|
|
# Capture console output by replacing the module-level console.
|
|
buf = StringIO()
|
|
test_console = Console(file=buf, force_terminal=False)
|
|
|
|
import arcade_cli.new as new_mod
|
|
|
|
orig = new_mod.console
|
|
new_mod.console = test_console
|
|
try:
|
|
create_new_toolkit_minimal(str(output_dir), "demo_srv")
|
|
finally:
|
|
new_mod.console = orig
|
|
|
|
output = buf.getvalue()
|
|
assert "Next steps:" in output, f"Expected 'Next steps:' in output:\n{output}"
|
|
assert "uv run server.py" in output, f"Expected 'uv run server.py' in output:\n{output}"
|
|
assert "demo_srv" in output, f"Expected toolkit name in output:\n{output}"
|
|
|
|
|
|
def test_create_new_toolkit_minimal_rejects_duplicate(tmp_path: Path) -> None:
|
|
"""Creating a toolkit with a name that already exists should raise."""
|
|
output_dir = tmp_path / "dup_test"
|
|
output_dir.mkdir()
|
|
|
|
create_new_toolkit_minimal(str(output_dir), "my_srv")
|
|
|
|
with pytest.raises(FileExistsError, match="already exists"):
|
|
create_new_toolkit_minimal(str(output_dir), "my_srv")
|
|
|
|
|
|
def test_create_new_toolkit_minimal_rejects_invalid_name(tmp_path: Path) -> None:
|
|
"""Toolkit names with invalid characters should raise ValueError."""
|
|
output_dir = tmp_path / "invalid_test"
|
|
output_dir.mkdir()
|
|
|
|
with pytest.raises(ValueError, match="illegal characters"):
|
|
create_new_toolkit_minimal(str(output_dir), "My-Server!")
|