Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions examples/canary/catalog-planner-smoke.py
Original file line number Diff line number Diff line change
Expand Up @@ -597,6 +597,7 @@ def assert_pr_release_and_refactor_profiles_select() -> None:
"python3 examples/issue-fix-capability-guide-smoke.py",
"python3 examples/issue-fix-reviewer-recommendation-smoke.py",
"python3 examples/issue-fix-reviewer-request-smoke.py",
"python3 examples/issue-fix-reviewer-notification-drain-postwrite-smoke.py",
"python3 examples/issue-fix-reviewer-notification-sink-smoke.py",
], reviewer_profile
assert all(check["tier"] == "default" for check in reviewer_profile["checks"]), reviewer_profile
Expand Down
43 changes: 3 additions & 40 deletions examples/cli-control-plane-command-modularization-smoke.py
Original file line number Diff line number Diff line change
@@ -1,28 +1,24 @@
#!/usr/bin/env python3
"""Smoke-test that todo/quota CLI groups live outside loopx/cli.py."""
"""Smoke-test todo/quota help and structured validation errors."""

from __future__ import annotations

import json
import os
import subprocess
import sys
import tempfile
from pathlib import Path


REPO_ROOT = Path(__file__).resolve().parents[1]
CLI_PATH = REPO_ROOT / "loopx" / "cli.py"
CLI_RUNTIME_PATH = REPO_ROOT / "loopx" / "cli_runtime.py"
INIT_PATH = REPO_ROOT / "loopx" / "cli_commands" / "__init__.py"
TODO_MODULE = REPO_ROOT / "loopx" / "cli_commands" / "todo.py"
QUOTA_MODULE = REPO_ROOT / "loopx" / "cli_commands" / "quota.py"
QUOTA_PRESENTATION_MODULE = REPO_ROOT / "loopx" / "cli_commands" / "quota_presentation.py"


def run_cli(*args: str) -> subprocess.CompletedProcess[str]:
return subprocess.run(
[sys.executable, "-m", "loopx.cli", *args],
cwd=REPO_ROOT,
env={**os.environ, "LOOPX_USAGE_PING": "0"},
text=True,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
Expand All @@ -36,38 +32,6 @@ def assert_contains(text: str, needle: str, label: str) -> None:
raise AssertionError(f"{label} missing {needle!r}")


def assert_source_shape() -> None:
cli_text = CLI_PATH.read_text(encoding="utf-8")
runtime_text = CLI_RUNTIME_PATH.read_text(encoding="utf-8")
init_text = INIT_PATH.read_text(encoding="utf-8")
todo_text = TODO_MODULE.read_text(encoding="utf-8")
quota_text = QUOTA_MODULE.read_text(encoding="utf-8")
quota_presentation_text = QUOTA_PRESENTATION_MODULE.read_text(encoding="utf-8")

assert_contains(init_text, "register_todo_command", "__init__")
assert_contains(init_text, "handle_todo_command", "__init__")
assert_contains(init_text, "register_quota_command", "__init__")
assert_contains(init_text, "handle_quota_command", "__init__")
assert "todo_parser = sub.add_parser" not in cli_text
assert "quota_parser = sub.add_parser" not in cli_text
assert_contains(
cli_text,
"register_todo_command(sub, add_subcommand_format)",
"cli.py",
)
assert_contains(cli_text, "register_quota_command(sub)", "cli.py")
assert_contains(cli_text, "dispatch_common_command(", "cli.py")
assert "handle_todo_command(" not in cli_text
assert "handle_quota_command(" not in cli_text
assert_contains(runtime_text, "handle_todo_command(", "cli_runtime.py")
assert_contains(runtime_text, "handle_quota_command(", "cli_runtime.py")
assert_contains(todo_text, "render_todo_markdown", "todo module")
assert_contains(todo_text, "append_cli_rollout_event", "todo module")
assert_contains(quota_text, "from .quota_presentation import", "quota module")
assert_contains(quota_presentation_text, "render_turn_context_markdown", "quota presentation")
assert_contains(quota_text, "append_cli_rollout_event", "quota module")


def assert_help_surfaces() -> None:
todo_help = run_cli("todo", "--help")
assert todo_help.returncode == 0, todo_help.stderr
Expand Down Expand Up @@ -199,7 +163,6 @@ def assert_history_reader_route() -> None:


def main() -> int:
assert_source_shape()
assert_help_surfaces()
assert_todo_error_payload()
assert_todo_markdown_error_payload()
Expand Down
38 changes: 2 additions & 36 deletions examples/cli-version-command-modularization-smoke.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/usr/bin/env python3
"""Smoke-test the low-risk version command module boundary."""
"""Smoke-test version output parity and public CLI formats."""

from __future__ import annotations

Expand All @@ -11,13 +11,10 @@


REPO_ROOT = Path(__file__).resolve().parents[1]
CLI = REPO_ROOT / "loopx" / "cli.py"
INIT = REPO_ROOT / "loopx" / "cli_commands" / "__init__.py"
MODULE = REPO_ROOT / "loopx" / "cli_commands" / "version.py"


def run_cli(*args: str) -> subprocess.CompletedProcess[str]:
env = {**os.environ, "PYTHONPATH": str(REPO_ROOT)}
env = {**os.environ, "PYTHONPATH": str(REPO_ROOT), "LOOPX_USAGE_PING": "0"}
return subprocess.run(
[sys.executable, "-m", "loopx.cli", *args],
cwd=REPO_ROOT,
Expand All @@ -42,36 +39,6 @@ def require_success(result: subprocess.CompletedProcess[str]) -> str:
return result.stdout


def assert_source_shape() -> None:
cli_source = CLI.read_text(encoding="utf-8")
init_source = INIT.read_text(encoding="utf-8")
module_source = MODULE.read_text(encoding="utf-8")

for marker in [
'sub.add_parser("version"',
"def build_version_payload(",
"def render_version_markdown(",
]:
require(marker not in cli_source, f"version implementation leaked into loopx/cli.py: {marker}")
for marker in [
"register_version_command(sub, add_subcommand_format)",
"handle_version_command(",
]:
require(marker in cli_source, f"loopx/cli.py missing {marker}")
for marker in [
"handle_version_command",
"register_version_command",
]:
require(marker in init_source, f"cli_commands/__init__.py missing {marker}")
for marker in [
"def build_version_payload(",
"def register_version_command(",
"def handle_version_command(",
"output_format(args)",
]:
require(marker in module_source, f"version module missing {marker}")


def assert_version_outputs() -> None:
legacy_flag = require_success(run_cli("--version")).strip()
markdown = require_success(run_cli("version")).strip()
Expand All @@ -90,7 +57,6 @@ def assert_version_outputs() -> None:


def main() -> int:
assert_source_shape()
assert_version_outputs()
print("cli-version-command-modularization-smoke: ok")
return 0
Expand Down
29 changes: 2 additions & 27 deletions examples/cli-worker-bridge-command-modularization-smoke.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,14 @@
from __future__ import annotations

import json
import os
import subprocess
import sys
import tempfile
from pathlib import Path


ROOT = Path(__file__).resolve().parents[1]
CLI = ROOT / "loopx" / "cli.py"
MODULE = ROOT / "loopx" / "cli_commands" / "worker_bridge.py"
INIT = ROOT / "loopx" / "cli_commands" / "__init__.py"
sys.path.insert(0, str(ROOT))

from loopx.worker_bridge import build_worker_bridge_install_contract # noqa: E402
Expand All @@ -22,6 +20,7 @@ def run_cli(*args: str, stdin: str | None = None) -> subprocess.CompletedProcess
[sys.executable, "-m", "loopx.cli", *args],
input=stdin,
cwd=ROOT,
env={**os.environ, "LOOPX_USAGE_PING": "0"},
check=False,
text=True,
stdout=subprocess.PIPE,
Expand All @@ -44,30 +43,6 @@ def require_success(result: subprocess.CompletedProcess[str]) -> str:


def main() -> None:
cli_source = CLI.read_text(encoding="utf-8")
module_source = MODULE.read_text(encoding="utf-8")
init_source = INIT.read_text(encoding="utf-8")

forbidden_cli_markers = [
"worker_bridge_parser = sub.add_parser",
"worker_bridge_sub = worker_bridge_parser.add_subparsers",
"build_worker_bridge_install_contract(",
"observe_active_user_intervention_feed(",
'if args.command == "worker-bridge":',
]
for marker in forbidden_cli_markers:
require(marker not in cli_source, f"worker-bridge marker leaked into cli.py: {marker}")

for marker in (
"register_worker_bridge_commands",
"handle_worker_bridge_command",
"WORKER_BRIDGE_COMMANDS",
"append_worker_bridge_counter_trace_row(",
):
require(marker in module_source, f"worker-bridge command module missing {marker}")
require("register_worker_bridge_commands" in init_source, "__init__ did not export worker bridge registration")
require("handle_worker_bridge_command" in init_source, "__init__ did not export worker bridge handler")

help_text = require_success(run_cli("worker-bridge", "active-user-observe", "--help"))
for option in ("--feed-jsonl", "--observation-json", "--counter-trace-json"):
require(option in help_text, f"active-user-observe help omitted {option}")
Expand Down
77 changes: 0 additions & 77 deletions examples/control_plane/todo-detail-cold-path-contract-smoke.py

This file was deleted.

11 changes: 0 additions & 11 deletions examples/issue-fix-reviewer-request-smoke.py
Original file line number Diff line number Diff line change
Expand Up @@ -2081,17 +2081,6 @@ def drain_metadata_loader(
assert verified_runner.edits == 1
assert_public_safe(verified_publication)

subprocess.run(
[
sys.executable,
str(
ROOT
/ "examples/issue-fix-reviewer-notification-drain-postwrite-smoke.py"
),
],
cwd=ROOT,
check=True,
)
finally:
for attempt in range(10):
try:
Expand Down
14 changes: 8 additions & 6 deletions loopx/canary/planner.py
Original file line number Diff line number Diff line change
Expand Up @@ -545,7 +545,7 @@
{
"command": "python3 examples/cli-version-command-modularization-smoke.py",
"tier": "default",
"reason": "guards a low-risk command migration plus old version invocations",
"reason": "guards version output parity and both JSON format option placements",
},
{
"command": "python3 examples/cli-control-plane-command-modularization-smoke.py",
Expand Down Expand Up @@ -598,11 +598,6 @@
"tier": "deep",
"reason": "samples lock behavior for concurrent todo writes",
},
{
"command": "python3 examples/control_plane/todo-detail-cold-path-contract-smoke.py",
"tier": "deep",
"reason": "checks the cold-path todo detail contract when detail surfaces are promoted",
},
],
},
{
Expand Down Expand Up @@ -771,6 +766,8 @@
"examples/issue-fix-capability-guide-smoke.py",
"examples/issue-fix-reviewer-recommendation-smoke.py",
"examples/issue-fix-reviewer-request-smoke.py",
"examples/issue-fix-reviewer-notification-drain-postwrite-smoke.py",
"loopx/capabilities/issue_fix/reviewer_notification_drain.py",
"examples/issue-fix-json-input-boundary-smoke.py",
"examples/issue-fix-reviewer-notification-sink-smoke.py",
"loopx/capabilities/issue_fix/cli.py",
Expand Down Expand Up @@ -799,6 +796,11 @@
"tier": "default",
"reason": "guards author exclusion, formal-request-first notification, permission-only comment fallback, idempotency, blockers, and post-write verification",
},
{
"command": "python3 examples/issue-fix-reviewer-notification-drain-postwrite-smoke.py",
"tier": "default",
"reason": "guards restart-safe drain writeback, unverified-send suppression, and semantic notification deduplication",
},
{
"command": "python3 examples/issue-fix-reviewer-notification-sink-smoke.py",
"tier": "default",
Expand Down
1 change: 1 addition & 0 deletions loopx/capabilities/issue_fix/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1396,6 +1396,7 @@ loopx issue-fix outcome \
python3 examples/issue-fix-capability-guide-smoke.py
python3 examples/issue-fix-reviewer-recommendation-smoke.py
python3 examples/issue-fix-reviewer-request-smoke.py
python3 examples/issue-fix-reviewer-notification-drain-postwrite-smoke.py
python3 examples/issue-fix-reviewer-notification-sink-smoke.py
python3 examples/issue-fix-workflow-plan-smoke.py
python3 examples/issue-fix-workflow-contract-smoke.py
Expand Down
1 change: 1 addition & 0 deletions loopx/capabilities/issue_fix/README.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -1214,6 +1214,7 @@ loopx issue-fix outcome \
python3 examples/issue-fix-capability-guide-smoke.py
python3 examples/issue-fix-reviewer-recommendation-smoke.py
python3 examples/issue-fix-reviewer-request-smoke.py
python3 examples/issue-fix-reviewer-notification-drain-postwrite-smoke.py
python3 examples/issue-fix-reviewer-notification-sink-smoke.py
python3 examples/issue-fix-workflow-plan-smoke.py
python3 examples/issue-fix-workflow-contract-smoke.py
Expand Down
1 change: 1 addition & 0 deletions loopx/capabilities/issue_fix/catalog_entry.py
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,7 @@
"python3 examples/issue-fix-validated-memory-writeback-smoke.py",
"python3 examples/issue-fix-reviewer-recommendation-smoke.py",
"python3 examples/issue-fix-reviewer-request-smoke.py",
"python3 examples/issue-fix-reviewer-notification-drain-postwrite-smoke.py",
"python3 examples/issue-fix-json-input-boundary-smoke.py",
"python3 examples/issue-fix-reviewer-notification-sink-smoke.py",
"python3 examples/content-ops-issue-fix-metadata-preview-smoke.py",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,7 @@ Run:
```bash
python3 examples/issue-fix-reviewer-notification-sink-smoke.py
python3 examples/issue-fix-reviewer-request-smoke.py
python3 examples/issue-fix-reviewer-notification-drain-postwrite-smoke.py
```

The provider-neutral fixture covers preview, dedicated-identity enforcement,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,7 @@ Run:

```bash
python3 examples/issue-fix-reviewer-request-smoke.py
python3 examples/issue-fix-reviewer-notification-drain-postwrite-smoke.py
```

The generic fixture verifies live-author exclusion, top-candidate selection,
Expand Down
Loading