From 1de0623168d13c51fb9a7c8a87f89030642ae4d0 Mon Sep 17 00:00:00 2001 From: Craig Jennings Date: Mon, 25 May 2026 21:30:34 -0500 Subject: refactor(save): remove the immediate-state-push org-sync machinery MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The opt-in org-sync mode pushed Linear state immediately — on every TODO-keyword cycle (the org-after-todo-state-change hook) and on every buffer save (the after-save hook scanning the whole file). That's the last immediate-push path, and it contradicts the one-write-path model the rest of v2 builds, so I removed it: pearl-enable-org-sync / -disable-org-sync, pearl-org-hook-function, pearl-sync-org-to-linear, pearl-sync-current-heading-to-linear, and the now-orphaned pearl--process-heading-at-point, pearl--map-org-state-to-linear, and pearl--update-issue-state-async. This finishes the "make org-sync private" task — there was nothing left to make private. Cycling a TODO keyword now marks state dirty (reconciled at the next save) instead of pushing. Saving the buffer pushes nothing. Re-introducing an auto-push on save is the separate "Automatic sync on save" task, which would call the save engine rather than this whole-file scanner. I kept pearl--extract-org-heading-properties and pearl--get-todo-states-pattern. They're general heading/keyword readers, not org-sync-specific, and the keyword-cycle save (the keyword-derivation follow-up) needs exactly them. The obsolete sync tests are replaced by two that assert the contract: the sync commands are gone, and a keyword cycle pushes nothing. --- tests/test-pearl-mapping.el | 20 ++++---------------- 1 file changed, 4 insertions(+), 16 deletions(-) (limited to 'tests/test-pearl-mapping.el') diff --git a/tests/test-pearl-mapping.el b/tests/test-pearl-mapping.el index 17eff82..2a96163 100644 --- a/tests/test-pearl-mapping.el +++ b/tests/test-pearl-mapping.el @@ -54,22 +54,10 @@ (test-pearl--with-mapping '(("Todo" . "TODO")) (should (string-equal "TODO" (pearl--map-linear-state-to-org nil))))) -;;; pearl--map-org-state-to-linear - -(ert-deftest test-pearl-map-org-state-to-linear-mapped-returns-state () - "An org keyword present in the mapping returns its Linear state." - (test-pearl--with-mapping '(("Todo" . "TODO") ("In Progress" . "DOING")) - (should (string-equal "In Progress" (pearl--map-org-state-to-linear "DOING"))))) - -(ert-deftest test-pearl-map-org-state-to-linear-unmapped-returns-nil () - "An org keyword not in the mapping returns nil." - (test-pearl--with-mapping '(("Todo" . "TODO") ("Done" . "DONE")) - (should (null (pearl--map-org-state-to-linear "WAITING"))))) - -(ert-deftest test-pearl-map-org-state-to-linear-nil-returns-nil () - "A nil org keyword returns nil." - (test-pearl--with-mapping '(("Todo" . "TODO")) - (should (null (pearl--map-org-state-to-linear nil))))) +;; pearl--map-org-state-to-linear (the keyword->state reverse map) was removed +;; with the org-sync push path in save-model-v2; the keyword-cycle save will +;; resolve through the team's states (the keyword-derivation task), not a flat +;; reverse mapping. ;;; pearl--get-todo-states-pattern -- cgit v1.2.3