Add quick_ideas skill and job for Quick dinners (Feature 18)
CI / ci (push) Successful in 5m36s
CI / ci (pull_request) Successful in 5m34s

quick_ideas v1 suggests Quick dinners of one kind, crockpot or under30,
from the household context, never returning a name already shown: the
exclude list is checked against normalized names with harness.Similar.
POST /api/v1/ideas/quick {kind, exclude[]} validates both fields (no
default kind) and answers 202 {jobId}; the quick_ideas job asks for 12
ideas, grounds them through the same GroundEach rounds as
ideas_from_ingredients and keeps up to 6 whose grounded recipe is of the
kind (crockpot: method crockpot; under30: minutes_total <= 30), so the
model's estimate never decides. Fewer survivors make a shorter page,
never a padded one.

The grounding loop, failure clearing and failed-result view are now
shared generic helpers used by both idea jobs rather than a second copy.

Maestro task 243a6812-f52b-4215-a4a2-8eb599914f7e.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-08 20:25:41 -04:00
co-authored by Claude Opus 5.5
parent 3c58e0c7f7
commit 290e3d3cd3
18 changed files with 1800 additions and 110 deletions
+21 -6
View File
@@ -16,6 +16,7 @@ import (
"code.cubecraftlabs.com/Maniacs_Mansion/Meal-Quest/internal/ai/harness"
"code.cubecraftlabs.com/Maniacs_Mansion/Meal-Quest/internal/ai/llm"
"code.cubecraftlabs.com/Maniacs_Mansion/Meal-Quest/internal/ai/skills"
"code.cubecraftlabs.com/Maniacs_Mansion/Meal-Quest/internal/household"
"code.cubecraftlabs.com/Maniacs_Mansion/Meal-Quest/internal/jobs"
"code.cubecraftlabs.com/Maniacs_Mansion/Meal-Quest/internal/recipes"
"code.cubecraftlabs.com/Maniacs_Mansion/Meal-Quest/internal/recipes/recipestest"
@@ -32,17 +33,21 @@ type env struct {
search *recipestest.Search
pages *recipestest.Pages
images *recipestest.Images
// model answers ideas_from_ingredients; normalize answers
// normalize_recipe while grounding.
// model answers ideas_from_ingredients and quick_ideas; normalize
// answers normalize_recipe while grounding.
model *llm.Fake
normalize *llm.Fake
// fail, when set, fails ideas_from_ingredients without a model call.
// fail, when set, fails ideas_from_ingredients and quick_ideas without
// a model call.
fail error
st *store.Store
}
// newEnv returns an ideas service over a migrated store and an unstarted
// newEnv returns an ideas service over a migrated store with the
// household's settings seeded and an unstarted
// job runner. It finds ideas through the real harness and
// ideas_from_ingredients with the scripted e.model, and grounds with fake
// ideas_from_ingredients or quick_ideas with the scripted e.model, and
// grounds with fake
// search, pages and images and the scripted e.normalize.
func newEnv(t *testing.T) *env {
t.Helper()
@@ -60,12 +65,16 @@ func newEnv(t *testing.T) *env {
if err := store.Migrate(ctx, st.Writer, migrations.FS); err != nil {
t.Fatal(err)
}
if err := household.SeedSettings(ctx, st, "America/New_York"); err != nil {
t.Fatal(err)
}
e := &env{
search: &recipestest.Search{Results: map[string][]recipes.Candidate{}},
pages: &recipestest.Pages{Bodies: map[string][]byte{}},
images: &recipestest.Images{JPEGs: map[string][]byte{}},
model: &llm.Fake{},
normalize: &llm.Fake{},
st: st,
}
g := recipestest.NewGrounder(t, st, dataDir, e.search, e.pages, e.images, e.normalize)
guard, err := harness.NewGuard(harness.DefaultMaxCalls)
@@ -84,12 +93,18 @@ func newEnv(t *testing.T) *env {
}
return skills.IdeasFromIngredients(ctx, cfg, scope, in)
}
quick := func(ctx context.Context, scope string, in skills.QuickIdeasRequest) (skills.QuickIdeaList, error) {
if e.fail != nil {
return skills.QuickIdeaList{}, e.fail
}
return skills.QuickIdeas(ctx, cfg, scope, in)
}
logger := slog.New(slog.NewTextHandler(io.Discard, nil))
e.runner, err = jobs.NewRunner(st, logger, 1)
if err != nil {
t.Fatal(err)
}
e.svc, err = NewService(g, generate, e.runner, logger)
e.svc, err = NewService(st, g, generate, quick, e.runner, logger)
if err != nil {
t.Fatal(err)
}