fix: negate missing condition paths correctly - #449
Open
Mohamed Mansour (mohamedmansour) wants to merge 1 commit into
Open
fix: negate missing condition paths correctly#449Mohamed Mansour (mohamedmansour) wants to merge 1 commit into
Mohamed Mansour (mohamedmansour) wants to merge 1 commit into
Conversation
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Mohamed Mansour (mohamedmansour)
requested review from
Bang Lee (Qusic),
Akrosh Gandhi (akroshg),
Jane Chu (janechu) and
mcritzjam
and
a lite review from Copilot
August 16, 2026 15:29
Copilot started reviewing on behalf of
Mohamed Mansour (mohamedmansour)
August 16, 2026 15:30
View session
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes a condition-evaluation edge case where missing identifier paths incorrectly propagated MissingValue through evaluation, causing unary negation (!) to be skipped and making path and !path both evaluate as false. This brings SSR behavior back in line with the browser/runtime evaluator and the documented handler contract.
Changes:
- Update
microsoft-webui-expressionsto treat missing identifier leaves as falsy operands (Ok(false)) while preserving missing-comparison-operand errors (MissingValue). - Add SSR + Playwright regression coverage for missing top-level and loop-item paths (including client-created elements and repeat updates).
- Update DESIGN + docs to clearly specify the “missing identifier is falsy (and negation applies)” contract.
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| packages/webui-framework/tests/fixtures/repeat-conditional/src/test-repeat-conditional/test-repeat-conditional.html | Adds missing top-level and loop-item <if> branches to exercise missing-path truthiness and negation. |
| packages/webui-framework/tests/fixtures/repeat-conditional/repeat-conditional.spec.ts | Adds Playwright regression asserting missing identifiers are falsy and negation flips them, both SSR and client-created. |
| docs/guide/concepts/state-management/index.md | Documents missing identifier behavior in conditions vs empty output for missing text/attr bindings. |
| docs/guide/concepts/how-it-works.md | Clarifies SSR “source of truth” guidance while reflecting missing identifier falsy semantics. |
| docs/guide/concepts/directives/if.md | Updates truthiness table and explicitly explains missing identifier behavior under negation. |
| docs/guide/concepts/best-practices.md | Aligns best-practices guidance with updated missing-identifier condition semantics. |
| docs/ai/SKILL.md | Updates AI guidance to match missing identifier falsy/negation semantics. |
| DESIGN.md | Updates the spec to define missing identifier operands as falsy before negation/logicals, while preserving handler behavior for missing predicates. |
| crates/webui-handler/src/lib.rs | Updates condition-eval docs and adds an SSR regression test covering global + loop scopes under negation. |
| crates/webui-expressions/src/lib.rs | Implements missing-identifier-as-false behavior and updates unit tests accordingly. |
💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
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.
A missing condition path currently propagates
MissingValueuntil the handler converts the entire expression tofalse. That skips unary negation, so bothpathand!pathrender as false and SSR diverges from the existing browser evaluator.Changes
Compatibility
Direct
microsoft-webui-expressionscallers now receiveOk(false)instead ofMissingValuefor a missing bare identifier. This aligns the public evaluator with documented handler behavior and the compiled browser runtime. Missing comparison operands retain their prior error behavior.Testing
cargo xtask checkcargo test -p microsoft-webui-expressionsmicrosoft-webui-handlerSSR regressionpnpm typecheck:e2einpackages/webui-frameworkrepeat-conditionalfixture suitepnpm buildindocs