Skip to content

Remove unused metadata generation entry points - #7570

Merged
thomhurst merged 1 commit into
mainfrom
issue-7568-unused-metadata
Nov 4, 2026
Merged

thomhurst merged 1 commit into
mainfrom
issue-7568-unused-metadata

Conversation

@thomhurst

@thomhurst thomhurst commented Nov 4, 2026 •

Copy link
Copy Markdown
Owner

Removes five unused private metadata generation entry points from TestMetadataGenerator, plus their exclusive helpers (GenerateDataSources, PreGeneratePropertyDataSourcesExpression, and GenerateGenericParameterConstraints). Shared helpers and the separate cleanup tracked by #7194 remain intact.

Closes #7568

Validation: dotnet test --project tests/TUnit.Core.SourceGenerator.Tests --framework net10.0 passed (337 passed, 1 skipped). Generated snapshots are unchanged. Only the installed .NET 10 runtime was tested locally; other framework legs remain for CI. This removes unreachable code and changes no public API or runtime metadata collection.

Summary by CodeRabbit

  • Refactor
    • Removed legacy internal helpers for generating metadata for generic tests, data sources, property data sources, optional factory parameters, type references, and generic constraints.
    • These changes remove internal metadata-generation capabilities; no public API changes are reported. The summary does not specify any impact on end-user behavior.

@coderabbitai

coderabbitai Bot commented Nov 4, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The pull request removes six private helper methods from TestMetadataGenerator. The helpers emitted test metadata and data-source expressions, appended optional factory parameters, generated property data-source expressions, formatted type references, and emitted generic constraint metadata.

Changes: Metadata helper cleanup

Layer / File(s) Summary
Remove private metadata-generation helpers
src/TUnit.Core.SourceGenerator/Generators/TestMetadataGenerator.cs
Removes helpers for metadata and data-source emission, factory parameters, property data-source expressions, type references, and generic constraint metadata.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Refactor

Possibly related issues

  • thomhurst/TUnit#7194 describes another unused method chain in TestMetadataGenerator; that chain is not part of this pull request.

Possibly related PRs

Merge Risk: Minimal · up to 2150a

No actionable merge-blocking issue is established for this cleanup; complete the pending checks before merging.

Pre-merge checks: Passed 5
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly and concisely describes the main change: removing unused metadata generation entry points from TestMetadataGenerator.
Linked Issues check Passed [#7568] Objective 1: remove the five unused private methods from TestMetadataGenerator. The whole-PR diff against the merge base removes GenerateMetadata, AppendOptionalFactoryParameters, GenerateType…
Out of Scope Changes check Passed The whole-PR diff touches only src/TUnit.Core.SourceGenerator/Generators/TestMetadataGenerator.cs. Every hunk removes a method named by #7568 or one of its exclusive helpers: GenerateMetadata, AppendO…
Docstring Coverage Passed No eligible functions found in the changed files. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentat…
Full details: Linked Issues check

Explanation

[#7568] Objective 1: remove the five unused private methods from TestMetadataGenerator. The whole-PR diff against the merge base removes GenerateMetadata, AppendOptionalFactoryParameters, GenerateTypeReference, GenerateGenericTypeInfo, and GenerateGenericMethodInfo. Objective 2: remove exclusive helpers after inspecting their dependencies. The diff removes GenerateDataSources, PreGeneratePropertyDataSourcesExpression, and GenerateGenericParameterConstraints. Each was reachable only through a removed method, as the issue describes. Objective 3: keep generator snapshots unchanged. The PR touches no snapshot files and adds no new generation logic, so the removed code cannot change emitted output. The author reports 337 passed and 1 skipped for the test project. I did not rebuild or rerun the tests. Separation from #7194: GenerateMetadataForConcreteInstantiation and GenerateGenericTestWithConcreteTypes remain in the diff context, so the generic concrete-instantiation chain is not removed here. Current-head evidence: the incremental diff from previous reviewed head 3e11233 to head 2150a2a could not be read, so I could not isolate what changed since the previous review. I used the whole-PR diff against the merge base, which still shows the same eight removed declarations and no added logic. Unresolved uncertainty: I did not confirm that unnamed helpers used only by the removed methods, such as GeneratePropertyDataSources, are now unused. The issue does not name them, so this does not fail the named requirements.

Full details: Out of Scope Changes check

Explanation

The whole-PR diff touches only src/TUnit.Core.SourceGenerator/Generators/TestMetadataGenerator.cs. Every hunk removes a method named by #7568 or one of its exclusive helpers: GenerateMetadata, AppendOptionalFactoryParameters, GenerateTypeReference, GenerateGenericTypeInfo, GenerateGenericMethodInfo, GenerateDataSources, PreGeneratePropertyDataSourcesExpression, and GenerateGenericParameterConstraints. The PR adds no logic and changes no public API. The only residual effect is an extra blank line left where PreGeneratePropertyDataSourcesExpression was removed. This is cosmetic and compile-neutral, and it does not conflict with the issue. The AI-generated raw summary lists fewer helpers than the diff removes. The diff is the authoritative source, and all removed declarations are in scope. Incremental diff from 3e11233 was unavailable, so this verdict rests on the whole-PR diff.

Full details: Docstring Coverage

Explanation

No eligible functions found in the changed files. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 0 functions across 0 files.

Finishing Touches
Generate docstrings
  • Commit to this branch
  • Create a new PR
Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

A rabbit checks the generator's tracks
Six unused helpers leave no gaps
Data-source paths and types are gone
The code grows lean from dusk to dawn
I nibble carrots, then hop along

Recent review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 8c97d5a7-6307-4097-b595-cb8fba83d981
Commits

Reviewing files that changed from the base of the PR and between 3e11233 and 2150a2a.

Files selected for processing: 1
  • src/TUnit.Core.SourceGenerator/Generators/TestMetadataGenerator.cs
Files with no reviewable changes: 1
  • src/TUnit.Core.SourceGenerator/Generators/TestMetadataGenerator.cs

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review.

@thomhurst

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 4, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-04T11:55:51.823133Z 2150a2a New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@github-actions

github-actions Bot commented Nov 4, 2026

Copy link
Copy Markdown
Contributor

Review: looks good.

This is a pure dead-code removal in TestMetadataGenerator.cs (331 deletions, 0 additions). I grepped the PR head for each removed symbol: GenerateMetadata, GenerateDataSources (generator-side), AppendOptionalFactoryParameters, PreGeneratePropertyDataSourcesExpression, GenerateTypeReference, GenerateGenericTypeInfo, GenerateGenericMethodInfo and GenerateGenericParameterConstraints. None has a remaining caller in the generator. The other GenerateDataSources hits are the unrelated runtime DataSourceGeneratorAttribute overrides. The helpers that are still shared (GeneratePropertyDataSources, GetClassRowConstructor, GenerateDataSourceAttribute) are kept and still used.

  • Because the removed methods were private and unreachable, generator output and the snapshots stay the same. That matches the PR's report of 337 passed on net10.0.
  • The change touches no public API and no runtime metadata collection, so the source-generator/reflection parity rule in AGENTS.md isn't affected.
  • Nit: removing PreGeneratePropertyDataSourcesExpression leaves two consecutive blank lines before the next doc comment, around the old line 5207. It's harmless, but worth tidying.

I have no blocking concerns. Merge once CI is green on the other framework legs.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 🚀

Reviewed commit: 3e11233ddc

ℹ️ About Codex in GitHub

Your team has set up Codex to 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 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@greptile-apps

greptile-apps Bot commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Low impact] The PR appears safe to merge.

Summary

Removes five unused private entry points and three helpers from TestMetadataGenerator.

  • The source generator no longer keeps unused metadata-generation routes.

Reviews (2) · Last reviewed commit: "Remove unused metadata generation entry ..." · Reviewed by Greptile

@thomhurst

Copy link
Copy Markdown
Owner Author
Both required reviewers approved head 3e11233 with no blocking findings, and there are no inline review threads. Disposition: the optional consecutive-blank-line nit is accepted as harmless and does not warrant a new head/review cycle. Promoting to ready for CI and the ready_for_review Claude run.

@thomhurst
thomhurst marked this pull request as ready for review November 4, 2026 07:01
@thomhurst

Copy link
Copy Markdown
Owner Author
PR is now ready and the head remains 3e11233. Waiting for the ready-for-review workflows, including .NET run 41789388994 (https://github.com/thomhurst/TUnit/actions/runs/41789388994). Auto-merge is not armed yet: the next unit must read the fresh Claude ready_for_review verdict before running Enable-AutoMerge.ps1.

@github-actions

github-actions Bot commented Nov 4, 2026

Copy link
Copy Markdown
Contributor

Review: looks good.

Pure dead-code removal in TestMetadataGenerator.cs. I grepped the PR head for every removed symbol (GenerateMetadata, GenerateTypeReference, GenerateGenericTypeInfo, GenerateGenericMethodInfo, GenerateGenericParameterConstraints, AppendOptionalFactoryParameters, PreGeneratePropertyDataSourcesExpression) and found no remaining callers in the generator. The shared helpers (GeneratePropertyDataSources, GetOpenGenericTypeName, GetClassRowConstructor) are still referenced.

  • The removed methods were private and unreachable, so generator output and snapshots are unchanged. That matches the reported 337 passing tests.
  • No public API or runtime metadata collection changes, so the source-generator/reflection parity rule doesn't apply.
  • Nit: removing PreGeneratePropertyDataSourcesExpression leaves two consecutive blank lines. It's harmless.

No blocking concerns. Merge once CI is green on the other framework legs.

@github-actions

github-actions Bot commented Nov 4, 2026

Copy link
Copy Markdown
Contributor

Review: LGTM.

Pure dead-code removal in TestMetadataGenerator. I checked the PR head for callers of every removed member (GenerateMetadata, GenerateDataSources, AppendOptionalFactoryParameters, PreGeneratePropertyDataSourcesExpression, GenerateTypeReference, GenerateGenericTypeInfo, GenerateGenericMethodInfo, GenerateGenericParameterConstraints) and found none. The shared helpers that look related (GeneratePropertyDataSources, GetClassRowConstructor, GetOpenGenericTypeName, GenerateDataSourceAttribute) are still used by live paths and were correctly kept. Generated snapshots are unchanged, which is consistent with the code being unreachable.

Nit: removing PreGeneratePropertyDataSourcesExpression leaves two consecutive blank lines before the next doc comment. It's harmless.

CI should confirm the other target frameworks. Nothing blocking.

This was referenced Nov 5, 2026

This branch was previously deployed

1 inactive deployment
Pull Requests — 2150a2ac Deployed Nov 4, 2026 by thomhurst via modularpipeline (macos-latest) #21167
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Source generator retains unused metadata generation entry points

1 participant