agent-acceptance 1.0.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,10 @@
1
+ """agent-acceptance: deterministic test-evidence checks for contributed PRs.
2
+
3
+ Report mode (default) posts a PR comment assessing whether added/modified
4
+ tests are real evidence: fail-before + pass-after = VALID; already-passing
5
+ on the base revision = PRE-PASS (proves nothing about the change). Optional
6
+ time-budgeted mutation sampling reports which behaviors the new tests leave
7
+ unpinned. No LLM anywhere in the gate.
8
+ """
9
+
10
+ __version__ = "1.0.0"
@@ -0,0 +1,180 @@
1
+ """agent-acceptance CLI.
2
+
3
+ Subcommands (v1.0 scope, P1_CONSOLIDATION_PLAN output 2):
4
+ run Orchestrate base/PR overlay runs locally (git worktree backend).
5
+ evaluate Parse JUnit XML results and write evidence.json.
6
+ report Render the deterministic PR-comment Markdown from evidence.
7
+
8
+ Exit codes: see agent_acceptance.exit_codes.
9
+ Policy/config is loaded ONLY from the base branch of the target repository —
10
+ a pull request can never alter the checks applied to itself.
11
+ """
12
+
13
+ from __future__ import annotations
14
+
15
+ import argparse
16
+ import sys
17
+ from pathlib import Path
18
+
19
+ from agent_acceptance import __version__
20
+ from agent_acceptance import exit_codes as xc
21
+ from agent_acceptance.core.evaluate import evaluate
22
+ from agent_acceptance.report.render import render
23
+
24
+
25
+ def _cmd_run(args: argparse.Namespace) -> int:
26
+ from agent_acceptance.config import ConfigError, load_config
27
+ from agent_acceptance.core.overlay import run_overlay
28
+
29
+ repo = Path(args.repo).resolve()
30
+ out_dir = Path(args.out)
31
+
32
+ try:
33
+ cfg = load_config(repo, args.base)
34
+ except ConfigError as exc:
35
+ print(f"error: bad .agent-acceptance.yml on base: {exc}", file=sys.stderr)
36
+ return xc.USAGE
37
+ except Exception as exc: # bad ref etc.
38
+ print(f"error: {exc}", file=sys.stderr)
39
+ return xc.USAGE
40
+
41
+ # CLI flags override the base policy where given.
42
+ test_dirs = (
43
+ [d for d in args.test_dirs.split(",") if d.strip()]
44
+ if args.test_dirs is not None else cfg.test_dirs
45
+ )
46
+ budget = args.mutation_budget if args.mutation_budget is not None \
47
+ else cfg.mutation_budget_seconds
48
+ flaky_n = args.flaky_n if args.flaky_n is not None else cfg.flaky_n
49
+ gate = args.gate_flag if args.gate_flag is not None else cfg.gate
50
+ # SPEC §2.5: flaky repeats are a gate-mode-only extension; report mode
51
+ # always runs each side once.
52
+ if not (gate and not args.report_only):
53
+ flaky_n = 1
54
+
55
+ try:
56
+ outcome = run_overlay(
57
+ repo, args.base, args.head, out_dir,
58
+ test_dirs=test_dirs, python_exe=args.python,
59
+ flaky_n=flaky_n, mutation_budget_s=budget,
60
+ )
61
+ except Exception as exc: # noqa: BLE001 — surface as usage/infra error
62
+ print(f"error: {exc}", file=sys.stderr)
63
+ return xc.USAGE
64
+
65
+ if outcome is None:
66
+ (out_dir / "report.md").write_text(
67
+ "# Test-evidence assessment\n\n"
68
+ "No test files were changed in this PR, so there is no executable "
69
+ "test evidence to verify.\n",
70
+ encoding="utf-8",
71
+ )
72
+ print("verdict=NO_EVIDENCE (no changed test files)")
73
+ return xc.OK
74
+
75
+ ev = outcome.evidence
76
+ print(f"strength={ev.strength} verdict={ev.verdict}")
77
+ print(f"evidence: {out_dir / 'evidence.json'}")
78
+
79
+ if gate and not args.report_only:
80
+ if ev.verdict in ("INVALID_EVIDENCE", "ERROR"):
81
+ # No usable evidence at all (incl. collection failures) -> invalid.
82
+ return xc.GATE_INVALID_EVIDENCE
83
+ if any(t.verdict == "BROKEN" for t in ev.tests):
84
+ return xc.GATE_BROKEN
85
+ return xc.OK
86
+
87
+
88
+ def _cmd_evaluate(args: argparse.Namespace) -> int:
89
+ ev = evaluate(
90
+ Path(args.out_dir), args.base_sha, args.head_sha,
91
+ mut_status=args.mutation_status,
92
+ )
93
+ (Path(args.out_dir) / "evidence.json").write_text(ev.to_json(), encoding="utf-8")
94
+ print(f"strength={ev.strength} verdict={ev.verdict}")
95
+ return xc.OK
96
+
97
+
98
+ def _cmd_report(args: argparse.Namespace) -> int:
99
+ out = Path(args.out_dir)
100
+ ev = evaluate(out, args.base_sha, args.head_sha,
101
+ mut_status=args.mutation_status) \
102
+ if not (out / "evidence.json").exists() else _load_evidence(out)
103
+ (out / "report.md").write_text(render(ev), encoding="utf-8")
104
+ print(f"wrote {out / 'report.md'}")
105
+ return xc.OK
106
+
107
+
108
+ def _load_evidence(out: Path):
109
+ import json
110
+
111
+ from agent_acceptance.core.evaluate import Evidence, MutationResult, TestRow
112
+
113
+ doc = json.loads((out / "evidence.json").read_text(encoding="utf-8"))
114
+ return Evidence(
115
+ base_sha=doc["base_sha"],
116
+ head_sha=doc["head_sha"],
117
+ strength=doc["strength"],
118
+ verdict=doc["verdict"],
119
+ tests=[
120
+ TestRow(key=t["test"], on_base=t["on_base"], on_pr=t["on_pr"],
121
+ verdict=t["verdict"], note=t.get("note", ""))
122
+ for t in doc["tests"]
123
+ ],
124
+ mutation=MutationResult(**doc["mutation"]),
125
+ )
126
+
127
+
128
+ def build_parser() -> argparse.ArgumentParser:
129
+ p = argparse.ArgumentParser(prog="agent-acceptance", description=__doc__)
130
+ p.add_argument("--version", action="version", version=__version__)
131
+ sub = p.add_subparsers(dest="command", required=True)
132
+
133
+ ev = sub.add_parser("evaluate", help="write evidence.json from JUnit XML runs")
134
+ ev.add_argument("out_dir", help="directory containing base.xml / pr.xml [/mutation.xml]")
135
+ ev.add_argument("--base-sha", required=True)
136
+ ev.add_argument("--head-sha", required=True)
137
+ ev.add_argument("--mutation-status", default=None,
138
+ help="force mutation phase status (e.g. TIMEOUT -> SKIPPED, no score)")
139
+ ev.set_defaults(func=_cmd_evaluate)
140
+
141
+ rp = sub.add_parser("report", help="render report.md (from evidence.json or raw runs)")
142
+ rp.add_argument("out_dir")
143
+ rp.add_argument("--base-sha", default="")
144
+ rp.add_argument("--head-sha", default="")
145
+ rp.add_argument("--mutation-status", default=None)
146
+ rp.set_defaults(func=_cmd_report)
147
+
148
+ rn = sub.add_parser("run", help="orchestrate base/PR overlay runs locally")
149
+ rn.add_argument("--repo", default=".", help="path to the target git repository")
150
+ rn.add_argument("--base", required=True, help="base revision (SHA/branch/tag)")
151
+ rn.add_argument("--head", required=True, help="PR revision (SHA/branch/tag)")
152
+ rn.add_argument("--out", default="out", help="output directory for XML/evidence")
153
+ rn.add_argument("--test-dirs", default=None,
154
+ help="comma-separated test dirs (default: policy on base)")
155
+ rn.add_argument("--python", default=sys.executable,
156
+ help="python interpreter used to run pytest/mutmut")
157
+ rn.add_argument("--mutation-budget", type=int, default=None, metavar="S",
158
+ help="mutation time budget in seconds (default: policy on "
159
+ "base, 600); 0 disables the mutation phase")
160
+ rn.add_argument("--flaky-n", type=int, default=None, metavar="N",
161
+ help="runs per phase; >1 enables the flaky rule "
162
+ "(default: policy on base, 3; report mode may use 1)")
163
+ rn.add_argument("--gate", dest="gate_flag", action="store_true", default=None,
164
+ help="gate mode: exit non-zero on invalid evidence "
165
+ "(default: policy on base, off)")
166
+ rn.add_argument("--no-gate", dest="gate_flag", action="store_false",
167
+ help="force report mode regardless of policy")
168
+ rn.add_argument("--report-only", action="store_true",
169
+ help="never convert findings into a non-zero exit code")
170
+ rn.set_defaults(func=_cmd_run)
171
+ return p
172
+
173
+
174
+ def main(argv: list[str] | None = None) -> int:
175
+ args = build_parser().parse_args(argv)
176
+ return args.func(args)
177
+
178
+
179
+ if __name__ == "__main__":
180
+ sys.exit(main())
@@ -0,0 +1,91 @@
1
+ """Repository policy, loaded ONLY from the base revision.
2
+
3
+ A pull request can never alter the checks applied to itself: the config
4
+ file (``.agent-acceptance.yml``) is read from the base ref via ``git show``
5
+ — never from the working tree and never from the PR.
6
+
7
+ Supported flat schema (scalars only; no nesting, no anchors):
8
+
9
+ test-dirs: tests,src/tests # comma-separated
10
+ mutation-budget-seconds: 600
11
+ flaky-n: 3
12
+ gate: false
13
+
14
+ Unknown keys are ignored (forward compatibility). Malformed lines raise
15
+ ConfigError. The parser is a deliberately minimal flat-YAML subset so the
16
+ core stays dependency-free and deterministic.
17
+ """
18
+
19
+ from __future__ import annotations
20
+
21
+ from dataclasses import dataclass, field
22
+
23
+ from agent_acceptance.core.overlay import GitError, _git
24
+
25
+
26
+ class ConfigError(ValueError):
27
+ """The policy file exists but cannot be parsed."""
28
+
29
+
30
+ @dataclass
31
+ class Config:
32
+ test_dirs: list[str] = field(default_factory=lambda: ["tests"])
33
+ mutation_budget_seconds: int = 600
34
+ flaky_n: int = 3
35
+ gate: bool = False
36
+
37
+
38
+ def _coerce_bool(value: str) -> bool:
39
+ low = value.strip().lower()
40
+ if low in ("true", "yes", "on"):
41
+ return True
42
+ if low in ("false", "no", "off"):
43
+ return False
44
+ raise ConfigError(f"expected boolean, got {value!r}")
45
+
46
+
47
+ def _coerce_int(value: str) -> int:
48
+ try:
49
+ return int(value.strip())
50
+ except ValueError as exc:
51
+ raise ConfigError(f"expected integer, got {value!r}") from exc
52
+
53
+
54
+ def parse_config(text: str) -> Config:
55
+ cfg = Config()
56
+ for lineno, raw in enumerate(text.splitlines(), start=1):
57
+ stripped = raw.strip()
58
+ if not stripped or stripped.startswith("#"):
59
+ continue
60
+ line = raw.split(" #", 1)[0].rstrip() # strip trailing comments
61
+ if not line.strip():
62
+ continue
63
+ if ":" not in line:
64
+ raise ConfigError(f"line {lineno}: expected 'key: value', got {raw!r}")
65
+ key, _, value = line.partition(":")
66
+ key = key.strip().lower()
67
+ value = value.strip()
68
+ if key == "test-dirs":
69
+ cfg.test_dirs = [d.strip() for d in value.split(",") if d.strip()] or ["tests"]
70
+ elif key == "mutation-budget-seconds":
71
+ cfg.mutation_budget_seconds = _coerce_int(value)
72
+ elif key == "flaky-n":
73
+ cfg.flaky_n = _coerce_int(value)
74
+ elif key == "gate":
75
+ cfg.gate = _coerce_bool(value)
76
+ # unknown keys ignored (forward compatibility)
77
+ return cfg
78
+
79
+
80
+ def load_config(repo, ref: str) -> Config:
81
+ """Read .agent-acceptance.yml from *ref*; missing file -> defaults.
82
+
83
+ Raises GitError when *ref* itself cannot be resolved; returns defaults
84
+ when the ref is fine but the policy file is absent.
85
+ """
86
+ _git(repo, "rev-parse", "--verify", "--quiet", f"{ref}^{{commit}}")
87
+ try:
88
+ text = _git(repo, "show", f"{ref}:.agent-acceptance.yml")
89
+ except GitError:
90
+ return Config()
91
+ return parse_config(text)
@@ -0,0 +1 @@
1
+ """Core deterministic checks: bidirectional validity, overlay, mutation."""
@@ -0,0 +1,204 @@
1
+ """Classify bidirectional test validity + mutation results.
2
+
3
+ Migrated from the P1a prototype (tool/action/scripts/evaluate.py) into a
4
+ testable package. Pure stdlib; deterministic; no LLM.
5
+
6
+ Class semantics (SPEC v2, P1_CONSOLIDATION_PLAN output 2):
7
+ - VALID: test fails on base, passes on PR -> real evidence.
8
+ - PRE-PASS: test already passes on base -> proves nothing about the change.
9
+ - BROKEN: test fails on both revisions -> the test itself is broken.
10
+ - ERROR: run collection failed (missing result, test errored).
11
+ """
12
+
13
+ from __future__ import annotations
14
+
15
+ import json
16
+ import xml.etree.ElementTree as ET
17
+ from dataclasses import dataclass, field
18
+ from pathlib import Path
19
+
20
+ VERDICTS = ("VALID", "PRE-PASS", "BROKEN", "ERROR")
21
+
22
+ STRENGTH_ORDER = {"NONE": 0, "WEAK": 1, "PARTIAL": 2, "STRONG": 3}
23
+
24
+
25
+ @dataclass
26
+ class TestRow:
27
+ key: str
28
+ on_base: str
29
+ on_pr: str
30
+ verdict: str
31
+ note: str = ""
32
+
33
+
34
+ @dataclass
35
+ class MutationResult:
36
+ status: str = "SKIPPED" # OK | SKIPPED | TIMEOUT
37
+ killed: int = 0
38
+ survived: int = 0
39
+ score: float | None = None
40
+ survivor_samples: list[dict] = field(default_factory=list)
41
+
42
+
43
+ @dataclass
44
+ class Evidence:
45
+ base_sha: str
46
+ head_sha: str
47
+ strength: str # NONE | WEAK | PARTIAL | STRONG
48
+ verdict: str # EVIDENCE_OK | INVALID_EVIDENCE | ERROR | NO_EVIDENCE
49
+ tests: list[TestRow]
50
+ mutation: MutationResult
51
+
52
+ @property
53
+ def counts(self) -> dict[str, int]:
54
+ return {v: sum(1 for t in self.tests if t.verdict == v) for v in VERDICTS}
55
+
56
+ def to_json(self) -> str:
57
+ doc = {
58
+ "schema": "agent-acceptance/evidence@v0",
59
+ "base_sha": self.base_sha,
60
+ "head_sha": self.head_sha,
61
+ "strength": self.strength,
62
+ "verdict": self.verdict,
63
+ "tests": [
64
+ {"test": t.key, "on_base": t.on_base, "on_pr": t.on_pr,
65
+ "verdict": t.verdict, "note": t.note}
66
+ for t in self.tests
67
+ ],
68
+ "counts": self.counts,
69
+ "mutation": {
70
+ "status": self.mutation.status,
71
+ "score": self.mutation.score,
72
+ "killed": self.mutation.killed,
73
+ "survived": self.mutation.survived,
74
+ "survivor_samples": self.mutation.survivor_samples,
75
+ },
76
+ }
77
+ return json.dumps(doc, indent=2)
78
+
79
+
80
+ def parse_junit(path: Path) -> dict[str, str]:
81
+ """Return {test_key: outcome}; outcome in {passed, failed, error}.
82
+
83
+ Missing file -> empty dict (caller treats as collection failure).
84
+ """
85
+ if not path.exists():
86
+ return {}
87
+ outcomes: dict[str, str] = {}
88
+ root = ET.parse(path).getroot()
89
+ for case in root.iter("testcase"):
90
+ key = f"{case.get('classname', '')}::{case.get('name', '')}"
91
+ if case.find("failure") is not None or case.find("assertion") is not None:
92
+ outcomes[key] = "failed"
93
+ elif case.find("error") is not None:
94
+ outcomes[key] = "error"
95
+ else:
96
+ outcomes[key] = "passed"
97
+ return outcomes
98
+
99
+
100
+ def parse_mutation(path: Path, forced_status: str | None = None) -> MutationResult:
101
+ """Parse a mutmut junitxml (one testcase per mutant).
102
+
103
+ mutmut marks *survived* mutants with a <skipped> element. If the phase did
104
+ not finish within budget (forced_status set), we report the declared status
105
+ and never fabricate a score.
106
+ """
107
+ if forced_status is not None or not path.exists():
108
+ return MutationResult(status=forced_status or "SKIPPED")
109
+ killed = survived = 0
110
+ samples: list[dict] = []
111
+ for case in ET.parse(path).getroot().iter("testcase"):
112
+ desc = f"{case.get('classname', '')}::{case.get('name', '')}"
113
+ skipped = case.find("skipped")
114
+ if skipped is not None:
115
+ survived += 1
116
+ if len(samples) < 5:
117
+ samples.append(
118
+ {"mutant": desc, "detail": (skipped.get("message", "") or "")[:160]}
119
+ )
120
+ else:
121
+ killed += 1
122
+ total = killed + survived
123
+ return MutationResult(
124
+ status="OK",
125
+ killed=killed,
126
+ survived=survived,
127
+ score=round(killed / total, 3) if total else None,
128
+ survivor_samples=samples,
129
+ )
130
+
131
+
132
+ def classify_pair(on_base: str, on_pr: str) -> str:
133
+ """Per-test verdict from the (base outcome, PR outcome) pair."""
134
+ if on_base == "failed" and on_pr == "passed":
135
+ return "VALID"
136
+ if on_base == "passed" and on_pr == "passed":
137
+ return "PRE-PASS"
138
+ if on_pr in ("missing", "error") or on_base == "error":
139
+ return "ERROR"
140
+ return "BROKEN"
141
+
142
+
143
+ def classify_run(
144
+ base: dict[str, str], pr: dict[str, str], mutation: MutationResult
145
+ ) -> tuple[str, str, list[TestRow]]:
146
+ """Aggregate per-test rows into (strength, verdict).
147
+
148
+ strength: NONE (no usable rows) | WEAK (only PRE-PASS) |
149
+ PARTIAL (some VALID but incomplete) | STRONG (all VALID).
150
+ verdict: EVIDENCE_OK | INVALID_EVIDENCE | ERROR.
151
+ """
152
+ rows = [
153
+ TestRow(key=key, on_base=outcome, on_pr=pr.get(key, "missing"),
154
+ verdict=classify_pair(outcome, pr.get(key, "missing")))
155
+ for key, outcome in base.items()
156
+ ]
157
+ if not rows:
158
+ return "NONE", "ERROR", rows
159
+
160
+ n = len(rows)
161
+ valid = sum(r.verdict == "VALID" for r in rows)
162
+ errored = sum(r.verdict == "ERROR" for r in rows)
163
+ broken = sum(r.verdict == "BROKEN" for r in rows)
164
+
165
+ if errored == n:
166
+ strength, verdict = "NONE", "ERROR"
167
+ elif valid == n:
168
+ strength, verdict = "STRONG", "EVIDENCE_OK"
169
+ elif valid > 0:
170
+ # Some real evidence; PARTIAL never blocks in gate mode — only a run
171
+ # with *no* valid evidence at all is gate-worthy invalid.
172
+ strength, verdict = "PARTIAL", "EVIDENCE_OK"
173
+ elif broken > 0:
174
+ strength, verdict = "NONE", "INVALID_EVIDENCE"
175
+ else: # only PRE-PASS rows
176
+ strength, verdict = "WEAK", "INVALID_EVIDENCE"
177
+ return strength, verdict, rows
178
+
179
+
180
+ def evaluate(
181
+ out_dir: Path, base_sha: str, head_sha: str, mut_status: str | None = None
182
+ ) -> Evidence:
183
+ """Full evaluation over a directory containing base.xml / pr.xml / mutation.xml."""
184
+ out_dir = Path(out_dir)
185
+ base = parse_junit(out_dir / "base.xml")
186
+ pr = parse_junit(out_dir / "pr.xml")
187
+
188
+ forced_mut = mut_status if mut_status and mut_status != "OK" else None
189
+ mut = parse_mutation(out_dir / "mutation.xml", forced_status=forced_mut)
190
+
191
+ if not base or not pr:
192
+ strength, verdict = "NONE", "ERROR"
193
+ rows: list = []
194
+ else:
195
+ strength, verdict, rows = classify_run(base, pr, mut)
196
+
197
+ return Evidence(
198
+ base_sha=base_sha,
199
+ head_sha=head_sha,
200
+ strength=strength,
201
+ verdict=verdict,
202
+ tests=rows,
203
+ mutation=mut,
204
+ )
@@ -0,0 +1,117 @@
1
+ """Sampled mutation backend (SPEC v2 §3, component C2).
2
+
3
+ Engine is pinned: mutmut 2.5.x, driven through ``python -m mutmut``. The
4
+ procedure is exactly the frozen one:
5
+
6
+ 1. generate mutmut config scoping mutation to the PR's changed source files
7
+ (``S_Δ``) and the test runner to the changed tests (``T_Δ``);
8
+ 2. ``mutmut run`` under a hard time budget (default 600 s);
9
+ 3. ``mutmut junitxml`` -> killed/survived counts + up to 5 survivor samples.
10
+
11
+ Degradation rule (§3.3): budget exceeded, engine missing, or engine error
12
+ ⇒ status SKIPPED/TIMEOUT with **no numeric claims** — a score is never
13
+ fabricated.
14
+ """
15
+
16
+ from __future__ import annotations
17
+
18
+ import shutil
19
+ import subprocess
20
+ import tempfile
21
+ from dataclasses import dataclass
22
+ from pathlib import Path
23
+
24
+ from agent_acceptance.core.evaluate import MutationResult, parse_mutation
25
+ from agent_acceptance.core.overlay import Changes, GitError, add_worktree, remove_worktree
26
+
27
+ JUNIT_TIMEOUT_S = 120
28
+
29
+
30
+ @dataclass
31
+ class MutationOutcome:
32
+ result: MutationResult
33
+ xml_path: Path | None = None
34
+
35
+
36
+ def write_mutmut_config(tree: Path, test_paths: list[str], src_paths: list[str]) -> Path:
37
+ """Write/merge the ``[mutmut]`` section of ``setup.cfg`` inside *tree*.
38
+
39
+ Existing content outside ``[mutmut]`` (e.g. ``[tool:pytest]`` of the
40
+ target project) is preserved verbatim.
41
+ """
42
+ cfg_path = tree / "setup.cfg"
43
+ section = (
44
+ "[mutmut]\n"
45
+ f"runner=python -m pytest -x -q -p no:cacheprovider {' '.join(test_paths)}\n"
46
+ f"paths_to_mutate={','.join(src_paths)}\n"
47
+ )
48
+ try:
49
+ text = cfg_path.read_text(encoding="utf-8")
50
+ except FileNotFoundError:
51
+ text = ""
52
+
53
+ if "[mutmut]" in text:
54
+ head, _, _tail = text.partition("[mutmut]")
55
+ text = head
56
+ elif text and not text.endswith("\n"):
57
+ text += "\n"
58
+ cfg_path.write_text(text + section, encoding="utf-8")
59
+ return cfg_path
60
+
61
+
62
+ def run_mutation(
63
+ repo: Path,
64
+ head: str,
65
+ changes: Changes,
66
+ out_dir: Path,
67
+ budget_s: int,
68
+ python_exe: str,
69
+ work_root: Path | None = None,
70
+ ) -> MutationOutcome:
71
+ """Run the sampled-mutation phase; degrade gracefully, never fabricate."""
72
+ out_dir = Path(out_dir)
73
+ if not changes.srcs:
74
+ return MutationOutcome(result=MutationResult(status="SKIPPED"))
75
+
76
+ repo = Path(repo).resolve()
77
+ mut_tree: Path | None = None
78
+ tmp_work = None
79
+ try:
80
+ root = work_root if work_root is not None else Path(
81
+ tempfile.mkdtemp(prefix="aa-mutation-")
82
+ )
83
+ if work_root is None:
84
+ tmp_work = str(root)
85
+ mut_tree = add_worktree(repo, head, root / "mut-tree")
86
+ write_mutmut_config(mut_tree, changes.tests, changes.srcs)
87
+
88
+ try:
89
+ subprocess.run(
90
+ [python_exe, "-m", "mutmut", "run"],
91
+ cwd=str(mut_tree), capture_output=True, text=True,
92
+ timeout=budget_s, check=False,
93
+ )
94
+ except subprocess.TimeoutExpired:
95
+ return MutationOutcome(result=MutationResult(status="TIMEOUT"))
96
+ except FileNotFoundError:
97
+ # mutmut not importable by python_exe — engine unavailable.
98
+ return MutationOutcome(result=MutationResult(status="SKIPPED"))
99
+
100
+ junit = subprocess.run(
101
+ [python_exe, "-m", "mutmut", "junitxml"],
102
+ cwd=str(mut_tree), capture_output=True, text=True,
103
+ timeout=JUNIT_TIMEOUT_S, check=False,
104
+ )
105
+ if junit.returncode != 0 or not junit.stdout.strip():
106
+ return MutationOutcome(result=MutationResult(status="SKIPPED"))
107
+ xml_path = out_dir / "mutation.xml"
108
+ xml_path.write_text(junit.stdout, encoding="utf-8")
109
+ return MutationOutcome(result=parse_mutation(xml_path), xml_path=xml_path)
110
+ finally:
111
+ if mut_tree is not None:
112
+ try:
113
+ remove_worktree(repo, mut_tree)
114
+ except GitError:
115
+ pass
116
+ if tmp_work is not None:
117
+ shutil.rmtree(tmp_work, ignore_errors=True)
@@ -0,0 +1,253 @@
1
+ """Local worktree backend: prepare base/PR trees, run changed tests, evaluate.
2
+
3
+ CLI counterpart of the Action's bash orchestration
4
+ (demo/tool/action/scripts/run.sh), replacing `git archive | tar` with
5
+ `git worktree add --detach` and Docker sandboxing with a plain subprocess:
6
+
7
+ - base phase: pristine base tree + the PR's changed test files overlaid on
8
+ top -> the new tests run against the OLD source (fail-before).
9
+ - pr phase: the PR tree checked out as-is -> the same tests against the NEW
10
+ source (pass-after).
11
+
12
+ All subprocess invocations use argv lists (never a shell string), so paths
13
+ containing spaces are safe. Failing pytest runs are *data*, not runner
14
+ errors, so the exit status of pytest is deliberately ignored.
15
+ """
16
+
17
+ from __future__ import annotations
18
+
19
+ import os
20
+ import shutil
21
+ import subprocess
22
+ import sys
23
+ import tempfile
24
+ import xml.etree.ElementTree as ET
25
+ from dataclasses import dataclass
26
+ from pathlib import Path, PurePosixPath
27
+
28
+ from agent_acceptance.core.evaluate import Evidence, evaluate, parse_junit
29
+
30
+
31
+ class GitError(RuntimeError):
32
+ """A git command failed while preparing the overlay runs."""
33
+
34
+
35
+ def _git(repo: Path, *args: str) -> str:
36
+ proc = subprocess.run(
37
+ ["git", "-C", str(repo), *args], capture_output=True, text=True
38
+ )
39
+ if proc.returncode != 0:
40
+ raise GitError(
41
+ f"git {' '.join(args)} failed: {proc.stderr.strip() or proc.stdout.strip()}"
42
+ )
43
+ return proc.stdout
44
+
45
+
46
+ def changed_files(repo: Path, base: str, head: str) -> list[str]:
47
+ """Files changed between two revisions (POSIX-style relative paths)."""
48
+ out = _git(repo, "diff", "--name-only", base, head)
49
+ return [line for line in out.splitlines() if line.strip()]
50
+
51
+
52
+ def is_test_file(path: str, test_dirs: list[str]) -> bool:
53
+ """True for *.py files under a test dir named test_*.py or *_test.py."""
54
+ if not path.endswith(".py"):
55
+ return False
56
+ name = PurePosixPath(path).name
57
+ if not (name.startswith("test_") or name.endswith("_test.py")):
58
+ return False
59
+ return any(
60
+ path == d.rstrip("/") or path.startswith(d.rstrip("/") + "/")
61
+ for d in test_dirs
62
+ )
63
+
64
+
65
+ @dataclass
66
+ class Changes:
67
+ tests: list[str]
68
+ srcs: list[str]
69
+
70
+
71
+ def classify_changes(
72
+ repo: Path, base: str, head: str, test_dirs: list[str]
73
+ ) -> Changes:
74
+ """Split changed files into test files and other Python source files."""
75
+ tests: list[str] = []
76
+ srcs: list[str] = []
77
+ for path in changed_files(repo, base, head):
78
+ if is_test_file(path, test_dirs):
79
+ tests.append(path)
80
+ elif path.endswith(".py"):
81
+ srcs.append(path)
82
+ return Changes(tests=tests, srcs=srcs)
83
+
84
+
85
+ def add_worktree(repo: Path, ref: str, dest: Path) -> Path:
86
+ """Materialise *ref* into *dest* via a detached worktree."""
87
+ _git(repo, "worktree", "add", "--detach", str(dest), ref)
88
+ return dest
89
+
90
+
91
+ def remove_worktree(repo: Path, dest: Path) -> None:
92
+ _git(repo, "worktree", "remove", "--force", str(dest))
93
+
94
+
95
+ def overlay_files(src_tree: Path, dest_tree: Path, rel_paths: list[str]) -> None:
96
+ """Copy *rel_paths* from src_tree onto dest_tree (plain copy, no execution)."""
97
+ for rel in rel_paths:
98
+ src = src_tree.joinpath(*PurePosixPath(rel).parts)
99
+ dest = dest_tree.joinpath(*PurePosixPath(rel).parts)
100
+ dest.parent.mkdir(parents=True, exist_ok=True)
101
+ shutil.copy2(src, dest)
102
+
103
+
104
+ def run_pytest(
105
+ tree: Path,
106
+ test_paths: list[str],
107
+ junit_xml: Path,
108
+ python_exe: str = sys.executable,
109
+ ) -> subprocess.CompletedProcess[str]:
110
+ """Run the changed tests inside *tree*; a failing run is data, not an error."""
111
+ cmd = [
112
+ python_exe, "-m", "pytest", "-p", "no:cacheprovider", "-q",
113
+ f"--junitxml={junit_xml}",
114
+ *test_paths,
115
+ ]
116
+ env = dict(os.environ)
117
+ env["PYTHONDONTWRITEBYTECODE"] = "1"
118
+ return subprocess.run(
119
+ cmd, cwd=str(tree), env=env, capture_output=True, text=True, check=False
120
+ )
121
+
122
+
123
+ def _write_synthetic_junit(path: Path, outcomes: dict[str, str]) -> None:
124
+ """Serialise merged per-test outcomes back to JUnit XML (flaky repeats)."""
125
+ suite = ET.Element("testsuite", tests=str(len(outcomes)))
126
+ for key in sorted(outcomes):
127
+ classname, _, name = key.partition("::")
128
+ case = ET.SubElement(suite, "testcase", classname=classname, name=name)
129
+ outcome = outcomes[key]
130
+ if outcome == "failed":
131
+ ET.SubElement(case, "failure", message="failed")
132
+ elif outcome == "error":
133
+ ET.SubElement(case, "error", message="unstable across repeats")
134
+ ET.ElementTree(suite).write(path, encoding="utf-8", xml_declaration=False)
135
+
136
+
137
+ def run_phase_repeat(
138
+ tree: Path,
139
+ test_paths: list[str],
140
+ out_dir: Path,
141
+ name: str,
142
+ repeats: int,
143
+ python_exe: str = sys.executable,
144
+ ) -> dict[str, str]:
145
+ """Run one phase up to *repeats* times (SPEC §2.5 flaky handling).
146
+
147
+ With ``repeats == 1`` this is a single plain run. With ``repeats > 1``
148
+ (gate-mode extension, ``flaky-n`` config), every test must show the same
149
+ outcome in every run; an unstable test maps to ``error`` — flakiness is
150
+ never evidence.
151
+ """
152
+ runs: list[dict[str, str]] = []
153
+ canonical = out_dir / f"{name}.xml"
154
+ for i in range(max(1, repeats)):
155
+ xml = out_dir / f"{name}.{i}.xml" if repeats > 1 else canonical
156
+ run_pytest(tree, test_paths, xml, python_exe)
157
+ runs.append(parse_junit(xml))
158
+
159
+ if repeats <= 1:
160
+ return runs[0]
161
+
162
+ merged: dict[str, str] = {}
163
+ keys: set[str] = set()
164
+ for r in runs:
165
+ keys.update(r)
166
+ for key in keys:
167
+ outcomes = {r.get(key, "missing") for r in runs}
168
+ merged[key] = outcomes.pop() if len(outcomes) == 1 else "error"
169
+ _write_synthetic_junit(canonical, merged)
170
+ return merged
171
+
172
+
173
+ @dataclass
174
+ class RunOutcome:
175
+ """Result of one overlay orchestration."""
176
+
177
+ changes: Changes
178
+ base_xml: Path
179
+ pr_xml: Path
180
+ evidence: Evidence
181
+
182
+
183
+ def run_overlay(
184
+ repo: Path,
185
+ base: str,
186
+ head: str,
187
+ out_dir: Path,
188
+ test_dirs: list[str] | None = None,
189
+ python_exe: str = sys.executable,
190
+ work_root: Path | None = None,
191
+ flaky_n: int = 1,
192
+ mutation_budget_s: int = 0,
193
+ ) -> RunOutcome | None:
194
+ """Orchestrate the double run (+ optional mutation phase) and evaluate.
195
+
196
+ Returns None when the PR changes no test files (nothing to verify — the
197
+ caller renders the NO_EVIDENCE report).
198
+
199
+ ``flaky_n``: repeats per phase; >1 engages the gate-mode flaky rule
200
+ (unstable tests count as ``error``). ``mutation_budget_s``: 0 skips the
201
+ mutation phase entirely; otherwise SPEC §3 budget semantics apply and a
202
+ budget overrun degrades to TIMEOUT/SKIPPED (never a fabricated score).
203
+ """
204
+ repo = Path(repo).resolve()
205
+ out_dir = Path(out_dir)
206
+ out_dir.mkdir(parents=True, exist_ok=True)
207
+ test_dirs = test_dirs if test_dirs is not None else ["tests"]
208
+
209
+ changes = classify_changes(repo, base, head, test_dirs)
210
+ if not changes.tests:
211
+ return None
212
+
213
+ base_tree: Path | None = None
214
+ head_tree: Path | None = None
215
+ tmp_work: str | None = None
216
+ try:
217
+ # Worktrees must live OUTSIDE the repository working tree (git refuses
218
+ # nested worktrees), so the default root is a fresh temp directory.
219
+ root = work_root if work_root is not None else Path(
220
+ tempfile.mkdtemp(prefix="aa-overlay-")
221
+ )
222
+ if work_root is None:
223
+ tmp_work = str(root)
224
+ base_tree = add_worktree(repo, base, root / "base-tree")
225
+ head_tree = add_worktree(repo, head, root / "pr-tree")
226
+ # New tests against the OLD source (fail-before).
227
+ overlay_files(head_tree, base_tree, changes.tests)
228
+
229
+ run_phase_repeat(base_tree, changes.tests, out_dir, "base", flaky_n, python_exe)
230
+ run_phase_repeat(head_tree, changes.tests, out_dir, "pr", flaky_n, python_exe)
231
+ finally:
232
+ for tree in (base_tree, head_tree):
233
+ if tree is not None:
234
+ try:
235
+ remove_worktree(repo, tree)
236
+ except GitError:
237
+ pass
238
+ if tmp_work is not None:
239
+ shutil.rmtree(tmp_work, ignore_errors=True)
240
+
241
+ mut_status = "SKIPPED"
242
+ if mutation_budget_s > 0 and changes.srcs:
243
+ from agent_acceptance.core.mutation import run_mutation
244
+
245
+ outcome = run_mutation(
246
+ repo, head, changes, out_dir, mutation_budget_s, python_exe, work_root
247
+ )
248
+ mut_status = outcome.result.status
249
+
250
+ ev = evaluate(out_dir, base, head, mut_status=mut_status)
251
+ (out_dir / "evidence.json").write_text(ev.to_json(), encoding="utf-8")
252
+ return RunOutcome(changes=changes, base_xml=out_dir / "base.xml",
253
+ pr_xml=out_dir / "pr.xml", evidence=ev)
@@ -0,0 +1,17 @@
1
+ """Exit code semantics (P1_CONSOLIDATION_PLAN_CN.md, output 2)."""
2
+
3
+ OK = 0
4
+ """Report published (or gate mode passed); nothing abnormal."""
5
+
6
+ GATE_INVALID_EVIDENCE = 10
7
+ """Gate mode only: evidence is INVALID (all tests PRE-PASS / no valid evidence)."""
8
+
9
+ GATE_BROKEN = 11
10
+ """Gate mode only: a changed test is BROKEN (fails on both revisions)."""
11
+
12
+ BROKEN_GOLD = 20
13
+ """The harness itself is misconfigured (e.g. a gold test passes on base).
14
+ Isolated as a tooling/dataset error — never counted as agent fault."""
15
+
16
+ USAGE = 2
17
+ """Bad invocation, missing files, or infrastructure error."""
@@ -0,0 +1 @@
1
+ """Deterministic Markdown projection of evidence."""
@@ -0,0 +1,68 @@
1
+ """Render the PR comment from an Evidence object. Deterministic projection."""
2
+
3
+ from __future__ import annotations
4
+
5
+ from agent_acceptance.core.evaluate import Evidence
6
+
7
+ MARKER = "<!-- agent-acceptance:report -->"
8
+
9
+ ICONS = {"passed": "✅", "failed": "❌", "error": "💥", "missing": "❔"}
10
+ VERDICT_ICON = {
11
+ "VALID": "**VALID** ✅",
12
+ "PRE-PASS": "PRE-PASS ⚠️",
13
+ "BROKEN": "BROKEN ✗",
14
+ "ERROR": "ERROR 💥",
15
+ }
16
+
17
+
18
+ def render(ev: Evidence) -> str:
19
+ counts = ev.counts
20
+ if ev.verdict == "NO_EVIDENCE":
21
+ return (
22
+ f"{MARKER}\n## 🧪 Test-evidence assessment — non-blocking\n\n"
23
+ "No test files were changed in this PR, so there is no executable "
24
+ "test evidence to verify.\n"
25
+ )
26
+
27
+ lines = [
28
+ MARKER,
29
+ "## 🧪 Test-evidence assessment — non-blocking",
30
+ "",
31
+ f"**Strength: {ev.strength}** · "
32
+ f"{counts['VALID']} valid / {counts['PRE-PASS']} pre-pass / "
33
+ f"{counts['BROKEN']} broken / {counts['ERROR']} error · "
34
+ f"base `{ev.base_sha[:7]}` → head `{ev.head_sha[:7]}`"
35
+ " · sandbox: no-network, read-only FS",
36
+ "",
37
+ "| Changed test | on base | on PR | verdict |",
38
+ "|---|---|---|---|",
39
+ ]
40
+ for t in ev.tests:
41
+ lines.append(
42
+ f"| `{t.key}` | {ICONS.get(t.on_base, t.on_base)} | "
43
+ f"{ICONS.get(t.on_pr, t.on_pr)} | {VERDICT_ICON[t.verdict]} |"
44
+ )
45
+
46
+ mut = ev.mutation
47
+ lines += ["", "**Mutation sampling** (mutmut, time-budgeted):"]
48
+ if mut.status != "OK" or mut.score is None:
49
+ lines.append(f"- *SKIPPED ({mut.status.lower()})* — no mutation numbers reported.")
50
+ else:
51
+ total = mut.killed + mut.survived
52
+ lines.append(
53
+ f"- score **{mut.killed}/{total} ({round(100 * mut.score)}%)**"
54
+ " — mutants killed by the changed tests"
55
+ )
56
+ for s in mut.survivor_samples:
57
+ lines.append(f" - `{s['mutant']}` — {s['detail']}")
58
+
59
+ lines += [
60
+ "",
61
+ "<sub>Report mode: this comment does not block merge. "
62
+ "VALID = failed on base, passed on PR (real evidence) · "
63
+ "PRE-PASS = test already passed on base (proves nothing about the change) · "
64
+ "BROKEN = test fails on both (test itself is broken) · "
65
+ "surviving mutants = behaviors your tests do not pin down. "
66
+ "Generated by agent-acceptance — deterministic execution, no LLM involved.</sub>",
67
+ ]
68
+ return "\n".join(lines) + "\n"
@@ -0,0 +1,164 @@
1
+ Metadata-Version: 2.5
2
+ Name: agent-acceptance
3
+ Version: 1.0.0
4
+ Summary: Deterministic test-evidence checks for AI-contributed PRs: verify added tests fail before and pass after the change. Report mode never blocks.
5
+ Project-URL: Repository, https://github.com/KlldYKG/agent-acceptance
6
+ Author: agent-acceptance contributors
7
+ License-Expression: Apache-2.0
8
+ License-File: LICENSE
9
+ Keywords: ai-generated-code,ci,github-actions,mutation-testing,testing
10
+ Classifier: Development Status :: 3 - Alpha
11
+ Classifier: Environment :: Console
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: Programming Language :: Python :: 3
14
+ Classifier: Programming Language :: Python :: 3.10
15
+ Classifier: Programming Language :: Python :: 3.11
16
+ Classifier: Programming Language :: Python :: 3.12
17
+ Classifier: Programming Language :: Python :: 3.13
18
+ Classifier: Topic :: Software Development :: Quality Assurance
19
+ Classifier: Topic :: Software Development :: Testing
20
+ Requires-Python: >=3.10
21
+ Provides-Extra: action
22
+ Provides-Extra: dev
23
+ Requires-Dist: mypy>=1.11; extra == 'dev'
24
+ Requires-Dist: pytest-cov>=5; extra == 'dev'
25
+ Requires-Dist: pytest>=8; extra == 'dev'
26
+ Requires-Dist: ruff>=0.6; extra == 'dev'
27
+ Description-Content-Type: text/markdown
28
+
29
+ # agent-acceptance
30
+
31
+ > 76% of open source projects with an AI contribution policy ask contributors
32
+ > to "take responsibility for tests". This Action makes that sentence execute —
33
+ > and checks whether the submitted evidence is real.
34
+
35
+ Deterministic, execution-layer test-evidence checks for AI-contributed (or
36
+ human) pull requests. No LLM anywhere in the loop.
37
+
38
+ ## What it checks
39
+
40
+ **1. Bidirectional test validity.** The PR's added/changed tests are run
41
+ against *both* revisions in a network-isolated sandbox:
42
+
43
+ | on base | on PR | verdict | meaning |
44
+ |---|---|---|---|
45
+ | ❌ fails | ✅ passes | **VALID** | real evidence: the test pins the change |
46
+ | ✅ passes | ✅ passes | **PRE-PASS** | proves nothing about the change — the classic AI-slop signature |
47
+ | ❌ fails | ❌ fails | **BROKEN** | the test itself is broken |
48
+ | — | error | **ERROR** | collection/execution failure |
49
+
50
+ **2. Sampled mutation testing** (mutmut 2.5.x, time-budgeted, scoped to the
51
+ PR's changed source files): quantifies how tightly the new tests pin down the
52
+ changed behavior. **Never fabricates numbers** — an unfinished phase renders
53
+ as `SKIPPED`, not a made-up score.
54
+
55
+ Verified end-to-end in
56
+ [agent-acceptance-demo](https://github.com/KlldYKG/agent-acceptance-demo):
57
+ PR #1 (real fix + real tests) → `VALID`, mutation score 100%; PR #2 (tests
58
+ that pass without any fix, i.e. slop) → `PRE-PASS`, detected.
59
+
60
+ ## Safety model (summary — full version below)
61
+
62
+ - **Untrusted code never gets network access.** Test and mutation phases run
63
+ in a container with `--network none`, read-only repo mount, dropped
64
+ capabilities, non-root UID, CPU/memory/PID limits.
65
+ - **The only networked phase is opt-in dependency installation** (`install-deps`:
66
+ separate container, binary wheels only, hard timeout).
67
+ ⚠️ **Residual risk**: installing a package executes its packaging code
68
+ (`setup.py`/`build` hooks). Only enable `install-deps` when you accept
69
+ running the PR's declared dependencies' build code on the runner.
70
+ - **The Action's own code always executes from your default branch**, never
71
+ from the PR (safe `pull_request_target` double-checkout pattern).
72
+ - **Report mode (default) never blocks merges.** Gate mode is opt-in and must
73
+ be enabled by a maintainer — see [docs/GATE_MODE.md](docs/GATE_MODE.md).
74
+
75
+ Full analysis: [docs/THREAT_MODEL.md](docs/THREAT_MODEL.md).
76
+
77
+ ## Quick start (GitHub Action)
78
+
79
+ In the target repository, create `.github/workflows/agent-acceptance.yml`:
80
+
81
+ ```yaml
82
+ name: agent-acceptance
83
+ on: pull_request_target
84
+ permissions:
85
+ contents: read
86
+ pull-requests: write
87
+ jobs:
88
+ evidence:
89
+ runs-on: ubuntu-latest
90
+ steps:
91
+ # Code under test: the PR merge snapshot (full history for git archive).
92
+ - uses: actions/checkout@v4
93
+ with:
94
+ ref: refs/pull/${{ github.event.pull_request.number }}/merge
95
+ fetch-depth: 0
96
+ # Action code: ALWAYS from the trusted default branch, never from the PR.
97
+ - uses: actions/checkout@v4
98
+ with:
99
+ ref: ${{ github.event.repository.default_branch }}
100
+ path: aa-trusted
101
+ - uses: ./aa-trusted/tool/action # pin a release tag / SHA in production
102
+ with:
103
+ github-token: ${{ github.token }}
104
+ ```
105
+
106
+ The action posts **one** PR comment (upserted in place) with the per-test
107
+ verdict table, mutation results, and a reading guide.
108
+
109
+ ### Inputs
110
+
111
+ | input | default | notes |
112
+ |---|---|---|
113
+ | `github-token` | `${{ github.token }}` | used only to upsert the PR comment |
114
+ | `test-dirs` | `tests` | comma-separated |
115
+ | `mutation-budget-seconds` | `600` | overrun ⇒ `SKIPPED` (no score) |
116
+ | `install-deps` | `false` | ⚠️ see safety model |
117
+ | `gate` | `false` | opt-in blocking — [docs/GATE_MODE.md](docs/GATE_MODE.md) |
118
+
119
+ ## Quick start (CLI)
120
+
121
+ The same checks, runnable locally against any git repository:
122
+
123
+ ```bash
124
+ pip install agent-acceptance
125
+
126
+ # Verify a branch against main (writes out/base.xml, out/pr.xml,
127
+ # out/evidence.json):
128
+ agent-acceptance run --repo . --base main --head my-branch --out out
129
+
130
+ # Or evaluate pre-captured JUnit XML:
131
+ agent-acceptance evaluate out --base-sha <sha> --head-sha <sha>
132
+
133
+ # Render the deterministic PR-comment Markdown:
134
+ agent-acceptance report out
135
+ ```
136
+
137
+ Exit codes: `0` ok · `10` gate: invalid evidence · `11` gate: broken test ·
138
+ `20` harness misconfiguration · `2` usage/infrastructure error.
139
+
140
+ Policy (`.agent-acceptance.yml`) is loaded **only from the base revision** —
141
+ a PR can never alter the checks applied to itself.
142
+
143
+ ## How this differs from review bots and static gates
144
+
145
+ | | LLM review bots | static policy gates (e.g. [Agent Gate](https://github.com/sjh9714/Agent-Gate)) | **agent-acceptance** |
146
+ |---|---|---|---|
147
+ | What it inspects | diff + prose | files/patterns | **executed behavior** |
148
+ | Can be fooled by plausible-sounding tests | yes | n/a | no — tests must actually fail-then-pass |
149
+ | Deterministic / replayable | no | yes | yes |
150
+ | Sees whether tests pin behavior | no | no | yes (mutation sampling) |
151
+
152
+ agent-acceptance is complementary to static gates: it verifies *execution
153
+ evidence*, they verify *policy compliance*.
154
+
155
+ ## Status
156
+
157
+ **v1.0.0** — first stable release. Install from
158
+ [PyPI](https://pypi.org/project/agent-acceptance/) or use the action
159
+ (pinned by commit SHA, see the quick start above). See
160
+ [CHANGELOG.md](CHANGELOG.md) for the release notes.
161
+
162
+ ## Contributing & license
163
+
164
+ Apache-2.0. Issues and PRs welcome — evidence-based tests especially.
@@ -0,0 +1,15 @@
1
+ agent_acceptance/__init__.py,sha256=r5RC0WXrq0y_k9NZjyAIC_tZ9UprkvUXtdl3kZZPHio,445
2
+ agent_acceptance/cli.py,sha256=pZ-swEMr6oaEW-hiDcT53bH7T1Lx56YA2R8kzhBNAzs,7322
3
+ agent_acceptance/config.py,sha256=3s2mw_DS07IXWe9XMTNNPTINc9u6D6kMe_vhDi9Rtc0,2970
4
+ agent_acceptance/exit_codes.py,sha256=CC25c0zy6KBxewLYmtHyKPlGSdxdS6PXjbVXcPrswus,581
5
+ agent_acceptance/core/__init__.py,sha256=irM04R0kmPVlKfZJV5IwoSMD7Nmecgob64TL7lrs_Wg,76
6
+ agent_acceptance/core/evaluate.py,sha256=53gnjKaPigktz5ZIf8lDdZe-oJkTmKc3AXI_lTAesr0,6809
7
+ agent_acceptance/core/mutation.py,sha256=RFC6aR4Aofl6h9TwWUFg44mxZPKyVbIFtVKMXXZOJ0E,4017
8
+ agent_acceptance/core/overlay.py,sha256=Nlj0s88cXKITubN-2WoNKSYoIaVoCYWJNpDz-Uircao,8768
9
+ agent_acceptance/report/__init__.py,sha256=aIs962t9zSQmEOr-ARTD3CN99jtnfoci2-d4BuAdG8c,53
10
+ agent_acceptance/report/render.py,sha256=1GDZVoZ_4xrRdh4FXlr2emOqrGD6pOKulEXXGRTYh1Q,2518
11
+ agent_acceptance-1.0.0.dist-info/METADATA,sha256=UG-mW6i3GdVhXmVroPzBk8jhV_zLMQG2EyTx0oDU854,6644
12
+ agent_acceptance-1.0.0.dist-info/WHEEL,sha256=2iZrJkDIkeDh0k9SikKMqFuRP-ua6mb4Ir1AsER4BEw,87
13
+ agent_acceptance-1.0.0.dist-info/entry_points.txt,sha256=C5po0rzyxPkWdAzHjsI-5NVWsuklB5NC8F9a3PotETQ,63
14
+ agent_acceptance-1.0.0.dist-info/licenses/LICENSE,sha256=lc83uOt0YtB77unS0h_YHfT-KKsJ3R6ag7_MdraPA-s,11359
15
+ agent_acceptance-1.0.0.dist-info/RECORD,,
@@ -0,0 +1,4 @@
1
+ Wheel-Version: 1.0
2
+ Generator: hatchling 1.33.0
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ agent-acceptance = agent_acceptance.cli:main
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright 2026 agent-acceptance contributors
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.