From 648893bd6ff5f4c403733d03258dbf3e91f2394b Mon Sep 17 00:00:00 2001 From: Craig Jennings Date: Mon, 25 May 2026 19:48:39 -0500 Subject: feat(save): detect dirty structured fields against synced baselines MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The save scan now flags priority, state, assignee, and labels as dirty when their live value differs from the synced baseline, so structured fields ride the same reconcile-at-save path as title and description. Each check is id/scalar-only and runs with no network: the priority cookie's number against LINEAR-PRIORITY, the explicit state id against LINEAR-STATE-ID-SYNCED (the picker arm — keyword cycling lands later), the assignee id against its baseline, and the label id set against its baseline (order-insensitive, since Linear label order isn't meaningful). A missing baseline on a legacy file reads as not-dirty; the saver's missing-property guard covers that edge. This also makes the priority cookie faithful. The renderer mapped both None and Medium to [#C], so a None issue couldn't be told apart from a Medium one and would have read dirty the moment its baseline said 0. None now renders with no cookie, 1:1 with the four cookie levels — matching what the priority setter already did. --- tests/test-pearl-mapping.el | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'tests/test-pearl-mapping.el') diff --git a/tests/test-pearl-mapping.el b/tests/test-pearl-mapping.el index a4e02e7..d9854cb 100644 --- a/tests/test-pearl-mapping.el +++ b/tests/test-pearl-mapping.el @@ -106,14 +106,14 @@ outlive a change to `pearl-state-to-todo-mapping'." (should (string-equal "[#C]" (pearl--map-linear-priority-to-org 3))) (should (string-equal "[#D]" (pearl--map-linear-priority-to-org 4)))) -(ert-deftest test-pearl-map-linear-priority-to-org-zero-defaults-c () - "Priority 0 (No priority) falls back to [#C]." - (should (string-equal "[#C]" (pearl--map-linear-priority-to-org 0)))) - -(ert-deftest test-pearl-map-linear-priority-to-org-nil-and-unknown-default-c () - "A nil or out-of-range priority falls back to [#C]." - (should (string-equal "[#C]" (pearl--map-linear-priority-to-org nil))) - (should (string-equal "[#C]" (pearl--map-linear-priority-to-org 99)))) +(ert-deftest test-pearl-map-linear-priority-to-org-none-no-cookie () + "Priority 0 (No priority) maps to no cookie, distinct from Medium's [#C]." + (should (string-equal "" (pearl--map-linear-priority-to-org 0)))) + +(ert-deftest test-pearl-map-linear-priority-to-org-nil-and-unknown-no-cookie () + "A nil or out-of-range priority maps to no cookie." + (should (string-equal "" (pearl--map-linear-priority-to-org nil))) + (should (string-equal "" (pearl--map-linear-priority-to-org 99)))) ;;; pearl--get-linear-priority-name -- cgit v1.2.3