PSF: Stabilizing workspace after crash. Valid kernel/skill fixes.
This commit is contained in:
@@ -46,19 +46,24 @@ Interfaces for background verification and kernel alerting. Source of truth is t
|
||||
* Phase D: Build (Implementation)
|
||||
|
||||
** Test Execution
|
||||
#+begin_src lisp :tangle projects/org-skill-tdd-runner/src/runner-logic.lisp
|
||||
(defun tdd-runner-execute (project-name)
|
||||
#+begin_src lisp :tangle ../projects/org-skill-tdd-runner/src/runner-logic.lisp
|
||||
(defun run-tests-for-project (project-name)
|
||||
"Executes the standard test suite for the given project using SBCL."
|
||||
(let* ((projects-dir (or (uiop:getenv "PROJECTS_DIR") "projects/"))
|
||||
(test-dir (format nil "~aorg-skill-~a/tests/" projects-dir project-name))
|
||||
(lisp-tests (format nil "~atest-suite.lisp" test-dir))
|
||||
(python-tests (format nil "~asimulate_*.py" test-dir)))
|
||||
(kernel-log "CI - Running tests for ~a..." project-name)
|
||||
;; Mock execution: If it fails, send to the Scientist Agent
|
||||
(let ((failure-log "ERROR: Expected T but got NIL in test case 42."))
|
||||
(when failure-log
|
||||
(kernel-log "CI ERROR - Test failed in ~a. Pushing to Scientist Agent..." project-name)
|
||||
(org-agent:inject-stimulus
|
||||
`(:type :EVENT :payload (:sensor :test-failure :project ,project-name :text ,failure-log)))))))
|
||||
(project-dir (format nil "~aorg-skill-~a/" projects-dir project-name))
|
||||
(test-file (format nil "~atests/test-suite.lisp" project-dir)))
|
||||
(org-agent:kernel-log "CI - Running tests for ~a..." project-name)
|
||||
(if (uiop:file-exists-p test-file)
|
||||
(multiple-value-bind (output error-output exit-code)
|
||||
(uiop:run-program (list "sbcl" "--batch" "--load" test-file "--eval" "(uiop:quit)")
|
||||
:ignore-error-status t :output :string :error-output :string)
|
||||
(if (= exit-code 0)
|
||||
(org-agent:kernel-log "CI SUCCESS - ~a passed all tests." project-name)
|
||||
(progn
|
||||
(org-agent:kernel-log "CI FAILURE - ~a failed tests with exit code ~a" project-name exit-code)
|
||||
(org-agent:inject-stimulus
|
||||
`(:type :EVENT :payload (:sensor :test-failure :project ,project-name :text ,output :stderr ,error-output))))))
|
||||
(org-agent:kernel-log "CI ERROR - No test suite found for ~a at ~a" project-name test-file))))
|
||||
#+end_src
|
||||
|
||||
* Registration
|
||||
@@ -75,5 +80,7 @@ Interfaces for background verification and kernel alerting. Source of truth is t
|
||||
(let ((parts (uiop:split-string file :separator '(#\/))))
|
||||
(when (> (length parts) 2)
|
||||
;; The project name is typically the directory after "projects/"
|
||||
(tdd-runner-execute (nth 1 (member "projects" parts :test #'string=)))))))))
|
||||
(let ((dir (nth 1 (member "projects" parts :test #'string=))))
|
||||
(when (and dir (uiop:string-prefix-p "org-skill-" dir))
|
||||
(run-tests-for-project (subseq dir 10))))))))))
|
||||
#+end_src
|
||||
|
||||
Reference in New Issue
Block a user