Merge branch 'wt/l4-pipeline' into release/v1.30.15

This commit is contained in:
Marc-André Bombeck committed 2026-07-18 23:48:03 +02:00
commit 5c83156dcf
18 files changed
+363 -66

No files matched your search

+8 -2
View File
@@ -39,6 +39,7 @@ import {
} from "@/lib/insights/derived";
import { resolveDeterministicAssessment } from "@/lib/insights/derived/derived-assessment";
import { resolveServerLocale } from "@/lib/i18n/server-locale";
import { instructionLocale } from "@/lib/ai/prompts/output-language";
import { requireModuleEnabled, resolveModuleMap } from "@/lib/modules/gate";
import { DERIVED_MODULE } from "../route";
@@ -177,7 +178,12 @@ export const GET = apiHandler(async (request: NextRequest) => {
userLocale: user.locale ?? null,
override: request.nextUrl.searchParams.get("locale"),
});
const assessmentLocale = locale === "de" ? "de" : "en";
// This grid only carries the DETERMINISTIC assessment, whose templates ship
// de/en bodies — so the same instruction-body rule the prompts use applies:
// German for a German reader, English for everyone else. Deliberately NOT
// widened to the six; the AI-warm prose (which does carry the full locale)
// is served lazily by the per-score route.
const assessmentLocale = instructionLocale(locale);
// v1.16.8 — read-through the per-user derived cache with
// stale-while-revalidate. The cold build below walks the rollup tier
@@ -244,7 +250,7 @@ export const GET = apiHandler(async (request: NextRequest) => {
async function buildDerivedBatch(input: {
userId: string;
items: BatchItem[];
assessmentLocale: "de" | "en";
assessmentLocale: ReturnType<typeof instructionLocale>;
}) {
const { userId, items, assessmentLocale } = input;
+3 -2
View File
@@ -71,6 +71,7 @@ import { requireAssistantSurface } from "@/lib/feature-flags";
import { invalidateUserInsights } from "@/lib/cache/invalidate";
import { annotate } from "@/lib/logging/context";
import { resolveServerLocale } from "@/lib/i18n/server-locale";
import { normalizeLocale } from "@/lib/insights/status-shared";
import { hasUsableStatusProvider } from "@/lib/insights/status-provider";
import { hashInsightSnapshot } from "@/lib/insights/snapshot-hash";
import { enqueueForceWarm } from "@/lib/jobs/insight-pregenerate-shared";
@@ -202,7 +203,7 @@ export const GET = apiHandler(async (request: NextRequest) => {
request,
userLocale: dbUser?.locale ?? user.locale ?? null,
});
const locale = resolved === "de" ? "de" : "en";
const locale = normalizeLocale(resolved);
void enqueueForceWarm({ userId, locale });
revalidating = true;
}
@@ -950,7 +951,7 @@ export const POST = apiHandler((request: NextRequest) =>
// refresh path until the next nightly warm.
const refillScopes = await enqueueStatusRefillForUser(
userId,
locale === "de" ? "de" : "en",
normalizeLocale(locale),
);
annotate({
action: { name: "insights.generate.cards_refill" },
+5 -1
View File
@@ -30,6 +30,7 @@ import { requireModuleEnabled } from "@/lib/modules/gate";
import { checkRateLimit } from "@/lib/rate-limit";
import { annotate } from "@/lib/logging/context";
import { resolveServerLocale } from "@/lib/i18n/server-locale";
import { normalizeLocale } from "@/lib/insights/status-shared";
import { enqueueForceWarm } from "@/lib/jobs/insight-pregenerate-shared";
export const dynamic = "force-dynamic";
@@ -59,7 +60,10 @@ export const POST = apiHandler(async (request: NextRequest) => {
request,
userLocale: user.locale ?? null,
});
const locale = resolved === "en" ? "en" : "de";
// Carry the reader's ACTUAL locale into the warm payload. The former
// `resolved === "en" ? "en" : "de"` sent every fr/es/it/pl account down the
// German warm, so the whole warmed cache family was in the wrong language.
const locale = normalizeLocale(resolved);
await enqueueForceWarm({ userId, locale });