Retrieval relevance comes after authorization and freshness. A nearly identical policy from another customer is still outside the request, and a retired revision can contain a convincingly wrong rule. Apply those filters before ranking so similarity never becomes a reason to cross a data boundary.
Return document IDs whose tenant matches case.tenant and whose revision equals case.current_revision, ordered by ID. Filter before ranking. Matching words from another tenant are not authorized evidence.
The notebook executes your Python against an original local mock. Use the supplied case rather than copying visible values. The hidden checks change identities, revisions and boundary inputs; no provider endpoint or external tool is contacted.
An example implementation of the function contract.