From 7361dc2d71f37cc23506af81b9f414e700befc42 Mon Sep 17 00:00:00 2001 From: "Ralf W. Grosse-Kunstleve" Date: Tue, 23 Jun 2026 15:32:21 -0700 Subject: [PATCH 1/3] docs: add pytest markers for test authorship --- AGENTS.md | 37 ++++++++++++++++++++++++++++++++++ cuda_bindings/pyproject.toml | 5 +++++ cuda_core/pytest.ini | 4 ++++ cuda_pathfinder/pyproject.toml | 5 +++++ pytest.ini | 3 +++ 5 files changed, 54 insertions(+) diff --git a/AGENTS.md b/AGENTS.md index 7e1582761b7..d8e56ce8a0b 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -113,6 +113,43 @@ 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 the test function or test class. Use +module-level `pytestmark` only when the whole test file has the same +provenance. + +- `@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 c3f15294612..6139fce0446 100644 --- a/cuda_bindings/pyproject.toml +++ b/cuda_bindings/pyproject.toml @@ -92,6 +92,11 @@ required_plugins = "pytest-benchmark" addopts = "--benchmark-disable --showlocals" norecursedirs = ["tests/cython", "examples"] xfail_strict = true +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 41bf0d9c4fd..35b924450ea 100644 --- a/cuda_core/pytest.ini +++ b/cuda_core/pytest.ini @@ -5,3 +5,7 @@ [pytest] addopts = --showlocals norecursedirs = cython +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 diff --git a/cuda_pathfinder/pyproject.toml b/cuda_pathfinder/pyproject.toml index c457438274a..3c9d721e859 100644 --- a/cuda_pathfinder/pyproject.toml +++ b/cuda_pathfinder/pyproject.toml @@ -104,6 +104,11 @@ git_describe_command = [ "git", "describe", "--dirty", "--tags", "--long", "--ma [tool.pytest.ini_options] addopts = "--showlocals" thread_unsafe_fixtures = ['mocker'] +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 9c11c2b5f56..b5893dfd87a 100644 --- a/pytest.ini +++ b/pytest.ini @@ -20,6 +20,9 @@ markers = core: tests for cuda_core cython: cython tests smoke: meta-level smoke tests + 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) From c987def4fbab803affa9b08b5ab61d537fedcdf0 Mon Sep 17 00:00:00 2001 From: "Ralf W. Grosse-Kunstleve" Date: Tue, 23 Jun 2026 15:44:10 -0700 Subject: [PATCH 2/3] docs: keep test authorship markers local --- AGENTS.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/AGENTS.md b/AGENTS.md index d8e56ce8a0b..e66437159b0 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -117,9 +117,10 @@ repos/{owner}/{repo}/milestones --jq '.[].title'`, and pick the best match. 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 the test function or test class. Use -module-level `pytestmark` only when the whole test file has the same -provenance. +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. From 518685c754d3f04370750eaf000eec40e90fbdef Mon Sep 17 00:00:00 2001 From: "Ralf W. Grosse-Kunstleve" Date: Tue, 23 Jun 2026 16:13:08 -0700 Subject: [PATCH 3/3] docs: note synced authorship marker registries --- cuda_bindings/pyproject.toml | 2 ++ cuda_core/pytest.ini | 2 ++ cuda_pathfinder/pyproject.toml | 2 ++ pytest.ini | 2 ++ 4 files changed, 8 insertions(+) diff --git a/cuda_bindings/pyproject.toml b/cuda_bindings/pyproject.toml index 6139fce0446..7b35e9c1404 100644 --- a/cuda_bindings/pyproject.toml +++ b/cuda_bindings/pyproject.toml @@ -92,6 +92,8 @@ 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", diff --git a/cuda_core/pytest.ini b/cuda_core/pytest.ini index 35b924450ea..c3d243387fe 100644 --- a/cuda_core/pytest.ini +++ b/cuda_core/pytest.ini @@ -6,6 +6,8 @@ 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 3c9d721e859..9d9f025085e 100644 --- a/cuda_pathfinder/pyproject.toml +++ b/cuda_pathfinder/pyproject.toml @@ -104,6 +104,8 @@ 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", diff --git a/pytest.ini b/pytest.ini index b5893dfd87a..76e5a2977d9 100644 --- a/pytest.ini +++ b/pytest.ini @@ -20,6 +20,8 @@ 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