refactor(journal): simplify fallback variable retrieval

Return the fallback value as-is instead of applying local
modifications, as the stream value is already authoritative for
untracked variables.
This commit is contained in:
hypercross 2026-07-13 10:24:33 +08:00
parent 4c2eb65470
commit 6f01a29723
1 changed files with 4 additions and 7 deletions

View File

@ -137,14 +137,11 @@ export function getCombined(key: string, fallback?: VariableStore): string {
return String(baseNum + modSum);
}
// Fall back to stream store
// Fall back to stream store. The stream value is authoritative for
// variables not tracked locally — it already includes any mods from
// the sender's engine, so we return it as-is without adding local mods.
const fb = fallback?.[key];
if (fb !== undefined) {
if (isTagValue(fb)) return fb;
const fbNum = parseFloat(fb);
if (!isNaN(fbNum)) return String(fbNum + modSum);
return fb;
}
if (fb !== undefined) return fb;
// No base, but has mods
if (mods.length > 0) return String(modSum);