diff options
| author | Craig Jennings <c@cjennings.net> | 2026-05-31 07:10:33 -0500 |
|---|---|---|
| committer | Craig Jennings <c@cjennings.net> | 2026-05-31 07:10:33 -0500 |
| commit | 394c75b2f92e2a72390b3417e483849bed13a399 (patch) | |
| tree | a5b92603ecb049381015fb7556f25dcf74fa6c21 /tests/test-pearl-fields.el | |
| parent | 4767d16423ff5c87cf1222603c7b8f1b59af8ef2 (diff) | |
| download | pearl-394c75b2f92e2a72390b3417e483849bed13a399.tar.gz pearl-394c75b2f92e2a72390b3417e483849bed13a399.zip | |
feat(accounts): multi-account support with tests
I added a named-account layer for working more than one Linear workspace from one Emacs.
Before this, everything that identified a workspace was a single global: pearl-api-key, pearl-graphql-url, pearl-org-file-path, and the lookup caches. Nothing stopped a work command from running under personal credentials or a work fetch from landing in the personal file, and switching accounts meant re-customizing the key, team, and file by hand and clearing the cache.
pearl-accounts maps a name to a per-workspace plist (credential source, org file, default team, optional endpoint), and pearl-switch-account makes one active. Account state flows through an explicit context rather than mutating globals. Every request snapshots its account at dispatch through pearl--graphql-request-async and re-establishes it around the callbacks. A switch mid-fetch can't bleed into a request already in flight: the result finishes into the account it was dispatched under. I centralized this in the one request primitive, so the leak surface is a single function instead of every call site.
Rendered files carry a #+LINEAR-ACCOUNT marker, and a buffer guard refuses a command run from one account's file while another is active, naming both, so a work edit can't push under personal credentials. An unmarked legacy file lets reads and refreshes through and acquires its marker on the first refresh. Mutations wait until then. Credentials resolve through auth-source, an env var, or an inline literal, and a resolved key is never persisted through Customize or logged. The active account shows in the mode line. A saved query can carry an :account so it refuses to run under the wrong workspace before any lookup.
With pearl-accounts unset, everything behaves exactly as before, off the legacy globals.
Diffstat (limited to 'tests/test-pearl-fields.el')
0 files changed, 0 insertions, 0 deletions
