Skip to content

Validate Settings warns when Custom Aliases cannot be used - #59

Merged
PiratesIRC merged 1 commit into
mainfrom
fix/custom-aliases-validation
Sep 25, 2026
Merged

PiratesIRC merged 1 commit into
mainfrom
fix/custom-aliases-validation

Conversation

@PiratesIRC

Copy link
Copy Markdown
Owner

What was wrong

A user wrote Custom Aliases as a list of one-key objects:

[{"Rai 1 FHD": ["RAI 1 Full HD"]}, {"Rai 2 FHD": ["Rai due FHD"]}]

The matcher accepts only one JSON object with a key per channel, so it dropped every entry. The only sign was one line in the container log, and Validate Settings never checked this setting.

What this changes

  • _parse_custom_aliases is now the only parser for the box. Both _build_alias_map and the new _validate_custom_aliases_setting call it, so the count Validate Settings reports always matches the count the matcher uses.
  • Validate Settings adds one line when the box is not empty:
    • a success line with the channel count when every entry is usable;
    • a warning when nothing can be used: invalid JSON (with line and column), a list, or any other non-object;
    • a warning naming up to three skipped entries (a value that is not a string or list, or no alias listed).
  • These are always warnings, never errors. An error would stop Match and Assign from loading channels, while the matcher itself carries on with the built-in aliases.
  • The help text and placeholder now show two channels in one object.

Testing

  • New tests/test_custom_aliases_validation.py (10 tests). All ten failed before the change, and the full suite passes (1557).
  • Removing the check from Validate Settings, raising it to an error, and silencing skipped entries each make a named test fail.
  • The toast text for the reported input, invalid JSON and ten skipped entries is 182, 160 and 229 characters. The toast shows about 280.

🤖 Generated with Claude Code

A user wrote Custom Aliases as a JSON list of one-key objects. The matcher
accepts only one object, so it dropped every entry, and the only trace was a
single line in the container log. Validate Settings never checked the box.

- _parse_custom_aliases is now the one parser for the box, called by both
  _build_alias_map and the new _validate_custom_aliases_setting, so the count
  Validate Settings reports is the count the matcher merges.
- Validate Settings adds a warning (never an error) for invalid JSON, a list,
  any other non-object, and entries skipped for a bad value or no alias.
  An error would make Match and Assign refuse to run while the matcher itself
  carries on with the built-in aliases.
- The help text and placeholder now show two channels in one object.

Tests: tests/test_custom_aliases_validation.py (10). Removing the check,
raising it to an error, and silencing skipped entries each fail a named test.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@PiratesIRC
PiratesIRC merged commit 832270f into main Sep 25, 2026
6 checks passed
@PiratesIRC
PiratesIRC deleted the fix/custom-aliases-validation branch September 25, 2026 12:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant