You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Split out of #10170, as the direct successor to #10210. See the AST re-baseline — measured properly, runWorkersOpinion is the worst real offender in the codebase at 12 positional parameters, and persistDecisionRecord (the one #10170 originally named) turns out to have 6 and is not an offender at all.
Two adjacent same-typed booleans at the tail.bodyTruncated and prHasTestEvidence are both boolean, both default false, and sit next to each other. Swap them at a call site and nothing fails to compile, nothing fails a type check, and no test necessarily catches it — but the evidence-absence demotion (#8961) and the test-absence demotion (#8833) both fire on the wrong condition. This is exactly the failure mode #10210 was accepted to prevent, in the function that has it worst.
images? has no caller. Its own comment says so: "Absent for every existing caller — wiring a real caller is a deliberately deferred follow-up." So every call site that wants either trailing boolean must thread an undefined placeholder past it. #10170 recorded "call sites already pass undefined placeholders positionally" as the smell justifying an options object; it was wrong about persistDecisionRecord, and right about this one.
It grows by one per signal. The last three parameters were appended by three separate issues (#4111, #8961, #8833). The next reviewer signal appends a thirteenth, and the two-boolean hazard becomes a three-boolean one.
Scope
Convert the accidental tail to a single options object, keeping the genuinely positional head. env through maxTokens are the real arguments and should stay positional; everything from diagnostics onward is the accidental part.
There are 4+ call sites, all within src/services/ai-review.ts (~lines 3234, 3265, 3280, 3349) — this does not cross a package or twin boundary, so unlike #10210 there is no parity suite to keep in step.
Guardrails
Pure refactor. No behaviour change, no signal added or removed, no prompt or demotion rule touched. The existing ai-review suites are the regression proof — if an assertion needs editing, that is a signal the refactor changed behaviour and should be re-examined rather than the test adjusted.
Split out of #10170, as the direct successor to #10210. See the AST re-baseline — measured properly,
runWorkersOpinionis the worst real offender in the codebase at 12 positional parameters, andpersistDecisionRecord(the one #10170 originally named) turns out to have 6 and is not an offender at all.The signature
src/services/ai-review.ts:1613Why this one, and why now
Two adjacent same-typed booleans at the tail.
bodyTruncatedandprHasTestEvidenceare bothboolean, both defaultfalse, and sit next to each other. Swap them at a call site and nothing fails to compile, nothing fails a type check, and no test necessarily catches it — but the evidence-absence demotion (#8961) and the test-absence demotion (#8833) both fire on the wrong condition. This is exactly the failure mode #10210 was accepted to prevent, in the function that has it worst.images?has no caller. Its own comment says so: "Absent for every existing caller — wiring a real caller is a deliberately deferred follow-up." So every call site that wants either trailing boolean must thread anundefinedplaceholder past it. #10170 recorded "call sites already passundefinedplaceholders positionally" as the smell justifying an options object; it was wrong aboutpersistDecisionRecord, and right about this one.It grows by one per signal. The last three parameters were appended by three separate issues (#4111, #8961, #8833). The next reviewer signal appends a thirteenth, and the two-boolean hazard becomes a three-boolean one.
Scope
Convert the accidental tail to a single options object, keeping the genuinely positional head.
envthroughmaxTokensare the real arguments and should stay positional; everything fromdiagnosticsonward is the accidental part.There are 4+ call sites, all within
src/services/ai-review.ts(~lines 3234, 3265, 3280, 3349) — this does not cross a package or twin boundary, so unlike #10210 there is no parity suite to keep in step.Guardrails
ai-reviewsuites are the regression proof — if an assertion needs editing, that is a signal the refactor changed behaviour and should be re-examined rather than the test adjusted.images?should simply be dropped rather than carried into the options object, given it has been dead since feat(review): advisory-only AI-vision analysis of before/after visual captures #4111. That is a separate call — flag it, do not decide it silently.Deliberately narrow: this issue is
runWorkersOpiniononly. The other 25 functions at 8+ parameters from the re-baseline are not in scope.