gateway-plugin/adapter.py was a 3,493-line monolith. This splits it into focused modules with clear separation of responsibilities, bringing it down to ~857 lines.
mixin_base:IrisAdapterBase (declaration-only base for shared attributes)
adapter.py: now holds only IrisAdapter (the composition of the 7 mixins + BasePlatformAdapter), register(), and test-facing re-exports
The mixins come before BasePlatformAdapter in the MRO so their methods override the base; super() calls (e.g. send_image) still resolve to BasePlatformAdapter. No circular imports; dispatch.py and http_server.py (instance-method callers) are unaffected.
Ruff complexity thresholds
Restored PLR0911/0912/0913/0915 to Ruff's built-in defaults (12/50/6/5) instead of "just above the current maxima" — which ratchets the bar down every time code grows (LLM maintenance adds functions, it doesn't refactor them). The existing genuinely-complex functions (frame builders mirroring the wire schema, the QR matrix builder, the dispatch table) now carry an explicit # noqa: PLR09xx marking them as reviewed, frozen exceptions. New code is held to the default ceilings.
Verification
All 125 tests green (94 test_android + 31 test_android_http), 0 failures
No new ruff errors introduced (plugin-proper has only pre-existing out-of-scope PLR2004/PLW2901)
protocol.py (850 lines) reviewed: cohesive wire-protocol layer, no split needed
Live-verified against the demo device (gateway running, pairing + messaging OK)
Closes #12
`gateway-plugin/adapter.py` was a 3,493-line monolith. This splits it into focused modules with clear separation of responsibilities, bringing it down to ~857 lines.
## Module split
- **Module-level helpers:** `hooks`, `classify`, `pickers`, `commands`, `setup`, `defaults`, `secrets`
- **Frame-handler mixins:** `inbound`, `tool_frames`, `push_frames`, `media_frames`, `picker_frames`, `channel_frames`, `query_frames`
- **`mixin_base`:** `IrisAdapterBase` (declaration-only base for shared attributes)
- **`adapter.py`:** now holds only `IrisAdapter` (the composition of the 7 mixins + `BasePlatformAdapter`), `register()`, and test-facing re-exports
The mixins come before `BasePlatformAdapter` in the MRO so their methods override the base; `super()` calls (e.g. `send_image`) still resolve to `BasePlatformAdapter`. No circular imports; `dispatch.py` and `http_server.py` (instance-method callers) are unaffected.
## Ruff complexity thresholds
Restored `PLR0911/0912/0913/0915` to Ruff's built-in defaults (12/50/6/5) instead of "just above the current maxima" — which ratchets the bar down every time code grows (LLM maintenance adds functions, it doesn't refactor them). The existing genuinely-complex functions (frame builders mirroring the wire schema, the QR matrix builder, the dispatch table) now carry an explicit `# noqa: PLR09xx` marking them as reviewed, frozen exceptions. New code is held to the default ceilings.
## Verification
- All 125 tests green (94 `test_android` + 31 `test_android_http`), 0 failures
- No new ruff errors introduced (plugin-proper has only pre-existing out-of-scope `PLR2004`/`PLW2901`)
- `protocol.py` (850 lines) reviewed: cohesive wire-protocol layer, no split needed
- Live-verified against the demo device (gateway running, pairing + messaging OK)
adapter.py was a 3,493-line monolith. Split it into focused modules with
clear separation of responsibilities, bringing it down to ~857 lines:
- Module-level helpers: hooks, classify, pickers, commands, setup,
defaults, secrets
- Frame-handler mixins: inbound, tool_frames, push_frames, media_frames,
picker_frames, channel_frames, query_frames
- mixin_base: IrisAdapterBase (declaration-only base for shared attrs)
- adapter.py now holds only IrisAdapter (the composition of the 7 mixins
+ BasePlatformAdapter), register(), and test-facing re-exports
The mixins come before BasePlatformAdapter in the MRO so their methods
override the base; super() calls (e.g. send_image) still resolve to
BasePlatformAdapter. No circular imports; dispatch.py and http_server.py
(instance-method callers) are unaffected.
Ruff complexity ceilings (PLR0911/0912/0913/0915) restored to Ruff's
built-in defaults (12/50/6/5) instead of "just above the current maxima",
which ratchets the bar down as code grows. The existing genuinely-complex
functions (frame builders mirroring the wire schema, the QR matrix builder,
the dispatch table) carry an explicit `# noqa: PLR09xx` marking them as
reviewed, frozen exceptions; new code is held to the default ceilings.
All 125 tests green (94 test_android + 31 test_android_http); no new ruff
errors introduced.
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Closes #12
gateway-plugin/adapter.pywas a 3,493-line monolith. This splits it into focused modules with clear separation of responsibilities, bringing it down to ~857 lines.Module split
hooks,classify,pickers,commands,setup,defaults,secretsinbound,tool_frames,push_frames,media_frames,picker_frames,channel_frames,query_framesmixin_base:IrisAdapterBase(declaration-only base for shared attributes)adapter.py: now holds onlyIrisAdapter(the composition of the 7 mixins +BasePlatformAdapter),register(), and test-facing re-exportsThe mixins come before
BasePlatformAdapterin the MRO so their methods override the base;super()calls (e.g.send_image) still resolve toBasePlatformAdapter. No circular imports;dispatch.pyandhttp_server.py(instance-method callers) are unaffected.Ruff complexity thresholds
Restored
PLR0911/0912/0913/0915to Ruff's built-in defaults (12/50/6/5) instead of "just above the current maxima" — which ratchets the bar down every time code grows (LLM maintenance adds functions, it doesn't refactor them). The existing genuinely-complex functions (frame builders mirroring the wire schema, the QR matrix builder, the dispatch table) now carry an explicit# noqa: PLR09xxmarking them as reviewed, frozen exceptions. New code is held to the default ceilings.Verification
test_android+ 31test_android_http), 0 failuresPLR2004/PLW2901)protocol.py(850 lines) reviewed: cohesive wire-protocol layer, no split needed✅ No issues found — changes look consistent with the stated intent. Ready to be merged.