SDK-2765: Python - Support handled_check_limit property for checks in IDV sandbox - python#156
Open
mehmet-yoti wants to merge 1 commit into
Conversation
…t types Add an optional `handled_check_limit` integer property to the base `SandboxCheck` class and `SandboxCheckBuilder`, so all concrete sandbox check types (DocumentAuthenticity, DocumentFaceMatch, DocumentTextData, IdDocumentComparison, SupplementaryDocumentTextData, ZoomLiveness) inherit support for setting how many times a configured check response is used before the sandbox advances to the next response. The field is omitted from serialized JSON when not set so the backend treats absence as no limit.
There was a problem hiding this comment.
Pull request overview
Adds support for an optional handled_check_limit property across the Python IDV sandbox check model/builder layer, enabling callers to control how many times a configured sandbox check response is reused before advancing to the next response, with conditional JSON serialization and accompanying pytest coverage.
Changes:
- Added optional
handled_check_limittoSandboxCheck(property + conditionalto_json()serialization) and toSandboxCheckBuilder(fluent setter + stored value). - Threaded
handled_check_limitthrough check constructors/builders for all concrete check types indoc_scan/check. - Added a new pytest module validating presence/absence in JSON and propagation via all builders.
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| yoti_python_sandbox/doc_scan/check/sandbox_check.py | Introduces handled_check_limit on the base check + builder and conditionally serializes it to JSON. |
| yoti_python_sandbox/doc_scan/check/sandbox_document_check.py | Passes handled_check_limit into the base SandboxCheck for document-based checks. |
| yoti_python_sandbox/doc_scan/check/sandbox_document_authenticity_check.py | Forwards handled_check_limit from the builder into the constructed check. |
| yoti_python_sandbox/doc_scan/check/sandbox_document_face_match_check.py | Forwards handled_check_limit from the builder into the constructed check. |
| yoti_python_sandbox/doc_scan/check/sandbox_document_text_data_check.py | Forwards handled_check_limit from the builder into the constructed check. |
| yoti_python_sandbox/doc_scan/check/sandbox_id_document_comparison_check.py | Adds handled_check_limit to the check constructor and forwards it from the builder. |
| yoti_python_sandbox/doc_scan/check/sandbox_liveness_check.py | Adds handled_check_limit to liveness base check and includes it in JSON via parent serialization. |
| yoti_python_sandbox/doc_scan/check/sandbox_zoom_liveness_check.py | Forwards handled_check_limit through Zoom liveness check + builder. |
| yoti_python_sandbox/doc_scan/check/sandbox_supplementary_document_text_data_check.py | Forwards handled_check_limit from the builder into the constructed check. |
| yoti_python_sandbox/tests/doc_scan/check/test_handled_check_limit.py | Adds tests validating JSON omission/inclusion and builder propagation across all check builders. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+28
to
+35
| @pytest.mark.parametrize("builder_class", ALL_BUILDER_CLASSES) | ||
| def test_handled_check_limit_is_included_in_json_when_set(builder_class): | ||
| check = builder_class().with_handled_check_limit(HANDLED_CHECK_LIMIT).build() | ||
|
|
||
| json = check.to_json() | ||
|
|
||
| assert json.get("handled_check_limit") == HANDLED_CHECK_LIMIT | ||
|
|
| advances to the next configured response. | ||
|
|
||
| :param handled_check_limit: the limit | ||
| :type handled_check_limit: int |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds an optional
handled_check_limitinteger property to the baseSandboxCheckclass andSandboxCheckBuilderin the Python IDV sandbox SDK. The property controls how many times a configured sandbox check response is used before the sandbox advances to the next response. The field is serialized ashandled_check_limitin JSON only when explicitly set, and all 6 concrete check types inherit the behaviour automatically.Changes
yoti_python_sandbox/doc_scan/check/sandbox_check.py— Addedhandled_check_limitparameter toSandboxCheck.__init__, a read-onlyhandled_check_limitproperty, and conditional JSON serialization into_json(). Addedwith_handled_check_limit()fluent builder method toSandboxCheckBuilder.sandbox_document_authenticity_check.py,sandbox_document_face_match_check.py,sandbox_document_text_data_check.py,sandbox_id_document_comparison_check.py,sandbox_liveness_check.py,sandbox_supplementary_document_text_data_check.py,sandbox_zoom_liveness_check.py— Updated each concrete check and builder to forwardhandled_check_limitthrough to the base class.yoti_python_sandbox/tests/doc_scan/check/test_handled_check_limit.py— 31 new tests covering: property present/absent in JSON, property getter on check object, end-to-end scenarios for each check type, and backward-compatibility when the limit is not set.QA Test Steps
pip install -e ".[dev]".pytestfrom the repo root; all 137 tests should pass.SandboxDocumentAuthenticityCheckBuilder), call.with_handled_check_limit(3).build(), and verifycheck.handled_check_limit == 3andcheck.to_json()["handled_check_limit"] == 3.with_handled_check_limit; verifycheck.handled_check_limit is Noneand"handled_check_limit" not in check.to_json().0and-1as the limit; confirm the value is serialized (the field is omitted only when the value isNone, not falsy).handled_check_limit) continue to produce identical JSON payloads with no new keys.Notes
None; no breaking changes to existing callers.if value is not Nonepattern consistent with other optional fields in the codebase.SandboxLivenessCheck(non-Zoom) also inherits the field viaSandboxCheck, providing consistency across all liveness check variants.Related Jira: SDK-2765
Auto-generated by Claude dynamic workflow