tier3: contracts + tests for 12 remaining modules (all 39 files now have Contracts)
Some checks failed
Deploy (Gitea) / deploy (push) Failing after 3s

This commit is contained in:
2026-05-05 12:36:42 -04:00
parent dcb5a1f1a6
commit a34b598858
21 changed files with 474 additions and 39 deletions

View File

@@ -11,6 +11,14 @@ It opens a thin pipe to OpenRouter's /api/v1/models endpoint (no API key needed
Recommended models are curated per task slot — code generation needs different capabilities than casual chat or background summarization. The recommendations are not hardcoded provider hooks; they're hand-picked from the OpenRouter free tier as a sensible default. Users can override via the TUI config screen, which replaces the picked model IDs into their cascade.
** Contract
1. (model-explorer-recommend slot): returns a list of plists with
~:id~ and ~:name~ for the given task slot (~:code~, ~:chat~,
~:plan~, ~:background~). Unknown slots return a fallback list.
2. (model-explorer-fetch provider): fetches the model list from the
provider's API and caches it. Returns nil on failure.
* Implementation
** Cache
@@ -120,26 +128,26 @@ Recommended models are curated per task slot — code generation needs different
(fiveam:in-suite model-explorer-suite)
(fiveam:test model-explorer-recommend-slots
"model-explorer-recommend should return models for all standard slots"
"Contract 1: recommend returns models for all standard slots."
(dolist (slot '(:code :chat :plan :background))
(let ((recs (passepartout::model-explorer-recommend slot)))
(fiveam:is (listp recs))
(fiveam:is (>= (length recs) 1)))))
(fiveam:test model-explorer-recommend-format
"Each recommendation should have :id and :name"
"Contract 1: each recommendation has :id and :name."
(dolist (rec (passepartout::model-explorer-recommend :chat))
(fiveam:is (getf rec :id))
(fiveam:is (getf rec :name))))
(fiveam:test model-explorer-recommend-unknown-slot
"Unknown slot should return fallback"
"Contract 1: unknown slot returns fallback list."
(let ((recs (passepartout::model-explorer-recommend :unknown)))
(fiveam:is (listp recs))
(fiveam:is (>= (length recs) 1))))
(fiveam:test model-explorer-fetch-openrouter-count
"OpenRouter API should return at least 300 models"
"Contract 2: OpenRouter API returns at least 300 models."
(let ((models (passepartout::model-explorer-fetch :openrouter)))
(if models
(fiveam:is (>= (length models) 300))