Repository navigation
fix(http): cast loose boolean query params before actions - #14085
cursor[bot] wants to merge 3 commits into
Conversation
SDKs send total=false as the string "false", which Boolean(loose) accepted but left as a non-empty string. PHP then coerced it to true for typed bool params, so list endpoints still ran the count. Parse loose forms to real booleans in utopia-http after validation (fixes #14082). Co-authored-by: chiragaggarwal5k <[email protected]>
🟢 Tier S · Ready to merge
Adds a validator cast() hook so accepted loose boolean query values reach HTTP actions as native booleans, fixing literal total=false being treated as true. Boolean performs the conversion and Nullable delegates while preserving null. Includes validator and HTTP unit coverage plus an account sessions E2E regression. Latest changes: Moves casting into validate() to reuse the validated validator instance, simplifies boolean matching with strict in_array(), updates HTTP test output assertions, and adjusts the PHPStan baseline.
Note @cursor[bot] does not have write access to this repository, so Hansi does not approve automatically. A maintainer can review and approve. 📂 Walkthrough · 9
Reviewed the commits since |
Adding Validator::parse() fatally conflicted with Appwrite's CompoundUID::static parse(), which messaging loads at boot. Rename the loose-value hook to cast() instead. Co-authored-by: chiragaggarwal5k <[email protected]>
✨ Benchmark resultsComparing
Per-scenario breakdown & investigation detailsMetrics below reflect the current branch (after). Δ P95 compares against the base.
Top API waits (after)
|
Calling resolveValidator again after validate re-ran factory closures (breaking HttpTest::testCanExecuteRoute). Cast loose values inside validate via by-ref, apply Rector's in_array form in Boolean::cast, and refresh the http phpstan baseline counts for the new test. Co-authored-by: chiragaggarwal5k <[email protected]>
What does this PR do?
List endpoints accept
total=falseto skip the count, but official SDKs send the query string literal"false".Boolean(loose: true)accepted that string and left it unchanged; PHP then coerced the non-empty string totruefor typedboolaction params, so the count still ran.This adds
Validator::parse()(overridden byBoolean/ delegated byNullable) and calls it from utopia-http after validation so loose forms become real booleans before the action runs.Test Plan
BooleanTest/NullableTestparse coverageHttpTest::testLooseBooleanParamsAreParsedToBoolfor"false"/"true"/"0"/"1"?total=false(SDK-shaped query string)Related PRs and Issues
total=falseon list endpoints is ignored #14082Checklist