Files
computer-playbook/utils/roles/validation
kevinveenbirkenbachandClaude Opus 4.7 c55ad69c41 refactor: drop requirement-file references from code, add doc rule + lint
Strip every `req <NNN>`, `req-<NNN>`, `Requirement <NNN>`,
`requirement-<NNN>`, and `docs/requirements/<NNN>-...md` mention from
non-Markdown source files. Comments anchored to requirement numbers
rot when requirements are renumbered or rewritten and conflate
present-state behaviour (which the comment should describe) with the
audit trail of how the code got there (which belongs in commit
messages, PR descriptions, and the requirement file itself).

* Document the rule in `docs/contributing/documentation.md` under
  "Comments". Code MUST describe the *why* in present-state language;
  contract enforcement lives in tests, not folklore.
* Clean 254 source files across `roles/`, `tests/`, `plugins/`,
  `cli/`, `scripts/`, `utils/`, `group_vars/`, and the repo-root
  `eslint.config.js`. Pure comment / docstring / log-message edits;
  no behavioural change.
* Add `tests/lint/repository/test_no_req_references_in_code.py` to
  enforce the rule going forward across `.js`, `.py`, `.yml`,
  `.yaml`, `.j2`, and `.sh` files. The legacy
  `test_no_stale_requirement_refs.py` is exempt as the only file
  whose purpose is to detect these very tokens.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-10 16:25:22 +02:00
..
…
2026-05-08 18:57:07 +02:00

Role Validation Helpers ✅

Validators that gate role inputs and outputs against project rules.

Scope 📋

Modules in utils/roles/validation/ MUST limit themselves to checking that role artefacts and their derived names obey the constraints documented in docs/contributing/: legal application identifiers, deployment-target invokability, container resource shape.

Validators MUST raise typed exceptions (or return the offending value with a clear message) so callers can surface the failure at the right layer (CLI exit code, lint test failure, runtime assertion).

Validators MUST stay independent of Ansible plugin loader behavior at import time so the same code runs from filter plugins, lookup plugins, the CLI, and tests.

Modules 📦

Module Validates
deploy_id.py Application id strings against the canonical <bucket>-<entity> shape and the active deploy-id grammar.
invokable.py Whether an application can legitimately be invoked under a given deployment type (e.g. server, workstation, universal).
resources.py Container resource declarations (cpus, mem_reservation, mem_limit, pids_limit) for shape and unit consistency.

Example Imports ✍️

from utils.roles.validation.deploy_id import validate_deploy_id
from utils.roles.validation.invokable import is_invokable_for
from utils.roles.validation.resources import validate_resource_block