fix(reflect): accept a top-level array of delta operations - #3829
Open
ebarkhordar wants to merge 1 commit into
Open
fix(reflect): accept a top-level array of delta operations#3829ebarkhordar wants to merge 1 commit into
ebarkhordar wants to merge 1 commit into
Conversation
A model that emits the operations as a bare top-level JSON array had the whole payload
rejected before per-op validation ran. Normalize a top-level list to {"operations": [...]}
and fall through to the existing validation path.
Fixes vectorize-io#3820
Strix Security ReviewNo security issues found. Updated for Reviewed by Strix |
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.
parse_delta_operation_listrequires the parsed JSON to be a dict carrying anoperationskey. When a model emits the operations as a bare top-level array, which is legal JSON and structurally complete, the guard rejects the whole payload withdelta payload must be an object with an operations array, so_validate_operations_listand_finalize_operationsnever see ops that are individually valid. Atllm_temperature_consolidation(0.0) the output is deterministic for a given window, so the refresh then fails identically on every retry.#3424 decoupled the transport cap and fixed the truncation case. This is the other malformation that shared that error message: here the JSON is complete, only its top-level container differs.
Fix
Normalize a top-level list to
{"operations": <list>}before the dict check, then fall through to the existing path. Per-op validation, invalid-op skipping and the all-ops-invalid error are unchanged, because the normalized payload reaches exactly the same code. The normalization only fires on a value that previously took thecontinuebranch, so no payload that parses today changes behaviour.Verification
Run in a clean container at
8c01b89:tests/test_delta_operation_parse.pyfail on main with theValueErrorabove and pass on the branchdelta_ops, passes go from 228 to 231, the difference being these three; 80 errors appear identically on both arms and are a missingpg0extra in the container, not a regressionruff check,ruff format --checkandty check hindsight_apiat the locked 0.14.9 and 0.0.8, withtyreporting the same 211 diagnostics on both armscompilealland the import smoke on 3.11 and 3.14, the ends of thebuild-api-python-versionsmatrixWhat this does not cover: nothing here drives a live provider or a real refresh, so the end-to-end wedge stays your observation rather than something I reproduced. I also left the prose-wrapped case alone, since
_extract_balanced_json_objectstill searches for a{and an array wrapped in commentary is unchanged.One note on the sample payload in the report: its op carries the v1
blockfield, whichAppendBlockOpdoes not define, so that exact snippet still raises, now asDeltaAllOpsInvalidErrorfrom per-op validation instead of on the top-level type.test_parse_delta_operation_list_rejects_v1_block_payloadspins that shape as invalid on purpose, so the tests here usetext.Fixes #3820