@jesdi/skills 0.0.94 → 0.0.96
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.
- package/package.json +1 -1
- package/skills/implement-spec/ARCHITECTURE.md +1 -1
- package/skills/implement-spec/README.md +10 -9
- package/skills/implement-spec/SKILL.md +1 -1
- package/skills/implement-spec/driver.py +31 -28
- package/skills/implement-spec/driver_agents.py +5 -2
- package/skills/implement-spec/driver_decisions.py +12 -7
- package/skills/implement-spec/driver_final.py +64 -34
- package/skills/implement-spec/driver_final_gate.py +41 -0
- package/skills/implement-spec/driver_fixloop.py +0 -27
- package/skills/implement-spec/driver_merge.py +34 -10
- package/skills/implement-spec/driver_report.py +1 -1
- package/skills/implement-spec/driver_run.py +1 -1
- package/skills/implement-spec/driver_state.py +2 -2
- package/skills/implement-spec/driver_tidy.py +1 -1
- package/skills/implement-spec/prompts/final-gate-fixer.md +33 -0
- package/skills/implement-spec/prompts/landing-red.md +1 -1
- package/skills/implement-spec/prompts/pr-body.md +2 -2
- package/skills/implement-spec/tests/test_arbitration.py +1 -1
- package/skills/implement-spec/tests/test_driver.py +60 -62
- package/skills/implement-spec/tests/test_final.py +57 -1
- package/skills/implement-spec/tests/test_final_gate.py +155 -0
- package/skills/implement-spec/tests/test_fixloop.py +26 -79
- package/skills/implement-spec/tests/test_merge.py +27 -3
- package/skills/implement-spec/tests/test_review.py +16 -3
- package/skills/implement-spec/tests/test_tidy.py +40 -16
- package/skills/implement-spec/tests/test_walk.py +9 -10
- package/skills-manifest.json +3 -3
|
@@ -4,6 +4,7 @@ gets a tree: `begin` opens it in the ticket's own slot for the conflict agent. T
|
|
|
4
4
|
from __future__ import annotations
|
|
5
5
|
|
|
6
6
|
import os
|
|
7
|
+
import re
|
|
7
8
|
import subprocess
|
|
8
9
|
|
|
9
10
|
from driver_slots import ancestor, git
|
|
@@ -22,18 +23,41 @@ def signs() -> bool:
|
|
|
22
23
|
return git(".", "config", "--type=bool", "commit.gpgsign").stdout.strip() == "true"
|
|
23
24
|
|
|
24
25
|
|
|
25
|
-
|
|
26
|
-
|
|
26
|
+
CO_AUTHOR = re.compile(r"co-authored-by\s*:", re.IGNORECASE)
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
def without_co_authors(message: str) -> str:
|
|
30
|
+
"""`message` without the Co-authored-by trailers of its last paragraph, folded lines included: git reads
|
|
31
|
+
trailers only there, and the push refuses them."""
|
|
32
|
+
head, gap, last = message.strip().rpartition("\n\n")
|
|
33
|
+
kept, dropping = [], False
|
|
34
|
+
for line in last.splitlines():
|
|
35
|
+
dropping = bool(CO_AUTHOR.match(line)) or (dropping and line[:1].isspace())
|
|
36
|
+
if not dropping:
|
|
37
|
+
kept.append(line)
|
|
38
|
+
return f"{head}{gap}{chr(10).join(kept)}".strip() + "\n"
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
def commit_tree(args: list[str], message: str, env: dict[str, str]) -> subprocess.CompletedProcess:
|
|
42
|
+
"""`git commit-tree` with `env` on top of os.environ: signed when commit.gpgsign is on, which commit-tree
|
|
43
|
+
ignores, and with no Co-authored-by trailer, so every commit the driver makes is one the push takes."""
|
|
27
44
|
sign = ["-S"] if signs() else []
|
|
28
|
-
return subprocess.run(["git", "commit-tree", *sign, *args
|
|
45
|
+
return subprocess.run(["git", "commit-tree", *sign, *args, "-m", without_co_authors(message)], capture_output=True,
|
|
46
|
+
text=True, env={**os.environ, **env})
|
|
29
47
|
|
|
30
48
|
|
|
31
|
-
def
|
|
32
|
-
"""
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
49
|
+
def unpushable(tip: str) -> list[str]:
|
|
50
|
+
"""Why each commit of `tip` that origin does not have may not be pushed: no good signature when commit.gpgsign
|
|
51
|
+
is on, or a Co-authored-by trailer."""
|
|
52
|
+
sign, found = signs(), []
|
|
53
|
+
log = git(".", "log", "-z", "--format=%h%x00%G?%x00%(trailers:key=Co-authored-by,valueonly,unfold,separator=;)",
|
|
54
|
+
tip, "--not", "--remotes=origin").stdout.split("\0")
|
|
55
|
+
for sha, status, co_author in zip(log[::3], log[1::3], log[2::3]):
|
|
56
|
+
if sign and status != "G":
|
|
57
|
+
found.append(f"{sha} has no good signature")
|
|
58
|
+
if co_author:
|
|
59
|
+
found.append(f"{sha} has a Co-authored-by trailer")
|
|
60
|
+
return found
|
|
37
61
|
|
|
38
62
|
|
|
39
63
|
def commit(pr_tip: str, tip: str, message: str) -> tuple[str, str]:
|
|
@@ -47,7 +71,7 @@ def commit(pr_tip: str, tip: str, message: str) -> tuple[str, str]:
|
|
|
47
71
|
if tree.returncode:
|
|
48
72
|
files = ", ".join(tree.stdout.splitlines()[1:]) or tree.stderr.strip()
|
|
49
73
|
return "", f"the merge into the PR branch conflicts in {files}"
|
|
50
|
-
made = commit_tree([tree.stdout.strip(), "-p", pr_tip, "-p", tip,
|
|
74
|
+
made = commit_tree([tree.stdout.strip(), "-p", pr_tip, "-p", tip], message, identity(tip))
|
|
51
75
|
return (made.stdout.strip(), "") if made.returncode == 0 else ("", f"git commit-tree failed: {made.stderr.strip()}")
|
|
52
76
|
|
|
53
77
|
|
|
@@ -103,7 +103,7 @@ def _unchanged_errors(role: str, report: dict, context: dict) -> list[str]:
|
|
|
103
103
|
uncommitted, the gate of the start is green, and a concern says why no change is needed: for a fixer, one
|
|
104
104
|
concern names each finding."""
|
|
105
105
|
done = report["status"] in ("DONE", "DONE_WITH_CONCERNS")
|
|
106
|
-
if role not in ("implementer", "fixer") or report["commits"] or not done:
|
|
106
|
+
if role not in ("implementer", "fixer", "final-gate-fixer") or report["commits"] or not done:
|
|
107
107
|
return []
|
|
108
108
|
titles = context.get("fix", [])
|
|
109
109
|
errors = _moved_errors(context) + [
|
|
@@ -143,7 +143,7 @@ class Run:
|
|
|
143
143
|
def change(state: dict) -> None:
|
|
144
144
|
held = record_of(state, number)
|
|
145
145
|
if ask:
|
|
146
|
-
held.update(ask.resume.
|
|
146
|
+
held.update(ask.resume.checkpoint())
|
|
147
147
|
evidence = [ask.report, f"{OUT / 'ledger.md'}:{line}"]
|
|
148
148
|
driver_decisions.stop(state["run"], ask.kind, number, ask.subjects, evidence, ask.resume)
|
|
149
149
|
held["phase"] = "blocked"
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
landing, disputes, corrected, settled}}}
|
|
7
7
|
|
|
8
8
|
green_gates is {"fast": [commit], "full": [commit]}, in a ticket and in run.final: a fast green never stands in for a
|
|
9
|
-
full one. landing is
|
|
9
|
+
full one. landing is a legacy commit whose full gate was red at the landing while the fixer of the round it started has
|
|
10
10
|
not reported, else None. disputes is {<locked file>::<test>: {test, requirement, ruling, reason}}, the reviewer's
|
|
11
11
|
ruling on the test; corrected is {<locked file>::<test>: {test, requirement, reason}}, the reading of its one
|
|
12
12
|
correction. A locked test has at most one of each per ticket. settled counts the arbitrations and review corrections
|
|
@@ -43,7 +43,7 @@ def _final() -> dict:
|
|
|
43
43
|
"""The end-of-run record before it starts. Every key is here, so a reader uses [] and a wrong name fails."""
|
|
44
44
|
return {"skipped": "", "phase": "pending", "recovery": None, "tidied": None, "onto": None, "base": None,
|
|
45
45
|
"commits": {}, "reviewed": None, "round": 0, "open": [], "must_fix": [], "lenses": {}, "batch": None,
|
|
46
|
-
"green_gates": tiers(), "pushed": None, "body": None, "pr": None}
|
|
46
|
+
"gate_repairs": 0, "gate_allowance": 1, "gate_failure": None, "green_gates": tiers(), "pushed": None, "body": None, "pr": None}
|
|
47
47
|
|
|
48
48
|
|
|
49
49
|
class State:
|
|
@@ -29,7 +29,7 @@ def _commit(source: str, parent: str, words: str) -> str:
|
|
|
29
29
|
"""A commit on `parent` with the tree and the author of `source` and the message `words`; "" when git fails."""
|
|
30
30
|
name, email, date = git(".", "log", "-1", "--format=%an%n%ae%n%aI", source).stdout.splitlines() or [""] * 3
|
|
31
31
|
env = {**driver_merge.identity(source), "GIT_AUTHOR_NAME": name, "GIT_AUTHOR_EMAIL": email, "GIT_AUTHOR_DATE": date}
|
|
32
|
-
return driver_merge.commit_tree([f"{source}^{{tree}}", "-p", parent,
|
|
32
|
+
return driver_merge.commit_tree([f"{source}^{{tree}}", "-p", parent], words, env).stdout.strip()
|
|
33
33
|
|
|
34
34
|
|
|
35
35
|
def rewrite(parent: str, steps: list[tuple[str, str]]) -> list[str]:
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# Fixer of the full integration gate
|
|
2
|
+
|
|
3
|
+
Spec: {spec}
|
|
4
|
+
Tickets: {tickets}
|
|
5
|
+
PR branch: {pr_branch}, at commit {start_sha}
|
|
6
|
+
Locked files: {locked}
|
|
7
|
+
Failure findings: {findings}
|
|
8
|
+
{findings_list}
|
|
9
|
+
|
|
10
|
+
Read the exact gate log and repair the failure as one batch. Each commit belongs to one ticket; list its SHA and ticket number in `commits`. The driver names it `fix(NN): <subject>`.
|
|
11
|
+
If no code change is needed, leave the branch and tracked files unchanged, report no commits, and give a concern naming "{gate_title}" with the evidence explaining why. This still consumes the repair attempt. The driver reruns the full gate on the unchanged commit; another failure stops for the operator.
|
|
12
|
+
Never edit a locked file: each one stays as it is at {start_sha}. Report a needed test correction in your concerns and stop BLOCKED for the operator.
|
|
13
|
+
Use targeted tests while you work. Before you report DONE or DONE_WITH_CONCERNS, make the fast gate green on your final commit: run `{gate}` with IMPLEMENT_SPEC_BASE={pr_branch} and IMPLEMENT_SPEC_LOCKED='{locked}' in the environment. Give its summary lines in `green`.
|
|
14
|
+
Commit on the checked-out PR branch, changing no existing commit. Do not dispatch subagents. The full gate and final review follow this batch.
|
|
15
|
+
|
|
16
|
+
Write one JSON report at {report} that matches this schema:
|
|
17
|
+
|
|
18
|
+
```json
|
|
19
|
+
{
|
|
20
|
+
"type": "object",
|
|
21
|
+
"required": ["status", "commits", "files", "concerns", "green"],
|
|
22
|
+
"properties": {
|
|
23
|
+
"status": {"enum": ["DONE", "DONE_WITH_CONCERNS", "NEEDS_CONTEXT", "BLOCKED"]},
|
|
24
|
+
"commits": {"type": "array", "items": {"type": "object", "required": ["sha", "ticket"], "properties": {"sha": {"type": "string", "pattern": "^[0-9a-f]{7,40}$"}, "ticket": {"type": "string", "pattern": "^[0-9]+$"}}}},
|
|
25
|
+
"files": {"type": "array", "items": {"type": "string"}},
|
|
26
|
+
"concerns": {"type": "array", "items": {"type": "string"}},
|
|
27
|
+
"green": {"type": "array", "items": {"type": "string"}}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
Stop only processes you started and their child processes, by PID (for example the PID of a job you put in the background, or its process group). Never kill a process you did not start, and never use `pkill`, `killall` or a `kill` by name or pattern: other slots and sessions share the machine. If a process you did not start blocks you, report it in your concerns and do not kill it.
|
|
33
|
+
Never run `git stash`, never reset, and never check out another branch: worktrees share one stash and one ref store.
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
|
|
2
|
-
|
|
2
|
+
An earlier driver version passed review and then ran the full gate on {landing_sha}, the commit that would land on {pr_branch}, and it is red: read the output in {landing_record}. The finding from the `gate` in the findings file is that record. Make it green with a commit on {branch}; the driver runs the fast gate on your commit, a re-review, and the full gate after every ticket has merged.
|
|
@@ -4,7 +4,7 @@ One commit per ticket, in merge order:
|
|
|
4
4
|
|
|
5
5
|
{map}
|
|
6
6
|
|
|
7
|
-
## Fix commits of the
|
|
7
|
+
## Fix commits of the integrated branch
|
|
8
8
|
|
|
9
9
|
{fixes}
|
|
10
10
|
|
|
@@ -15,6 +15,6 @@ One commit per ticket, in merge order:
|
|
|
15
15
|
## Review coverage
|
|
16
16
|
|
|
17
17
|
- Branch tip and reviewed tip: {tip}
|
|
18
|
-
- Full review: {
|
|
18
|
+
- Full review: {full_review}
|
|
19
19
|
- Scoped review after the fix batch: {scoped}
|
|
20
20
|
{providers}
|
|
@@ -152,7 +152,7 @@ def test_the_summary_keeps_its_table_and_counts_an_arbitration_as_a_reviewer_age
|
|
|
152
152
|
# Most fake agents report no cost, so they are counted as not priced.
|
|
153
153
|
assert names[-4:] == ["fix rounds per ticket", "human stops", "cost", "agents not priced"], rows
|
|
154
154
|
assert re.search(r"^\| cost \| \d+\.\d\d USD \|$", rows, re.M), rows
|
|
155
|
-
for row in ("| fast gates run | 2 |", "| full gates run |
|
|
155
|
+
for row in ("| fast gates run | 2 |", "| full gates run | 0 |", "| agents, reviewer on anthropic/claude-opus-5@medium | 3 |",
|
|
156
156
|
"| fix rounds per ticket | 01: 1, 02: 0 |", "| human stops | 1 |"):
|
|
157
157
|
assert row in rows, rows
|
|
158
158
|
|
|
@@ -183,7 +183,6 @@ def test_accepted_reports_end_the_run_with_exit_0(repo, tmp_path, capsys):
|
|
|
183
183
|
"Ticket 01: test-writer ran on claude-sonnet-5-5@medium", "Ticket 01: implementer ran on claude-sonnet-5-5@medium",
|
|
184
184
|
f"Ticket 01: the fast gate is green on {tip}, record .agent/implement/01/gate-fast-{tip}.log.",
|
|
185
185
|
"Ticket 01: reviewer ran on openai/gpt-6-astra@medium",
|
|
186
|
-
f"Ticket 01: the full gate is green on {tip}, record .agent/implement/01/gate-full-{tip}.log.",
|
|
187
186
|
f"Ticket 01: merged into feat/x as a fast-forward at {tip}."]
|
|
188
187
|
assert ledger[1].endswith(", cost 0.25 USD: report accepted.")
|
|
189
188
|
assert branches() == ["feat/x"] and "nothing to commit" in subprocess.run(
|
|
@@ -215,7 +214,7 @@ def test_an_agent_that_writes_no_report_is_rerun_once_then_blocks(repo, tmp_path
|
|
|
215
214
|
def test_a_field_of_another_role_is_ignored(repo, tmp_path, capsys, extra):
|
|
216
215
|
repo()
|
|
217
216
|
code, ledger = agents(tmp_path, capsys, f"{COMMIT}fields='\"green\": [], {extra}'\n{REPORT}")
|
|
218
|
-
assert code == 0 and len(ledger) ==
|
|
217
|
+
assert code == 0 and len(ledger) == 4 and ledger[0].endswith("report accepted.")
|
|
219
218
|
|
|
220
219
|
|
|
221
220
|
@pytest.mark.parametrize("status", ["BLOCKED", "NEEDS_CONTEXT"])
|
|
@@ -413,6 +412,9 @@ def test_command_lines_per_provider():
|
|
|
413
412
|
"--sandbox", "read-only", "-o", "r.json.last"]
|
|
414
413
|
assert driver_agents.command("reviewer", "opus@low", "r.json")[:6] == [
|
|
415
414
|
"claude", "-p", "--model", "opus", "--effort", "low"]
|
|
415
|
+
claude = driver_agents.command("implementer", "opus@low", "r.json")
|
|
416
|
+
# No Co-authored-by trailer on the agent's commits: the push refuses one.
|
|
417
|
+
assert claude[claude.index("--settings") + 1] == '{"attribution": {"commit": "", "pr": ""}, "includeCoAuthoredBy": false}'
|
|
416
418
|
|
|
417
419
|
|
|
418
420
|
@pytest.mark.parametrize("role", driver.ONLY)
|
|
@@ -458,7 +460,7 @@ def two(repo, second="None", touches="`demo/y.py: g`"):
|
|
|
458
460
|
return repo(t01=ticket("01", **REFACTOR), t02=ticket("02", second, touches=touches, **REFACTOR))
|
|
459
461
|
|
|
460
462
|
|
|
461
|
-
def
|
|
463
|
+
def test_two_tickets_run_in_two_slots_and_only_the_integrated_tip_gets_the_full_gate(repo, tmp_path, capsys):
|
|
462
464
|
two(repo)
|
|
463
465
|
log = tmp_path.parent / f"{tmp_path.name}-prepare.log"
|
|
464
466
|
code, ledger, out = walk(tmp_path, capsys, WORK + TOGETHER + REPORT, "--prepare", f"pwd >> {log}")
|
|
@@ -466,10 +468,9 @@ def test_two_tickets_run_in_two_slots_and_the_second_merge_is_a_gated_merge_comm
|
|
|
466
468
|
calls = dict(line.split() for line in Path(f"{tmp_path}-runner.calls").read_text().splitlines())
|
|
467
469
|
assert calls == {"01": str(tmp_path.resolve()), "02": str((tmp_path / ".agent/worktrees/slot-2").resolve())}
|
|
468
470
|
assert len(out_of("git", "rev-list", "--parents", "-n1", walked()).split()) == 3 # a merge commit
|
|
469
|
-
#
|
|
470
|
-
|
|
471
|
-
assert
|
|
472
|
-
assert "| fast gates run | 2 |" in out and "| full gates run | 3 |" in out
|
|
471
|
+
# Fast gates cover each ticket; the full gate covers the final tidied tip.
|
|
472
|
+
assert len([line for line in ledger if "gate is green" in line]) == 2
|
|
473
|
+
assert "| fast gates run | 2 |" in out and "| full gates run | 1 |" in out
|
|
473
474
|
assert [line for line in ledger if "merged into feat/x as a merge commit" in line]
|
|
474
475
|
assert {entry["phase"] for entry in state_of(tmp_path)["tickets"].values()} == {"merged"}
|
|
475
476
|
assert branches() == ["feat/x"] and out_of("git", "status", "--porcelain") == ""
|
|
@@ -487,16 +488,15 @@ RESOLVE = """if [ $role = conflict ]; then git add -A; git commit -q -m resolved
|
|
|
487
488
|
"""
|
|
488
489
|
|
|
489
490
|
|
|
490
|
-
def
|
|
491
|
+
def test_a_merge_conflict_goes_to_the_conflict_agent_once_before_final_integration_gating(repo, tmp_path, capsys):
|
|
491
492
|
two(repo)
|
|
492
493
|
code, ledger, out = walk(tmp_path, capsys, RESOLVE + "FILE=work.txt\n" + WORK + TOGETHER + REPORT)
|
|
493
494
|
assert code == 0, out
|
|
494
495
|
(line,) = [line for line in ledger if "the conflict agent resolved the merge conflict in work.txt at " in line]
|
|
495
496
|
number, tip = line[7:9], walked()
|
|
496
497
|
assert line.endswith(f" at {tip[:7]}.") and len(out_of("git", "rev-list", "--parents", "-n1", tip).split()) == 3
|
|
497
|
-
assert
|
|
498
|
-
|
|
499
|
-
assert "| fast gates run | 2 |" in out and "| full gates run | 3 |" in out and "| agents, conflict on claude-opus-5-5@medium | 1 |" in out
|
|
498
|
+
assert not [line for line in ledger if "the full gate" in line]
|
|
499
|
+
assert "| fast gates run | 2 |" in out and "| full gates run | 1 |" in out and "| agents, conflict on claude-opus-5-5@medium | 1 |" in out
|
|
500
500
|
assert dict(state_of(tmp_path)["run"]["landed"])[number] == tip
|
|
501
501
|
prompt = (tmp_path / f".agent/implement/{number}/conflict-0.prompt.md").read_text()
|
|
502
502
|
assert "Files in conflict: work.txt\n" in prompt and prompt.rstrip().endswith("one ref store.")
|
|
@@ -547,17 +547,14 @@ def test_a_red_gate_is_a_finding_and_the_ticket_it_blocks_never_starts(repo, tmp
|
|
|
547
547
|
assert walk(tmp_path, capsys, "exit 9\n")[0] == 2 # a BLOCKED ticket stays BLOCKED on a rerun
|
|
548
548
|
|
|
549
549
|
|
|
550
|
-
def
|
|
550
|
+
def test_a_gate_that_rejects_merge_commits_runs_only_after_tidy(repo, tmp_path, capsys):
|
|
551
551
|
two(repo)
|
|
552
|
-
gate = '[ -z "$(git rev-parse -q --verify HEAD^2)" ]'
|
|
553
|
-
code, ledger, out = walk(tmp_path, capsys, WORK +
|
|
554
|
-
assert code ==
|
|
555
|
-
(
|
|
556
|
-
assert "
|
|
557
|
-
assert
|
|
558
|
-
# Red full gates at landing start rounds 1 and 2; the third blocks, with no third round.
|
|
559
|
-
assert [line.split()[-2] for line in ledger if "at the landing, so feat/x does not move" in line] == ["1", "2"]
|
|
560
|
-
assert len(branches()) == 2 and out_of("git", "status", "--porcelain") == ""
|
|
552
|
+
gate = '[ -z "$(git rev-parse -q --verify HEAD^2)" ]'
|
|
553
|
+
code, ledger, out = walk(tmp_path, capsys, WORK + TOGETHER + REPORT, gate=gate)
|
|
554
|
+
assert code == 0, out
|
|
555
|
+
assert len(out_of("git", "rev-list", "--parents", "-n1", walked()).split()) == 3
|
|
556
|
+
assert "| full gates run | 1 |" in out
|
|
557
|
+
assert {entry["phase"] for entry in state_of(tmp_path)["tickets"].values()} == {"merged"}
|
|
561
558
|
|
|
562
559
|
|
|
563
560
|
def test_a_tree_that_is_not_clean_is_a_red_gate_and_the_slot_keeps_the_work(repo, tmp_path, capsys):
|
|
@@ -889,22 +886,28 @@ def test_a_run_outside_a_repository_takes_no_lock_and_makes_no_file(tmp_path, mo
|
|
|
889
886
|
assert code == 3 and "git status failed" in out and [path.name for path in tmp_path.iterdir()] == [".agent"]
|
|
890
887
|
|
|
891
888
|
|
|
892
|
-
def
|
|
893
|
-
"""
|
|
894
|
-
|
|
889
|
+
def move_during_landing(monkeypatch, command):
|
|
890
|
+
"""Simulate another writer after the locked-file check and before atomic ref publication."""
|
|
891
|
+
original = driver._refuse_breach
|
|
892
|
+
|
|
893
|
+
def checked(number, run, landing):
|
|
894
|
+
original(number, run, landing)
|
|
895
|
+
if len(out_of("git", "rev-list", "--parents", "-n1", landing.commit).split()) == 3:
|
|
896
|
+
subprocess.run(command, shell=True, check=True)
|
|
897
|
+
|
|
898
|
+
monkeypatch.setattr(driver, "_refuse_breach", checked)
|
|
899
|
+
|
|
900
|
+
|
|
901
|
+
def test_a_pr_branch_that_another_hand_moves_during_landing_retries(repo, tmp_path, capsys, monkeypatch):
|
|
895
902
|
two(repo)
|
|
896
903
|
mark = tmp_path.parent / f"{tmp_path.name}-moved"
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
'refs/heads/feat/x "$(git commit-tree "feat/x^{tree}" -p feat/x -m other)"; }')
|
|
900
|
-
code, ledger, out = walk(tmp_path, capsys, WORK + TOGETHER + REPORT, gate=gate)
|
|
904
|
+
move_during_landing(monkeypatch, f'[ -e {mark} ] || {{ touch {mark}; {MOVE}; }}')
|
|
905
|
+
code, ledger, out = walk(tmp_path, capsys, WORK + TOGETHER + REPORT)
|
|
901
906
|
assert code == 0 and mark.exists(), out
|
|
902
907
|
subjects = out_of("git", "log", "--format=%s", walked()).splitlines()
|
|
903
908
|
assert "other" in subjects and {"implementer 01", "implementer 02"} <= set(subjects)
|
|
904
909
|
assert len([line for line in ledger if "merged into feat/x as a merge commit" in line]) == 1
|
|
905
|
-
|
|
906
|
-
# end of run.
|
|
907
|
-
assert "| fast gates run | 2 |" in out and "| full gates run | 4 |" in out
|
|
910
|
+
assert "| fast gates run | 2 |" in out and "| full gates run | 1 |" in out
|
|
908
911
|
|
|
909
912
|
|
|
910
913
|
# Ticket 09, review round 1 (m1, Codex 6): the restart has a bound, and only a stale ref starts it.
|
|
@@ -917,27 +920,18 @@ def merge_blocked(ledger):
|
|
|
917
920
|
return line
|
|
918
921
|
|
|
919
922
|
|
|
920
|
-
def
|
|
923
|
+
def test_a_pr_branch_that_moves_at_each_landing_blocks_after_the_second_try(repo, tmp_path, capsys, monkeypatch):
|
|
921
924
|
two(repo)
|
|
922
|
-
|
|
925
|
+
move_during_landing(monkeypatch, MOVE)
|
|
926
|
+
code, ledger, out = walk(tmp_path, capsys, WORK + TOGETHER + REPORT)
|
|
923
927
|
assert code == 1, out
|
|
924
928
|
assert "BLOCKED at the merge: " in merge_blocked(ledger) and "feat/x" in merge_blocked(ledger)
|
|
925
|
-
#
|
|
926
|
-
assert "| fast gates run | 2 |" in out and "| full gates run |
|
|
929
|
+
# Landing is tried twice; a blocked ticket prevents the final full gate.
|
|
930
|
+
assert "| fast gates run | 2 |" in out and "| full gates run | 0 |" in out
|
|
927
931
|
assert out_of("git", "log", "--format=%s", "feat/x").splitlines().count("other") == 2
|
|
928
932
|
|
|
929
933
|
|
|
930
|
-
def
|
|
931
|
-
two(repo)
|
|
932
|
-
mark = tmp_path.parent / f"{tmp_path.name}-red"
|
|
933
|
-
gate = MERGE_GATE + f'[ -e {mark} ] || {{ touch {mark}; {MOVE}; exit 1; }}'
|
|
934
|
-
code, ledger, out = walk(tmp_path, capsys, WORK + FIXES + TOGETHER + REPORT, gate=gate)
|
|
935
|
-
assert code == 0 and not [line for line in ledger if "BLOCKED" in line], out
|
|
936
|
-
# The red gate starts fix round 1, not a second landing; the fix lands at the next landing.
|
|
937
|
-
assert len([line for line in ledger if "at the landing, so feat/x does not move and fix round 1 starts" in line]) == 1
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
def test_a_conflict_on_the_second_try_blocks_the_ticket_with_no_conflict_agent(repo, tmp_path, capsys):
|
|
934
|
+
def test_a_conflict_on_the_second_try_blocks_the_ticket_with_no_conflict_agent(repo, tmp_path, capsys, monkeypatch):
|
|
941
935
|
"""Requirement 11: the conflict agent runs once for each merge. The second try runs no agent."""
|
|
942
936
|
two(repo)
|
|
943
937
|
mark = tmp_path.parent / f"{tmp_path.name}-foreign"
|
|
@@ -946,25 +940,12 @@ def test_a_conflict_on_the_second_try_blocks_the_ticket_with_no_conflict_agent(r
|
|
|
946
940
|
'blob=$(echo foreign | git hash-object -w --stdin); for nn in 01 02; do '
|
|
947
941
|
'git update-index --add --cacheinfo 100644,$blob,work-$nn.txt; done; git update-ref refs/heads/feat/x '
|
|
948
942
|
'"$(git commit-tree "$(git write-tree)" -p feat/x -m other)"; rm "$GIT_INDEX_FILE" )')
|
|
949
|
-
|
|
950
|
-
code, ledger, out = walk(tmp_path, capsys, WORK + TOGETHER + REPORT
|
|
943
|
+
move_during_landing(monkeypatch, f'[ -e {mark} ] || {{ touch {mark}; {foreign}; }}')
|
|
944
|
+
code, ledger, out = walk(tmp_path, capsys, WORK + TOGETHER + REPORT)
|
|
951
945
|
assert code == 1 and mark.exists(), out
|
|
952
946
|
assert "BLOCKED at the merge: the merge into the PR branch conflicts in work-0" in merge_blocked(ledger)
|
|
953
947
|
assert not [line for line in ledger if "conflict ran on" in line]
|
|
954
|
-
assert "| fast gates run | 2 |" in out and "| full gates run |
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
# Fix round 1 of ticket 03.
|
|
958
|
-
|
|
959
|
-
def test_a_merge_commit_the_slot_cannot_check_out_is_not_gated_and_does_not_land(repo, tmp_path, capsys):
|
|
960
|
-
two(repo)
|
|
961
|
-
gate = 'touch "$(git rev-parse --git-dir)/index.lock"' # after its gate, the slot can check out nothing
|
|
962
|
-
code, ledger, out = walk(tmp_path, capsys, WORK + TOGETHER + REPORT, gate=gate)
|
|
963
|
-
assert code == 1, out
|
|
964
|
-
(line,) = [line for line in ledger if "BLOCKED" in line]
|
|
965
|
-
assert "BLOCKED at the merge: the slot is at " in line and "the full gate did not run" in line
|
|
966
|
-
assert len(out_of("git", "rev-list", "--parents", "-n1", "feat/x").split()) == 2 # no merge commit landed
|
|
967
|
-
assert "| fast gates run | 2 |" in out and "| full gates run | 1 |" in out # the full one: the fast-forward
|
|
948
|
+
assert "| fast gates run | 2 |" in out and "| full gates run | 0 |" in out
|
|
968
949
|
|
|
969
950
|
|
|
970
951
|
@pytest.mark.parametrize("gate, after", [
|
|
@@ -1169,3 +1150,20 @@ def test_parallel_checkout_waits_for_worktree_registration_to_finish(repo, tmp_p
|
|
|
1169
1150
|
code, _, out = walk(tmp_path, capsys, WORK + REPORT)
|
|
1170
1151
|
assert code == 0, out + "\n" + "\n".join(failures)
|
|
1171
1152
|
assert failures == []
|
|
1153
|
+
|
|
1154
|
+
|
|
1155
|
+
def test_failed_landing_checkout_blocks_before_the_local_merge(repo, tmp_path, capsys):
|
|
1156
|
+
repo(t01=ticket("01", **REFACTOR))
|
|
1157
|
+
start = out_of("git", "rev-parse", "feat/x")
|
|
1158
|
+
gate = 'touch "$(git rev-parse --git-dir)/index.lock"'
|
|
1159
|
+
code, ledger, out = walk(tmp_path, capsys, WORK + REPORT, gate=gate)
|
|
1160
|
+
assert code == 2, out
|
|
1161
|
+
assert state_of(tmp_path)["tickets"]["01"]["phase"] == "blocked"
|
|
1162
|
+
assert out_of("git", "rev-parse", "feat/x") == start
|
|
1163
|
+
assert "| full gates run | 0 |" in out
|
|
1164
|
+
assert any("landing checkout failed" in line for line in ledger)
|
|
1165
|
+
(tmp_path / ".git/index.lock").unlink()
|
|
1166
|
+
code, _, out = walk(tmp_path, capsys, WORK + REPORT, "--answer", "01-ticket-blocked-1=retry")
|
|
1167
|
+
assert code == 0, out
|
|
1168
|
+
assert state_of(tmp_path)["tickets"]["01"]["phase"] == "merged"
|
|
1169
|
+
assert "| full gates run | 1 |" in out
|
|
@@ -420,7 +420,8 @@ def test_a_conflict_with_the_fetched_base_runs_the_conflict_agent_once_then_the_
|
|
|
420
420
|
rig = conflicted
|
|
421
421
|
assert rig.code == 0, rig.output()
|
|
422
422
|
(call,) = rig.final_calls("conflict")
|
|
423
|
-
(gate,) =
|
|
423
|
+
(gate,) = rig.gates("full")
|
|
424
|
+
assert gate["commit"] == rig.branch()
|
|
424
425
|
assert gate["t0"] >= call["t1"], "the gate follows the resolution"
|
|
425
426
|
base = ref(rig.origin, "refs/heads/main")
|
|
426
427
|
git(rig.repo, "merge-base", "--is-ancestor", base, "feat/csv")
|
|
@@ -611,3 +612,58 @@ def test_a_cached_body_that_no_longer_validates_is_rewritten_before_gh_pr_create
|
|
|
611
612
|
assert len(rig.final_calls("pr-writer")) == 2, "the invalid cached body was not rewritten"
|
|
612
613
|
(pr,) = rig.prs()
|
|
613
614
|
assert risk_valid(tmp_path, pr["body"].split("## Tickets")[0]) and "styles" not in pr["body"].split("## Tickets")[0]
|
|
615
|
+
|
|
616
|
+
|
|
617
|
+
def test_full_gate_runs_only_after_every_ticket_is_integrated(tmp_path):
|
|
618
|
+
rig = Final(tmp_path, THREE).run(plan())
|
|
619
|
+
assert rig.code == 0, rig.output()
|
|
620
|
+
full = rig.gates('full')
|
|
621
|
+
assert len(full) == 1
|
|
622
|
+
assert full[0]['commit'] == rig.branch()
|
|
623
|
+
assert all(entry['phase'] == 'merged' for entry in rig.state()['tickets'].values())
|
|
624
|
+
assert len(rig.gates('fast')) == 3
|
|
625
|
+
|
|
626
|
+
|
|
627
|
+
@pytest.mark.parametrize("review_fix", [False, True])
|
|
628
|
+
def test_red_integration_gate_is_repaired_before_full_review_without_ticket_rounds(tmp_path, review_fix):
|
|
629
|
+
rig = Final(tmp_path)
|
|
630
|
+
rig.gate_conf(full={'subjects': ['feat(01): Export rows']})
|
|
631
|
+
repairs = [fixer('fixed\n', 'repair integration', ticket_of='01')]
|
|
632
|
+
if review_fix:
|
|
633
|
+
repairs.append(fixer('reviewed\n', 'repair review finding', ticket_of='01'))
|
|
634
|
+
steps = plan(**{'final/fixer': repairs, 'final/final-spec': [final(finding('FOLLOWUP')) if review_fix else final()]})
|
|
635
|
+
rig.run(steps, '--push')
|
|
636
|
+
assert rig.code == 0, rig.output()
|
|
637
|
+
assert rig.state()['tickets']['01']['round'] == 0
|
|
638
|
+
assert rig.state()['tickets']['01']['phase'] == 'merged'
|
|
639
|
+
assert len(rig.final_calls('fixer')) == 1 + int(review_fix)
|
|
640
|
+
call = rig.final_calls('fixer')[0]
|
|
641
|
+
assert 'gate-full-' in call['prompt']
|
|
642
|
+
assert rig.final_calls('final-spec')[0]['t0'] > call['t1']
|
|
643
|
+
assert [g['exit'] for g in rig.gates('full')] == ([1, 0, 0] if review_fix else [1, 0])
|
|
644
|
+
full_tip = rig.final_calls('final-spec')[0]['head']
|
|
645
|
+
state = rig.state()['run']['final']
|
|
646
|
+
body = rig.prs()[0]['body']
|
|
647
|
+
assert f"Full review: {state['onto']}..{full_tip}" in body
|
|
648
|
+
scoped = f'{full_tip}..{rig.branch()}' if review_fix else 'not needed'
|
|
649
|
+
assert f'Scoped review after the fix batch: {scoped}' in body
|
|
650
|
+
assert 'Fix commits of the integrated branch' in body
|
|
651
|
+
|
|
652
|
+
|
|
653
|
+
@pytest.mark.parametrize('transient', [True, False])
|
|
654
|
+
def test_final_gate_repair_can_prove_no_code_change_but_still_spends_its_attempt(tmp_path, transient):
|
|
655
|
+
rig = Final(tmp_path)
|
|
656
|
+
rig.gate_conf(full={'subjects': ['feat(01): Export rows']})
|
|
657
|
+
no_change = {'report': dict(status='DONE_WITH_CONCERNS', commits=[], files=[], green=['targeted checks pass'],
|
|
658
|
+
concerns=['the full integration gate is red on $HEAD: inspected the exact log; no code change is needed'])}
|
|
659
|
+
if transient:
|
|
660
|
+
no_change['files'] = {str(rig.rig / 'gate.json'): '{}'} # repair the external gate environment
|
|
661
|
+
rig.run(plan(**{'final/fixer': [no_change]}), '--push')
|
|
662
|
+
assert rig.code == (0 if transient else 2), rig.output()
|
|
663
|
+
state = rig.state()['run']['final']
|
|
664
|
+
assert state['gate_repairs'] == 1
|
|
665
|
+
assert rig.branch() == state['tidied']
|
|
666
|
+
assert len(rig.final_calls('fixer')) == 1
|
|
667
|
+
assert [g['exit'] for g in rig.gates('full')] == [1, 0 if transient else 1]
|
|
668
|
+
assert bool(rig.pushes()) == transient
|
|
669
|
+
assert len(rig.final_calls('final-spec')) == int(transient)
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
"""Full integration gating through the driver CLI, after ticket landings."""
|
|
2
|
+
import pytest
|
|
3
|
+
|
|
4
|
+
from test_final import fixer
|
|
5
|
+
from test_walk import plan
|
|
6
|
+
from test_fixloop import inside # noqa: F401 (in-process runtime discovery)
|
|
7
|
+
from test_tidy import Inside, tools # noqa: F401 (fake gh and signing config)
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
@pytest.mark.parametrize("reword", [False, True])
|
|
11
|
+
def test_red_repair_parks_once_and_retry_uses_saved_failure_without_reopening_tickets(tmp_path, reword):
|
|
12
|
+
rig = Inside(tmp_path)
|
|
13
|
+
rig.gate_conf(full={'subjects': ['feat(01): Export rows', 'fix(01): first repair']})
|
|
14
|
+
steps = plan(**{'final/fixer': [fixer('first\n', 'first repair', ticket_of='01'),
|
|
15
|
+
fixer('second\n', 'second repair', ticket_of='01')]})
|
|
16
|
+
rig.run(steps, '--push')
|
|
17
|
+
assert rig.code == 2, rig.output()
|
|
18
|
+
assert len(rig.final_calls('fixer')) == 1
|
|
19
|
+
assert not rig.final_calls('final-spec') and not rig.pushes()
|
|
20
|
+
assert rig.state()['tickets']['01']['phase'] == 'merged'
|
|
21
|
+
assert rig.final()['gate_allowance'] == 1
|
|
22
|
+
assert rig.state()['run']['questions'][0]['resume']['gate_allowance'] == 2
|
|
23
|
+
gate_count = len(rig.gates('full'))
|
|
24
|
+
if reword:
|
|
25
|
+
import json
|
|
26
|
+
state = rig.state()
|
|
27
|
+
state['run']['questions'][0]['subject'] = 'Revised wording for the integration retry'
|
|
28
|
+
(rig.repo / '.agent/implement/state.json').write_text(json.dumps(state))
|
|
29
|
+
rig.run(steps, '--push', '--answer', 'final-ticket-blocked-1=retry')
|
|
30
|
+
assert rig.code == 0, rig.output()
|
|
31
|
+
assert len(rig.final_calls('fixer')) == 2
|
|
32
|
+
assert len(rig.calls('01', 'implementer')) == 1
|
|
33
|
+
assert len(rig.gates('full')) == gate_count + 1
|
|
34
|
+
assert rig.final()['gate_repairs'] == rig.final()['gate_allowance'] == 2
|
|
35
|
+
assert rig.state()['tickets']['01']['round'] == 0
|
|
36
|
+
assert rig.pushes() == [f'refs/heads/feat/csv {rig.branch()}']
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
def test_editing_after_red_gate_does_not_grant_another_repair(tmp_path):
|
|
40
|
+
rig = Inside(tmp_path)
|
|
41
|
+
rig.gate_conf(full={'subjects': ['feat(01): Export rows', 'fix(01): first repair']})
|
|
42
|
+
steps = plan(**{'final/fixer': [fixer('first\n', 'first repair', ticket_of='01')]})
|
|
43
|
+
rig.run(steps)
|
|
44
|
+
assert rig.code == 2, rig.output()
|
|
45
|
+
snapshot = rig.snap()
|
|
46
|
+
rig.run(steps, '--answer', 'final-ticket-blocked-1=edit')
|
|
47
|
+
assert rig.code == 1, rig.output()
|
|
48
|
+
assert rig.final()['gate_allowance'] == rig.final()['gate_repairs'] == 1
|
|
49
|
+
assert len(rig.calls()) == snapshot.calls and len(rig.gates()) == snapshot.gates
|
|
50
|
+
assert rig.state()['tickets']['01']['phase'] == 'merged'
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
def test_interrupted_integration_repair_resumes_from_saved_log(tmp_path, monkeypatch):
|
|
54
|
+
import driver_final
|
|
55
|
+
from driver_run import Halted
|
|
56
|
+
|
|
57
|
+
rig = Inside(tmp_path)
|
|
58
|
+
rig.gate_conf(full={'subjects': ['feat(01): Export rows']})
|
|
59
|
+
steps = plan(**{'final/fixer': [fixer('fixed\n', 'repair integration', ticket_of='01')]})
|
|
60
|
+
real = driver_final._run_fixer
|
|
61
|
+
|
|
62
|
+
def interrupted(*args, **kwargs):
|
|
63
|
+
raise Halted('interrupted before repair')
|
|
64
|
+
|
|
65
|
+
monkeypatch.setattr(driver_final, '_run_fixer', interrupted)
|
|
66
|
+
rig.run(steps)
|
|
67
|
+
assert rig.code == 4 and len(rig.gates('full')) == 1, rig.out
|
|
68
|
+
assert rig.final()['gate_failure']['record'].endswith('.log')
|
|
69
|
+
assert rig.final()['gate_repairs'] == 0
|
|
70
|
+
monkeypatch.setattr(driver_final, '_run_fixer', real)
|
|
71
|
+
rig.run(steps)
|
|
72
|
+
assert rig.code == 0, rig.out
|
|
73
|
+
assert [gate['exit'] for gate in rig.gates('full')] == [1, 0]
|
|
74
|
+
assert len(rig.calls('01', 'implementer')) == 1
|
|
75
|
+
assert rig.final()['gate_repairs'] == 1
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
def test_old_final_state_gains_an_unused_repair_allowance_without_rerunning_work(tmp_path):
|
|
79
|
+
import json
|
|
80
|
+
|
|
81
|
+
rig = Inside(tmp_path).run(plan())
|
|
82
|
+
assert rig.code == 0, rig.out
|
|
83
|
+
snapshot = rig.snap()
|
|
84
|
+
state = rig.state()
|
|
85
|
+
del state['run']['final']['gate_repairs']
|
|
86
|
+
del state['run']['final']['gate_allowance']
|
|
87
|
+
del state['run']['final']['gate_failure']
|
|
88
|
+
del state['run']['final']['lenses']
|
|
89
|
+
(rig.repo / '.agent/implement/state.json').write_text(json.dumps(state))
|
|
90
|
+
rig.run(plan())
|
|
91
|
+
assert rig.code == 0, rig.out
|
|
92
|
+
assert len(rig.calls()) == snapshot.calls and len(rig.gates()) == snapshot.gates
|
|
93
|
+
assert rig.final()['gate_repairs'] == 0 and rig.final()['gate_failure'] is None
|
|
94
|
+
assert rig.final()['gate_allowance'] == 1
|
|
95
|
+
rig.run(plan(), '--push')
|
|
96
|
+
assert rig.code == 0, rig.out
|
|
97
|
+
body = rig.prs()[0]['body']
|
|
98
|
+
assert f"Full review: {rig.final()['onto']}..{rig.final()['tidied']}" in body
|
|
99
|
+
assert 'Scoped review after the fix batch: not needed' in body
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
def test_gate_repair_after_review_fix_preserves_findings_for_scoped_review(tmp_path):
|
|
103
|
+
from test_final import final
|
|
104
|
+
from test_review import finding
|
|
105
|
+
|
|
106
|
+
rig = Inside(tmp_path)
|
|
107
|
+
rig.gate_conf(full={'subjects': ['fix(01): review fix']})
|
|
108
|
+
steps = plan(**{'final/final-spec': [final(finding('KEEP-THIS-FINDING'))],
|
|
109
|
+
'final/fixer': [fixer('review\n', 'review fix', ticket_of='01'),
|
|
110
|
+
fixer('gate\n', 'gate repair', ticket_of='01')]})
|
|
111
|
+
rig.run(steps, '--push')
|
|
112
|
+
assert rig.code == 0, rig.out
|
|
113
|
+
assert [gate['exit'] for gate in rig.gates('full')] == [0, 1, 0]
|
|
114
|
+
assert len(rig.final_calls('final-spec')) == 1
|
|
115
|
+
assert len(rig.final_calls('final-reviewer')) == 1
|
|
116
|
+
assert 'KEEP-THIS-FINDING' in (rig.repo / '.agent/implement/final/findings-0.json').read_text()
|
|
117
|
+
scoped = rig.final_calls('final-reviewer')[0]
|
|
118
|
+
assert scoped['head'] == rig.branch()
|
|
119
|
+
assert 'findings-0.json' in scoped['prompt']
|
|
120
|
+
assert rig.final()['reviewed'] == rig.branch()
|
|
121
|
+
assert rig.pushes() == [f'refs/heads/feat/csv {rig.branch()}']
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
@pytest.mark.parametrize("transient", [True, False])
|
|
125
|
+
def test_evidenced_noop_repair_checks_the_same_tip_and_keeps_the_bound(tmp_path, monkeypatch, transient):
|
|
126
|
+
import test_final
|
|
127
|
+
|
|
128
|
+
monkeypatch.setattr(test_final, "Final", Inside)
|
|
129
|
+
test_final.test_final_gate_repair_can_prove_no_code_change_but_still_spends_its_attempt(tmp_path, transient)
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
def test_noop_gate_repair_without_failure_evidence_cannot_spend_or_publish(tmp_path):
|
|
133
|
+
rig = Inside(tmp_path)
|
|
134
|
+
rig.gate_conf(full={"subjects": ["feat(01): Export rows"]})
|
|
135
|
+
empty = {"report": dict(status="DONE", commits=[], files=[], green=["passed"], concerns=["no change"])}
|
|
136
|
+
rig.run(plan(**{"final/fixer": [empty, empty]}), "--push")
|
|
137
|
+
assert rig.code == 2, rig.out
|
|
138
|
+
assert rig.final()["gate_repairs"] == 0
|
|
139
|
+
assert len(rig.gates("full")) == 1 and not rig.pushes()
|
|
140
|
+
assert "no concern names the finding the full integration gate is red" in rig.out
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
def test_gate_repair_preserves_locked_tests_and_escalates_a_needed_correction(tmp_path):
|
|
144
|
+
rig = Inside(tmp_path)
|
|
145
|
+
rig.gate_conf(full={"subjects": ["feat(01): Export rows"]})
|
|
146
|
+
changed = fixer("fixed\n", "alter test", ticket_of="01")
|
|
147
|
+
changed["commits"][0]["files"]["tests/test_01.py"] = "changed = True\n"
|
|
148
|
+
changed["report"]["files"].append("tests/test_01.py")
|
|
149
|
+
retry = {"report": dict(changed["report"], commits=[{"sha": "$HEAD", "ticket": "01"}])}
|
|
150
|
+
rig.run(plan(**{"final/fixer": [changed, retry]}), "--push")
|
|
151
|
+
assert rig.code == 2, rig.out
|
|
152
|
+
assert "locked file changed: tests/test_01.py" in rig.out
|
|
153
|
+
assert rig.final()["gate_repairs"] == 0 and not rig.pushes()
|
|
154
|
+
assert rig.branch() == rig.final()["tidied"]
|
|
155
|
+
assert rig.state()["tickets"]["01"]["phase"] == "merged"
|