Skip to content

fix: use static member discovery in registry inspection - #3531

Merged
Roman Lutz (romanlutz) merged 5 commits into
microsoft:mainfrom
huong8373tt-beep:fix/static-discovery-members
Oct 26, 2026
Merged

Roman Lutz (romanlutz) merged 5 commits into
microsoft:mainfrom
huong8373tt-beep:fix/static-discovery-members

Conversation

@huong8373tt-beep

Copy link
Copy Markdown
Contributor

Summary

  • Use inspect.getmembers_static when discovering registry members from a dynamically loaded module.
  • Avoid invoking module-level dynamic attribute lookup during registry discovery.
  • Add a regression test covering a module with __dir__ and __getattr__.

This addresses P311-20 from #3166.

Validation

  • 54 focused registry tests passed
  • pre-commit run --files pyrit/registry/discovery.py tests/unit/registry/test_initializer_registry.py passed
  • git diff --check passed

Disclosure

Slai Agent Runtime assisted with analysis, implementation, testing, and preparation of this contribution. The account owner authorized and reviewed the work and remains responsible for the submission.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Comment thread pyrit/registry/discovery.py Outdated
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

# Conflicts:
#	pyrit/registry/discovery.py
#	tests/unit/registry/test_initializer_registry.py
@huong8373tt-beep

Copy link
Copy Markdown
Contributor Author

Thanks for catching and addressing the lazy-export regression. The updated approach preserves explicitly declared __all__ exports while leaving unrelated dynamic attributes unevaluated, and the added registration coverage captures the intended behavior. Much appreciated.

@romanlutz
Roman Lutz (romanlutz) added this pull request to the merge queue Oct 26, 2026
Merged via the queue into microsoft:main with commit 70610f1 Oct 26, 2026
65 checks passed
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.

2 participants