fix: CLI test, TUI integration harness — all non-blockers resolved
Some checks failed
Deploy (Gitea) / deploy (push) Failing after 3s
Some checks failed
Deploy (Gitea) / deploy (push) Failing after 3s
- gateway-cli: add load-time sanity check, fix FiveAM prefix for jailed-package compatibility - TUI integration: switch all tests from file-grep to tmux capture-pane (agent-responds, cascade-failure, eval-command, connection-drop). Fixes file-buffering false negatives. Increase eval sleep to 3s. - Cherry-pick: system-integration-tests.org org source updated
This commit is contained in:
@@ -15,17 +15,21 @@
|
|||||||
(ql:quickload :fiveam :silent t))
|
(ql:quickload :fiveam :silent t))
|
||||||
|
|
||||||
(defpackage :passepartout-gateway-cli-tests
|
(defpackage :passepartout-gateway-cli-tests
|
||||||
(:use :cl :fiveam :passepartout)
|
(:use :cl :passepartout)
|
||||||
(:export #:cli-suite))
|
(:export #:cli-suite))
|
||||||
|
|
||||||
(in-package :passepartout-gateway-cli-tests)
|
(in-package :passepartout-gateway-cli-tests)
|
||||||
|
|
||||||
(def-suite cli-suite :description "Verification of the CLI Gateway")
|
(fiveam:def-suite cli-suite :description "Verification of the CLI Gateway")
|
||||||
(in-suite cli-suite)
|
(fiveam:in-suite cli-suite)
|
||||||
|
|
||||||
(test test-gateway-cli-input-format
|
(fiveam:test test-gateway-cli-input-format
|
||||||
"Contract 1: gateway-cli-input injects a properly formed signal without error."
|
"Contract 1: gateway-cli-input injects a properly formed signal without error."
|
||||||
(handler-case
|
(handler-case
|
||||||
(gateway-cli-input "hello")
|
(progn (gateway-cli-input "hello") (fiveam:is t))
|
||||||
(error (c)
|
(error (c)
|
||||||
(fail "gateway-cli-input crashed: ~a" c))))
|
(fiveam:is nil "gateway-cli-input crashed: ~a" c))))
|
||||||
|
|
||||||
|
(handler-case
|
||||||
|
(progn (gateway-cli-input "test-load") (log-message "CLI: Load-time test OK"))
|
||||||
|
(error (c) (log-message "CLI: Load-time test FAILED: ~a" c)))
|
||||||
|
|||||||
@@ -44,18 +44,29 @@ The CLI Gateway is the simplest interface to Passepartout — raw stdin/stdout o
|
|||||||
(ql:quickload :fiveam :silent t))
|
(ql:quickload :fiveam :silent t))
|
||||||
|
|
||||||
(defpackage :passepartout-gateway-cli-tests
|
(defpackage :passepartout-gateway-cli-tests
|
||||||
(:use :cl :fiveam :passepartout)
|
(:use :cl :passepartout)
|
||||||
(:export #:cli-suite))
|
(:export #:cli-suite))
|
||||||
|
|
||||||
(in-package :passepartout-gateway-cli-tests)
|
(in-package :passepartout-gateway-cli-tests)
|
||||||
|
|
||||||
(def-suite cli-suite :description "Verification of the CLI Gateway")
|
(fiveam:def-suite cli-suite :description "Verification of the CLI Gateway")
|
||||||
(in-suite cli-suite)
|
(fiveam:in-suite cli-suite)
|
||||||
|
|
||||||
(test test-gateway-cli-input-format
|
(fiveam:test test-gateway-cli-input-format
|
||||||
"Contract 1: gateway-cli-input injects a properly formed signal without error."
|
"Contract 1: gateway-cli-input injects a properly formed signal without error."
|
||||||
(handler-case
|
(handler-case
|
||||||
(gateway-cli-input "hello")
|
(progn (gateway-cli-input "hello") (fiveam:is t))
|
||||||
(error (c)
|
(error (c)
|
||||||
(fail "gateway-cli-input crashed: ~a" c))))
|
(fiveam:is nil "gateway-cli-input crashed: ~a" c))))
|
||||||
|
#+end_src
|
||||||
|
|
||||||
|
** Load-Time Sanity Check
|
||||||
|
|
||||||
|
Verifies the function exists and can be called at load time without
|
||||||
|
depending on FiveAM macro resolution in the jailed package.
|
||||||
|
|
||||||
|
#+begin_src lisp
|
||||||
|
(handler-case
|
||||||
|
(progn (gateway-cli-input "test-load") (log-message "CLI: Load-time test OK"))
|
||||||
|
(error (c) (log-message "CLI: Load-time test FAILED: ~a" c)))
|
||||||
#+end_src
|
#+end_src
|
||||||
|
|||||||
@@ -350,30 +350,26 @@ done
|
|||||||
|
|
||||||
test_agent_responds() {
|
test_agent_responds() {
|
||||||
# Full round-trip: TUI → daemon → pipeline → TUI.
|
# Full round-trip: TUI → daemon → pipeline → TUI.
|
||||||
# Polls for ⬇ marker (any 3+ letter agent response).
|
# Uses tmux capture-pane to read the rendered screen.
|
||||||
local before_ts
|
local before_ts
|
||||||
before_ts=$(date +%s)
|
before_ts=$(date +%s)
|
||||||
|
|
||||||
tmux send-keys -t tui-test "hello" Enter
|
tmux send-keys -t tui-test "hello" Enter
|
||||||
|
|
||||||
while true; do
|
while true; do
|
||||||
if grep -q '⬇.*[a-zA-Z]\{3,\}' "$TUI_LOG"; then
|
if tmux capture-pane -t tui-test -p -S -50 2>/dev/null | grep -q '⬇.*[a-zA-Z]\{3,\}'; then
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
local now_ts
|
local now_ts
|
||||||
now_ts=$(date +%s)
|
now_ts=$(date +%s)
|
||||||
if (( now_ts - before_ts > 60 )); then
|
if (( now_ts - before_ts > 60 )); then
|
||||||
echo "TIMEOUT: no agent response in log after 60s" >&2
|
echo "TIMEOUT: no agent response after 60s" >&2
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
sleep 1
|
sleep 2
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
test_agent_not_cascade_failure() {
|
test_agent_not_cascade_failure() {
|
||||||
# Check if the ⬇ response is a cascade failure meaning no LLM backend is configured.
|
if tmux capture-pane -t tui-test -p -S -50 2>/dev/null | grep '⬇' | grep -qi 'cascade.*fail\|exhausted\|neural cascade'; then
|
||||||
# This is a WARNING, not a failure — the daemon is alive but needs an API key.
|
|
||||||
if grep '⬇' "$TUI_LOG" | grep -qi 'cascade.*fail\|exhausted\|neural cascade'; then
|
|
||||||
echo "NOTE: LLM cascade failure — no API key configured (warning only)" >&2
|
echo "NOTE: LLM cascade failure — no API key configured (warning only)" >&2
|
||||||
WARN=$((WARN + 1))
|
WARN=$((WARN + 1))
|
||||||
fi
|
fi
|
||||||
@@ -382,8 +378,8 @@ test_agent_not_cascade_failure() {
|
|||||||
|
|
||||||
test_eval_command() {
|
test_eval_command() {
|
||||||
tmux send-keys -t tui-test "/eval (+ 1 2)" Enter
|
tmux send-keys -t tui-test "/eval (+ 1 2)" Enter
|
||||||
sleep 2
|
sleep 3
|
||||||
grep -q '=> 3' "$TUI_LOG"
|
tmux capture-pane -t tui-test -p -S -10 2>/dev/null | grep -q '=> 3'
|
||||||
}
|
}
|
||||||
|
|
||||||
test_status_bar() {
|
test_status_bar() {
|
||||||
@@ -391,14 +387,8 @@ test_status_bar() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
test_connection_drop() {
|
test_connection_drop() {
|
||||||
# Drop the daemon's connection to the TUI (the TUI notices and logs an error).
|
|
||||||
# We don't kill the daemon itself — just close its TCP listener temporarily.
|
|
||||||
# If the daemon and TUI share the same host, restarting the TUI's session
|
|
||||||
# forces a reconnect. This test is best-effort; in pure headless mode,
|
|
||||||
# the connection may already be lost from the TUI startup delay.
|
|
||||||
sleep 1
|
sleep 1
|
||||||
grep -qi 'connection.*lost\|ERROR.*Connection\|error.*connect' "$TUI_LOG" || true
|
tmux capture-pane -t tui-test -p -S -10 2>/dev/null | grep -qi 'connection.*lost\|ERROR.*Connection\|error.*connect' || true
|
||||||
# Not a hard failure — connection monitoring depends on TUI rendering speed
|
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -42,30 +42,26 @@ done
|
|||||||
|
|
||||||
test_agent_responds() {
|
test_agent_responds() {
|
||||||
# Full round-trip: TUI → daemon → pipeline → TUI.
|
# Full round-trip: TUI → daemon → pipeline → TUI.
|
||||||
# Polls for ⬇ marker (any 3+ letter agent response).
|
# Uses tmux capture-pane to read the rendered screen.
|
||||||
local before_ts
|
local before_ts
|
||||||
before_ts=$(date +%s)
|
before_ts=$(date +%s)
|
||||||
|
|
||||||
tmux send-keys -t tui-test "hello" Enter
|
tmux send-keys -t tui-test "hello" Enter
|
||||||
|
|
||||||
while true; do
|
while true; do
|
||||||
if grep -q '⬇.*[a-zA-Z]\{3,\}' "$TUI_LOG"; then
|
if tmux capture-pane -t tui-test -p -S -50 2>/dev/null | grep -q '⬇.*[a-zA-Z]\{3,\}'; then
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
local now_ts
|
local now_ts
|
||||||
now_ts=$(date +%s)
|
now_ts=$(date +%s)
|
||||||
if (( now_ts - before_ts > 60 )); then
|
if (( now_ts - before_ts > 60 )); then
|
||||||
echo "TIMEOUT: no agent response in log after 60s" >&2
|
echo "TIMEOUT: no agent response after 60s" >&2
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
sleep 1
|
sleep 2
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
test_agent_not_cascade_failure() {
|
test_agent_not_cascade_failure() {
|
||||||
# Check if the ⬇ response is a cascade failure meaning no LLM backend is configured.
|
if tmux capture-pane -t tui-test -p -S -50 2>/dev/null | grep '⬇' | grep -qi 'cascade.*fail\|exhausted\|neural cascade'; then
|
||||||
# This is a WARNING, not a failure — the daemon is alive but needs an API key.
|
|
||||||
if grep '⬇' "$TUI_LOG" | grep -qi 'cascade.*fail\|exhausted\|neural cascade'; then
|
|
||||||
echo "NOTE: LLM cascade failure — no API key configured (warning only)" >&2
|
echo "NOTE: LLM cascade failure — no API key configured (warning only)" >&2
|
||||||
WARN=$((WARN + 1))
|
WARN=$((WARN + 1))
|
||||||
fi
|
fi
|
||||||
@@ -74,8 +70,8 @@ test_agent_not_cascade_failure() {
|
|||||||
|
|
||||||
test_eval_command() {
|
test_eval_command() {
|
||||||
tmux send-keys -t tui-test "/eval (+ 1 2)" Enter
|
tmux send-keys -t tui-test "/eval (+ 1 2)" Enter
|
||||||
sleep 2
|
sleep 3
|
||||||
grep -q '=> 3' "$TUI_LOG"
|
tmux capture-pane -t tui-test -p -S -10 2>/dev/null | grep -q '=> 3'
|
||||||
}
|
}
|
||||||
|
|
||||||
test_status_bar() {
|
test_status_bar() {
|
||||||
@@ -83,14 +79,8 @@ test_status_bar() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
test_connection_drop() {
|
test_connection_drop() {
|
||||||
# Drop the daemon's connection to the TUI (the TUI notices and logs an error).
|
|
||||||
# We don't kill the daemon itself — just close its TCP listener temporarily.
|
|
||||||
# If the daemon and TUI share the same host, restarting the TUI's session
|
|
||||||
# forces a reconnect. This test is best-effort; in pure headless mode,
|
|
||||||
# the connection may already be lost from the TUI startup delay.
|
|
||||||
sleep 1
|
sleep 1
|
||||||
grep -qi 'connection.*lost\|ERROR.*Connection\|error.*connect' "$TUI_LOG" || true
|
tmux capture-pane -t tui-test -p -S -10 2>/dev/null | grep -qi 'connection.*lost\|ERROR.*Connection\|error.*connect' || true
|
||||||
# Not a hard failure — connection monitoring depends on TUI rendering speed
|
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user