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-org-parse.el | 35 ++++++----------------------------- 1 file changed, 6 insertions(+), 29 deletions(-) (limited to 'tests/test-pearl-org-parse.el') diff --git a/tests/test-pearl-org-parse.el b/tests/test-pearl-org-parse.el index 87f4a02..e0bb967 100644 --- a/tests/test-pearl-org-parse.el +++ b/tests/test-pearl-org-parse.el @@ -19,12 +19,10 @@ ;;; Commentary: -;; Tests for the org readers `pearl--extract-org-heading-properties' and -;; `pearl--process-heading-at-point'. The reader uses org APIs over the -;; LINEAR-* property drawer, so it works from anywhere in the entry, at any -;; heading depth, and is unbothered by body text or nested sub-entries. The one -;; network boundary reached during processing (`--update-issue-state-async') is -;; stubbed. +;; Tests for the org reader `pearl--extract-org-heading-properties'. It uses +;; org APIs over the LINEAR-* property drawer, so it works from anywhere in the +;; entry, at any heading depth, and is unbothered by body text or nested +;; sub-entries. ;;; Code: @@ -100,29 +98,8 @@ (goto-char (point-min)) (should (null (pearl--extract-org-heading-properties))))) -;;; process-heading-at-point - -(ert-deftest test-pearl-process-heading-updates-when-complete () - "A complete entry triggers an async state update with the mapped state." - (let ((captured nil)) - (cl-letf (((symbol-function 'pearl--update-issue-state-async) - (lambda (id state team) (setq captured (list id state team))))) - (test-pearl--in-org - "*** IN-PROGRESS x\n:PROPERTIES:\n:LINEAR-ID: i-1\n:LINEAR-IDENTIFIER: ENG-2\n:LINEAR-TEAM-ID: t-1\n:END:\n" - (re-search-forward "x") - (pearl--process-heading-at-point) - (should (equal '("i-1" "In Progress" "t-1") captured)))))) - -(ert-deftest test-pearl-process-heading-skips-without-team () - "An entry missing its team id makes no API call." - (let ((called nil)) - (cl-letf (((symbol-function 'pearl--update-issue-state-async) - (lambda (&rest _) (setq called t)))) - (test-pearl--in-org - "*** TODO x\n:PROPERTIES:\n:LINEAR-ID: i-1\n:LINEAR-IDENTIFIER: ENG-2\n:END:\n" - (re-search-forward "x") - (pearl--process-heading-at-point) - (should-not called))))) +;; process-heading-at-point (the org-sync per-heading state push) was removed +;; in save-model-v2; the extractor above is retained for the keyword-cycle save. ;;; render -> parse round trip -- cgit v1.2.3