tests: all 16 tests now sourced from org (doctor→diagnostics rename, orphaned tests adopted)
Some checks failed
Deploy (Gitea) / deploy (push) Failing after 2s

This commit is contained in:
2026-05-05 09:58:00 -04:00
parent 11383a29d4
commit 817d1c5fec
11 changed files with 105 additions and 41 deletions

View File

@@ -40,12 +40,13 @@ The package definition. All public symbols are exported here.
#:stop-daemon
#:log-message
#:main
#:doctor-run-all
#:doctor-main
#:doctor-check-dependencies
#:doctor-check-env
#:register-provider
#:system-ready-p
#:diagnostics-run-all
#:diagnostics-main
#:diagnostics-dependencies-check
#:diagnostics-env-check
#:register-provider
#:provider-openai-request
#:system-ready-p
#:run-setup-wizard
#:skill-gateway-register
#:skill-gateway-link
@@ -304,7 +305,7 @@ Friendly error handler that replaces the raw SBCL debugger with a diagnostic mes
(format t "┌─────────────────────────────────────────────┐~%")
(format t "│ ERROR: ~A~%" (type-of condition))
(format t "│~%")
(format t "│ Run: passepartout doctor~%")
(format t "│ Run: passepartout diagnostics~%")
(format t "│ For system diagnostics~%")
(format t "└─────────────────────────────────────────────┘~%")
(format t "~%")

View File

@@ -225,8 +225,8 @@ This is the "fail open" principle applied to boot: the system should start even
(format t "==================================================~%")
(handler-case
(progn
(when (fboundp 'doctor-run-all)
(let ((result (doctor-run-all :auto-install nil)))
(when (fboundp 'diagnostics-run-all)
(let ((result (diagnostics-run-all :auto-install nil)))
(setf *health-check-ran* t)
(if result
(progn
@@ -235,10 +235,10 @@ This is the "fail open" principle applied to boot: the system should start even
(progn
(setf *system-health* :degraded)
(format t "DAEMON: Health check found issues.~%")
(format t " Run 'passepartout doctor --fix' to repair.~%")))))
(format t " Run 'passepartout diagnostics' to repair.~%")))))
(setf *health-check-ran* t))
(error (c)
(format t "DOCTOR ERROR: ~a~%" c)
(format t "DIAGNOSTICS ERROR: ~a~%" c)
(setf *system-health* :unhealthy)
(setf *health-check-ran* t)))
(format t "==================================================~%~%"))
@@ -272,7 +272,7 @@ Boot sequence:
(actuator-initialize)
(skill-initialize-all)
;; Run proactive doctor before starting services
;; Run proactive diagnostics before starting services
(diagnostics-startup-run)
(heartbeat-start)

View File

@@ -51,9 +51,9 @@ Note: not every harness or skill file has a corresponding test file. Tests exist
(:file "tests/programming-lisp-tests")
(:file "tests/boot-sequence-tests")
(:file "tests/model-explorer-tests")
(:file "tests/diagnostics-tests")
(:file "tests/tui-tests")
(:file "tests/llm-gateway-tests")
(:file "tests/doctor-tests")))
(:file "tests/llm-gateway-tests")))
#+end_src
** TUI System

View File

@@ -180,5 +180,30 @@ Event handlers + daemon I/O + main loop.
(redraw sw cw ch iw)
(refresh scr)
(sleep 0.03))
(disconnect-daemon))))
(disconnect-daemon))))
#+end_src
* Test Suite
#+begin_src lisp :tangle ../tests/tui-tests.lisp
(eval-when (:compile-toplevel :load-toplevel :execute)
(ql:quickload :fiveam :silent t))
(defpackage :passepartout-tui-tests
(:use :cl :passepartout)
(:export #:tui-suite))
(in-package :passepartout-tui-tests)
(fiveam:def-suite tui-suite :description "Verification of the TUI parsing and styling logic")
(fiveam:in-suite tui-suite)
(fiveam:test test-tui-connection-drop
"Tier 2 Chaos: Verify that handle-return degrades gracefully when the daemon connection is lost."
(let ((passepartout.gateway-tui::*incoming-msgs* nil)
(passepartout.gateway-tui::*input-buffer* (make-array 5 :element-type 'character :initial-contents "hello" :fill-pointer 5 :adjustable t))
(mock-stream (make-string-output-stream)))
(close mock-stream)
(passepartout.gateway-tui::handle-return mock-stream)
(fiveam:is (member "ERROR: Connection to daemon lost." passepartout.gateway-tui::*incoming-msgs* :test #'string=))))
#+end_src

View File

@@ -21,6 +21,11 @@ Binary detection must use shell probing (`which`) to account for varying `$PATH`
* Phase C: Implementation (Build)
** Package Context
#+begin_src lisp
(in-package :passepartout)
#+end_src
** Global Configuration
;; REPL-VERIFIED: 2026-05-03T13:00:00
#+begin_src lisp
@@ -238,24 +243,34 @@ The doctor checks all supported LLM providers and detects local Ollama instances
* Phase D: Verification (Testing)
** Dependency Test
#+begin_src lisp :tangle no
(test test-doctor-dependency-check
#+begin_src lisp :tangle ../tests/diagnostics-tests.lisp
(eval-when (:compile-toplevel :load-toplevel :execute)
(ql:quickload :fiveam :silent t))
(defpackage :passepartout-diagnostics-tests
(:use :cl :fiveam :passepartout)
(:export #:diagnostics-suite))
(in-package :passepartout-diagnostics-tests)
(def-suite diagnostics-suite :description "Verification of the System Diagnostics logic")
(in-suite diagnostics-suite)
(test test-diagnostics-dependency-fail
"Verify that missing binaries are correctly identified as failures."
(let ((passepartout::*diagnostics-binaries* '("non-existent-binary-123")))
(is (null (passepartout:diagnostics-dependencies-check)))))
#+end_src
(is (null (diagnostics-dependencies-check)))))
** Environment Test
#+begin_src lisp :tangle no
(test test-doctor-env-check
(test test-diagnostics-env-fail
"Verify that an invalid MEMEX_DIR triggers a critical failure."
(let ((old-m (uiop:getenv "MEMEX_DIR")))
(let ((old-m (uiop:getenv "MEMEX_DIR"))
(old-d (uiop:getenv "PASSEPARTOUT_DATA_DIR")))
(unwind-protect
(progn
(setf (uiop:getenv "MEMEX_DIR") "/non/existent/path/999")
(is (null (passepartout:diagnostics-env-check))))
(setf (uiop:getenv "MEMEX_DIR") (or old-m "")))))
(is (null (diagnostics-env-check))))
(setf (uiop:getenv "MEMEX_DIR") (or old-m ""))
(setf (uiop:getenv "PASSEPARTOUT_DATA_DIR") (or old-d "")))))
#+end_src
* Phase E: Lifecycle

View File

@@ -161,3 +161,23 @@ If API-KEY is nil, reads from environment."
:priority 50
:trigger (lambda (ctx) (declare (ignore ctx)) nil))
#+end_src
* Test Suite
#+begin_src lisp :tangle ../tests/llm-gateway-tests.lisp
(eval-when (:compile-toplevel :load-toplevel :execute)
(ql:quickload :fiveam :silent t))
(defpackage :passepartout-llm-gateway-tests
(:use :cl :passepartout)
(:export #:llm-gateway-suite))
(in-package :passepartout-llm-gateway-tests)
(fiveam:def-suite llm-gateway-suite :description "Tests for the LLM provider backend")
(fiveam:in-suite llm-gateway-suite)
(fiveam:test test-provider-rejects-bad-keyword
"Verify that provider-openai-request returns :error for an unregistered provider."
(let ((result (provider-openai-request "hello" "test" :provider :not-a-real-provider)))
(fiveam:is (eq (getf result :status) :error))))
#+end_src