Skip to content

Fix "Expression is always true" errors#9517

Merged
glen-84 merged 2 commits intomainfrom
gai/fix-expression-is-always-true
Apr 9, 2026
Merged

Fix "Expression is always true" errors#9517
glen-84 merged 2 commits intomainfrom
gai/fix-expression-is-always-true

Conversation

@glen-84
Copy link
Copy Markdown
Member

@glen-84 glen-84 commented Apr 9, 2026

Summary of the changes (Less than 80 chars)

  • Fix "Expression is always true" errors.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR addresses “Expression is always true” warnings by removing redundant null checks and adding targeted analyzer suppressions where runtime nullability differs from the declared API contract.

Changes:

  • Removed redundant null checks and simplified assertions that are always true under current nullability contracts.
  • Added ReSharper suppressions for nullable-flow warnings that can’t be expressed cleanly with current type annotations.
  • Simplified root type resolution in the execution pipeline.

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
src/Mocha/src/Mocha/Runtime/MessagingRuntimeHostedService.cs Removes redundant null-check before disposing the hosted runtime.
src/HotChocolate/Utilities/src/Utilities.Buffers/ChunkedArrayWriter.cs Adds suppression around chunk null-check in drain/cleanup loop.
src/HotChocolate/Fusion/src/Fusion.Execution/Transport/Http/FileEntryBuilder.cs Simplifies path handling by removing redundant parent null checks.
src/HotChocolate/Data/src/Data/Projections/Expressions/Handlers/QueryableProjectionScalarHandler.cs Adds suppression for nullable-flow loop condition during expression unwrapping.
src/HotChocolate/Core/test/Types.Tests/Types/Relay/NodeTypeTests.cs Simplifies “no errors” assertion assuming Errors is non-null.
src/HotChocolate/Core/test/Types.Tests/Types/Relay/NodeResolverTests.cs Simplifies “no errors” assertion assuming Errors is non-null.
src/HotChocolate/Core/test/Types.Tests/Types/ObjectTypeTests.cs Adds suppression for context non-null check in async resolver test helper.
src/HotChocolate/Core/test/Types.CursorPagination.Tests/UseConnectionAttributeTests.cs Simplifies “no errors” assertion assuming Errors is non-null.
src/HotChocolate/Core/src/Types/Execution/Pipeline/OperationExecutionMiddleware.cs Removes query root null-guard and resolves query root directly from schema.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@glen-84 glen-84 merged commit 6bac912 into main Apr 9, 2026
130 checks passed
@glen-84 glen-84 deleted the gai/fix-expression-is-always-true branch April 9, 2026 14:36
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 9, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 0.00%. Comparing base (2c9fa85) to head (08db6a7).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@     Coverage Diff      @@
##   main   #9517   +/-   ##
============================
============================

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants