Skip to content

Rename TModel TypeVar to _TModel to fix broken doc links#240

Closed
Copilot wants to merge 3 commits intomainfrom
copilot/fix-broken-links-documentation
Closed

Rename TModel TypeVar to _TModel to fix broken doc links#240
Copilot wants to merge 3 commits intomainfrom
copilot/fix-broken-links-documentation

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 24, 2026

DocFx treats module-level TypeVar instances as public documented types and generates <xref:...TModel> cross-reference links that resolve to nothing, producing broken links in the AgentNotificationActivity.as_model documentation.

Change

Rename the module-scope TypeVar from TModel to _TModel in agent_notification_activity.py. The underscore prefix marks it as private; doc generators skip cross-reference link generation for private symbols and render the type as plain text instead.

# before
TModel = TypeVar("TModel")

def as_model(self, model: Type[TModel]) -> Optional[TModel]: ...

# after
_TModel = TypeVar("_TModel")

def as_model(self, model: Type[_TModel]) -> Optional[_TModel]: ...

This also aligns with standard Python convention: TypeVars not part of a public generic API should always be underscore-prefixed.

Copilot AI changed the title [WIP] Fix broken links in documentation for AgentNotificationActivity Rename TModel TypeVar to _TModel to fix broken doc links Apr 24, 2026
Copilot AI requested a review from JimDaly April 24, 2026 18:56
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 24, 2026

⚠️ Deprecation Warning: The deny-licenses option is deprecated for possible removal in the next major release. For more information, see issue 997.

Dependency Review

✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.

Scanned Files

None

@JimDaly JimDaly marked this pull request as ready for review April 24, 2026 20:03
@JimDaly JimDaly requested a review from a team as a code owner April 24, 2026 20:03
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR addresses broken DocFx cross-reference links by making a module-level TypeVar private in AgentNotificationActivity, preventing it from being treated as a public documented symbol.

Changes:

  • Renamed the module-scope TypeVar from TModel to _TModel.
  • Updated AgentNotificationActivity.as_model type annotations to use _TModel.

Comment on lines 150 to +151
# Generic escape hatch
def as_model(self, model: Type[TModel]) -> Optional[TModel]:
def as_model(self, model: Type[_TModel]) -> Optional[_TModel]:
Copy link

Copilot AI Apr 24, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

as_model calls model.model_validate(...), but the annotation model: Type[_TModel] doesn’t guarantee that the passed type has a model_validate classmethod. Consider bounding _TModel to pydantic.BaseModel (or using type[BaseModel] directly) so static type checkers can validate correct usage.

Copilot uses AI. Check for mistakes.
@JimDaly
Copy link
Copy Markdown
Member

JimDaly commented Apr 29, 2026

After consulting with the learn platform team, closing this since it may not fix the problem.

@JimDaly JimDaly closed this Apr 29, 2026
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.

Fix broken links in documentation to microsoft_agents_a365.notifications.models.agent_notification_activity.TModel

4 participants