fix(chaos): use robust emacs-lisp tangle paths to ensure correct artifact placement

This commit is contained in:
2026-04-28 17:48:11 -04:00
parent e8a3980fb4
commit aee1c9fa36
2 changed files with 33 additions and 33 deletions

View File

@@ -9,7 +9,7 @@ The *System Manifest* defines the structural components of the OpenCortex. It se
* Implementation * Implementation
** Main System ** Main System
#+begin_src lisp :tangle (expand-file-name "../opencortex.asd" (concat (or (getenv "INSTALL_DIR") ".") "/harness")) #+begin_src lisp :tangle (expand-file-name "../opencortex.asd" (concat (or (identity (getenv "INSTALL_DIR")) ".") "/harness"))
(defsystem :opencortex (defsystem :opencortex
:name "opencortex" :name "opencortex"
:author "Amr Gharbeia" :author "Amr Gharbeia"
@@ -31,7 +31,7 @@ The *System Manifest* defines the structural components of the OpenCortex. It se
#+end_src #+end_src
** Test System ** Test System
#+begin_src lisp :tangle (expand-file-name "../opencortex.asd" (concat (or (getenv "INSTALL_DIR") ".") "/harness")) #+begin_src lisp :tangle (expand-file-name "../opencortex.asd" (concat (or (identity (getenv "INSTALL_DIR")) ".") "/harness"))
(defsystem :opencortex/tests (defsystem :opencortex/tests
:depends-on (:opencortex :fiveam) :depends-on (:opencortex :fiveam)
:components ((:file "tests/pipeline-act-tests") :components ((:file "tests/pipeline-act-tests")
@@ -55,14 +55,14 @@ The *System Manifest* defines the structural components of the OpenCortex. It se
#+end_src #+end_src
** TUI System ** TUI System
#+begin_src lisp :tangle (expand-file-name "../opencortex.asd" (concat (or (getenv "INSTALL_DIR") ".") "/harness")) #+begin_src lisp :tangle (expand-file-name "../opencortex.asd" (concat (or (identity (getenv "INSTALL_DIR")) ".") "/harness"))
(defsystem :opencortex/tui (defsystem :opencortex/tui
:depends-on (:opencortex :croatoan :usocket :bordeaux-threads) :depends-on (:opencortex :croatoan :usocket :bordeaux-threads)
:components ((:file "harness/tui-client"))) :components ((:file "harness/tui-client")))
#+end_src #+end_src
** Test Orchestrator ** Test Orchestrator
#+begin_src lisp :tangle (expand-file-name "run-all-tests.lisp" (concat (or (getenv "INSTALL_DIR") ".") "/harness")) #+begin_src lisp :tangle (expand-file-name "run-all-tests.lisp" (concat (or (identity (getenv "INSTALL_DIR")) ".") "/harness"))
(load (merge-pathnames "quicklisp/setup.lisp" (user-homedir-pathname))) (load (merge-pathnames "quicklisp/setup.lisp" (user-homedir-pathname)))
(let ((oc-dir (or (uiop:getenv "OC_DATA_DIR") (let ((oc-dir (or (uiop:getenv "OC_DATA_DIR")

View File

@@ -1,4 +1,4 @@
#+PROPERTY: header-args:lisp :tangle (expand-file-name "tui-client.lisp" (concat (or (uiop:getenv "INSTALL_DIR") ".") "/harness")) #+PROPERTY: header-args:lisp :tangle (expand-file-name "tui-client.lisp" (concat (or (identity (getenv "INSTALL_DIR")) ".") "/harness"))
:PROPERTIES: :PROPERTIES:
:ID: tui-client-spec :ID: tui-client-spec
:CREATED: [2026-04-17 Fri 11:00] :CREATED: [2026-04-17 Fri 11:00]
@@ -22,26 +22,26 @@ A simple MVP console is insufficient for a Lisp Machine. To reach v0.2.0, the TU
* Phase B: Protocol (Success Criteria) * Phase B: Protocol (Success Criteria)
** Test Suite Context ** Test Suite Context
#+begin_src lisp :tangle (expand-file-name "tui-tests.lisp" (concat (or (getenv "INSTALL_DIR") ".") "/tests")) #+begin_src lisp :tangle (expand-file-name "tui-tests.lisp" (concat (or (identity (getenv "INSTALL_DIR")) ".") "/tests"))
(defpackage :opencortex-tui-tests (defpackage :opencortex-tui-tests
(:use :cl :fiveam :opencortex) (:use :cl :fiveam :opencortex)
(:export #:tui-suite)) (:export #:tui-suite))
#+end_src #+end_src
#+begin_src lisp :tangle (expand-file-name "tui-tests.lisp" (concat (or (getenv "INSTALL_DIR") ".") "/tests")) #+begin_src lisp :tangle (expand-file-name "tui-tests.lisp" (concat (or (identity (getenv "INSTALL_DIR")) ".") "/tests"))
(in-package :opencortex-tui-tests) (in-package :opencortex-tui-tests)
#+end_src #+end_src
#+begin_src lisp :tangle (expand-file-name "tui-tests.lisp" (concat (or (getenv "INSTALL_DIR") ".") "/tests")) #+begin_src lisp :tangle (expand-file-name "tui-tests.lisp" (concat (or (identity (getenv "INSTALL_DIR")) ".") "/tests"))
(def-suite tui-suite :description "Verification of the TUI parsing and styling logic") (def-suite tui-suite :description "Verification of the TUI parsing and styling logic")
#+end_src #+end_src
#+begin_src lisp :tangle (expand-file-name "tui-tests.lisp" (concat (or (getenv "INSTALL_DIR") ".") "/tests")) #+begin_src lisp :tangle (expand-file-name "tui-tests.lisp" (concat (or (identity (getenv "INSTALL_DIR")) ".") "/tests"))
(in-suite tui-suite) (in-suite tui-suite)
#+end_src #+end_src
** Command Parsing Tests ** Command Parsing Tests
#+begin_src lisp :tangle (expand-file-name "tui-tests.lisp" (concat (or (getenv "INSTALL_DIR") ".") "/tests")) #+begin_src lisp :tangle (expand-file-name "tui-tests.lisp" (concat (or (identity (getenv "INSTALL_DIR")) ".") "/tests"))
(test test-tui-connection-drop (test test-tui-connection-drop
"Tier 2 Chaos: Verify that handle-return degrades gracefully when the daemon connection is lost." "Tier 2 Chaos: Verify that handle-return degrades gracefully when the daemon connection is lost."
(let ((opencortex.tui::*incoming-msgs* nil) (let ((opencortex.tui::*incoming-msgs* nil)
@@ -57,81 +57,81 @@ A simple MVP console is insufficient for a Lisp Machine. To reach v0.2.0, the TU
* Phase C: Implementation (Build) * Phase C: Implementation (Build)
** Package Context ** Package Context
#+begin_src lisp :tangle (expand-file-name "tui-client.lisp" (concat (or (uiop:getenv "INSTALL_DIR") ".") "/harness")) #+begin_src lisp :tangle (expand-file-name "tui-client.lisp" (concat (or (identity (getenv "INSTALL_DIR")) ".") "/harness"))
(in-package :cl-user) (in-package :cl-user)
#+end_src #+end_src
#+begin_src lisp :tangle (expand-file-name "tui-client.lisp" (concat (or (uiop:getenv "INSTALL_DIR") ".") "/harness")) #+begin_src lisp :tangle (expand-file-name "tui-client.lisp" (concat (or (identity (getenv "INSTALL_DIR")) ".") "/harness"))
(defpackage :opencortex.tui (defpackage :opencortex.tui
(:use :cl :croatoan) (:use :cl :croatoan)
(:export :main)) (:export :main))
#+end_src #+end_src
#+begin_src lisp :tangle (expand-file-name "tui-client.lisp" (concat (or (uiop:getenv "INSTALL_DIR") ".") "/harness")) #+begin_src lisp :tangle (expand-file-name "tui-client.lisp" (concat (or (identity (getenv "INSTALL_DIR")) ".") "/harness"))
(in-package :opencortex.tui) (in-package :opencortex.tui)
#+end_src #+end_src
** Global State ** Global State
#+begin_src lisp :tangle (expand-file-name "tui-client.lisp" (concat (or (uiop:getenv "INSTALL_DIR") ".") "/harness")) #+begin_src lisp :tangle (expand-file-name "tui-client.lisp" (concat (or (identity (getenv "INSTALL_DIR")) ".") "/harness"))
(defvar *daemon-host* "127.0.0.1") (defvar *daemon-host* "127.0.0.1")
#+end_src #+end_src
#+begin_src lisp :tangle (expand-file-name "tui-client.lisp" (concat (or (uiop:getenv "INSTALL_DIR") ".") "/harness")) #+begin_src lisp :tangle (expand-file-name "tui-client.lisp" (concat (or (identity (getenv "INSTALL_DIR")) ".") "/harness"))
(defvar *daemon-port* 9105) (defvar *daemon-port* 9105)
#+end_src #+end_src
#+begin_src lisp :tangle (expand-file-name "tui-client.lisp" (concat (or (uiop:getenv "INSTALL_DIR") ".") "/harness")) #+begin_src lisp :tangle (expand-file-name "tui-client.lisp" (concat (or (identity (getenv "INSTALL_DIR")) ".") "/harness"))
(defvar *socket* nil) (defvar *socket* nil)
#+end_src #+end_src
#+begin_src lisp :tangle (expand-file-name "tui-client.lisp" (concat (or (uiop:getenv "INSTALL_DIR") ".") "/harness")) #+begin_src lisp :tangle (expand-file-name "tui-client.lisp" (concat (or (identity (getenv "INSTALL_DIR")) ".") "/harness"))
(defvar *stream* nil) (defvar *stream* nil)
#+end_src #+end_src
#+begin_src lisp :tangle (expand-file-name "tui-client.lisp" (concat (or (uiop:getenv "INSTALL_DIR") ".") "/harness")) #+begin_src lisp :tangle (expand-file-name "tui-client.lisp" (concat (or (identity (getenv "INSTALL_DIR")) ".") "/harness"))
(defvar *chat-history* (list) "Full chronological log of messages.") (defvar *chat-history* (list) "Full chronological log of messages.")
#+end_src #+end_src
#+begin_src lisp :tangle (expand-file-name "tui-client.lisp" (concat (or (uiop:getenv "INSTALL_DIR") ".") "/harness")) #+begin_src lisp :tangle (expand-file-name "tui-client.lisp" (concat (or (identity (getenv "INSTALL_DIR")) ".") "/harness"))
(defvar *scroll-index* 0 "Offset for history rendering.") (defvar *scroll-index* 0 "Offset for history rendering.")
#+end_src #+end_src
#+begin_src lisp :tangle (expand-file-name "tui-client.lisp" (concat (or (uiop:getenv "INSTALL_DIR") ".") "/harness")) #+begin_src lisp :tangle (expand-file-name "tui-client.lisp" (concat (or (identity (getenv "INSTALL_DIR")) ".") "/harness"))
(defvar *status-text* "Connecting...") (defvar *status-text* "Connecting...")
#+end_src #+end_src
#+begin_src lisp :tangle (expand-file-name "tui-client.lisp" (concat (or (uiop:getenv "INSTALL_DIR") ".") "/harness")) #+begin_src lisp :tangle (expand-file-name "tui-client.lisp" (concat (or (identity (getenv "INSTALL_DIR")) ".") "/harness"))
(defvar *input-buffer* (make-array 0 :element-type 'char :fill-pointer 0 :adjustable t)) (defvar *input-buffer* (make-array 0 :element-type 'char :fill-pointer 0 :adjustable t))
#+end_src #+end_src
#+begin_src lisp :tangle (expand-file-name "tui-client.lisp" (concat (or (uiop:getenv "INSTALL_DIR") ".") "/harness")) #+begin_src lisp :tangle (expand-file-name "tui-client.lisp" (concat (or (identity (getenv "INSTALL_DIR")) ".") "/harness"))
(defvar *command-history* (make-array 0 :element-type 't :fill-pointer 0 :adjustable t)) (defvar *command-history* (make-array 0 :element-type 't :fill-pointer 0 :adjustable t))
#+end_src #+end_src
#+begin_src lisp :tangle (expand-file-name "tui-client.lisp" (concat (or (uiop:getenv "INSTALL_DIR") ".") "/harness")) #+begin_src lisp :tangle (expand-file-name "tui-client.lisp" (concat (or (identity (getenv "INSTALL_DIR")) ".") "/harness"))
(defvar *history-index* -1) (defvar *history-index* -1)
#+end_src #+end_src
#+begin_src lisp :tangle (expand-file-name "tui-client.lisp" (concat (or (uiop:getenv "INSTALL_DIR") ".") "/harness")) #+begin_src lisp :tangle (expand-file-name "tui-client.lisp" (concat (or (identity (getenv "INSTALL_DIR")) ".") "/harness"))
(defvar *is-running* t) (defvar *is-running* t)
#+end_src #+end_src
#+begin_src lisp :tangle (expand-file-name "tui-client.lisp" (concat (or (uiop:getenv "INSTALL_DIR") ".") "/harness")) #+begin_src lisp :tangle (expand-file-name "tui-client.lisp" (concat (or (identity (getenv "INSTALL_DIR")) ".") "/harness"))
(defvar *queue-lock* (bt:make-lock)) (defvar *queue-lock* (bt:make-lock))
#+end_src #+end_src
#+begin_src lisp :tangle (expand-file-name "tui-client.lisp" (concat (or (uiop:getenv "INSTALL_DIR") ".") "/harness")) #+begin_src lisp :tangle (expand-file-name "tui-client.lisp" (concat (or (identity (getenv "INSTALL_DIR")) ".") "/harness"))
(defvar *incoming-msgs* nil) (defvar *incoming-msgs* nil)
#+end_src #+end_src
** Utilities ** Utilities
#+begin_src lisp :tangle (expand-file-name "tui-client.lisp" (concat (or (uiop:getenv "INSTALL_DIR") ".") "/harness")) #+begin_src lisp :tangle (expand-file-name "tui-client.lisp" (concat (or (identity (getenv "INSTALL_DIR")) ".") "/harness"))
(defun enqueue-msg (msg) (defun enqueue-msg (msg)
"Thread-safe addition to incoming message queue." "Thread-safe addition to incoming message queue."
(bt:with-lock-held (*queue-lock*) (bt:with-lock-held (*queue-lock*)
(setf *incoming-msgs* (append *incoming-msgs* (list msg))))) (setf *incoming-msgs* (append *incoming-msgs* (list msg)))))
#+begin_src lisp :tangle (expand-file-name "tui-client.lisp" (concat (or (uiop:getenv "INSTALL_DIR") ".") "/harness")) #+begin_src lisp :tangle (expand-file-name "tui-client.lisp" (concat (or (identity (getenv "INSTALL_DIR")) ".") "/harness"))
(defun dequeue-msgs () (defun dequeue-msgs ()
"Thread-safe retrieval of incoming messages." "Thread-safe retrieval of incoming messages."
(bt:with-lock-held (*queue-lock*) (bt:with-lock-held (*queue-lock*)
@@ -142,7 +142,7 @@ A simple MVP console is insufficient for a Lisp Machine. To reach v0.2.0, the TU
#+end_src #+end_src
** Styling Engine ** Styling Engine
#+begin_src lisp :tangle (expand-file-name "tui-client.lisp" (concat (or (uiop:getenv "INSTALL_DIR") ".") "/harness")) #+begin_src lisp :tangle (expand-file-name "tui-client.lisp" (concat (or (identity (getenv "INSTALL_DIR")) ".") "/harness"))
(defun get-line-style (text) (defun get-line-style (text)
"Determines croatoan attributes based on content patterns." "Determines croatoan attributes based on content patterns."
(cond (cond
@@ -154,7 +154,7 @@ A simple MVP console is insufficient for a Lisp Machine. To reach v0.2.0, the TU
#+end_src #+end_src
** Rendering Orchestrator ** Rendering Orchestrator
#+begin_src lisp :tangle (expand-file-name "tui-client.lisp" (concat (or (uiop:getenv "INSTALL_DIR") ".") "/harness")) #+begin_src lisp :tangle (expand-file-name "tui-client.lisp" (concat (or (identity (getenv "INSTALL_DIR")) ".") "/harness"))
(defun render-chat (win) (defun render-chat (win)
"Renders the chat history with scrolling and styling." "Renders the chat history with scrolling and styling."
(clear win) (clear win)
@@ -172,14 +172,14 @@ A simple MVP console is insufficient for a Lisp Machine. To reach v0.2.0, the TU
#+end_src #+end_src
** Input Handling ** Input Handling
#+begin_src lisp :tangle (expand-file-name "tui-client.lisp" (concat (or (uiop:getenv "INSTALL_DIR") ".") "/harness")) #+begin_src lisp :tangle (expand-file-name "tui-client.lisp" (concat (or (identity (getenv "INSTALL_DIR")) ".") "/harness"))
(defun handle-backspace () (defun handle-backspace ()
"Deletes last character from input buffer." "Deletes last character from input buffer."
(when (> (fill-pointer *input-buffer*) 0) (when (> (fill-pointer *input-buffer*) 0)
(decf (fill-pointer *input-buffer*)))) (decf (fill-pointer *input-buffer*))))
#+end_src #+end_src
#+begin_src lisp :tangle (expand-file-name "tui-client.lisp" (concat (or (uiop:getenv "INSTALL_DIR") ".") "/harness")) #+begin_src lisp :tangle (expand-file-name "tui-client.lisp" (concat (or (identity (getenv "INSTALL_DIR")) ".") "/harness"))
(defun handle-return (stream) (defun handle-return (stream)
"Process input buffer as message or command." "Process input buffer as message or command."
(let ((cmd (coerce *input-buffer* 'string))) (let ((cmd (coerce *input-buffer* 'string)))
@@ -200,7 +200,7 @@ A simple MVP console is insufficient for a Lisp Machine. To reach v0.2.0, the TU
#+end_src #+end_src
** Main Entry Point ** Main Entry Point
#+begin_src lisp :tangle (expand-file-name "tui-client.lisp" (concat (or (uiop:getenv "INSTALL_DIR") ".") "/harness")) #+begin_src lisp :tangle (expand-file-name "tui-client.lisp" (concat (or (identity (getenv "INSTALL_DIR")) ".") "/harness"))
(defun main () (defun main ()
"Initializes ncurses and starts the TUI event loop." "Initializes ncurses and starts the TUI event loop."
(handler-case (handler-case