Files
zeekay 1b367e2b62 chore: rebase the tree onto upstream master
The tree was a debranded snapshot of upstream taken around 2026-02-20, and
upstream has moved about five months since. This replaces it with upstream
master, mechanically re-derived: bin/debrand does the rename, and the
pipeline and squashed migrations are restored from the shipped tree.

Not a merge. The previous import replaced the tree wholesale in a single
commit, so there is no shared content history to merge against. Reproducing
the rename on the new tree is what actually converges.

What survives: .hanzo/workflows, the Dockerfiles and bin/docker* entrypoints,
compose files, LLM.md, and insights/migrations. The squashed initial
migration is load-bearing — the live database records it by name, so
upstream's ~918 individual migrations cannot come back.

Nine products are dropped as unreferenced. Twenty-one more that we do not run
are kept anyway because the core app still imports them; unpicking those is a
refactor and does not belong in a rebase.

This base does not build yet, and the reasons are not in the rename:
upstream now wants Python 3.13.13 against our 3.12.12 and Django 5.2 against
our 4.2, and the dependency manifests still name upstream packages that we
republish under our own names. Those are decisions, not renames.
2026-08-01 15:44:40 -07:00

107 lines
3.2 KiB
Python

from __future__ import annotations
from typing import Any
import pytest
from click.testing import CliRunner
from insightscli.cli import cli
runner = CliRunner()
def test_wait_command_registered() -> None:
result = runner.invoke(cli, ["wait", "--help"])
assert result.exit_code == 0
assert "Block until the detached dev stack is ready" in result.output
def test_stop_command_registered() -> None:
result = runner.invoke(cli, ["stop", "--help"])
assert result.exit_code == 0
assert "Stop the detached dev stack processes" in result.output
def test_up_command_registered_as_start_alias() -> None:
result = runner.invoke(cli, ["up", "--help"])
assert result.exit_code == 0
assert "Alias for `insightscli start`" in result.output
def test_down_command_registered_as_stop_alias() -> None:
result = runner.invoke(cli, ["down", "--help"])
assert result.exit_code == 0
assert "Alias for `insightscli stop`" in result.output
def test_up_forwards_detached_flag_to_start_script(monkeypatch: pytest.MonkeyPatch) -> None:
captured: dict[str, Any] = {}
def fake_run(command, **kwargs) -> None:
captured["command"] = command
captured["kwargs"] = kwargs
monkeypatch.setattr("insightscli.command_types._run", fake_run)
result = runner.invoke(cli, ["up", "-d"])
assert result.exit_code == 0
command = captured["command"]
assert command[0].endswith("/bin/start")
assert command[1:] == ["-d"]
def test_wait_forwards_args_and_preserves_exit_code(monkeypatch: pytest.MonkeyPatch) -> None:
captured: dict[str, Any] = {}
def fake_run(command, **kwargs) -> None:
captured["command"] = command
captured["kwargs"] = kwargs
raise SystemExit(3)
monkeypatch.setattr("insightscli.command_types._run", fake_run)
result = runner.invoke(cli, ["wait", "--timeout", "1", "--json"])
assert result.exit_code == 3
assert captured["command"] == ["phrocs", "wait", "--timeout", "1", "--json"]
assert captured["kwargs"]["preserve_exit_code"] is True
def test_stop_forwards_timeout_and_preserves_exit_code(monkeypatch: pytest.MonkeyPatch) -> None:
captured: dict[str, Any] = {}
def fake_run(command, **kwargs) -> None:
captured["command"] = command
captured["kwargs"] = kwargs
raise SystemExit(2)
monkeypatch.setattr("insightscli.command_types._run", fake_run)
result = runner.invoke(cli, ["stop", "--timeout", "42"])
assert result.exit_code == 2
assert captured["command"] == ["phrocs", "stop", "--timeout", "42"]
assert captured["kwargs"]["preserve_exit_code"] is True
def test_down_forwards_timeout_and_preserves_exit_code(monkeypatch: pytest.MonkeyPatch) -> None:
captured: dict[str, Any] = {}
def fake_run(command, **kwargs) -> None:
captured["command"] = command
captured["kwargs"] = kwargs
raise SystemExit(2)
monkeypatch.setattr("insightscli.command_types._run", fake_run)
result = runner.invoke(cli, ["down", "--timeout", "42"])
assert result.exit_code == 2
assert captured["command"] == ["phrocs", "stop", "--timeout", "42"]
assert captured["kwargs"]["preserve_exit_code"] is True