<feed xmlns='http://www.w3.org/2005/Atom'>
<title>dotemacs/tests/test-ai-config-helpers.el, branch load-graph-classify-start</title>
<subtitle>My Emacs configuration
</subtitle>
<id>https://git.cjennings.net/dotemacs/atom?h=load-graph-classify-start</id>
<link rel='self' href='https://git.cjennings.net/dotemacs/atom?h=load-graph-classify-start'/>
<link rel='alternate' type='text/html' href='https://git.cjennings.net/dotemacs/'/>
<updated>2026-05-13T23:22:54+00:00</updated>
<entry>
<title>test(ai-config): cover auth-source, api-key caching, context, clear-buffer</title>
<updated>2026-05-13T23:22:54+00:00</updated>
<author>
<name>Craig Jennings</name>
<email>c@cjennings.net</email>
</author>
<published>2026-05-13T23:22:54+00:00</published>
<link rel='alternate' type='text/html' href='https://git.cjennings.net/dotemacs/commit/?id=0d5a28d8f8b12332a132005fcf4ef4e2a86f8904'/>
<id>urn:sha1:0d5a28d8f8b12332a132005fcf4ef4e2a86f8904</id>
<content type='text'>
The big-module coverage push starts with ai-config (was 53/191, 27.7%). New test file covers seven helpers that don't depend on a live gptel install:

- `cj/auth-source-secret`: returns string secrets, funcall's function secrets, errors on missing.
- `cj/anthropic-api-key` / `cj/openai-api-key`: cache the result so subsequent calls don't re-hit auth-source.
- `cj/gptel--add-file-to-context`: adds existing files, skips nil and missing paths.
- `cj/gptel-clear-buffer`: erases in a gptel-org buffer and reinserts the fresh prefix; no-ops + messages elsewhere.
- `cj/gptel-context-clear`: three cond branches (`remove-all`, `clear`, alist-fallback) with appropriate `fboundp` stubs.
- `cj/gptel-insert-model-heading`: inserts at the response-begin position with the backend/model heading.

External primitives (`auth-source-search`, `gptel-add-file`, `gptel-context-remove-all`, etc.) are stubbed. The fallback test declares `gptel-context--alist` as a top-level `defvar` so `setq` inside the function reaches the dynamic binding under lexical scoping.
</content>
</entry>
</feed>
