From 8bae955521cdf3e2f8d5ff015b3ae36b5b8a75e8 Mon Sep 17 00:00:00 2001 From: Craig Jennings Date: Mon, 1 Jun 2026 23:40:11 -0500 Subject: feat(filter): :state accepts a list of state names I made :state polymorphic, mirroring :state-type. A string still compiles to state.name.eq. A list now compiles to state.name.in, so (:state ("Todo" "In Review")) matches issues in either state. The reverse-compile inverts state.name.in back to a scalar (one name) or a list (several), so copy-down no longer refuses a Linear view filtering on a set of named states. The validator accepts a string or a list of non-empty names, the same shape it already enforces for :labels, and a list-valued :state keeps its precedence over :state-type and :open. Phase 1 of docs/multi-state-filter-spec.org. Suite, compile, and lint green. --- tests/test-pearl-reverse-compile.el | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'tests/test-pearl-reverse-compile.el') diff --git a/tests/test-pearl-reverse-compile.el b/tests/test-pearl-reverse-compile.el index ec67391..382c72a 100644 --- a/tests/test-pearl-reverse-compile.el +++ b/tests/test-pearl-reverse-compile.el @@ -57,6 +57,24 @@ (ert-deftest test-pearl-rc-roundtrip-state-name () (test-pearl-rc--should-roundtrip '(:state "In Progress"))) +(ert-deftest test-pearl-rc-roundtrip-state-name-list () + "A multi-state :state round-trips (state.name.in with several names)." + (let ((r (test-pearl-rc--roundtrip '(:state ("Todo" "In Review"))))) + (should (eq 'ok (car r))) + (should (equal (cdr r) '(:state ("Todo" "In Review")))))) + +(ert-deftest test-pearl-rc-state-name-in-many-to-list () + "state.name.in with several names reverse-compiles to a list :state." + (should (equal (test-pearl-rc--from-json + "{\"state\":{\"name\":{\"in\":[\"Todo\",\"In Review\"]}}}") + '(ok :state ("Todo" "In Review"))))) + +(ert-deftest test-pearl-rc-state-name-in-one-to-scalar () + "state.name.in with one name normalizes to a scalar :state." + (should (equal (test-pearl-rc--from-json + "{\"state\":{\"name\":{\"in\":[\"Todo\"]}}}") + '(ok :state "Todo")))) + (ert-deftest test-pearl-rc-roundtrip-state-type-single () (let ((r (test-pearl-rc--roundtrip '(:state-type "started")))) (should (eq 'ok (car r))) -- cgit v1.2.3