mirror of
https://github.com/tiennm99/ccs.git
synced 2026-09-10 02:17:11 +00:00
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:
@@ -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 });
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user