mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2026-11-06 10:59:59 +00:00
Four tests were guarding two rules. Both duplicates are gone and what they were meant to check now lives with the rule it belongs to. The handler name/length pair: a 120-character limit sat over the same files as an 80-character one, so it could never fire first, and outside that overlap it matched `name:` keys that were no task at all -- a volume name, a var. It found nothing in either half. Deleted; the surviving lint instead grows the scope it was missing, `roles/*/handlers/**` and `playbooks/**`, because a handler is a task, and the dispatch input descriptions, because a form line is read like a job name. The templated-handler-name pair is worse: the second one skipped every document with `if not isinstance(doc, dict)`, and a handlers file is a list. It has been vacuously green for its whole life. Its intent -- every `handlers/*.yml`, not just `main.yml` -- is now what the surviving test does. The notify/listen contract itself gains the rule that made the rename in a8dd7f1 safe: a notify must land on a `listen:` topic, never on a display name, and both spell out as [a-z_-]+. Following `import_tasks` chains by hand is gone with it; scanning every project YAML sees the same handlers, plus the ones a role hands to a generic renderer through a data structure. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
11 lines
832 B
Markdown
11 lines
832 B
Markdown
# Handler Tests 🛎️
|
|
|
|
Integration tests that enforce contracts between tasks and handlers. One file per contract, no second opinion on the same rule:
|
|
|
|
- [test_invoked.py](test_invoked.py) — every `notify:` MUST resolve to a `listen:` topic (never to a handler name), every `listen:` MUST be notified by someone, and both MUST spell out as `[a-z_-]+`.
|
|
- [test_names_static.py](test_names_static.py) — a `listen:`-bearing handler entry MUST carry a static name (no Jinja templating).
|
|
|
|
Tests in this directory MUST only cover handler invocation and naming rules. Tests for task-file includes, run-once flags, or block structure MUST live elsewhere under `tests/integration/`.
|
|
|
|
For framework, directory layout, and `make test-integration` usage see [integration.md](../../../../docs/contributing/actions/testing/integration.md).
|