Proof Portal
litellm
BerriAI117 findings · 107 requirementsLiteLLM Python->Rust migration audit (proof mirroring).
93 withheld (location undisclosed)
The Mistral OCR integration shall honor the provider request/response contract: forward only supported parameters, build a well-formed request or reject a non-dict document, target the canonical Mistral OCR endpoint, require an API key, and return a structured OCR response or re-raise a parse failure
Specification
The requirement exactly as authored — its complete prose text and, where present, the formal FRETish sentence it compiles to.
The Mistral OCR integration shall honor the provider request/response contract: forward only supported parameters, build a well-formed request or reject a non-dict document, target the canonical Mistral OCR endpoint, require an API key, and return a structured OCR response or re-raise a parse failure
the mistral_ocr shall always satisfy ocr_contract_honored
Rationale & tags
Why this requirement exists, and how it is categorised.
Rationale & tags
Why this requirement exists, and how it is categorised.
System-level black-box behavior of the Mistral OCR provider, decomposed into component software requirements
Verification & provenance
How this requirement was checked: the review trail, edit history, and the machine-analysis status terms (each ⓘ explains what it means).
Review
- Status
- approved
- Reviewer
- Buger · system_owner
- Reviewed
- Jul 1, 2026, 16:42 UTC
History
- Created
- Jul 1, 2026, 09:53 UTC · Claude Code · AI agent
- Modified
- Aug 1, 2026, 18:27 UTC · Claude Opus 4 8 · AI agent
Hazard review
- domainreviewedexternal_call_timeout_boundedexternal_call_failure_observableexternal_call_concurrency_boundedupstream_budget_coordinatedssrf_protectioncert_validation_strictredirect_policy_explicitretry_policy_explicittls_required_for_secrets
End-to-end Mistral OCR call is real network I/O (litellm/ocr/main.py -> BaseLLMHTTPHandler.ocr): a hung/erroring/slow Mistral API must be time-bounded, concurrency-bounded so it cannot starve other proxy clients, surface typed failures, fit the upstream ingress budget, and the user-influenced document URL plus Bearer-key TLS plus default redirect-following make ssrf/cert/redirect/tls/retry real hazards; witnesses live in the out-of-scope OCR call path so coverage is tracked debt
- scenarioreviewednominalerror_handlingmalformed_input
The behavioral core of this contract: nominal (valid doc -> structured OCRResponse), error_handling (parse failure and dependency-unavailable re-raise via litellm.exception_type), and malformed_input (non-dict/invalid-type document rejected with ValueError before any endpoint call); the remaining scenario partitions have no distinct referent for a stateless single-document forward
- propertyreviewed
A single stateless document->pages request/response forward has no accumulating, ordering, idempotency, or all-or-nothing semantics of its own; totality is discharged by decomposition into the 9 satisfying SW-REQs and invariant_preservation is Go-lemma-only while this path is Python plus a Rust FFI bridge
- structuralreviewed
Implementation is garbage-collected Python plus a memory-safe Rust FFI bridge with no manual allocation, pointer arithmetic, fixed-width overflow, or user-controlled printf format; nil handling and the base64 encode step are already modeled as behavioral partitions / child SW-REQs, so the language-level memory-safety classes have no C/C++/Go construct to bind at this contract
Change history
Every recorded revision of this requirement's source file — newest first, each with its commit message and the diff for that change.
Open known issues
Findings currently open against this requirement — issues its verification surfaced that are not resolved yet. Each links to the full finding.
Obligations
What this requirement must witness to be considered satisfied — the required evidence, and the tests that discharge each one.
12 obligations · 4 deferred · 8 discharged
Browse the catalogueEvidence tagged via <REQ> is witnessed by a requirement that satisfies this one — normal for stakeholder / aggregate requirements, which are proven through the requirements that refine them.
HTTP clients shall verify TLS certificates, hostnames, and chains; InsecureSkipVerify and equivalent shall not be enabled in production.
- nominalrequiredpresentCovered by 2 tests
- negativerecommendedpresentCovered by 2 tests
Behavior when operations fail or dependencies are unavailable.
- negativerequiredpresent
- nominalrequiredpresent
Outbound concurrency to each external dependency shall be capped (semaphore / bulkhead / circuit breaker) so that one stalled dependency cannot exhaust caller capacity.
Deferred — tracked by a finding withheld pending disclosure.
- nominalrequireddeferredWitnessing deferred — accepted while the tracking known issue stays open.
External-call failures (timeout, unreachable, refused, TLS error) shall map to typed errors that the caller surfaces; silent retries / black-hole drops are forbidden without explicit policy.
- nominalrequiredpresentCovered by 8 tests
Every cross-process call shall declare connect, read, and total deadlines; no external call is defaulted to "no timeout."
- nominalrequiredpresentCovered by 4 tests
Behavior when inputs are syntactically or structurally invalid.
- negativerequiredpresent
- nominalrequiredpresent
Happy-path behavior with valid inputs.
- nominalrequiredpresentCovered by 22 testsvia INT-REQ-001via INT-REQ-001via SW-REQ-260701-APG0via SW-REQ-260701-APG0via SW-REQ-260701-APG0via SW-REQ-260701-DEP5via SW-REQ-260701-DEP5via SW-REQ-260701-EM9Fvia SW-REQ-260701-EM9Fvia SW-REQ-260701-EM9Fvia SW-REQ-260701-EM9Fvia SW-REQ-260701-KYETvia SW-REQ-260701-KYETvia SW-REQ-260701-KYETvia SW-REQ-260701-KYETvia SW-REQ-260701-KYETvia SW-REQ-260701-VWQCvia SW-REQ-260701-VWQCvia SW-REQ-260701-X0S8via SW-REQ-260701-X0S8
HTTP clients shall declare their redirect-following policy (max hops, scheme/host invariants, header propagation).
- nominalrequiredpresentCovered by 2 tests
HTTP clients shall declare an explicit retry policy (which methods, which errors, max attempts, backoff schedule, jitter).
Control absent on the OCR call path; real reliability/security gap documented in KI-ocr-retry (owner, remediation). Honest tracked debt, not a sham suppression.
- nominalrequireddeferredWitnessing deferred — accepted while the tracking known issue stays open.
HTTP clients with user-influenced URLs shall enforce an allowlist of reachable destinations and reject internal-network targets.
Deferred — tracked by a finding withheld pending disclosure.
- nominalrequireddeferredWitnessing deferred — accepted while the tracking known issue stays open.
Endpoints handling secrets shall reject plaintext HTTP.
If the assembled OCR call sends the Bearer credential over plaintext or a downgraded transport, a MITM on the path captures the key and can impersonate the customer against Mistral and read their documents
- nominalrequiredpresentCovered by 4 tests
- negativerecommendedpresentCovered by 1 test
Spec shall enumerate the upstream timeout chain (load balancer, ingress, peer service, client-side proxy) and prove that the caller's total call budget is strictly less than the minimum upstream timeout.
Deferred — tracked by a finding withheld pending disclosure.
- nominalrequireddeferredWitnessing deferred — accepted while the tracking known issue stays open.
Formula evidence
The formal formula behind this requirement, the variables it is written over, and the tests that exercise it (each term is explained inline).
Formula evidence
The formal formula behind this requirement, the variables it is written over, and the tests that exercise it (each term is explained inline).
FRETish formula
the mistral_ocr shall always satisfy ocr_contract_honored
Witnesses· 1 scenario total
- test_interface_contract_end_to_endexercises 1 condition scenario
MC/DC truth table· 2 rows
Each row assigns the formula's conditions (T/F) and shows the Result— the formula's value for that input row, not a test pass/fail. A row proves a condition when flipping only that condition flips the outcome. The test that covers each row is linked.
mcdc:ignoreNo-actionfalse-result row satisfied by designUncoveredneeds a covering test| # | ocr_contract_honored | Result | Proves | Covering test |
|---|---|---|---|---|
| 1 | F | F | ocr_contract_honored | Exempted · defensive — the assembled stack always targets /v1/ocr with a Bearer header, forwards only supported params, and returns a structured OCRResponse; a correct build cannot dishonor the contract, so this invariant-violation row is unreachable (reviewed: agent:claude-opus-4-8) |
| 2 | T | T | ocr_contract_honored |
Its place
How this requirement connects — what proves it, what it affects, and what it rests on. Authored links only here; automatically derived links come from the audit index.
Loading graph…
Trace evidence
The concrete artifacts linked to this requirement — implementing code, verifying tests, documents, and the findings raised against it.
No implementation linked
No source files are traced to this requirement yet.
Mirrors
Ports this requirement participates in — it carries a reviewed exemption on one side, or a finding raised against it is tracked as part of the port.
Mirrors
Ports this requirement participates in — it carries a reviewed exemption on one side, or a finding raised against it is tracked as part of the port.
- Mistral OCR: Python -> RustMIR-001InheritedPython → RustView in Mirrors
Impact
Blast radius — authored trace links only (automatically derived links come from the audit index and aren't shown here).
Impact
Blast radius — authored trace links only (automatically derived links come from the audit index and aren't shown here).
If you change this
Requirements (10)
- Interface decomposition of SYS-REQ-260701-3HNG between…mistral_ocr · INT
- transform_ocr_response re-raises the underlying exception…mistral_ocr · SW
- validate_environment raises ValueError when no API key is…mistral_ocr · SW
- map_ocr_params forwards a parameter iff it is in the…mistral_ocr · SW
- transform_ocr_response returns an OCRResponse carrying…mistral_ocr · SW
- validate_environment returns headers with a Bearer…mistral_ocr · SW
- get_complete_url appends only /ocr when the effective base…mistral_ocr · SW
- transform_ocr_request raises ValueError when the document…mistral_ocr · SW
- transform_ocr_request builds a request body of model,…mistral_ocr · SW
- get_supported_ocr_params returns exactly the set of…mistral_ocr · SW
Files to re-check (3)
- transformation.rslitellm-rust/crates/core/src/providers/mistral/ocr/transformation.rs
- transformation.pylitellm/llms/mistral/ocr/transformation.py
- transformation.rslitellm-rust/crates/core/src/ocr/transformation.rs
Tests to re-run (2)
- tests.rslitellm-rust/crates/ai-gateway/src/ocr/tests.rs
- test_mistral_ocr_transformation.pytests/test_litellm/llms/mistral/ocr/test_mistral_ocr_transformation.py
What this rests on
Parent requirements (1)
Discussions
Discuss this with the proof team. Nothing changes in your audit automatically — you open a request and a staff member records any outcome inside the thread.