test: property-check the unsupported-model fallback invariants#574
Conversation
fast-check properties over resolveUnsupportedCodexFallbackModel (via the fetch-helpers facade), generating every default-chain model under provider prefixes, reasoning-effort suffixes, and arbitrary casing: - the feature toggle off, or a non-unsupported error body, always yields undefined - any returned fallback is a member of the canonical chain for the requested model, is never the current model, never an already-attempted model, and respects the gpt-5.3 -> gpt-5.2 legacy edge toggle - with nothing attempted the first chain target wins; with every target attempted the resolver gives up - attempted-model spellings canonicalize the same way as requested models, so a differently-spelled attempt still skips its target https://claude.ai/code/session_01XNtnkLbBiXZxfQQYLMpucB
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
|
Warning Review limit reached
More reviews will be available in 6 minutes and 3 seconds. Learn how PR review limits work. Your organization has run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (1)
✨ Finishing Touches🧪 Generate unit tests (beta)
✨ Simplify code
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
The resolver normalizes chain values through canonicalizeModelName; the test helper now mirrors that transform so the expectations stay valid even if a future chain entry is added in a non-canonical spelling. https://claude.ai/code/session_01XNtnkLbBiXZxfQQYLMpucB
Summary
Companion to the direct-coverage wave (#559–#573), in the repo's existing
test/property/tradition.resolveUnsupportedCodexFallbackModelsteers which model the proxy retries with when ChatGPT accounts reject a Codex model — a wrong fallback means silent infinite retry loops or model downgrades the user never asked for. The existing example-based coverage (via the fetch-helpers suites) pins specific cases; this addstest/property/model-fallback.property.test.ts(6 fast-check properties) pinning the invariants across the whole input space.The generator produces every default-chain model under provider prefixes (
openai/,models/), reasoning-effort suffixes (-low,-xhigh, …), and arbitrary casing — exactly the spellingscanonicalizeModelNamemust normalize.Invariants pinned
undefined.gpt-5.3-codex → gpt-5.2-codexlegacy-edge toggle.OPENAI/GPT-5.3-CODEX-HIGHstill skipsgpt-5.3-codex.Validation
vitest run test/property/model-fallback.property.test.ts— 6/6 passing (default fast-check run counts)npm run typecheck— cleannpx eslint test/property/model-fallback.property.test.ts --max-warnings=0— cleanhttps://claude.ai/code/session_01XNtnkLbBiXZxfQQYLMpucB
Generated by Claude Code
note: greptile review for oc-chatgpt-multi-auth. cite files like
lib/foo.ts:123. confirm regression tests + windows concurrency/token redaction coverage.Greptile Summary
adds
test/property/model-fallback.property.test.ts— 6 fast-check properties that pin the fallback invariants ofresolveUnsupportedCodexFallbackModelacross the full input space of provider prefixes, effort suffixes, and arbitrary casing. the localcanonicalizehelper now passes chain values through normalization before comparison, closing the coupling issue flagged in the previous wave.true, leaving thegpt-5.3-codex + toggle-off = undefinedbranch untested.Confidence Score: 5/5
test-only addition; no production code changes, no concurrency or token-safety surface introduced.
all changes are confined to a new property test file; the implementation under test is unchanged. the two gaps noted leave a small slice of the stated invariants unexercised, but neither gap conceals a defect in the resolver itself.
test/property/model-fallback.property.test.ts — properties 4 and 6 have the coverage gaps described above.
Important Files Changed
Flowchart
%%{init: {'theme': 'neutral'}}%% flowchart TD A["resolveUnsupportedCodexFallbackModel(options)"] --> B{fallbackOnUnsupportedCodexModel?} B -- false --> Z1[return undefined] B -- true --> C{errorBody is unsupported-model error?} C -- no --> Z2[return undefined] C -- yes --> D["canonicalize requestedModel → currentModel"] D --> E{currentModel in chain?} E -- no --> Z3[return undefined] E -- yes --> F["iterate chain targets"] F --> G{legacyEdge=false AND target=gpt-5.2-codex AND current=gpt-5.3-codex?} G -- yes --> H[skip target] H --> F G -- no --> I{target === currentModel?} I -- yes --> H I -- no --> J{target in attempted set?} J -- yes --> H J -- no --> K[return target] F -- exhausted --> Z4[return undefined]Prompt To Fix All With AI
Reviews (2): Last reviewed commit: "test: canonicalize expected chain target..." | Re-trigger Greptile