Skip to content

Commit 39c9885

Browse files
committed
test(cli): cover the retired record key in explicit config sources
An --config file and AGENT_DEVICE_CONFIG resolve through the same parseConfigObject check as user and project config; pin the refusal for both spellings. Addresses review thread discussion_r4302985179.
1 parent 98d717c commit 39c9885

1 file changed

Lines changed: 33 additions & 0 deletions

File tree

‎src/__tests__/cli-config-retired-record.test.ts‎

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,39 @@ test('retired record config key is refused with migration guidance on every conf
4444
fs.rmSync(root, { recursive: true, force: true });
4545
});
4646

47+
test('retired record config key is refused in an explicit --config file', async () => {
48+
const { root, home, project } = makeTempWorkspace();
49+
const configPath = path.join(root, 'chosen.json');
50+
fs.writeFileSync(configPath, JSON.stringify({ record: true }));
51+
52+
const result = await runCliCapture(['snapshot', '--config', configPath], {
53+
cwd: project,
54+
env: { HOME: home },
55+
defaultResponse: { ok: true, data: {} },
56+
});
57+
assert.equal(result.code, 1);
58+
assert.match(result.stderr, /"record" in config file .*chosen\.json was removed/);
59+
assert.match(result.stderr, /--record is per-invocation only/);
60+
61+
fs.rmSync(root, { recursive: true, force: true });
62+
});
63+
64+
test('retired record config key is refused in an AGENT_DEVICE_CONFIG file', async () => {
65+
const { root, home, project } = makeTempWorkspace();
66+
const configPath = path.join(root, 'from-env.json');
67+
fs.writeFileSync(configPath, JSON.stringify({ record: true }));
68+
69+
const result = await runCliCapture(['snapshot'], {
70+
cwd: project,
71+
env: { HOME: home, AGENT_DEVICE_CONFIG: configPath },
72+
defaultResponse: { ok: true, data: {} },
73+
});
74+
assert.equal(result.code, 1);
75+
assert.match(result.stderr, /"record" in config file .*from-env\.json was removed/);
76+
77+
fs.rmSync(root, { recursive: true, force: true });
78+
});
79+
4780
test('retired AGENT_DEVICE_RECORD fails closed only for commands that accept --record', async () => {
4881
const { root, home, project } = makeTempWorkspace();
4982
const env = { HOME: home, AGENT_DEVICE_RECORD: 'true' };

0 commit comments

Comments
 (0)