feat(layout,test): resolve backlog items I-2, I-3, and C-1 with unanimous peer review
- I-2: add 5.0s upper-bound execution time assertion in test_bug4_headless_unobservable_fast_path to contractually guard SKS_EMPTY_GIVEUP early-exit latency - I-3: clean up PaneInfo.focused, wire MAM_MAX_PANE_COLS/MAM_MAX_COLS environment variables and CLI --max-cols flag - C-1: apply max_columns growth guard to headless 0x0 layouts, mirroring GUI behavior - Promoted Planner consensus plan Rev.2 (plan-fea5f1b2.md) and unanimous PASS reports from Reviewers Claude (report-55d1a1d9.md) and Cline (report-6f18ba0f.md) - Verified all 333 test cases pass with exit code 0
This commit is contained in:
@@ -2,6 +2,7 @@ import os
|
||||
import sys
|
||||
import json
|
||||
import subprocess
|
||||
import time
|
||||
import pytest
|
||||
|
||||
from lib_py.layout import compute_2xk_layout
|
||||
@@ -129,7 +130,14 @@ echo "SUCCESS"
|
||||
|
||||
|
||||
def test_bug4_headless_unobservable_fast_path(tmp_path):
|
||||
"""Verify Bug 4 / R-1: in headless mode where capture-pane is empty, send_keys_safe bypasses dialogs and succeeds immediately via RPC fast-path."""
|
||||
"""Verify Bug 4 / R-1 + I-2: in headless mode where capture-pane is empty,
|
||||
send_keys_safe bypasses dialogs and succeeds immediately via the RPC fast-path.
|
||||
|
||||
The elapsed-time bound is a contract, not a nicety: removing the
|
||||
SKS_EMPTY_GIVEUP early exit leaves every functional assertion green and only
|
||||
changes the wall clock (measured 1.22s -> 10.21s), so this is the sole
|
||||
assertion that can detect that regression.
|
||||
"""
|
||||
test_script = f"""#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
SKILL_DIR="{os.path.abspath('.agents/skills')}"
|
||||
@@ -149,7 +157,6 @@ _sks_herdr() {{
|
||||
fi
|
||||
if [ "${{1:-}}" = "paste-buffer" ]; then
|
||||
PASTE_CALLED=1
|
||||
return 0
|
||||
fi
|
||||
return 0
|
||||
}}
|
||||
@@ -166,9 +173,21 @@ if [ "$PASTE_CALLED" = "1" ]; then
|
||||
fi
|
||||
echo "HEADLESS_OK"
|
||||
"""
|
||||
res = subprocess.run(["bash", "-c", test_script], capture_output=True, text=True)
|
||||
# Remove SKS_* from env so lib.sh defaults apply cleanly
|
||||
env = {k: v for k, v in os.environ.items()
|
||||
if k not in ("SKS_QUIESCENT_TRIES", "SKS_QUIESCENT_INTERVAL", "SKS_EMPTY_GIVEUP")}
|
||||
|
||||
t0 = time.perf_counter()
|
||||
res = subprocess.run(["bash", "-c", test_script], capture_output=True, text=True, env=env)
|
||||
elapsed = time.perf_counter() - t0
|
||||
|
||||
assert res.returncode == 0, f"Headless send_keys_safe failed: {res.stderr}"
|
||||
assert "HEADLESS_OK" in res.stdout
|
||||
assert elapsed < 5.0, (
|
||||
f"headless fast-path took {elapsed:.2f}s (limit 5.0s) — the "
|
||||
f"SKS_EMPTY_GIVEUP early exit in _pane_quiescent is likely gone; "
|
||||
f"the full 10s quiescence window was consumed instead"
|
||||
)
|
||||
|
||||
|
||||
def test_bug4_slow_settling_pane_success(tmp_path):
|
||||
|
||||
Reference in New Issue
Block a user