DocsReferenceConstraint kinds

Constraint Kinds

Every requirement Quell extracts from your specs is classified into a ConstraintKind. The kind determines how Quell generates and verifies the test.

Kinds

MUST_RAISE

A requirement that the function raises a specific exception under given conditions.

Extracted from: Raises: blocks in docstrings.

Example spec:

Raises:
    ValueError: If amount is zero or negative.

Generated test pattern:

def test_process_payment_must_raise_valueerror():
    import pytest
    with pytest.raises(ValueError):
        process_payment(request=PaymentRequest(amount=-1, currency="USD"))

Violation injection: Quell comments out the raise statement and confirms the test fails.


MUST_RETURN

A requirement about what the function returns.

Extracted from: Returns: blocks in docstrings.

Example spec:

Returns:
    dict with transaction_id, status, amount.

Violation injection: Quell replaces the return with return None and confirms the test fails.


BOUNDARY

A requirement that a value must be within a numeric range.

Extracted from: Pydantic Field(gt=0), Field(ge=18), Field(min_length=1); boundary phrases in docstrings ("must be greater than 0", "cannot exceed 500").

Example spec:

amount: float = Field(gt=0)

Generated test pattern:

def test_paymentrequest_amount_gt_boundary():
    import pytest
    with pytest.raises(Exception):
        PaymentRequest(amount=0, currency="USD")

Violation injection: Quell weakens the threshold to -9999 and confirms the test fails.


ENUM_VALID

A requirement that a value must be one of an allowed set.

Extracted from: Pydantic Literal["USD", "EUR", "GBP"] fields; enumeration phrases in docstrings ("one of USD, EUR, GBP").

Example spec:

currency: Literal["USD", "EUR", "GBP"]

Generated test pattern:

def test_paymentrequest_currency_invalid():
    import pytest
    with pytest.raises(Exception):
        PaymentRequest(amount=10.0, currency="JPY")

ENUM_INVALID

A requirement that a value must NOT be one of a set. Less common than ENUM_VALID.


NOT_NONE

A requirement that a return value or field must not be None.


BUG_REPRO

A requirement derived from a natural language bug description. Generated by quell reproduce.

Coverage: A BUG_REPRO requirement is never considered covered — it always generates a test. The test is written in a failing state (the bug exists) and passes once the bug is fixed.


MUTATION

A requirement derived from a mutation testing survivor (mutmut or Stryker). Used when enable_mutations = true.


CUSTOM

A requirement generated by the LLM for specs that don't fit the other categories.

Rule engine vs LLM

KindRule engineLLM
MUST_RAISEYesFallback
BOUNDARYYesFallback
ENUM_VALIDYesFallback
MUST_RETURNYesFallback
BUG_REPRONoAlways
MUTATIONYesFallback
CUSTOMNoAlways

The LLM is never called for kinds the rule engine handles, unless the rule engine fails to produce a verified test after max_verification_attempts.