Skip to content

harden datastream evaluation against rules engine failures (SCH-7057) - #103

Merged
bpapillon merged 4 commits into
mainfrom
bpapillon/sch-7057-fix-datastream-wasm-failures-in-python-sdk
Sep 5, 2026
Merged

harden datastream evaluation against rules engine failures (SCH-7057)#103
bpapillon merged 4 commits into
mainfrom
bpapillon/sch-7057-fix-datastream-wasm-failures-in-python-sdk

Conversation

@bpapillon

@bpapillon bpapillon commented Sep 4, 2026

Copy link
Copy Markdown
Collaborator

Fixes the 1.3.4 regression reported by Syrto on 2026-09-04 (SCH-7057). Engine-side fix: SchematicHQ/schematic-api#8063. Supersedes #102, which GitHub closed when the branch was renamed to the Linear branch name.

WASM v0.7.0 added warning_tiers without the null-tolerant deserializer, and this SDK sends "warning_tiers": null for any company that has been through a partial-update merge, because the generated models keep explicitly-set None values when dumped. Every check against such a company returned an error code, which _evaluate_flag turned into the flag default with reason="RULES_ENGINE_ERROR". Callers could not tell that from a real denial.

  • Strip None values 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_flag now raises RulesEngineError (exported from schematic.datastream) instead of returning the default, so check_flag/check_flags fall back to the REST API the way they already do for other datastream failures.
  • The fallback log line moves from DEBUG to WARNING.
  • E2E cannot run from this public repo (the reusable workflow lives in the private SchematicHQ/actions), so the guard goes into schematic-api's sdk_e2e.yml; see SchematicHQ/schematic-api#8063.

WASM_VERSION stays at 0.7.1 until 0.7.2 is released; the Python-side stripping makes the SDK safe on either.

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.
E2E previously ran only by hand from schematic-api. WASM bump PRs are
opened by a bot and merged on unit tests alone, which is how 1.3.4
shipped a WASM that failed every datastream check for entitled
companies. Run the suite on PRs that touch the WASM version, the
datastream client, or the test app.
SchematicHQ/actions is private and this repo is public, so the reusable
workflow cannot be called from here (GitHub: 'workflow was not found').
E2E runs from schematic-api's sdk_e2e.yml instead.
@bpapillon bpapillon self-assigned this Sep 5, 2026
@bpapillon
bpapillon marked this pull request as ready for review September 5, 2026 05:19
@bpapillon
bpapillon requested a review from a team as a code owner September 5, 2026 05:19
@bpapillon
bpapillon merged commit a3095a8 into main Sep 5, 2026
4 checks passed
@bpapillon
bpapillon deleted the bpapillon/sch-7057-fix-datastream-wasm-failures-in-python-sdk branch September 5, 2026 05:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants