Skip to content

The callback-prefix collision check never looks at editor_keyboard or diary_keyboard #271

Closed

Description

@lumenpearson

server/tests/test_bot_manage.py:288-344 guards against two CallbackData classes sharing a prefix — the way two screens end up matching one press — by scanning vars() of three modules named in the test: keyboards, manage_keyboards and calendar_keyboard.

Three prefixes live elsewhere and are never checked: EditorAction (ted) and EditorSubject (tes) in app/bot/editor_keyboard.py, and DiaryAction (dry) in app/bot/diary_keyboard.py. None of them collides today; the guard simply cannot see them.

Failure scenario. A new CallbackData is added to keyboards.py with prefix="dry", or a new class in editor_keyboard.py reuses hw. The test stays green. aiogram routes the press to whichever handler is registered first, which is the RolePick failure CLAUDE.md describes — a press on one screen silently acting on another.

The same gap will widen on its own: the server decomposition (sub-project 1 of docs/specs/2026-10-03-one-contract-design.md) moves CallbackData classes into per-feature modules, and every class moved out of the three named modules drops out of the check.

Fix. Discover every CallbackData subclass under app.bot instead of naming modules, before any keyboard is moved.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    • Status
      Done

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions