[OneDev #34] axon: validate on: field in profile YAML at load time #8

Open
opened 2026-05-24 04:46:36 +00:00 by joseph · 0 comments
Owner

Imported from OneDev issue #34 (id 35557)
Original project: internal-joseph
Original state: Open
Original submitterId: 5
Original submitDate: 2026-05-05T19:19:45.421+00:00
Original lastActivity: {'date': '2026-05-05T19:19:45.421+00:00', 'description': 'opened', 'userId': 5}

Original fields:

  • Type: New Feature
  • Priority: Normal
  • Assignees: None

Issue

Mapping.on is loaded as a free-form string. If the user writes on: prss (typo), Profile.mappings_for() filters it out silently because it checks m.on == "press" and m.on == "release" — neither matches. The mapping is loaded successfully but never fires, with no error message.

Fix

In axon/profile.py:load_profile(), after parsing m.get("on", "press"), validate the value is one of {"press", "release", "any"} and raise ValueError(f"Invalid on: value {on!r} for trigger {trigger!r}").

_parse_action already raises on unknown action types — same pattern.

Why

Cuts a confusing class of "I configured G7 but it doesn't fire" debug sessions.

  • File: axon/profile.py:load_profile
  • Found in: final review, internal-joseph/docs/2026-05-05-inputd-core.md
Imported from OneDev issue #34 (id 35557) Original project: internal-joseph Original state: Open Original submitterId: 5 Original submitDate: 2026-05-05T19:19:45.421+00:00 Original lastActivity: {'date': '2026-05-05T19:19:45.421+00:00', 'description': 'opened', 'userId': 5} Original fields: - Type: New Feature - Priority: Normal - Assignees: None ## Issue `Mapping.on` is loaded as a free-form string. If the user writes `on: prss` (typo), `Profile.mappings_for()` filters it out silently because it checks `m.on == "press"` and `m.on == "release"` — neither matches. The mapping is loaded successfully but never fires, with no error message. ## Fix In `axon/profile.py:load_profile()`, after parsing `m.get("on", "press")`, validate the value is one of `{"press", "release", "any"}` and raise `ValueError(f"Invalid on: value {on!r} for trigger {trigger!r}")`. `_parse_action` already raises on unknown action types — same pattern. ## Why Cuts a confusing class of "I configured G7 but it doesn't fire" debug sessions. ## Related - File: `axon/profile.py:load_profile` - Found in: final review, `internal-joseph/docs/2026-05-05-inputd-core.md`
Sign in to join this conversation.
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
joseph/internal-joseph#8
No description provided.