Problem
In src/runners/cc-agents-discovery.ts, discoverCcAgents() calls parseSemver() + compareSemver() manually (lines 146-148) after already calling isCcAgentsJsonSupported() (line 115) which does the exact same check internally.
This means detectCcVersion() may be called up to 2x (once in isCcAgentsJsonSupported, once in discoverCcAgents), and parseSemver is applied 4x total (2 parses × 2 calls).
Fix
discoverCcAgents should call isCcAgentsJsonSupported() once, not duplicate the semver logic
- Or extract a private
checkVersionSupport() that returns the parsed version to avoid double work
Impact
Discovered during
Code quality sweep on src/runners/ (pre-#3180 audit).
Problem
In
src/runners/cc-agents-discovery.ts,discoverCcAgents()callsparseSemver()+compareSemver()manually (lines 146-148) after already callingisCcAgentsJsonSupported()(line 115) which does the exact same check internally.This means
detectCcVersion()may be called up to 2x (once inisCcAgentsJsonSupported, once indiscoverCcAgents), andparseSemveris applied 4x total (2 parses × 2 calls).Fix
discoverCcAgentsshould callisCcAgentsJsonSupported()once, not duplicate the semver logiccheckVersionSupport()that returns the parsed version to avoid double workImpact
Discovered during
Code quality sweep on
src/runners/(pre-#3180 audit).