fix(consult): date the full-data cache and slim the model card

The cache key now includes the request date, and files older than two days are removed. The model card keeps values only. Parashari aspects are copied from the engine. Saving a chart warms the packet without blocking the response.

Biography severe conflicts rose from 1 to 3, so this is not accepted for merge. Not pushed.
This commit is contained in:
jesse-ux
2026-10-09 10:00:45 +08:00
parent 3874a328a5
commit 16f9f86843
20 changed files with 976 additions and 23 deletions
@@ -170,13 +170,33 @@ const GOLDEN_ROUTE_FOR_DOMAIN: Record<string, string> = {
career: "career",
};
let factsFixture: { figures?: Record<string, { domains?: Record<string, Json> }> } | null = null;
/** Set only for the after run. The file is the server facts copy; the card slims it. */
function factsForFigure(figureId: string, domain: string): Json | null {
const fixturePath = process.env.CONSULT_CARD_FACTS_FIXTURE;
if (!fixturePath) return null;
if (!factsFixture) factsFixture = JSON.parse(readFileSync(fixturePath, "utf8"));
const facts = factsFixture?.figures?.[figureId]?.domains?.[domain];
if (!facts || typeof facts !== "object") {
// family/children reuse the parents golden route and are not in the four-domain fixture.
if (domain === "family" || domain === "children") return null;
throw new Error(`consult card facts missing for ${figureId} ${domain}`);
}
return facts;
}
function stubRunWorkflow(figure: GoldenFigure, executed: string[]) {
return async (input: { theme: string }) => {
const key = GOLDEN_ROUTE_FOR_DOMAIN[input.theme];
if (!key) throw new Error(`backtest golden has no engine route for domain ${input.theme}`);
executed.push(input.theme);
// runConsultationWorkflow: schema parse, then minute-sensitive themes on the policy.
const data = consultationWorkflowResponseSchema.parse(routeWorkflow(figure, key));
const parsed = consultationWorkflowResponseSchema.parse(routeWorkflow(figure, key));
const facts = factsForFigure(figure.id, input.theme);
const data = facts
? { ...parsed, consult_card_facts: { schema: "consult-card-facts-v1", domains: [facts] } }
: parsed;
const consumer = data.consumer_context as Json;
return {
...data,