diff --git a/AGENTS.md b/AGENTS.md index 7e1582761b..e66437159b 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -113,6 +113,44 @@ repos/{owner}/{repo}/milestones --jq '.[].title'`, and pick the best match. end on clarifications unless truly blocked. Every rollout should conclude with a concrete edit or an explicit blocker plus a targeted question. +## Test authorship markers + +Use pytest markers to make the provenance of newly added unit tests explicit. +Keep this provenance system minimal: choose from only these three markers. +Place the marker immediately above each test function. A class-level marker is +acceptable only when every test method in the class has the same provenance. +Do not use module-level `pytestmark` for authorship provenance; it is too easy +to miss in large files and makes later per-test provenance changes ambiguous. + +- `@pytest.mark.agent_authored(model="")`: the test was authored by an + agent and has not yet been materially reviewed or rewritten by a human. + Agents must add this marker when generating new unit tests, for example: + + ```python + import pytest + + @pytest.mark.agent_authored(model="gpt-5.5") + def test_something(): + ... + ``` + +- `@pytest.mark.human_reviewed`: a human has materially reviewed or rewritten + an agent-authored test. Prefer replacing + `@pytest.mark.agent_authored(model="")` with this marker instead of + keeping both. +- `@pytest.mark.human_authored`: the test was authored by a human, or + rewritten enough that the authorship is primarily human. + +Use at most one authorship marker per test. Treat missing markers as legacy or +unknown provenance, not as implicit `@pytest.mark.human_authored`. Because +these are pytest markers, tests can be selected with `pytest -m`, for example +`pytest -m agent_authored`. + +When an agent notices a human adding a new test or materially modifying an +existing test, suggest adding `@pytest.mark.human_authored` or replacing +`@pytest.mark.agent_authored(model="")` with +`@pytest.mark.human_reviewed` as appropriate. + # Editing constraints diff --git a/cuda_bindings/pyproject.toml b/cuda_bindings/pyproject.toml index c3f1529461..7b35e9c140 100644 --- a/cuda_bindings/pyproject.toml +++ b/cuda_bindings/pyproject.toml @@ -92,6 +92,13 @@ required_plugins = "pytest-benchmark" addopts = "--benchmark-disable --showlocals" norecursedirs = ["tests/cython", "examples"] xfail_strict = true +# Keep this authorship marker registry in sync across all pytest config roots. +# Search for "agent_authored(model)" before editing. +markers = [ + "agent_authored(model): agent-authored test not yet materially human-reviewed", + "human_reviewed: agent-authored test materially reviewed or rewritten by a human", + "human_authored: test authored primarily by a human", +] [tool.setuptools_scm] root = ".." diff --git a/cuda_core/pytest.ini b/cuda_core/pytest.ini index 41bf0d9c4f..c3d243387f 100644 --- a/cuda_core/pytest.ini +++ b/cuda_core/pytest.ini @@ -5,3 +5,9 @@ [pytest] addopts = --showlocals norecursedirs = cython +markers = + # Keep this authorship marker registry in sync across all pytest config roots. + # Search for "agent_authored(model)" before editing. + agent_authored(model): agent-authored test not yet materially human-reviewed + human_reviewed: agent-authored test materially reviewed or rewritten by a human + human_authored: test authored primarily by a human diff --git a/cuda_pathfinder/pyproject.toml b/cuda_pathfinder/pyproject.toml index c457438274..9d9f025085 100644 --- a/cuda_pathfinder/pyproject.toml +++ b/cuda_pathfinder/pyproject.toml @@ -104,6 +104,13 @@ git_describe_command = [ "git", "describe", "--dirty", "--tags", "--long", "--ma [tool.pytest.ini_options] addopts = "--showlocals" thread_unsafe_fixtures = ['mocker'] +# Keep this authorship marker registry in sync across all pytest config roots. +# Search for "agent_authored(model)" before editing. +markers = [ + "agent_authored(model): agent-authored test not yet materially human-reviewed", + "human_reviewed: agent-authored test materially reviewed or rewritten by a human", + "human_authored: test authored primarily by a human", +] [tool.mypy] # Try to keep the mypy configuration similar between the subprojects diff --git a/pytest.ini b/pytest.ini index 9c11c2b5f5..76e5a2977d 100644 --- a/pytest.ini +++ b/pytest.ini @@ -20,6 +20,11 @@ markers = core: tests for cuda_core cython: cython tests smoke: meta-level smoke tests + # Keep this authorship marker registry in sync across all pytest config roots. + # Search for "agent_authored(model)" before editing. + agent_authored(model): agent-authored test not yet materially human-reviewed + human_reviewed: agent-authored test materially reviewed or rewritten by a human + human_authored: test authored primarily by a human flaky: mark test as flaky (provided by pytest-rerunfailures) # pytest-run-parallel related markers thread_unsafe: mark test as thread unsafe (provided by pytest-run-parallel)