fix(config): merge legacy and unified continuity maps

- combine continuity.inherit_from_account with legacy continuity_inherit_from_account

- prefer unified continuity entries on key collisions

- add regression coverage for mixed-key merge behavior
This commit is contained in:
Tam Nhu Tran
2026-03-03 02:49:18 +07:00
parent 8a45727b31
commit 1eb41cc4e2
2 changed files with 49 additions and 8 deletions
+39
View File
@@ -226,4 +226,43 @@ describe('continuity-inheritance-config', () => {
fs.rmSync(tempHome, { recursive: true, force: true });
}
});
it('merges continuity.inherit_from_account with legacy continuity_inherit_from_account', () => {
const originalCcsHome = process.env.CCS_HOME;
const tempHome = fs.mkdtempSync(path.join(os.tmpdir(), 'ccs-continuity-merge-home-'));
const ccsDir = path.join(tempHome, '.ccs');
fs.mkdirSync(ccsDir, { recursive: true });
fs.writeFileSync(
path.join(ccsDir, 'config.yaml'),
[
'version: 8',
'continuity:',
' inherit_from_account:',
' glm: team-a',
' copilot: work',
'continuity_inherit_from_account:',
' glm: legacy',
' km: account-kimi',
'',
].join('\n')
);
process.env.CCS_HOME = tempHome;
try {
const config = loadOrCreateUnifiedConfig();
expect(config.continuity?.inherit_from_account).toEqual({
glm: 'team-a',
copilot: 'work',
km: 'account-kimi',
});
} finally {
if (originalCcsHome === undefined) {
delete process.env.CCS_HOME;
} else {
process.env.CCS_HOME = originalCcsHome;
}
fs.rmSync(tempHome, { recursive: true, force: true });
}
});
});