From 2477c9d05500b0e3a37d1ed4c3f491455c921cf9 Mon Sep 17 00:00:00 2001 From: NagyVikt Date: Tue, 21 Apr 2026 14:55:18 +0200 Subject: [PATCH] Keep the doctor metadata guard stable across local refactors The metadata suite was pinning the exact local variable name passed to the Doctor/fix dry-run renderer. The CLI now uses a different option binding, so the assertion was failing even though the repair-first path still executed the same contract.\n\nThis narrows the source guard to the behavior that matters: the doctor command remains single-source and still forwards the Doctor/fix payload together with a dry-run flag. Constraint: The regression test must keep protecting the repair-first doctor path without forcing a cosmetic local variable name.\nRejected: Rename the CLI variable back to singleRepoOptions | needless churn in production code for a test-only mismatch\nConfidence: high\nScope-risk: narrow\nReversibility: clean\nDirective: Keep metadata assertions focused on behavioral contracts rather than ephemeral local identifier names.\nTested: node --test test/metadata.test.js\nTested: node --test test/merge-workflow.test.js\nTested: node --check bin/multiagent-safety.js\nNot-tested: full npm test suite --- test/metadata.test.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/metadata.test.js b/test/metadata.test.js index 61b8668..b14b396 100644 --- a/test/metadata.test.js +++ b/test/metadata.test.js @@ -121,7 +121,7 @@ test('active doctor command remains single-source and runs the repair-first path const cliSource = fs.readFileSync(cliPath, 'utf8'); const doctorDefs = cliSource.match(/function doctor\(rawArgs\)/g) || []; assert.equal(doctorDefs.length, 1, 'doctor() must not be duplicated'); - assert.match(cliSource, /printOperations\('Doctor\/fix', fixPayload, singleRepoOptions\.dryRun\);/); + assert.match(cliSource, /printOperations\('Doctor\/fix', fixPayload,\s*[^)]+\.dryRun\);/); }); test('worktree-change detection uses normal untracked-file mode', () => {