fix(#1493): read workflow.drift_action/drift_threshold from nested config shape in verify.cts
loadConfig() returns a flattened object with no nested `workflow` key, so config?.workflow was always undefined, making drift_action permanently 'warn' and drift_threshold permanently 3 regardless of .planning/config.json. Fixes by reading the raw config.json directly (matching the pattern in check-command-router.cts:readWorkflowConfig). Adds two behavioral regression tests that fail under the old code and pass under the fix. Closes #1493 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -2210,8 +2210,18 @@ function cmdVerifyCodebaseDrift(cwd: string, raw: boolean): void {
|
||||
else if (status === 'D') deleted.push(file);
|
||||
}
|
||||
|
||||
const config = loadConfig(cwd);
|
||||
const wf = config?.workflow as Record<string, unknown> | undefined;
|
||||
// loadConfig() returns a flattened object — there is no nested `workflow`
|
||||
// key. Read the raw config.json directly to access workflow-scoped keys,
|
||||
// matching the pattern used in check-command-router.cts:readWorkflowConfig.
|
||||
let wf: Record<string, unknown> | undefined;
|
||||
try {
|
||||
const rawCfg = JSON.parse(
|
||||
fs.readFileSync(path.join(planningDir(cwd), 'config.json'), 'utf-8'),
|
||||
) as Record<string, unknown>;
|
||||
wf = rawCfg['workflow'] as Record<string, unknown> | undefined;
|
||||
} catch {
|
||||
wf = undefined;
|
||||
}
|
||||
const threshold =
|
||||
Number.isInteger(wf?.drift_threshold) && (wf?.drift_threshold as number) >= 1
|
||||
? (wf?.drift_threshold as number)
|
||||
|
||||
Reference in New Issue
Block a user