harden datastream evaluation against rules engine failures (SCH-7057) - #102
Closed
bpapillon wants to merge 2 commits into
Closed
harden datastream evaluation against rules engine failures (SCH-7057)#102bpapillon wants to merge 2 commits into
bpapillon wants to merge 2 commits into
Conversation
The generated models keep explicitly-set None values even with exclude_none=True, and partial_company sets every unset optional entitlement field to None when it merges a partial update. WASM v0.7.0 rejects an explicit null for warning_tiers, so from a company's first partial update every check against it returned an error code and the caller saw the flag default (schematichq 1.3.4, 2026-09-04).
_evaluate_flag returned the flag default with reason RULES_ENGINE_ERROR, so an engine failure was indistinguishable from a real verdict and never reached the API fallback the client already has. Raise RulesEngineError instead, and log the fallback at WARNING so an abandoned datastream evaluation is visible without DEBUG logging.
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.
Fixes the 1.3.4 regression reported by Syrto on 2026-09-04 (see SchematicHQ/schematic-api#8060 for the engine-side fix).
WASM v0.7.0 added
warning_tierswithout the null-tolerant deserializer, and this SDK sends"warning_tiers": nullfor any company that has been through a partial-update merge, because the generated models keep explicitly-setNonevalues when dumped. Every check against such a company returned an error code, which_evaluate_flagturned into the flag default withreason="RULES_ENGINE_ERROR". Callers could not tell that from a real denial.Nonevalues from the envelope before it reaches the WASM, so the envelope shape no longer depends on how the models were built. Regression test runs the real partial-merge path against the bundled WASM._evaluate_flagnow raisesRulesEngineError(exported fromschematic.datastream) instead of returning the default, socheck_flag/check_flagsfall back to the REST API the way they already do for other datastream failures.WASM_VERSIONstays at 0.7.1 until 0.7.2 is released; the Python-side stripping makes the SDK safe on either.