AntFleet

Anatomy · 8ff8c1af-1

getModelPricing JSDoc contradicts implementation (never returns null)

mediumdocs-gap
repo 56f59a0d·PR #2·reviewed 4 days ago

The vulnerable code

src/providers/pricing.ts:62-66

Code snippet unavailable.

The reasoning

Opus

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.

GPT-5

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.

The agreement

Both frontier models flagged this within the same line range. AntFleet's unanimous gate fired — the finding posted on the PR.

Closure

Tweet thread template

tweet 1 of 8156 / 280

Two frontier models reviewed PR #2 on 56f59a0d. Both found this bug: medium docs-gap: getModelPricing JSDoc contradicts implementation (never returns null)

tweet 2 of 8116 / 280

The vulnerable code (src/providers/pricing.ts:62-66): (full snippet at https://www.antfleet.dev/anatomy/8ff8c1af-1)

tweet 3 of 8280 / 280

What Opus saw: "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 — le…

tweet 4 of 8272 / 280

What GPT-5 saw: "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."

tweet 5 of 897 / 280

Both flagged the same line range. AntFleet's unanimous gate fired — the finding posted on the PR.

tweet 6 of 893 / 280

The fix landed in commit pending: (view diff at https://www.antfleet.dev/anatomy/8ff8c1af-1)

tweet 7 of 881 / 280

AntFleet reviews every PR with two frontier models. Only unanimous findings post.

tweet 8 of 877 / 280

Full anatomy + reasoning + diffs: https://www.antfleet.dev/anatomy/8ff8c1af-1

Paste into X composer one tweet at a time. X has no multi-tweet intent API.

medium docs-gap: getModelPricing JSDoc contradicts implementation (never ret… — AntFleet anatomy