ci: trigga på master + formatfix inför Gitea Actions
CI / Typecheck, test & build (push) Failing after 2s

This commit is contained in:
Sven (AAMOS AI)
2026-08-13 17:25:14 +07:00
parent 61d60931ad
commit c32a7e33c7
141 changed files with 40555 additions and 45210 deletions
+83 -209
View File
@@ -99,10 +99,13 @@ export async function deriveMemoryUpdates(
const validEventIds = new Set(input.events.map((e) => e.id));
const groundedProposals = parsed.data.memoryUpdates.filter((u) => {
const grounded = u.sourceEventIds.length > 0 && u.sourceEventIds.every((id) => validEventIds.has(id));
const grounded =
u.sourceEventIds.length > 0 && u.sourceEventIds.every((id) => validEventIds.has(id));
if (!grounded) {
// eslint-disable-next-line no-console
console.error(`UPDATE_USER_MEMORY avvisade fabricerat minne: key=${u.key}, sourceEventIds=[${u.sourceEventIds.join(", ")}]`);
console.error(
`UPDATE_USER_MEMORY avvisade fabricerat minne: key=${u.key}, sourceEventIds=[${u.sourceEventIds.join(", ")}]`,
);
}
return grounded;
});
@@ -264,12 +267,20 @@ const UI_LABELS: Record<
guess: "Questa è un'ipotesi: confermala o modificala se è corretta.",
},
de: {
origin: { user_stated: "Du hast gesagt", observed: "Wir haben bemerkt", ai_inferred: "Vermutung" },
origin: {
user_stated: "Du hast gesagt",
observed: "Wir haben bemerkt",
ai_inferred: "Vermutung",
},
paused: "Pausiert",
guess: "Dies ist eine Vermutung: bestätige oder ändere sie, wenn sie stimmt.",
},
fr: {
origin: { user_stated: "Vous avez dit", observed: "Nous avons remarqué", ai_inferred: "Hypothèse" },
origin: {
user_stated: "Vous avez dit",
observed: "Nous avons remarqué",
ai_inferred: "Hypothèse",
},
paused: "En pause",
guess: "Ceci est une hypothèse : confirmez ou modifiez si cela vous convient.",
},
@@ -307,37 +318,22 @@ const UI_LABELS: Record<
type MemoryValueRenderer = (value: Record<string, unknown>) => string | null;
const MEMORY_SUMMARY_TEMPLATES: Record<
string,
Record<string, MemoryValueRenderer>
> = {
const MEMORY_SUMMARY_TEMPLATES: Record<string, Record<string, MemoryValueRenderer>> = {
sv: {
favoriteCuisine: (v) =>
typeof v.favoriteCuisine === "string"
? `Favoritkök: ${String(v.favoriteCuisine)}`
: null,
typeof v.favoriteCuisine === "string" ? `Favoritkök: ${String(v.favoriteCuisine)}` : null,
avoidIngredient: (v) =>
typeof v.avoidIngredientId === "string"
? `Undviker ingrediens: ${String(v.avoidIngredientId)}`
: null,
goal: (v) =>
typeof v.goal === "string" ? `Mål: ${String(v.goal)}` : null,
goal: (v) => (typeof v.goal === "string" ? `Mål: ${String(v.goal)}` : null),
primaryGoal: (v) =>
typeof v.primaryGoal === "string"
? `Primärt mål: ${String(v.primaryGoal)}`
: null,
allergen: (v) =>
typeof v.allergen === "string"
? `Allergi: ${String(v.allergen)}`
: null,
typeof v.primaryGoal === "string" ? `Primärt mål: ${String(v.primaryGoal)}` : null,
allergen: (v) => (typeof v.allergen === "string" ? `Allergi: ${String(v.allergen)}` : null),
spiceLevelMax: (v) =>
typeof v.spiceLevelMax === "number"
? `Max styrka: ${v.spiceLevelMax}`
: null,
typeof v.spiceLevelMax === "number" ? `Max styrka: ${v.spiceLevelMax}` : null,
dislikedIngredient: (v) =>
typeof v.dislikedIngredient === "string"
? `Undviker: ${String(v.dislikedIngredient)}`
: null,
typeof v.dislikedIngredient === "string" ? `Undviker: ${String(v.dislikedIngredient)}` : null,
typicalPortions: (v) =>
typeof v.typicalPortions === "number"
? `Laggar vanligen ${v.typicalPortions} portioner`
@@ -356,28 +352,16 @@ const MEMORY_SUMMARY_TEMPLATES: Record<
typeof v.avoidIngredientId === "string"
? `Avoids ingredient: ${String(v.avoidIngredientId)}`
: null,
goal: (v) =>
typeof v.goal === "string" ? `Goal: ${String(v.goal)}` : null,
goal: (v) => (typeof v.goal === "string" ? `Goal: ${String(v.goal)}` : null),
primaryGoal: (v) =>
typeof v.primaryGoal === "string"
? `Primary goal: ${String(v.primaryGoal)}`
: null,
allergen: (v) =>
typeof v.allergen === "string"
? `Allergy: ${String(v.allergen)}`
: null,
typeof v.primaryGoal === "string" ? `Primary goal: ${String(v.primaryGoal)}` : null,
allergen: (v) => (typeof v.allergen === "string" ? `Allergy: ${String(v.allergen)}` : null),
spiceLevelMax: (v) =>
typeof v.spiceLevelMax === "number"
? `Max spice level: ${v.spiceLevelMax}`
: null,
typeof v.spiceLevelMax === "number" ? `Max spice level: ${v.spiceLevelMax}` : null,
dislikedIngredient: (v) =>
typeof v.dislikedIngredient === "string"
? `Avoids: ${String(v.dislikedIngredient)}`
: null,
typeof v.dislikedIngredient === "string" ? `Avoids: ${String(v.dislikedIngredient)}` : null,
typicalPortions: (v) =>
typeof v.typicalPortions === "number"
? `Usually cooks ${v.typicalPortions} servings`
: null,
typeof v.typicalPortions === "number" ? `Usually cooks ${v.typicalPortions} servings` : null,
spicePreference: (v) =>
typeof v.spicePreference === "string"
? `Spice preference: ${String(v.spicePreference)}`
@@ -392,28 +376,16 @@ const MEMORY_SUMMARY_TEMPLATES: Record<
typeof v.avoidIngredientId === "string"
? `Evita ingrediente: ${String(v.avoidIngredientId)}`
: null,
goal: (v) =>
typeof v.goal === "string" ? `Objetivo: ${String(v.goal)}` : null,
goal: (v) => (typeof v.goal === "string" ? `Objetivo: ${String(v.goal)}` : null),
primaryGoal: (v) =>
typeof v.primaryGoal === "string"
? `Objetivo principal: ${String(v.primaryGoal)}`
: null,
allergen: (v) =>
typeof v.allergen === "string"
? `Alergia: ${String(v.allergen)}`
: null,
typeof v.primaryGoal === "string" ? `Objetivo principal: ${String(v.primaryGoal)}` : null,
allergen: (v) => (typeof v.allergen === "string" ? `Alergia: ${String(v.allergen)}` : null),
spiceLevelMax: (v) =>
typeof v.spiceLevelMax === "number"
? `Nivel máximo de picante: ${v.spiceLevelMax}`
: null,
typeof v.spiceLevelMax === "number" ? `Nivel máximo de picante: ${v.spiceLevelMax}` : null,
dislikedIngredient: (v) =>
typeof v.dislikedIngredient === "string"
? `Evita: ${String(v.dislikedIngredient)}`
: null,
typeof v.dislikedIngredient === "string" ? `Evita: ${String(v.dislikedIngredient)}` : null,
typicalPortions: (v) =>
typeof v.typicalPortions === "number"
? `Suele cocinar ${v.typicalPortions} raciones`
: null,
typeof v.typicalPortions === "number" ? `Suele cocinar ${v.typicalPortions} raciones` : null,
spicePreference: (v) =>
typeof v.spicePreference === "string"
? `Preferencia de picante: ${String(v.spicePreference)}`
@@ -428,24 +400,14 @@ const MEMORY_SUMMARY_TEMPLATES: Record<
typeof v.avoidIngredientId === "string"
? `Evita ingrediente: ${String(v.avoidIngredientId)}`
: null,
goal: (v) =>
typeof v.goal === "string" ? `Obiettivo: ${String(v.goal)}` : null,
goal: (v) => (typeof v.goal === "string" ? `Obiettivo: ${String(v.goal)}` : null),
primaryGoal: (v) =>
typeof v.primaryGoal === "string"
? `Obiettivo principale: ${String(v.primaryGoal)}`
: null,
allergen: (v) =>
typeof v.allergen === "string"
? `Allergia: ${String(v.allergen)}`
: null,
typeof v.primaryGoal === "string" ? `Obiettivo principale: ${String(v.primaryGoal)}` : null,
allergen: (v) => (typeof v.allergen === "string" ? `Allergia: ${String(v.allergen)}` : null),
spiceLevelMax: (v) =>
typeof v.spiceLevelMax === "number"
? `Livello piccante max: ${v.spiceLevelMax}`
: null,
typeof v.spiceLevelMax === "number" ? `Livello piccante max: ${v.spiceLevelMax}` : null,
dislikedIngredient: (v) =>
typeof v.dislikedIngredient === "string"
? `Evita: ${String(v.dislikedIngredient)}`
: null,
typeof v.dislikedIngredient === "string" ? `Evita: ${String(v.dislikedIngredient)}` : null,
typicalPortions: (v) =>
typeof v.typicalPortions === "number"
? `Di solito cucina ${v.typicalPortions} porzioni`
@@ -457,35 +419,23 @@ const MEMORY_SUMMARY_TEMPLATES: Record<
},
de: {
favoriteCuisine: (v) =>
typeof v.favoriteCuisine === "string"
? `Lieblingsküche: ${String(v.favoriteCuisine)}`
: null,
typeof v.favoriteCuisine === "string" ? `Lieblingsküche: ${String(v.favoriteCuisine)}` : null,
avoidIngredient: (v) =>
typeof v.avoidIngredientId === "string"
? `Vermeidet Zutat: ${String(v.avoidIngredientId)}`
: null,
goal: (v) =>
typeof v.goal === "string" ? `Ziel: ${String(v.goal)}` : null,
goal: (v) => (typeof v.goal === "string" ? `Ziel: ${String(v.goal)}` : null),
primaryGoal: (v) =>
typeof v.primaryGoal === "string"
? `Hauptziel: ${String(v.primaryGoal)}`
: null,
allergen: (v) =>
typeof v.allergen === "string"
? `Allergie: ${String(v.allergen)}`
: null,
typeof v.primaryGoal === "string" ? `Hauptziel: ${String(v.primaryGoal)}` : null,
allergen: (v) => (typeof v.allergen === "string" ? `Allergie: ${String(v.allergen)}` : null),
spiceLevelMax: (v) =>
typeof v.spiceLevelMax === "number"
? `Max. Schärfe: ${v.spiceLevelMax}`
: null,
typeof v.spiceLevelMax === "number" ? `Max. Schärfe: ${v.spiceLevelMax}` : null,
dislikedIngredient: (v) =>
typeof v.dislikedIngredient === "string"
? `Vermeidet: ${String(v.dislikedIngredient)}`
: null,
typicalPortions: (v) =>
typeof v.typicalPortions === "number"
? `Kocht meist ${v.typicalPortions} Portionen`
: null,
typeof v.typicalPortions === "number" ? `Kocht meist ${v.typicalPortions} Portionen` : null,
spicePreference: (v) =>
typeof v.spicePreference === "string"
? `Schärfepräferenz: ${String(v.spicePreference)}`
@@ -500,24 +450,14 @@ const MEMORY_SUMMARY_TEMPLATES: Record<
typeof v.avoidIngredientId === "string"
? `Évite l'ingrédient: ${String(v.avoidIngredientId)}`
: null,
goal: (v) =>
typeof v.goal === "string" ? `Objectif: ${String(v.goal)}` : null,
goal: (v) => (typeof v.goal === "string" ? `Objectif: ${String(v.goal)}` : null),
primaryGoal: (v) =>
typeof v.primaryGoal === "string"
? `Objectif principal: ${String(v.primaryGoal)}`
: null,
allergen: (v) =>
typeof v.allergen === "string"
? `Allergie: ${String(v.allergen)}`
: null,
typeof v.primaryGoal === "string" ? `Objectif principal: ${String(v.primaryGoal)}` : null,
allergen: (v) => (typeof v.allergen === "string" ? `Allergie: ${String(v.allergen)}` : null),
spiceLevelMax: (v) =>
typeof v.spiceLevelMax === "number"
? `Niveau épicé max: ${v.spiceLevelMax}`
: null,
typeof v.spiceLevelMax === "number" ? `Niveau épicé max: ${v.spiceLevelMax}` : null,
dislikedIngredient: (v) =>
typeof v.dislikedIngredient === "string"
? `Évite: ${String(v.dislikedIngredient)}`
: null,
typeof v.dislikedIngredient === "string" ? `Évite: ${String(v.dislikedIngredient)}` : null,
typicalPortions: (v) =>
typeof v.typicalPortions === "number"
? `Cuisine habituellement ${v.typicalPortions} portions`
@@ -529,31 +469,19 @@ const MEMORY_SUMMARY_TEMPLATES: Record<
},
da: {
favoriteCuisine: (v) =>
typeof v.favoriteCuisine === "string"
? `Yndlingskøkken: ${String(v.favoriteCuisine)}`
: null,
typeof v.favoriteCuisine === "string" ? `Yndlingskøkken: ${String(v.favoriteCuisine)}` : null,
avoidIngredient: (v) =>
typeof v.avoidIngredientId === "string"
? `Undgår ingrediens: ${String(v.avoidIngredientId)}`
: null,
goal: (v) =>
typeof v.goal === "string" ? `Mål: ${String(v.goal)}` : null,
goal: (v) => (typeof v.goal === "string" ? `Mål: ${String(v.goal)}` : null),
primaryGoal: (v) =>
typeof v.primaryGoal === "string"
? `Primært mål: ${String(v.primaryGoal)}`
: null,
allergen: (v) =>
typeof v.allergen === "string"
? `Allergi: ${String(v.allergen)}`
: null,
typeof v.primaryGoal === "string" ? `Primært mål: ${String(v.primaryGoal)}` : null,
allergen: (v) => (typeof v.allergen === "string" ? `Allergi: ${String(v.allergen)}` : null),
spiceLevelMax: (v) =>
typeof v.spiceLevelMax === "number"
? `Max styrke: ${v.spiceLevelMax}`
: null,
typeof v.spiceLevelMax === "number" ? `Max styrke: ${v.spiceLevelMax}` : null,
dislikedIngredient: (v) =>
typeof v.dislikedIngredient === "string"
? `Undgår: ${String(v.dislikedIngredient)}`
: null,
typeof v.dislikedIngredient === "string" ? `Undgår: ${String(v.dislikedIngredient)}` : null,
typicalPortions: (v) =>
typeof v.typicalPortions === "number"
? `Tilbereder som regel ${v.typicalPortions} portioner`
@@ -572,24 +500,14 @@ const MEMORY_SUMMARY_TEMPLATES: Record<
typeof v.avoidIngredientId === "string"
? `Unngår ingrediens: ${String(v.avoidIngredientId)}`
: null,
goal: (v) =>
typeof v.goal === "string" ? `Mål: ${String(v.goal)}` : null,
goal: (v) => (typeof v.goal === "string" ? `Mål: ${String(v.goal)}` : null),
primaryGoal: (v) =>
typeof v.primaryGoal === "string"
? `Primært mål: ${String(v.primaryGoal)}`
: null,
allergen: (v) =>
typeof v.allergen === "string"
? `Allergi: ${String(v.allergen)}`
: null,
typeof v.primaryGoal === "string" ? `Primært mål: ${String(v.primaryGoal)}` : null,
allergen: (v) => (typeof v.allergen === "string" ? `Allergi: ${String(v.allergen)}` : null),
spiceLevelMax: (v) =>
typeof v.spiceLevelMax === "number"
? `Maks styrke: ${v.spiceLevelMax}`
: null,
typeof v.spiceLevelMax === "number" ? `Maks styrke: ${v.spiceLevelMax}` : null,
dislikedIngredient: (v) =>
typeof v.dislikedIngredient === "string"
? `Unngår: ${String(v.dislikedIngredient)}`
: null,
typeof v.dislikedIngredient === "string" ? `Unngår: ${String(v.dislikedIngredient)}` : null,
typicalPortions: (v) =>
typeof v.typicalPortions === "number"
? `Lager vanligvis ${v.typicalPortions} porsjoner`
@@ -608,24 +526,14 @@ const MEMORY_SUMMARY_TEMPLATES: Record<
typeof v.avoidIngredientId === "string"
? `Vältettävä ainesosa: ${String(v.avoidIngredientId)}`
: null,
goal: (v) =>
typeof v.goal === "string" ? `Tavoite: ${String(v.goal)}` : null,
goal: (v) => (typeof v.goal === "string" ? `Tavoite: ${String(v.goal)}` : null),
primaryGoal: (v) =>
typeof v.primaryGoal === "string"
? `Päätavoite: ${String(v.primaryGoal)}`
: null,
allergen: (v) =>
typeof v.allergen === "string"
? `Allergia: ${String(v.allergen)}`
: null,
typeof v.primaryGoal === "string" ? `Päätavoite: ${String(v.primaryGoal)}` : null,
allergen: (v) => (typeof v.allergen === "string" ? `Allergia: ${String(v.allergen)}` : null),
spiceLevelMax: (v) =>
typeof v.spiceLevelMax === "number"
? `Max tulisuus: ${v.spiceLevelMax}`
: null,
typeof v.spiceLevelMax === "number" ? `Max tulisuus: ${v.spiceLevelMax}` : null,
dislikedIngredient: (v) =>
typeof v.dislikedIngredient === "string"
? `Vältää: ${String(v.dislikedIngredient)}`
: null,
typeof v.dislikedIngredient === "string" ? `Vältää: ${String(v.dislikedIngredient)}` : null,
typicalPortions: (v) =>
typeof v.typicalPortions === "number"
? `Valmistaa yleensä ${v.typicalPortions} annosta`
@@ -644,28 +552,16 @@ const MEMORY_SUMMARY_TEMPLATES: Record<
typeof v.avoidIngredientId === "string"
? `Vermijdt ingrediënt: ${String(v.avoidIngredientId)}`
: null,
goal: (v) =>
typeof v.goal === "string" ? `Doel: ${String(v.goal)}` : null,
goal: (v) => (typeof v.goal === "string" ? `Doel: ${String(v.goal)}` : null),
primaryGoal: (v) =>
typeof v.primaryGoal === "string"
? `Primair doel: ${String(v.primaryGoal)}`
: null,
allergen: (v) =>
typeof v.allergen === "string"
? `Allergie: ${String(v.allergen)}`
: null,
typeof v.primaryGoal === "string" ? `Primair doel: ${String(v.primaryGoal)}` : null,
allergen: (v) => (typeof v.allergen === "string" ? `Allergie: ${String(v.allergen)}` : null),
spiceLevelMax: (v) =>
typeof v.spiceLevelMax === "number"
? `Max pittigheid: ${v.spiceLevelMax}`
: null,
typeof v.spiceLevelMax === "number" ? `Max pittigheid: ${v.spiceLevelMax}` : null,
dislikedIngredient: (v) =>
typeof v.dislikedIngredient === "string"
? `Vermijdt: ${String(v.dislikedIngredient)}`
: null,
typeof v.dislikedIngredient === "string" ? `Vermijdt: ${String(v.dislikedIngredient)}` : null,
typicalPortions: (v) =>
typeof v.typicalPortions === "number"
? `Kookt meestal ${v.typicalPortions} porties`
: null,
typeof v.typicalPortions === "number" ? `Kookt meestal ${v.typicalPortions} porties` : null,
spicePreference: (v) =>
typeof v.spicePreference === "string"
? `Pittigheidspreferentie: ${String(v.spicePreference)}`
@@ -680,28 +576,16 @@ const MEMORY_SUMMARY_TEMPLATES: Record<
typeof v.avoidIngredientId === "string"
? `Unika składnika: ${String(v.avoidIngredientId)}`
: null,
goal: (v) =>
typeof v.goal === "string" ? `Cel: ${String(v.goal)}` : null,
goal: (v) => (typeof v.goal === "string" ? `Cel: ${String(v.goal)}` : null),
primaryGoal: (v) =>
typeof v.primaryGoal === "string"
? `Cel główny: ${String(v.primaryGoal)}`
: null,
allergen: (v) =>
typeof v.allergen === "string"
? `Alergia: ${String(v.allergen)}`
: null,
typeof v.primaryGoal === "string" ? `Cel główny: ${String(v.primaryGoal)}` : null,
allergen: (v) => (typeof v.allergen === "string" ? `Alergia: ${String(v.allergen)}` : null),
spiceLevelMax: (v) =>
typeof v.spiceLevelMax === "number"
? `Maks. ostrość: ${v.spiceLevelMax}`
: null,
typeof v.spiceLevelMax === "number" ? `Maks. ostrość: ${v.spiceLevelMax}` : null,
dislikedIngredient: (v) =>
typeof v.dislikedIngredient === "string"
? `Unika: ${String(v.dislikedIngredient)}`
: null,
typeof v.dislikedIngredient === "string" ? `Unika: ${String(v.dislikedIngredient)}` : null,
typicalPortions: (v) =>
typeof v.typicalPortions === "number"
? `Zwykle gotuje ${v.typicalPortions} porcje`
: null,
typeof v.typicalPortions === "number" ? `Zwykle gotuje ${v.typicalPortions} porcje` : null,
spicePreference: (v) =>
typeof v.spicePreference === "string"
? `Preferencja ostrości: ${String(v.spicePreference)}`
@@ -716,24 +600,14 @@ const MEMORY_SUMMARY_TEMPLATES: Record<
typeof v.avoidIngredientId === "string"
? `Evita ingrediente: ${String(v.avoidIngredientId)}`
: null,
goal: (v) =>
typeof v.goal === "string" ? `Objetivo: ${String(v.goal)}` : null,
goal: (v) => (typeof v.goal === "string" ? `Objetivo: ${String(v.goal)}` : null),
primaryGoal: (v) =>
typeof v.primaryGoal === "string"
? `Objetivo principal: ${String(v.primaryGoal)}`
: null,
allergen: (v) =>
typeof v.allergen === "string"
? `Alergia: ${String(v.allergen)}`
: null,
typeof v.primaryGoal === "string" ? `Objetivo principal: ${String(v.primaryGoal)}` : null,
allergen: (v) => (typeof v.allergen === "string" ? `Alergia: ${String(v.allergen)}` : null),
spiceLevelMax: (v) =>
typeof v.spiceLevelMax === "number"
? `Nível picante máx.: ${v.spiceLevelMax}`
: null,
typeof v.spiceLevelMax === "number" ? `Nível picante máx.: ${v.spiceLevelMax}` : null,
dislikedIngredient: (v) =>
typeof v.dislikedIngredient === "string"
? `Evita: ${String(v.dislikedIngredient)}`
: null,
typeof v.dislikedIngredient === "string" ? `Evita: ${String(v.dislikedIngredient)}` : null,
typicalPortions: (v) =>
typeof v.typicalPortions === "number"
? `Costuma cozinhar ${v.typicalPortions} porções`
+25 -11
View File
@@ -38,9 +38,7 @@ describe("buildMemoryOverview", () => {
});
it("visar origin och confidence tydligt", () => {
const items: MemoryItem[] = [
makeItem({ origin: "observed", confidence: 0.75 }),
];
const items: MemoryItem[] = [makeItem({ origin: "observed", confidence: 0.75 })];
const overview = buildMemoryOverview(items, "sv-SE");
const item = overview.sections[0]!.items[0]!;
expect(item.originLabel).toBe("Vi har sett");
@@ -83,12 +81,24 @@ describe("buildMemoryOverview", () => {
});
it("renderMemorySummary stödjer S5-value-former", () => {
expect(renderMemorySummary({ summarySv: "", value: { favoriteCuisine: "thai" } }, "en-US")).toBe("Favorite cuisine: thai");
expect(renderMemorySummary({ summarySv: "", value: { avoidIngredientId: "broccoli" } }, "en-US")).toBe("Avoids ingredient: broccoli");
expect(renderMemorySummary({ summarySv: "", value: { goal: "less_waste" } }, "en-US")).toBe("Goal: less_waste");
expect(renderMemorySummary({ summarySv: "", value: { primaryGoal: "less_waste" } }, "en-US")).toBe("Primary goal: less_waste");
expect(renderMemorySummary({ summarySv: "", value: { allergen: "gluten" } }, "en-US")).toBe("Allergy: gluten");
expect(renderMemorySummary({ summarySv: "", value: { spiceLevelMax: 2 } }, "en-US")).toBe("Max spice level: 2");
expect(
renderMemorySummary({ summarySv: "", value: { favoriteCuisine: "thai" } }, "en-US"),
).toBe("Favorite cuisine: thai");
expect(
renderMemorySummary({ summarySv: "", value: { avoidIngredientId: "broccoli" } }, "en-US"),
).toBe("Avoids ingredient: broccoli");
expect(renderMemorySummary({ summarySv: "", value: { goal: "less_waste" } }, "en-US")).toBe(
"Goal: less_waste",
);
expect(
renderMemorySummary({ summarySv: "", value: { primaryGoal: "less_waste" } }, "en-US"),
).toBe("Primary goal: less_waste");
expect(renderMemorySummary({ summarySv: "", value: { allergen: "gluten" } }, "en-US")).toBe(
"Allergy: gluten",
);
expect(renderMemorySummary({ summarySv: "", value: { spiceLevelMax: 2 } }, "en-US")).toBe(
"Max spice level: 2",
);
});
});
@@ -131,7 +141,9 @@ describe("deriveMemoryUpdates", () => {
const result = await deriveMemoryUpdates(aamos, {
scope: "user",
scopeId: "u1",
events: [{ id: "evt-real", type: "recipe_cooked", occurredAt: "2026-08-01T12:00:00Z", payload: {} }],
events: [
{ id: "evt-real", type: "recipe_cooked", occurredAt: "2026-08-01T12:00:00Z", payload: {} },
],
existingMemoryKeys: [],
consentFlags: { personalization: true, anonymizedImprovement: false, imageTraining: false },
});
@@ -156,7 +168,9 @@ describe("deriveMemoryUpdates", () => {
const result = await deriveMemoryUpdates(aamos, {
scope: "user",
scopeId: "u1",
events: [{ id: "evt-real", type: "recipe_cooked", occurredAt: "2026-08-01T12:00:00Z", payload: {} }],
events: [
{ id: "evt-real", type: "recipe_cooked", occurredAt: "2026-08-01T12:00:00Z", payload: {} },
],
existingMemoryKeys: [],
consentFlags: { personalization: true, anonymizedImprovement: false, imageTraining: false },
});