docs: add Contract sections + tag tests to contract items (Tier 2 — 10 files)
Some checks failed
Deploy (Gitea) / deploy (push) Failing after 2s
Some checks failed
Deploy (Gitea) / deploy (push) Failing after 2s
This commit is contained in:
@@ -22,6 +22,16 @@ The Reason stage already ran every proposed action through the deterministic eng
|
||||
|
||||
Because a skill's deterministic gate runs during Reason, but between Reason and Act, the action might have been transformed by the pipeline (metadata added, format normalized). The last-mile verification catches any transformation that might have introduced an unsafe property. It's the same philosophy as "trust but verify" — the second check is cheap and catches a class of bugs that would otherwise be silent data corruption.
|
||||
|
||||
** Contract
|
||||
|
||||
1. (loop-gate-act signal): the final pipeline stage. Handles HITL
|
||||
~:approval-required~ (suspends action), runs last-mile
|
||||
~cognitive-verify~ on approved actions, dispatches via
|
||||
~action-dispatch~, sets ~:status :acted~, returns feedback.
|
||||
2. (act-gate signal): thin alias for ~loop-gate-act~.
|
||||
3. (action-dispatch approved signal): routes approved actions to
|
||||
registered actuators by ~:target~ keyword.
|
||||
|
||||
* Implementation
|
||||
|
||||
** Package Context
|
||||
@@ -289,6 +299,7 @@ Verifies that the act gate correctly processes an approved action and sets the s
|
||||
(in-suite pipeline-act-suite)
|
||||
|
||||
(test test-loop-gate-act-basic
|
||||
"Contract 1: approved action reaches :acted status via loop-gate-act."
|
||||
(clrhash passepartout::*skill-registry*)
|
||||
(let* ((signal (list :type :EVENT :status nil :depth 0 :approved-action '(:target :cli :payload (:text "Hello"))))
|
||||
(result (loop-gate-act signal)))
|
||||
@@ -296,14 +307,14 @@ Verifies that the act gate correctly processes an approved action and sets the s
|
||||
(is (null result))))
|
||||
|
||||
(test test-loop-gate-act-no-approved-action
|
||||
"When no approved-action is set, the signal should still reach :acted status."
|
||||
"Contract 1: signal with no approved-action still reaches :acted status."
|
||||
(clrhash passepartout::*skill-registry*)
|
||||
(let* ((signal (list :type :EVENT :status nil :depth 0)))
|
||||
(loop-gate-act signal)
|
||||
(is (eq :acted (getf signal :status)))))
|
||||
|
||||
(test test-loop-gate-act-last-mile-reject
|
||||
"When the last-mile cognitive-verify rejects with :LOG, status should not reach :acted."
|
||||
"Contract 1: last-mile cognitive-verify rejection blocks approved-action."
|
||||
(clrhash passepartout::*skill-registry*)
|
||||
(passepartout::defskill :mock-blocker
|
||||
:priority 50
|
||||
@@ -318,7 +329,7 @@ Verifies that the act gate correctly processes an approved action and sets the s
|
||||
(is (null (getf signal :approved-action)))))
|
||||
|
||||
(test test-loop-gate-act-preserves-meta
|
||||
"Signal metadata should not be mutated by the act gate."
|
||||
"Contract 1: signal metadata is not mutated by loop-gate-act."
|
||||
(clrhash passepartout::*skill-registry*)
|
||||
(let* ((meta '(:source :tui :session "s1"))
|
||||
(signal (list :type :EVENT :status nil :depth 0 :meta meta
|
||||
|
||||
Reference in New Issue
Block a user