From dcfecf3e4f46c920eb77ca9b3169d0719fa0b9fd Mon Sep 17 00:00:00 2001 From: Craig Jennings Date: Wed, 27 May 2026 22:54:43 -0500 Subject: feat(sources): favorites, views, and filters via pick-source Pearl now treats Linear sources (favorites, custom views, ad-hoc filters, saved queries) as one surface. `pearl-pick-source` is the unified picker: it lists every Linear favorite alongside every locally saved query, and dispatches by kind. View / project / cycle / label / user favorites resolve to runnable filter or view sources; issue / document / dashboard favorites open in the browser since they aren't lists. The filter compiler grows id-based forms (`:label-id` and `:assignee-id`), so favorites that name a Linear entity (a user, a label) compile to rename-proof queries rather than fragile name matching. The ad-hoc builder gets a matching member-assignee option ("me / member / any"), so a one-off "what's a teammate working on?" doesn't require building a saved query first. Two pre-existing builder bugs surfaced during verify and got fixed in the same pass. The builder previously passed display names straight to the compiler, but `:team` compiles to `team.key.eq` and `:project` to `project.id.eq`, so Linear rejected every builder run that pinned a team or project. Now the builder resolves the picked name to its key / id before assembling. And `pearl-list-issues-by-project` previously injected `:assignee :me` into the filter, hiding every teammate's work in the project. It now returns the whole project. The save prompt on the builder was rewritten so the local-only nature is unambiguous, and the README grew a Sources section plus a keymap-table entry for `f s`. --- tests/test-pearl-filter.el | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'tests/test-pearl-filter.el') diff --git a/tests/test-pearl-filter.el b/tests/test-pearl-filter.el index 6143311..38d254e 100644 --- a/tests/test-pearl-filter.el +++ b/tests/test-pearl-filter.el @@ -189,5 +189,29 @@ "A non-string entry in :labels is a user-error." (should-error (pearl--validate-issue-filter '(:labels ("bug" 7))) :type 'user-error)) +;;; id-based forms (rename-proof; used by favorite-derived filter sources) + +(ert-deftest test-pearl-filter-assignee-id () + ":assignee-id compiles to assignee.id.eq -- rename-proof, used by user favorites." + (should (equal (pearl--build-issue-filter '(:assignee-id "u-1")) + '(("assignee" ("id" ("eq" . "u-1"))))))) + +(ert-deftest test-pearl-filter-label-id () + ":label-id compiles to labels.some.id.in [id] -- rename-proof, used by label favorites." + (should (equal (pearl--build-issue-filter '(:label-id "lbl-1")) + '(("labels" ("some" ("id" ("in" . ["lbl-1"])))))))) + +(ert-deftest test-pearl-filter-validate-rejects-empty-assignee-id () + "An empty :assignee-id is a user-error." + (should-error (pearl--validate-issue-filter '(:assignee-id "")) :type 'user-error)) + +(ert-deftest test-pearl-filter-validate-rejects-empty-label-id () + "An empty :label-id is a user-error." + (should-error (pearl--validate-issue-filter '(:label-id "")) :type 'user-error)) + +(ert-deftest test-pearl-filter-validate-rejects-unknown-id-key () + "An unknown key is still rejected (sanity that :label-id/:assignee-id were registered)." + (should-error (pearl--validate-issue-filter '(:not-a-key "x")) :type 'user-error)) + (provide 'test-pearl-filter) ;;; test-pearl-filter.el ends here -- cgit v1.2.3