Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS
JavaScript ai-agentsdashboarddeveloper-toolsdigital-twinquantified-selfsecond-brainself-hostedtailscale
fix: invalidate placeholder foundation caches
[._.]/ Adam Eivyaa99c114254d
diff --git a/server/services/pipeline/foundationJudge.js b/server/services/pipeline/foundationJudge.jsindex 3b33e801d2..38f4e807d7 100644--- a/server/services/pipeline/foundationJudge.js+++ b/server/services/pipeline/foundationJudge.js@@ -632,7 +632,15 @@ export async function judgeFoundation(seriesId, {const hash = foundationInputsHash(series, universe, issues);const existing = await loadSnapshot(seriesId);- if (!force && existing && existing.status === 'complete' && existing.sourceInputsHash === hash) {+ // Cache only a verdict that still satisfies the current rubric contract.+ // This also self-heals snapshots written by an older permissive validator+ // from echoed prompt examples (`gap: "string"`): unchanged story inputs must+ // not make fabricated editorial evidence immortal across restarts/resumes.+ if (!force+ && existing+ && existing.status === 'complete'+ && existing.sourceInputsHash === hash+ && isValidFoundationShape(existing)) {return { ...existing, cached: true };}diff --git a/server/services/pipeline/foundationJudge.test.js b/server/services/pipeline/foundationJudge.test.jsindex 8a76563a8c..53b5356900 100644--- a/server/services/pipeline/foundationJudge.test.js+++ b/server/services/pipeline/foundationJudge.test.js@@ -469,6 +469,35 @@ describe('judgeFoundation — cache / fast-pass', () => {expect(stageRunner.runStagedLLM).not.toHaveBeenCalled();});+ it('re-judges a matching cached snapshot whose findings are echoed schema placeholders', async () => {+ const series = { id: 'ser-1', name: 'S', universeId: null };+ seriesSvc.getSeries.mockResolvedValue(series);+ const hash = foundationInputsHash(series, null);+ const placeholderDimensions = Object.fromEntries(FOUNDATION_DIMENSIONS.map((key) => [+ key,+ { score: 6, gap: 'string', fix: 'string' },+ ]));+ fileUtils.tryReadFile.mockResolvedValue(JSON.stringify({+ seriesId: 'ser-1',+ status: 'complete',+ sourceInputsHash: hash,+ weightedScore: 6,+ dimensions: placeholderDimensions,+ oneLineVerdict: 'string',+ }));+ stageRunner.runStagedLLM.mockResolvedValue({+ content: { dimensions: dims({ worldbuilding: 7 }), oneLineVerdict: 'Fresh specific verdict.' },+ providerId: 'judge-x', model: 'jm-heavy', runId: 'run-rejudge',+ });++ const out = await judgeFoundation('ser-1');++ expect(stageRunner.runStagedLLM).toHaveBeenCalledTimes(1);+ expect(out.cached).toBeUndefined();+ expect(out.runId).toBe('run-rejudge');+ expect(out.oneLineVerdict).toBe('Fresh specific verdict.');+ });+it('runs the judge (writer/judge split) and persists a hashed snapshot on a fresh foundation', async () => {seriesSvc.getSeries.mockResolvedValue({ id: 'ser-1', name: 'S', universeId: null });const logSpy = vi.spyOn(console, 'log').mockImplementation(() => {});