mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-10-31 02:28:09 +08:00
Type every function signature that took an untyped `trans`, using the narrowest context each function actually needs: ProvidesAppContext, ProvidesUserContext or ProvidesHistoryContext in manager and service code, SessionRequestContext for FastAPI endpoints, and GalaxyWebTransaction for legacy WSGI controllers. Lower-level packages (model, security, datatypes, tool_util, util) use TYPE_CHECKING imports with quoted annotations so no runtime cycle is introduced. Annotating a previously untyped function turns on mypy body checking for it, which surfaced several latent bugs, fixed here: - webapps/base/controller.py passed three arguments to can_modify_library_item(), which accepts two. - api/provenance.py BaseProvenanceController was missing SharableItemSecurityMixin, so security_check() did not exist on it. - managers/users.py raised exceptions.Message, which does not exist, and is_admin() returned None rather than False. - Unguarded toolbox.get_tool() results in tools, workflow modules and library upload now raise ToolMissingException instead of failing with AttributeError. - FTP upload paths raised TypeError when no FTP directory was configured instead of reporting a request error. Where an annotation exposed a gap in an interface, the interface is fixed rather than suppressed: error_codes gained a PEP 562 __getattr__ for its JSON-loaded members, vault moved from StructuredApp to MinimalManagerApp, dataset_matcher_factory is declared on ProvidesHistoryContext, and the toolbox panel view methods accept both a web transaction and a request context.