# Constraint kinds

> The requirement kinds the Python quelltest package extracts, which ones the rule engine can generate tests for, and how each violation is injected.

Canonical page: https://quelltest.com/docs/reference/constraint-kinds

A constraint kind classifies a requirement extracted from your Python code: `must_raise`, `boundary`, `enum_valid` and so on. The kind decides which rule generates the test and how the verifier violates the requirement to prove the test can fail. This page lists every kind defined in the Python package, which spec reader produces it, and whether the rule engine handles it.

## What are the kinds?

| Kind | Meaning | Typical source | Rule engine | Violation injected |
| --- | --- | --- | --- | --- |
| `must_raise` | Raises an exception under a condition | `Raises:` docstring entry, `try/except` re-raise, standalone `raise` | yes | `raise` replaced with `pass` |
| `boundary` | Value above, below or at a threshold | `if x <= 0: raise`, `assert x > 0`, `Field(gt=0)`, `min_length`, `max_length` | yes | threshold literal replaced with `-9999` |
| `enum_valid` | Value must be one of a set | `if x not in VALID: raise`, `Literal[...]` | yes | `raise` replaced with `pass` |
| `enum_invalid` | An invalid value must be rejected | defined in the model; no reader emits it in the tested code | no | none |
| `must_return` | Returns a specific value or type | `Returns:` docstring | yes | non-`None` returns become `return None` |
| `not_none` | Return must not be `None` | defined in the model; no reader emits it in the tested code | no | none |
| `not_null` | A variable (or PySpark column) must not be null | `if x is None: raise` | yes | `raise` replaced with `pass` |
| `type_check` | `isinstance` guard | `if not isinstance(x, ...): raise` | yes | `raise` replaced with `pass` |
| `auth_check` | Authentication or permission guard | `if not request.user.is_authenticated: raise` | no | `raise` replaced with `pass` |
| `bare_except` | Bare or broad `except` that swallows everything (a smell) | `except Exception: pass` | no | none |
| `silent_fail` | Returns `None` instead of raising | `if not result: return None` | yes | first silent return becomes a `raise` |
| `magic_value` | Hardcoded string or number in a condition | `if status == "admin":` | yes | `raise` replaced with `pass` |
| `mutation` | A mutant that survived | mutmut results (optional) | no | `mutmut apply` |
| `bug_repro` | Reproduce a reported bug | `quell reproduce` | yes | none (already broken) |
| `custom` | Free-form requirement | LLM-handled | yes | `raise` replaced with `pass` |

The "Rule engine" column says whether `can_handle` is true for the kind. Requirements the rule engine cannot handle go to the LLM only when you pass `--use-llm`, otherwise they are scaffolded or flagged with a reason.

## What cannot the rule engine do?

It returns no test when all required parameters are complex objects, when the guard checks `self.attr` (it needs class instantiation) or a local variable such as a database result (it cannot be injected through a stub), and for async functions it wraps the call with `asyncio.run`. FastAPI and Flask route handlers go to a framework engine that needs an app object found in the project.

## Which readers produce which kinds?

| Reader | Kinds |
| --- | --- |
| Guard clauses (`quell find`) | `boundary`, `not_null`, `enum_valid`, `type_check`, `auth_check`, `bare_except`, `silent_fail`, `magic_value`, `must_raise` |
| Docstrings | `must_raise`, `boundary`, `enum_valid`, `must_return` |
| Types and Pydantic models | `boundary`, `enum_valid` |
| Bug reports | `bug_repro` |

See [how it works](https://quelltest.com/docs/how-it-works.md) and the [five-gate pipeline](https://quelltest.com/docs/reference/gates.md).
