74 lines
3.0 KiB
Org Mode
74 lines
3.0 KiB
Org Mode
#+TITLE: SKILL: Automated TDD Runner (Universal Literate Note)
|
|
#+ID: skill-tdd-runner
|
|
#+STARTUP: content
|
|
#+FILETAGS: :tdd:ci:verification:safety:psf:
|
|
|
|
* Overview
|
|
The **Automated TDD Runner** provides the system with Continuous Integration (CI) capabilities. It monitors active project directories and autonomously executes test suites whenever a file change is detected, ensuring that the kernel remains in a "Green" (verified) state.
|
|
|
|
* Phase A: Demand (PRD)
|
|
:PROPERTIES:
|
|
:STATUS: FROZEN
|
|
:END:
|
|
|
|
** 1. Purpose
|
|
Define automated behaviors for background test execution and regression alerting.
|
|
|
|
** 2. User Needs
|
|
- **Background Execution:** Run `FiveAM` (Lisp) or `pytest` (Python) suites without user intervention.
|
|
- **Trigger on Perception:** Execute tests whenever a `:buffer-update` or `:file-saved` event occurs.
|
|
- **Immediate Alerting:** Inject a high-priority `:EVENT` into the kernel if a test fails.
|
|
- **System Locking:** Option to prevent further actions if the project is in a "RED" (failing) state.
|
|
|
|
** 3. Success Criteria
|
|
*** TODO Automatic test suite discovery logic verification
|
|
*** TODO Background execution of FiveAM test suite
|
|
*** TODO Regression event injection on failure
|
|
*** TODO Integration with the Self-Fix agent
|
|
|
|
* Phase B: Blueprint (PROTOCOL)
|
|
:PROPERTIES:
|
|
:STATUS: SIGNED
|
|
:END:
|
|
|
|
** 1. Architectural Intent
|
|
Interfaces for background verification and kernel alerting. Source of truth is the project's `tests/` directory and the result of the test runner.
|
|
|
|
** 2. Semantic Interfaces
|
|
#+begin_src lisp
|
|
(defun tdd-runner-perceive-change (project-name)
|
|
"Triggered when a project file is modified; initiates the test loop.")
|
|
|
|
(defun tdd-runner-execute (project-name)
|
|
"Executes the standard test suite for the given project.")
|
|
#+end_src
|
|
|
|
* 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)
|
|
(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)
|
|
;; Logic to execute based on available test files
|
|
(if (uiop:file-exists-p lisp-tests)
|
|
(format nil "Executing FiveAM for ~a" project-name)
|
|
(format nil "Executing Python simulation for ~a" project-name))))
|
|
#+end_src
|
|
|
|
* Registration
|
|
#+begin_src lisp
|
|
(defskill :skill-tdd-runner
|
|
:priority 95 ; High priority safety gate
|
|
:trigger (lambda (context) (eq (getf (getf context :payload) :sensor) :buffer-update))
|
|
:neuro (lambda (context) nil)
|
|
:symbolic (lambda (action context)
|
|
(let ((file (getf (getf context :payload) :file)))
|
|
(when (and file (search "projects/" file))
|
|
;; Extract project name and run tests
|
|
(tdd-runner-execute "extracted-project-name")))))
|
|
#+end_src
|