diff options
| author | Craig Jennings <c@cjennings.net> | 2026-05-25 21:22:27 -0500 |
|---|---|---|
| committer | Craig Jennings <c@cjennings.net> | 2026-05-25 21:22:27 -0500 |
| commit | 60b51e1c996f1c8f152696946b9440f26ea9a956 (patch) | |
| tree | 3154332cc2b7d5bb3e0eb71a812d9effc8c46633 /tests/test-pearl-bugfixes.el | |
| parent | f9841539b3adb192d0c15470fa9c31d6cbbdf447 (diff) | |
| download | pearl-60b51e1c996f1c8f152696946b9440f26ea9a956.tar.gz pearl-60b51e1c996f1c8f152696946b9440f26ea9a956.zip | |
refactor(save): retire the immediate-push field setters for buffer-editors
The structured fields now reconcile at save (the previous commits), so the immediate-push setters are the duplicate path that made the package feel like it had two save models. I retired them. pearl-set-priority is deleted outright — priority is edited org-natively through the heading cookie. pearl-set-state, pearl-set-assignee, and pearl-set-labels become pearl-edit-state / -assignee / -labels: the same completing-read picker, but it writes the buffer representation (keyword/name/id, the assignee drawer, the labels drawer plus the live LINEAR-LABEL-IDS set) and marks the field dirty instead of pushing. The change goes out at the next pearl-save-issue / pearl-save-all. pearl-compose-current-description is renamed pearl-edit-description (its compose-and-push behavior is unchanged — v2 doesn't touch the compose buffers).
The transient, the C-; L e keymap, the affordance preamble, and the README follow the new names, and the priority slots are dropped (no command — it's the org cookie). Deleting the setters left pearl--push-issue-field and pearl--priority-choices with no callers, so both are gone, along with the killed-buffer test that only exercised the removed helper. I filed a follow-up: the atomic savers' async commit callbacks need the same killed-buffer guard that helper carried.
The setter command tests are rewritten to assert the buffer-write-and-no-push contract. The reconcile-and-push path they used to cover is exercised in test-pearl-save.
Diffstat (limited to 'tests/test-pearl-bugfixes.el')
| -rw-r--r-- | tests/test-pearl-bugfixes.el | 25 |
1 files changed, 0 insertions, 25 deletions
diff --git a/tests/test-pearl-bugfixes.el b/tests/test-pearl-bugfixes.el index caab884..7f5c635 100644 --- a/tests/test-pearl-bugfixes.el +++ b/tests/test-pearl-bugfixes.el @@ -151,30 +151,5 @@ (should-error (pearl-run-saved-query "bad") :type 'user-error) (should-not fetched)))) -;;; Bug: async issue callbacks must be harmless if the buffer is killed - -(ert-deftest test-pearl-push-issue-field-killed-buffer-no-signal () - "A field push whose buffer is killed before the success callback does not signal." - (let ((buf (generate-new-buffer "pearl-pif-kill"))) - (unwind-protect - (let (marker) - (with-current-buffer buf - (insert "* h\n:PROPERTIES:\n:LINEAR-ID: a\n:END:\nbody\n") - (org-mode) - (goto-char (point-min)) - (setq marker (point-marker))) - ;; The update stub kills the buffer, then reports success; the success - ;; callback must not run its buffer ops (or signal) on a dead buffer. - (cl-letf (((symbol-function 'pearl--update-issue-async) - (lambda (_id _fields cb) (kill-buffer buf) (funcall cb '(:success t))))) - ;; Must complete without signaling; the on-success thunk (which would - ;; error) must not run because the buffer is dead. - (pearl--push-issue-field - "a" marker '(("priority" . 2)) - (lambda () (error "on-success must not run against a dead buffer")) - "ok" "fail") - (should-not (buffer-live-p buf)))) - (when (buffer-live-p buf) (kill-buffer buf))))) - (provide 'test-pearl-bugfixes) ;;; test-pearl-bugfixes.el ends here |
