From 7dad50910fa865a208e11a475ccf644f706f012f Mon Sep 17 00:00:00 2001 From: Amr Gharbeia Date: Sun, 3 May 2026 20:28:10 -0400 Subject: [PATCH] fix: proto-get case-insensitive keyword lookup proto-get was using getf which does eq comparison, so :EXPLANATION from the LLM response didn't match :explanation in the policy gate. Now iterates the plist and compares uppercased strings. --- lisp/core-communication.lisp | 8 ++++++-- org/core-communication.org | 8 ++++++-- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/lisp/core-communication.lisp b/lisp/core-communication.lisp index 2f9a58f..acc5485 100644 --- a/lisp/core-communication.lisp +++ b/lisp/core-communication.lisp @@ -1,8 +1,12 @@ (in-package :passepartout) (defun proto-get (plist key) - "Look up KEY in PLIST with keyword normalization." - (getf plist (if (keywordp key) key (intern (string-upcase (string key)) :keyword)))) + "Look up KEY in PLIST with case-insensitive keyword normalization." + (let ((key-upcase (string-upcase (string key)))) + (loop for (k v) on plist by #'cddr + when (and (keywordp k) + (string-equal (string k) key-upcase)) + do (return v)))) (defvar *actuator-registry* (make-hash-table :test 'equalp) "Global registry mapping target keywords to their physical actuator functions.") diff --git a/org/core-communication.org b/org/core-communication.org index 477dbda..1bdaade 100644 --- a/org/core-communication.org +++ b/org/core-communication.org @@ -44,8 +44,12 @@ Returns the value associated with KEY in PLIST by interning a keyword. ;; REPL-VERIFIED: 2026-05-03T13:00:00 #+begin_src lisp (defun proto-get (plist key) - "Look up KEY in PLIST with keyword normalization." - (getf plist (if (keywordp key) key (intern (string-upcase (string key)) :keyword)))) + "Look up KEY in PLIST with case-insensitive keyword normalization." + (let ((key-upcase (string-upcase (string key)))) + (loop for (k v) on plist by #'cddr + when (and (keywordp k) + (string-equal (string k) key-upcase)) + do (return v)))) #+end_src ** Actuator Registry