Repository navigation
fix(reflection): don't construct data sources to detect typed class sources (#7671 regression) - #7911
Conversation
…methods don't construct data sources (#7671) #7904 extracted a method's data sources before deciding whether the method takes part in class type inference, so a throwing data-source constructor replaced the generic constraint failure in reflection mode and the failed test lost its filter attributes. Issue7671Tests.Matching_Filter_Keeps_Constraint_Failure failed on main in reflection mode on every OS. The typed-source check now reads attribute types from CustomAttributeData, and data sources are constructed only for methods that are inferred from.
Codex Review Summary: ✅ CompletedThis 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. |
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
ReviewThe fix looks correct and small. Non-blocking notes:
Validation in the description (both modes, 14 fixtures with identical counts) is thorough. Approving in spirit; CI on |
[Medium impact] The PR appears safe to merge. SummaryThis PR checks attribute metadata before constructing method data sources.
Reviews (2) · Last reviewed commit: "fix(reflection): decide typed class sour..." · Reviewed by Greptile |
Summary
Fixes the
Engine testsfailures onmain(run 46319218712). All 5 cases ofIssue7671Tests.Matching_Filter_Keeps_Constraint_Failurefailed in reflection mode on Linux and Windows. Each found 0 tests where it expected 1 failed test.Cause: #7904 changed
BuildTestsFromMethodRowsand the method-row inference beside class rows. Both now callReflectionAttributeExtractor.ExtractDataSources(method)before they decide whether to skip a method, so they can check for a typed source that closes the class. That builds every data-source attribute on methods that were skipped before. In the #7671 fixture,[ThrowingSource]throws in its constructor. Its exception became a[DISCOVERY FAILED]test in place of the'struct' constraintfailure. Reading that test's attributes threw again, so it had no category or property, and the filter dropped it.Fix: the typed-source check (
DeclaresTypedClassSource) now reads attribute types fromCustomAttributeData, with the sameinherit: falseused for methods. Data sources are built only for methods that take part in inference.InferClassTypesFromTypedMethodSourcenow calls a new overload that takes the attribute's type.Validation
TUnit.TestProjectin both modes. Matching filters give 1 failed test with the constraint message, and non-matching filters give 0. Both modes now agree. Before the fix, reflection gave 0 for the matching filters.TUnit.Engine.Testsleft to CI, asAGENTS.mdsays.Summary by CodeRabbit