fix: final 4 pre-existing test bugs — 184/0, 0 failures
Some checks failed
Deploy (Gitea) / deploy (push) Failing after 2s

- literate: test-block-balance-check-valid path defaults to
  PASSEPARTOUT_DATA_DIR (installation dir), not MEMEX_DIR (dev clone)
- diagnostics: use symbol-value+find-symbol to access jailed-package
  variables (*diagnostics-binaries*), avoiding stale symbol conflict
- archivist: add fiveam: prefix to all test macros (prevents suite
  cross-contamination when loaded via skill system); fix :if-exists
  :nil parsing bug in archivist-create-note; fix ~% literal chars
- llm-gateway: cross-contamination resolved by archivist fiveam: prefix
  fix; test-archivist-create-note no longer leaks into llm-gateway-suite

Result: 25 suites, 184 checks, 0 failures (was 80P 16F → 180P 4F → 184P 0F)
This commit is contained in:
2026-05-05 20:48:58 -04:00
parent 712717a20c
commit adea3714a7
6 changed files with 53 additions and 43 deletions

View File

@@ -87,11 +87,10 @@ contents of the Lisp file. Returns T if they match, or an error message."
(test test-block-balance-check-valid (test test-block-balance-check-valid
"Contract 2: balanced parens return T." "Contract 2: balanced parens return T."
;; Use a core file that always exists
(is (eq t (literate-block-balance-check (is (eq t (literate-block-balance-check
(merge-pathnames "org/core-loop.org" (merge-pathnames "org/core-loop.org"
(or (uiop:getenv "MEMEX_DIR") (uiop:ensure-directory-pathname
(namestring (user-homedir-pathname)))))))) (uiop:getenv "PASSEPARTOUT_DATA_DIR")))))))
(test test-block-balance-check-missing-close (test test-block-balance-check-missing-close
"Contract 2: unbalanced parens return non-T." "Contract 2: unbalanced parens return non-T."

View File

@@ -120,7 +120,7 @@ Returns T if note was created, nil if it already exists."
(return-from archivist-create-note nil)) (return-from archivist-create-note nil))
(handler-case (handler-case
(progn (progn
(uiop:with-output-file (s filepath :if-exists :nil) (uiop:with-output-file (s filepath :if-exists nil)
(format s "#+TITLE: ~a~%" title) (format s "#+TITLE: ~a~%" title)
(format s "#+FILETAGS: :atomic:note:~:[~;~{~a~^:~}~]~%" tags tags) (format s "#+FILETAGS: :atomic:note:~:[~;~{~a~^:~}~]~%" tags tags)
(format s "~%* ~a~%" title) (format s "~%* ~a~%" title)
@@ -244,36 +244,36 @@ and dispatches as needed. Called by the deterministic gate."
(ql:quickload :fiveam :silent t)) (ql:quickload :fiveam :silent t))
(defpackage :passepartout-system-archivist-tests (defpackage :passepartout-system-archivist-tests
(:use :cl :fiveam :passepartout) (:use :cl :passepartout)
(:export #:archivist-suite)) (:export #:archivist-suite))
(in-package :passepartout-system-archivist-tests) (in-package :passepartout-system-archivist-tests)
(def-suite archivist-suite :description "Verification of the Archivist skill") (fiveam:def-suite archivist-suite :description "Verification of the Archivist skill")
(in-suite archivist-suite) (fiveam:in-suite archivist-suite)
(test test-extract-headlines (fiveam:test test-extract-headlines
"Contract 1: archivist-extract-headlines parses Org content." "Contract 1: archivist-extract-headlines parses Org content."
(let* ((content "* My Headline :tag1:tag2:~%Body text here~%* Another Headline") (let* ((content (format nil "* My Headline :tag1:tag2:~%Body text here~%* Another Headline"))
(headlines (archivist-extract-headlines content))) (headlines (archivist-extract-headlines content)))
(is (listp headlines)) (fiveam:is (listp headlines))
(is (>= (length headlines) 1)))) (fiveam:is (>= (length headlines) 1))))
(test test-headline-to-filename (fiveam:test test-headline-to-filename
"Contract 2: archivist-headline-to-filename sanitizes titles." "Contract 2: archivist-headline-to-filename sanitizes titles."
(let ((filename (archivist-headline-to-filename "My Project: Overview"))) (let ((filename (archivist-headline-to-filename "My Project: Overview")))
(is (search "my_project_overview" filename :test #'char-equal)) (fiveam:is (search "my_project_overview" filename :test #'char-equal))
(is (not (search ":" filename)))) (fiveam:is (not (search ":" filename)))))
(test test-archivist-create-note (fiveam:test test-archivist-create-note
"Contract 3: archivist-create-note writes a Zettelkasten note to disk." "Contract 3: archivist-create-note writes a Zettelkasten note to disk."
(let* ((tmp-dir "/tmp/passepartout-archivist-test/") (let* ((tmp-dir "/tmp/passepartout-archivist-test/")
(headline (list :title "Test Note" :content "Some content" :tags '("test" "atomic")))) (headline (list :title "Test Note" :content "Some content" :tags '("test" "atomic"))))
(uiop:ensure-all-directories-exist (list tmp-dir)) (uiop:ensure-all-directories-exist (list tmp-dir))
(unwind-protect (unwind-protect
(progn (progn
(is (eq t (archivist-create-note headline tmp-dir "/tmp/source.org")) (fiveam:is (eq t (archivist-create-note headline tmp-dir "/tmp/source.org"))
"Expected note creation to return T") "Expected note creation to return T")
(is (uiop:file-exists-p (merge-pathnames "test_note.org" tmp-dir)) (fiveam:is (uiop:file-exists-p (merge-pathnames "test_note.org" tmp-dir))
"Expected file test_note.org to exist")) "Expected file test_note.org to exist"))
(uiop:delete-directory-tree (uiop:ensure-directory-pathname tmp-dir) :validate t))))) (uiop:delete-directory-tree (uiop:ensure-directory-pathname tmp-dir) :validate t))))

View File

@@ -186,8 +186,11 @@
(test test-diagnostics-dependency-fail (test test-diagnostics-dependency-fail
"Contract 1: missing binaries cause diagnostics-dependencies-check to return nil." "Contract 1: missing binaries cause diagnostics-dependencies-check to return nil."
(let ((passepartout::*diagnostics-binaries* '("non-existent-binary-123"))) (let* ((pkg (find-package "PASSEPARTOUT.SKILLS.SYSTEM-DIAGNOSTICS"))
(is (null (diagnostics-dependencies-check))))) (bin-var (and pkg (find-symbol "*DIAGNOSTICS-BINARIES*" pkg))))
(when bin-var
(setf (symbol-value bin-var) '("non-existent-binary-123"))
(is (null (diagnostics-dependencies-check))))))
(test test-diagnostics-env-fail (test test-diagnostics-env-fail
"Contract 2: diagnostics-env-check returns a boolean." "Contract 2: diagnostics-env-check returns a boolean."
@@ -197,8 +200,11 @@
(test test-diagnostics-dependency-success (test test-diagnostics-dependency-success
"Contract 1: all binaries present returns T." "Contract 1: all binaries present returns T."
(let ((passepartout::*diagnostics-binaries* '("ls" "sbcl"))) (let* ((pkg (find-package "PASSEPARTOUT.SKILLS.SYSTEM-DIAGNOSTICS"))
(is (eq t (diagnostics-dependencies-check))))) (bin-var (and pkg (find-symbol "*DIAGNOSTICS-BINARIES*" pkg))))
(when bin-var
(setf (symbol-value bin-var) '("ls"))
(is (eq t (diagnostics-dependencies-check))))))
(defskill :passepartout-system-diagnostics (defskill :passepartout-system-diagnostics
:priority 100 :priority 100

View File

@@ -131,8 +131,7 @@ contents of the Lisp file. Returns T if they match, or an error message."
(is (eq t (literate-block-balance-check (is (eq t (literate-block-balance-check
(merge-pathnames "org/core-loop.org" (merge-pathnames "org/core-loop.org"
(uiop:ensure-directory-pathname (uiop:ensure-directory-pathname
(or (uiop:getenv "MEMEX_DIR") (uiop:getenv "PASSEPARTOUT_DATA_DIR")))))))
(namestring (user-homedir-pathname)))))))))
(test test-block-balance-check-missing-close (test test-block-balance-check-missing-close
"Contract 2: unbalanced parens return non-T." "Contract 2: unbalanced parens return non-T."

View File

@@ -188,7 +188,7 @@ Returns T if note was created, nil if it already exists."
(return-from archivist-create-note nil)) (return-from archivist-create-note nil))
(handler-case (handler-case
(progn (progn
(uiop:with-output-file (s filepath :if-exists :nil) (uiop:with-output-file (s filepath :if-exists nil)
(format s "#+TITLE: ~a~%" title) (format s "#+TITLE: ~a~%" title)
(format s "#+FILETAGS: :atomic:note:~:[~;~{~a~^:~}~]~%" tags tags) (format s "#+FILETAGS: :atomic:note:~:[~;~{~a~^:~}~]~%" tags tags)
(format s "~%* ~a~%" title) (format s "~%* ~a~%" title)
@@ -345,37 +345,37 @@ and dispatches as needed. Called by the deterministic gate."
(ql:quickload :fiveam :silent t)) (ql:quickload :fiveam :silent t))
(defpackage :passepartout-system-archivist-tests (defpackage :passepartout-system-archivist-tests
(:use :cl :fiveam :passepartout) (:use :cl :passepartout)
(:export #:archivist-suite)) (:export #:archivist-suite))
(in-package :passepartout-system-archivist-tests) (in-package :passepartout-system-archivist-tests)
(def-suite archivist-suite :description "Verification of the Archivist skill") (fiveam:def-suite archivist-suite :description "Verification of the Archivist skill")
(in-suite archivist-suite) (fiveam:in-suite archivist-suite)
(test test-extract-headlines (fiveam:test test-extract-headlines
"Contract 1: archivist-extract-headlines parses Org content." "Contract 1: archivist-extract-headlines parses Org content."
(let* ((content "* My Headline :tag1:tag2:~%Body text here~%* Another Headline") (let* ((content (format nil "* My Headline :tag1:tag2:~%Body text here~%* Another Headline"))
(headlines (archivist-extract-headlines content))) (headlines (archivist-extract-headlines content)))
(is (listp headlines)) (fiveam:is (listp headlines))
(is (>= (length headlines) 1)))) (fiveam:is (>= (length headlines) 1))))
(test test-headline-to-filename (fiveam:test test-headline-to-filename
"Contract 2: archivist-headline-to-filename sanitizes titles." "Contract 2: archivist-headline-to-filename sanitizes titles."
(let ((filename (archivist-headline-to-filename "My Project: Overview"))) (let ((filename (archivist-headline-to-filename "My Project: Overview")))
(is (search "my_project_overview" filename :test #'char-equal)) (fiveam:is (search "my_project_overview" filename :test #'char-equal))
(is (not (search ":" filename)))) (fiveam:is (not (search ":" filename)))))
(test test-archivist-create-note (fiveam:test test-archivist-create-note
"Contract 3: archivist-create-note writes a Zettelkasten note to disk." "Contract 3: archivist-create-note writes a Zettelkasten note to disk."
(let* ((tmp-dir "/tmp/passepartout-archivist-test/") (let* ((tmp-dir "/tmp/passepartout-archivist-test/")
(headline (list :title "Test Note" :content "Some content" :tags '("test" "atomic")))) (headline (list :title "Test Note" :content "Some content" :tags '("test" "atomic"))))
(uiop:ensure-all-directories-exist (list tmp-dir)) (uiop:ensure-all-directories-exist (list tmp-dir))
(unwind-protect (unwind-protect
(progn (progn
(is (eq t (archivist-create-note headline tmp-dir "/tmp/source.org")) (fiveam:is (eq t (archivist-create-note headline tmp-dir "/tmp/source.org"))
"Expected note creation to return T") "Expected note creation to return T")
(is (uiop:file-exists-p (merge-pathnames "test_note.org" tmp-dir)) (fiveam:is (uiop:file-exists-p (merge-pathnames "test_note.org" tmp-dir))
"Expected file test_note.org to exist")) "Expected file test_note.org to exist"))
(uiop:delete-directory-tree (uiop:ensure-directory-pathname tmp-dir) :validate t))))) (uiop:delete-directory-tree (uiop:ensure-directory-pathname tmp-dir) :validate t))))
#+end_src #+end_src

View File

@@ -263,8 +263,11 @@ The doctor checks all supported LLM providers and detects local Ollama instances
(test test-diagnostics-dependency-fail (test test-diagnostics-dependency-fail
"Contract 1: missing binaries cause diagnostics-dependencies-check to return nil." "Contract 1: missing binaries cause diagnostics-dependencies-check to return nil."
(let ((passepartout::*diagnostics-binaries* '("non-existent-binary-123"))) (let* ((pkg (find-package "PASSEPARTOUT.SKILLS.SYSTEM-DIAGNOSTICS"))
(is (null (diagnostics-dependencies-check))))) (bin-var (and pkg (find-symbol "*DIAGNOSTICS-BINARIES*" pkg))))
(when bin-var
(setf (symbol-value bin-var) '("non-existent-binary-123"))
(is (null (diagnostics-dependencies-check))))))
(test test-diagnostics-env-fail (test test-diagnostics-env-fail
"Contract 2: diagnostics-env-check returns a boolean." "Contract 2: diagnostics-env-check returns a boolean."
@@ -274,8 +277,11 @@ The doctor checks all supported LLM providers and detects local Ollama instances
(test test-diagnostics-dependency-success (test test-diagnostics-dependency-success
"Contract 1: all binaries present returns T." "Contract 1: all binaries present returns T."
(let ((passepartout::*diagnostics-binaries* '("ls"))) (let* ((pkg (find-package "PASSEPARTOUT.SKILLS.SYSTEM-DIAGNOSTICS"))
(is (eq t (diagnostics-dependencies-check))))) (bin-var (and pkg (find-symbol "*DIAGNOSTICS-BINARIES*" pkg))))
(when bin-var
(setf (symbol-value bin-var) '("ls"))
(is (eq t (diagnostics-dependencies-check))))))
#+end_src #+end_src
* Phase E: Lifecycle * Phase E: Lifecycle