Repository navigation
fix(mocks): Is<T>(predicate) passes T, not T?, for non-nullable T - #7405
Conversation
…7304) A null argument no longer reaches a dereferencing predicate as an NRE that fails the mocked call; it simply does not match. Is<T?>(...) still lets a predicate match null.
|
@codex review |
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 12 seconds. View limit details
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Review: PR 7405 (
|
|
Codex Review: Didn't find any major issues. Hooray! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
[Low impact] The PR appears safe to merge; no actionable issues remain. SummaryChanges
Reviews (4) · Last reviewed commit: "fix(mocks): preserve predicate exception..." · Reviewed by Greptile |
|
@codex review The new head enforces CS8602 as an error for PredicateNullabilityTests.cs. Reverting the signature failed with three errors; the fixed signature passed all four targeted tests. Claude’s non-blocking points are accepted: the null-only exception behavior and cost are documented and intentional. The nullable argument conversion note remains in the PR description; the existing matcher documentation already explains selecting T versus T?. |
|
Codex Review: Didn't find any major issues. Keep it up! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
|
Review of #7405 The change does what it says. 1. Catching This is the part I'd reconsider.
A more predictable alternative is to decide from the declared nullability. Annotations aren't available at runtime for a generic 2. Escalating CS8602 to an error for a single file in the repo-root 3. Minor
Overall this is a good ergonomic improvement. I'd like the NRE-swallowing reconsidered, or at least its risk documented, before merge. |
|
@codex review Addressed Claude's latest pre-merge request in 68112ca. The matcher guide, API remarks, and implementation comment now state that both forms pass null to the predicate, any NullReferenceException on that path is suppressed (including unrelated predicate failures), and the exception path has a cost. The guide recommends an explicit null guard and includes the nullable-parameter note. A generator-based null short-circuit would change matching semantics and does not distinguish the caller's generic annotations at this matcher boundary; this change takes the review's documentation option. The remaining editorconfig placement and test-strengthening suggestions are non-blocking and left as follow-ups within this PR's review: the existing scoped rule enforces the regression, and the null-call test also verifies the predicate setup was never matched. The object overload visibly delegates to the same typed path. Validation: git diff --check passed. This commit changes documentation and comments only; no runtime tests were rerun. The prior head's test validation remains in the PR description. Keeping the PR in draft for fresh reviews of this head. |
|
Codex Review: Didn't find any major issues. What shall we delve into next? Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
ReviewThe change does what it says. Points to consider:
No blocking issues. Binary compatibility reasoning ( |
|
Marked ready at unchanged head 68112ca after verifying positive Claude and Codex verdicts, every review surface, and resolved threads. The latest non-blocking suggestions retain the prior disposition: null-path behavior is documented and intentional, the scoped compiler regression rule is effective, and both matcher entry paths share the implementation. Waiting for the ready-for-review Claude run 41551757718 and newly triggered CI. Auto-merge is not armed yet because the repository requires the fresh Claude run to pass and its comment to be read first. |
|
Review of #7405 The change does what it says: Concern: swallowing
Alternatives:
Both are cleaner than a catch-all. Minor
Overall this is a good ergonomic fix. I'd reconsider the NRE catch before merge. 🤖 Generated with Claude Code |
|
@codex review Addressed Claude's renewed concern from run 41551757718 in 9239682: removed the NRE catch rather than suppressing predicate bugs. This restores main's existing exception propagation; the only API change is the intended nullable annotation fix. Updated #7304's incompatible null-matching expectation under its own lock, since nullable generic annotations cannot encode runtime matching intent. Docs and API remarks now explain propagation and explicit null guards. Added regression coverage for null dereference propagation, guarded null non-match, and an unrelated exception on a null argument. Full net10.0 mocks suite passed: 1456/1456. git diff --check passed. AOT publish was not run; no reflection changed. The unrelated ineffective warning pragmas are tracked in #7432. Prior minor suggestions retain their disposition: the scoped editorconfig rule enforces CS8602; object matching delegates to the typed path. The explicit guard regression now asserts the actual empty-string default. Keeping this new head in draft for fresh Claude and Codex reviews. The earlier workflow wait is resolved; this unit pushed fixes. |
|
Codex Review: Didn't find any major issues. 👍 Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
ReviewThe change is small and does what it says. What I checked
Suggestions (non-blocking)
I have no blocking concerns. The change looks good to merge once CI is green. |
Summary
Is<T>(Func<T?, bool>)forced a null guard (CS8602) in predicates that dereference a non-nullable reference argument. It now acceptsFunc<T, bool>, soIs<User>(u => u.Name == "Alice")compiles without CS8602. UseIs<User?>(...)for nullable arguments.Nullable annotations do not distinguish the two forms at runtime: both pass null to the predicate. All predicate exceptions continue to propagate, as on main. An explicit null guard makes null a non-match. This preserves existing runtime behavior and avoids swallowing unrelated predicate bugs.
The signature change is annotation-only and binary compatible for unconstrained T. The implicit predicate conversion drops its unnecessary null suppression. The matcher guide and API remarks explain null handling. A file-specific .editorconfig rule enforces CS8602 in the regression tests.
Closes #7304
Validation