aiohttp's Application._middlewares is a FrozenList, not a plain tuple.
Replacing it with a tuple worked at install time but broke later when
AppRunner.setup() called _middlewares.freeze() -- tuples don't have
.freeze(), causing startup crash:
'tuple' object has no attribute 'freeze'
Switched to app._middlewares.append(middleware), which is safe because
the FrozenList is still mutable at middleware-install time (the freeze
happens later in AppRunner.setup()). Updated the test mock to use a
list instead of a tuple so it matches real aiohttp behavior.
31/31 tests in test_command_middleware.py pass.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>