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] This PR appears safe to merge. SummaryThis PR checks method attribute types before constructing data sources during generic class inference.
Reviews (1) · Last reviewed commit: "fix(reflection): decide typed class sour..." · Reviewed by Greptile |
Updated [TUnit](https://github.com/thomhurst/TUnit) from 1.87.12 to 1.90.0. <details> <summary>Release notes</summary> _Sourced from [TUnit's releases](https://github.com/thomhurst/TUnit/releases)._ ## 1.90.0 <!-- Release notes generated using configuration in .github/release.yml at b7aa60158f6f83fd74efb4974dfca3664dc5244c --> ## What's Changed ### Other Changes * fix(generic): share generic inference and constructor-row binding across source-gen, reflection and TUnit0001 by @thomhurst in thomhurst/TUnit#7883 * fix(engine): report missing required constructor and method arguments consistently in both modes by @thomhurst in thomhurst/TUnit#7900 * feat(metadata): preserve generic array shape in TypeInfo and retire constructor array recovery by @thomhurst in thomhurst/TUnit#7901 * fix(discovery): don't construct data sources when collecting generic constraint failure filters by @thomhurst in thomhurst/TUnit#7902 * fix(reflection): discover internal and protected internal test methods by @thomhurst in thomhurst/TUnit#7898 * fix(generic): infer generic class types from member, typed and type-free sources the same way in both modes by @thomhurst in thomhurst/TUnit#7904 * feat(engine): experimental adaptive [ParallelLimiter] limits, a shared parallel budget across test processes, and child-process CPU in the adaptive summary by @thomhurst in thomhurst/TUnit#7910 * fix(reflection): don't construct data sources to detect typed class sources (#7671 regression) by @thomhurst in thomhurst/TUnit#7911 **Full Changelog**: thomhurst/TUnit@v1.88.3...v1.90.0 <!-- tunit-release-draft --> ## 1.88.3 <!-- Release notes generated using configuration in .github/release.yml at 596354246a5059d42005f45787f2ebad4b4ad4cb --> ## What's Changed ### Other Changes * fix(engine): hold the adaptive limit when other processes saturate the CPUs by @thomhurst in thomhurst/TUnit#7895 ### Dependencies * chore(deps): update all non-major dependencies to 1.88.2 by @thomhurst in thomhurst/TUnit#7897 **Full Changelog**: thomhurst/TUnit@v1.88.2...v1.88.3 <!-- tunit-release-draft --> ## 1.88.2 <!-- Release notes generated using configuration in .github/release.yml at 5eb1fcfb91bd5439d32c483eda3619ceffbb3dd7 --> ## What's Changed ### Other Changes * test: stabilise CI tests that fail under load or on Windows checkouts by @thomhurst in thomhurst/TUnit#7882 * fix(engine): stop [ParallelLimiter] waits holding parallel slots, and settle adaptive parallelism by @thomhurst in thomhurst/TUnit#7888 **Full Changelog**: thomhurst/TUnit@v1.88.1...v1.88.2 <!-- tunit-release-draft --> ## 1.88.1 <!-- Release notes generated using configuration in .github/release.yml at 01c0862e7bc168c559ed29b3239b620dfc789372 --> ## What's Changed ### Other Changes * fix(engine): stop adaptive parallelism raising the limit while tests wait on a fixture by @thomhurst in thomhurst/TUnit#7879 * feat(html-report): pin span attributes and add an AI tab for GenAI spans by @thomhurst in thomhurst/TUnit#7880 ### Dependencies * chore(deps): update all non-major dependencies to 1.88.0 by @thomhurst in thomhurst/TUnit#7875 **Full Changelog**: thomhurst/TUnit@v1.88.0...v1.88.1 <!-- tunit-release-draft --> ## 1.88.0 <!-- Release notes generated using configuration in .github/release.yml at f8e0aec133d6d30cb1a9a0bdf35e14c5d81f0354 --> ## What's Changed ### Adaptive Parallelism (Experimental Opt-in) TUnit will attempt to dynamically control parallelism based on machine contention. This is experimental. See the docs for how to opt-in: https://tunit.dev/docs/execution/parallelism/#adaptive-parallelism * feat(engine): opt-in adaptive parallelism driven by machine load and throughput by @thomhurst in thomhurst/TUnit#7872 ### Other Changes * Reduce TUnit.Mocks setup and call history allocations by @thomhurst in thomhurst/TUnit#7840 * Speed up mock setup and invocation history by @thomhurst in thomhurst/TUnit#7841 * fix(assertions): suppress CS8619/CS8621 for a Task<T> delegate passed to Assert.That by @JohnVerheij in thomhurst/TUnit#7805 * docs: explain the Rider discovery hang on .NET Framework with non-ASCII test names by @IG-ABHINAV in thomhurst/TUnit#7815 * fix(assertions): CompletesWithin reports cancellation, stops its timer, and returns a Task<T> result again by @JohnVerheij in thomhurst/TUnit#7853 ### Dependencies * chore(deps): update all non-major dependencies to 1.87.12 by @thomhurst in thomhurst/TUnit#7833 * chore(deps): update all non-major dependencies by @thomhurst in thomhurst/TUnit#7835 * chore(deps): update dependency gitversion.tool to v7 by @thomhurst in thomhurst/TUnit#7808 * chore(deps): update all non-major dependencies to 10.0.4 by @thomhurst in thomhurst/TUnit#7836 * chore(deps): update dependency azure.storage.blobs to 12.30.2 by @thomhurst in thomhurst/TUnit#7839 * chore(deps): update all non-major dependencies to 33.7.2 by @thomhurst in thomhurst/TUnit#7842 * chore(deps): update dependency polyfill to v12 by @thomhurst in thomhurst/TUnit#7845 * chore(deps): update dependency dompurify to v3.5.0 by @thomhurst in thomhurst/TUnit#7846 * chore(deps): update dependency node-forge to v1.4.4 by @thomhurst in thomhurst/TUnit#7848 * chore(deps): update all non-major dependencies by @thomhurst in thomhurst/TUnit#7850 * chore(deps): update all non-major dependencies to 33.7.3 by @thomhurst in thomhurst/TUnit#7854 * chore(deps): update dependency serilog.sinks.seq to 9.2.0 by @thomhurst in thomhurst/TUnit#7855 ## New Contributors * @IG-ABHINAV made their first contribution in thomhurst/TUnit#7815 **Full Changelog**: thomhurst/TUnit@v1.87.12...v1.88.0 <!-- tunit-release-draft --> Commits viewable in [compare view](thomhurst/TUnit@v1.87.12...v1.90.0). </details> [](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores) Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. [//]: # (dependabot-automerge-start) [//]: # (dependabot-automerge-end) --- <details> <summary>Dependabot commands and options</summary> <br /> You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot show <dependency name> ignore conditions` will show all of the ignore conditions of the specified dependency - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself) </details> Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
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