Repository navigation
fix(engine): drop row-scoped data sources from failed test metadata - #7079
Conversation
… row
In reflection mode, ReflectionAttributeExtractor.GetAllAttributes put
every method-level data source attribute into the attribute list of
every test case built from that method. The TestBuilder then appends
the data source that produced the case on top of that. Since
ArgumentsAttribute applies Skip, DisplayName and Categories from
OnTestRegistered, the settings of one [Arguments] row leaked into all
other rows, so [Arguments("c", Skip = "...")] skipped "a" and "b" too.
The source generator already leaves method-level data source
attributes out of the generated attribute list (GetTestAttributes) and
relies on the per-case data source added by the TestBuilder. Do the
same in reflection mode so both engines behave identically.
Fixes thomhurst#7076
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. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Merge Risk: ⚪ Minimal · up to
|
ReviewThe fix looks correct and well-scoped. Reflection mode now matches the source generator ( The tests cover both the Skip and DisplayName cases and run in all modes via Minor suggestions, none blocking:
LGTM. |
[Medium impact] The PR appears safe to merge; no new actionable issue was found. SummaryFailed-discovery metadata now drops row-scoped attributes when no row produced the test.
Reviews (4) · Last reviewed commit: "test: assert the failed-metadata factori..." · Reviewed by Greptile |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 8a937e19f9
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
thomhurst
left a comment
There was a problem hiding this comment.
Automated code review. The method-level fix looks right and matches the source generator's GetTestAttributes filter. The comments below cover related gaps; the first four are in code outside this diff, so they're anchored on this change with file references.
ReviewThe fix is sound. Method-level data source attributes no longer leak into every row's attribute list, so Points to check
Tests: the snapshot updates look consistent. Running the new per-row Skip/DisplayName tests in both source-gen and reflection modes would confirm parity. Overall this looks good to me once point 1 is confirmed and the description is corrected. |
|
Thanks @kenny-ish - Could you take a look at the p1 concern and the merge conflicts? |
|
After #7111, most of this PR is already covered on main: |
|
Reworking and tests sounds good 😄 |
thomhurst#7111 scopes class and method [Arguments] rows to their own test in TestBuilder, which covers the original thomhurst#7076 fix, so this drops the earlier changes and keeps what main still lacks: the failed-discovery metadata paths in ReflectionTestDataCollector returned every method attribute, so a test whose discovery failed still carried every [Arguments] row with its Skip, DisplayName and Categories. They now drop the row-scoped data sources through ScopeRowAttributesToTest. The thomhurst#7076 regression tests are kept and run in every engine mode.
ReviewThe change is small and correct. The three failed-discovery metadata factories in Tests: Minor suggestions, not blocking:
Approve from my side. |
A renamed factory now fails with its name instead of a NullReferenceException, and the test returns Task.CompletedTask instead of awaiting it.
|
Applied the two test nits from the review: the factory lookup is now asserted with its name before it is invoked, and the test returns |
ReviewSmall, focused fix. The three failed-discovery factories in Notes (non-blocking):
LGTM. |
|
Thanks @kenny-ish ! |
Updated [TUnit](https://github.com/thomhurst/TUnit) from 1.76.0 to 1.76.45. <details> <summary>Release notes</summary> _Sourced from [TUnit's releases](https://github.com/thomhurst/TUnit/releases)._ ## 1.76.45 <!-- Release notes generated using configuration in .github/release.yml at v1.76.45 --> ## What's Changed ### Other Changes * chore(docs): remark Forgejo test summary compatability by @koryphaee in thomhurst/TUnit#7272 * fix(aspire): cancel and join startup waits (#7277) by @thomhurst in thomhurst/TUnit#7279 * fix(aspire): follow DCP runtime instances when reading resource logs by @thomhurst in thomhurst/TUnit#7283 ### Dependencies * chore(deps): update all non-major dependencies by @thomhurst in thomhurst/TUnit#7259 * chore(deps): update dependency imposter to 1.0.7 by @thomhurst in thomhurst/TUnit#7264 * chore(deps): update dependency imposter to 1.0.8 by @thomhurst in thomhurst/TUnit#7265 * chore(deps): update dependency polly to 8.8.1 by @thomhurst in thomhurst/TUnit#7266 * chore(deps): update dependency awssdk.sqs to 4.0.100.21 by @thomhurst in thomhurst/TUnit#7267 * chore(deps): update dependency node-forge to v1.4.1 by @thomhurst in thomhurst/TUnit#7268 * chore(deps): update dependency qs to v6.17.0 by @thomhurst in thomhurst/TUnit#7270 * chore(deps): bump postcss-selector-parser from 6.1.4 to 6.1.5 in /docs by @dependabot[bot] in thomhurst/TUnit#7269 * chore(deps): update dependency node-forge to v1.4.2 by @thomhurst in thomhurst/TUnit#7273 * chore(deps): update all non-major dependencies by @thomhurst in thomhurst/TUnit#7274 * chore(deps): update dependency minimatch to v11 by @thomhurst in thomhurst/TUnit#7275 * chore(deps): update dependency minimatch to v11.0.1 by @thomhurst in thomhurst/TUnit#7276 * chore(deps): update dependency node to v26 by @thomhurst in thomhurst/TUnit#7278 * chore(deps): update dependency minimatch to v11.0.2 by @thomhurst in thomhurst/TUnit#7280 **Full Changelog**: thomhurst/TUnit@v1.76.28...v1.76.45 ## 1.76.28 <!-- Release notes generated using configuration in .github/release.yml at v1.76.28 --> ## What's Changed ### Other Changes * Remove legacy JSON output implementation by @Saad-elnagar in thomhurst/TUnit#7234 * fix(engine): drop row-scoped data sources from failed test metadata by @kenny-ish in thomhurst/TUnit#7079 * Merge the analyzer release tables under one New Rules section (RS2007) by @bfs2021 in thomhurst/TUnit#7174 * fix: release finished test instances before session end by @thomhurst in thomhurst/TUnit#7262 * fix: never hand out a disposed shared data-source instance by @thomhurst in thomhurst/TUnit#7248 ### Dependencies * chore(deps): update all non-major dependencies to 1.76.0 by @thomhurst in thomhurst/TUnit#7233 * chore(deps): bump follow-redirects from 1.16.0 to 1.16.1 in /docs by @dependabot[bot] in thomhurst/TUnit#7232 * chore(deps): bump launch-editor from 2.14.1 to 2.14.2 in /docs by @dependabot[bot] in thomhurst/TUnit#7231 * chore(deps): update all non-major dependencies to 1.20.1 by @thomhurst in thomhurst/TUnit#7235 * chore(deps): update dependency awssdk.sqs to 4.0.100.20 by @thomhurst in thomhurst/TUnit#7236 * chore(deps): update dependency microsoft.playwright to 1.64.0 by @thomhurst in thomhurst/TUnit#7237 * chore(deps): update all non-major dependencies by @thomhurst in thomhurst/TUnit#7238 * chore(deps): update dependency path-to-regexp to v9 by @thomhurst in thomhurst/TUnit#7241 * chore(deps): update all non-major dependencies by @thomhurst in thomhurst/TUnit#7242 * chore(deps): update dependency serialize-javascript to v7.1.3 by @thomhurst in thomhurst/TUnit#7243 * chore(deps): update dependency imposter to 1.0.4 by @thomhurst in thomhurst/TUnit#7244 * chore(deps): update dependency stackexchange.redis to 3.4.20 by @thomhurst in thomhurst/TUnit#7245 * chore(deps): update dependency serialize-javascript to v7.1.4 by @thomhurst in thomhurst/TUnit#7246 * chore(deps): update dependency imposter to 1.0.5 by @thomhurst in thomhurst/TUnit#7247 * chore(deps): update all non-major dependencies to 13.6.4 by @thomhurst in thomhurst/TUnit#7251 * chore(deps): update dependency imposter to 1.0.6 by @thomhurst in thomhurst/TUnit#7258 * chore(deps): bump fast-uri from 3.1.8 to 3.1.9 in /docs by @dependabot[bot] in thomhurst/TUnit#7253 * chore(deps): bump body-parser from 1.20.6 to 1.20.9 in /docs by @dependabot[bot] in thomhurst/TUnit#7252 ## New Contributors * @Saad-elnagar made their first contribution in thomhurst/TUnit#7234 * @kenny-ish made their first contribution in thomhurst/TUnit#7079 * @bfs2021 made their first contribution in thomhurst/TUnit#7174 **Full Changelog**: thomhurst/TUnit@v1.76.0...v1.76.28 Commits viewable in [compare view](thomhurst/TUnit@v1.76.0...v1.76.45). </details> Updated [TUnit.Core](https://github.com/thomhurst/TUnit) from 1.76.0 to 1.76.45. <details> <summary>Release notes</summary> _Sourced from [TUnit.Core's releases](https://github.com/thomhurst/TUnit/releases)._ ## 1.76.45 <!-- Release notes generated using configuration in .github/release.yml at v1.76.45 --> ## What's Changed ### Other Changes * chore(docs): remark Forgejo test summary compatability by @koryphaee in thomhurst/TUnit#7272 * fix(aspire): cancel and join startup waits (#7277) by @thomhurst in thomhurst/TUnit#7279 * fix(aspire): follow DCP runtime instances when reading resource logs by @thomhurst in thomhurst/TUnit#7283 ### Dependencies * chore(deps): update all non-major dependencies by @thomhurst in thomhurst/TUnit#7259 * chore(deps): update dependency imposter to 1.0.7 by @thomhurst in thomhurst/TUnit#7264 * chore(deps): update dependency imposter to 1.0.8 by @thomhurst in thomhurst/TUnit#7265 * chore(deps): update dependency polly to 8.8.1 by @thomhurst in thomhurst/TUnit#7266 * chore(deps): update dependency awssdk.sqs to 4.0.100.21 by @thomhurst in thomhurst/TUnit#7267 * chore(deps): update dependency node-forge to v1.4.1 by @thomhurst in thomhurst/TUnit#7268 * chore(deps): update dependency qs to v6.17.0 by @thomhurst in thomhurst/TUnit#7270 * chore(deps): bump postcss-selector-parser from 6.1.4 to 6.1.5 in /docs by @dependabot[bot] in thomhurst/TUnit#7269 * chore(deps): update dependency node-forge to v1.4.2 by @thomhurst in thomhurst/TUnit#7273 * chore(deps): update all non-major dependencies by @thomhurst in thomhurst/TUnit#7274 * chore(deps): update dependency minimatch to v11 by @thomhurst in thomhurst/TUnit#7275 * chore(deps): update dependency minimatch to v11.0.1 by @thomhurst in thomhurst/TUnit#7276 * chore(deps): update dependency node to v26 by @thomhurst in thomhurst/TUnit#7278 * chore(deps): update dependency minimatch to v11.0.2 by @thomhurst in thomhurst/TUnit#7280 **Full Changelog**: thomhurst/TUnit@v1.76.28...v1.76.45 ## 1.76.28 <!-- Release notes generated using configuration in .github/release.yml at v1.76.28 --> ## What's Changed ### Other Changes * Remove legacy JSON output implementation by @Saad-elnagar in thomhurst/TUnit#7234 * fix(engine): drop row-scoped data sources from failed test metadata by @kenny-ish in thomhurst/TUnit#7079 * Merge the analyzer release tables under one New Rules section (RS2007) by @bfs2021 in thomhurst/TUnit#7174 * fix: release finished test instances before session end by @thomhurst in thomhurst/TUnit#7262 * fix: never hand out a disposed shared data-source instance by @thomhurst in thomhurst/TUnit#7248 ### Dependencies * chore(deps): update all non-major dependencies to 1.76.0 by @thomhurst in thomhurst/TUnit#7233 * chore(deps): bump follow-redirects from 1.16.0 to 1.16.1 in /docs by @dependabot[bot] in thomhurst/TUnit#7232 * chore(deps): bump launch-editor from 2.14.1 to 2.14.2 in /docs by @dependabot[bot] in thomhurst/TUnit#7231 * chore(deps): update all non-major dependencies to 1.20.1 by @thomhurst in thomhurst/TUnit#7235 * chore(deps): update dependency awssdk.sqs to 4.0.100.20 by @thomhurst in thomhurst/TUnit#7236 * chore(deps): update dependency microsoft.playwright to 1.64.0 by @thomhurst in thomhurst/TUnit#7237 * chore(deps): update all non-major dependencies by @thomhurst in thomhurst/TUnit#7238 * chore(deps): update dependency path-to-regexp to v9 by @thomhurst in thomhurst/TUnit#7241 * chore(deps): update all non-major dependencies by @thomhurst in thomhurst/TUnit#7242 * chore(deps): update dependency serialize-javascript to v7.1.3 by @thomhurst in thomhurst/TUnit#7243 * chore(deps): update dependency imposter to 1.0.4 by @thomhurst in thomhurst/TUnit#7244 * chore(deps): update dependency stackexchange.redis to 3.4.20 by @thomhurst in thomhurst/TUnit#7245 * chore(deps): update dependency serialize-javascript to v7.1.4 by @thomhurst in thomhurst/TUnit#7246 * chore(deps): update dependency imposter to 1.0.5 by @thomhurst in thomhurst/TUnit#7247 * chore(deps): update all non-major dependencies to 13.6.4 by @thomhurst in thomhurst/TUnit#7251 * chore(deps): update dependency imposter to 1.0.6 by @thomhurst in thomhurst/TUnit#7258 * chore(deps): bump fast-uri from 3.1.8 to 3.1.9 in /docs by @dependabot[bot] in thomhurst/TUnit#7253 * chore(deps): bump body-parser from 1.20.6 to 1.20.9 in /docs by @dependabot[bot] in thomhurst/TUnit#7252 ## New Contributors * @Saad-elnagar made their first contribution in thomhurst/TUnit#7234 * @kenny-ish made their first contribution in thomhurst/TUnit#7079 * @bfs2021 made their first contribution in thomhurst/TUnit#7174 **Full Changelog**: thomhurst/TUnit@v1.76.0...v1.76.28 Commits viewable in [compare view](thomhurst/TUnit@v1.76.0...v1.76.45). </details> 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 <dependency name> major version` will close this group update PR and stop Dependabot creating any more for the specific dependency's major version (unless you unignore this specific dependency's major version or upgrade to it yourself) - `@dependabot ignore <dependency name> minor version` will close this group update PR and stop Dependabot creating any more for the specific dependency's minor version (unless you unignore this specific dependency's minor version or upgrade to it yourself) - `@dependabot ignore <dependency name>` will close this group update PR and stop Dependabot creating any more for the specific dependency (unless you unignore this specific dependency or upgrade to it yourself) - `@dependabot unignore <dependency name>` will remove all of the ignore conditions of the specified dependency - `@dependabot unignore <dependency name> <ignore condition>` will remove the ignore condition of the specified dependency and ignore conditions </details> Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Pavel Borisov <Inok@users.noreply.github.com>
Fixes #7076
#7111 now scopes class- and method-level
[Arguments]rows to the test they produced (TestBuilder.ScopeRowAttributesToTest), which covers what this PR originally changed, so I reworked it on top of main as discussed.What main still missed: the failed-discovery metadata paths in
ReflectionTestDataCollector(CreateFailedTestMetadata,CreateFailedMethodGenericMetadataandCreateFailedTestMetadataForDynamicBuilder) returnedmethod.GetCustomAttributes()as is, so a test whose discovery failed still carried every[Arguments]row, including each row'sSkip,DisplayNameandCategories. They now go throughScopeRowAttributesToTestwith no producing row, which drops the row-scoped data sources the same way the normal path does.Tests:
Issue7076Tests(all engine modes): per-rowSkipandDisplayNamefor method rows, class rows and inherited rows, the class constructor receiving the method data source, and the three failed-metadata factories.TestVariantTests.CreateTestVariant_DoesNotInheritParentRowSettings: a variant does not inherit the parent row'sDisplayName.With main's
ReflectionTestDataCollector,Failed_Metadata_Filters_Method_DataSourcesfails; the other tests already pass on current main and are kept as regression coverage for #7076.Summary by CodeRabbit
Bug Fixes
Tests