feat(FN-4080): complete Step 1 — add thinking persistence resolver

Fusion-Task-Id: FN-4080
Fusion-Task-Lineage: 086863ba-7100-41ab-9cfc-197301fbcab0
This commit is contained in:
Fusion
2026-05-13 05:36:47 -07:00
committed by gsxdsm
parent 03e6b4853a
commit 8c7fb1f893
5 changed files with 81 additions and 4 deletions

View File

@@ -0,0 +1,44 @@
import { describe, expect, it } from "vitest";
import { resolvePersistAgentThinkingLog } from "../types.js";
describe("resolvePersistAgentThinkingLog", () => {
it("returns false for both kinds when granular and legacy are unset", () => {
expect(resolvePersistAgentThinkingLog({}, { ephemeral: false })).toBe(false);
expect(resolvePersistAgentThinkingLog({}, { ephemeral: true })).toBe(false);
});
it("uses granular permanent setting when defined", () => {
expect(
resolvePersistAgentThinkingLog(
{ persistAgentThinkingLogPermanent: true, persistAgentThinkingLogEphemeral: undefined },
{ ephemeral: false },
),
).toBe(true);
expect(
resolvePersistAgentThinkingLog(
{ persistAgentThinkingLogPermanent: true, persistAgentThinkingLogEphemeral: undefined },
{ ephemeral: true },
),
).toBe(false);
});
it("falls back to legacy setting when granular fields are undefined", () => {
expect(resolvePersistAgentThinkingLog({ persistAgentThinkingLog: true }, { ephemeral: false })).toBe(true);
expect(resolvePersistAgentThinkingLog({ persistAgentThinkingLog: true }, { ephemeral: true })).toBe(true);
});
it("prioritizes granular setting over legacy fallback", () => {
expect(
resolvePersistAgentThinkingLog(
{ persistAgentThinkingLogPermanent: false, persistAgentThinkingLog: true },
{ ephemeral: false },
),
).toBe(false);
expect(
resolvePersistAgentThinkingLog(
{ persistAgentThinkingLogEphemeral: false, persistAgentThinkingLog: true },
{ ephemeral: true },
),
).toBe(false);
});
});

View File

@@ -62,11 +62,19 @@ describe("settings key parity", () => {
expect(isGlobalSettingsKey("persistAgentThinkingLog")).toBe(true);
expect(isProjectSettingsKey("persistAgentThinkingLog")).toBe(false);
expect(isGlobalOnlySettingsKey("persistAgentThinkingLog")).toBe(true);
expect(isGlobalSettingsKey("persistAgentThinkingLogPermanent")).toBe(true);
expect(isProjectSettingsKey("persistAgentThinkingLogPermanent")).toBe(false);
expect(isGlobalOnlySettingsKey("persistAgentThinkingLogPermanent")).toBe(true);
expect(isGlobalSettingsKey("persistAgentThinkingLogEphemeral")).toBe(true);
expect(isProjectSettingsKey("persistAgentThinkingLogEphemeral")).toBe(false);
expect(isGlobalOnlySettingsKey("persistAgentThinkingLogEphemeral")).toBe(true);
expect(isGlobalSettingsKey("researchSettings")).toBe(false);
});
it("defaults persisted thinking logs to disabled", () => {
expect(DEFAULT_GLOBAL_SETTINGS.persistAgentThinkingLog).toBe(false);
expect(DEFAULT_GLOBAL_SETTINGS.persistAgentThinkingLogPermanent).toBe(false);
expect(DEFAULT_GLOBAL_SETTINGS.persistAgentThinkingLogEphemeral).toBe(false);
});
it("includes heartbeatMultiplier in project defaults", () => {