AntFleet

Disagreement · 8ff8c1af-openai-2

getModelPricing JSDoc contradicts implementation (never returns null)

mismatch
repo 56f59a0d·PR #2·reviewed 4 days ago

Primary finding

getModelPricing JSDoc contradicts implementation (never returns null)

mediumdocs-gaphigh
  • src/providers/pricing.ts:62-66
  • src/providers/pricing.ts:66-71
The comment promises null for unknown models, but the code always returns a fallback-derived object. This can mislead callers into writing null checks that never fire or into assuming returned values are known rates when they are conservative fallbacks.

Recommendation

Align docs and code. Either: (a) keep fallback behavior and update the JSDoc to explain that unknown models return fallback pricing; or (b) return null for unknown models (and expose an explicit getFallbackModelPricing if needed). Given hasKnownPricing exists, option (a) is simplest.

Counterpart finding

pricing.ts comments document hasKnownPricing as returning null but signature returns boolean; getModelPricing JSDoc lies about return value

lowdocs-gaphigh
  • src/providers/pricing.ts:60-67
JSDoc claims getModelPricing returns null for unknown models, but the implementation falls back to FALLBACK_PRICING (a non-null object). Callers reading the doc will write `if (price === null)` branches that are dead code and silently apply FALLBACK_PRICING — leading to wrong cost reporting being mistaken for 'unknown model.' This is a misleading comment that would cause real cost-attribution bugs.

Recommendation

Either fix the doc to say 'Falls back to conservative pricing for unknown models; use hasKnownPricing() to check existence' OR change return type to `{...} | null` and have callers handle null.

Why this didn't post

This finding didn't meet AntFleet's unanimous agreement threshold. Both frontier models review every PR independently; only findings they both flag with the same severity and category are posted to the PR. This one fell through.

read the methodology →

From the same review

These findings passed the unanimous gate on the same PR review. The disagreement above was filtered out; the findings below were posted.