prizmkit 1.1.192 → 1.1.193
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/bundled/VERSION.json +3 -3
- package/bundled/dev-pipeline/README.md +23 -34
- package/bundled/dev-pipeline/assets/feature-list-example.json +0 -1
- package/bundled/dev-pipeline/assets/skill-subagent-integration.md +3 -0
- package/bundled/dev-pipeline/prizmkit_runtime/config.py +24 -2
- package/bundled/dev-pipeline/prizmkit_runtime/daemon.py +2 -0
- package/bundled/dev-pipeline/prizmkit_runtime/gitops.py +89 -40
- package/bundled/dev-pipeline/prizmkit_runtime/heartbeat.py +9 -1
- package/bundled/dev-pipeline/prizmkit_runtime/interoperability.py +0 -22
- package/bundled/dev-pipeline/prizmkit_runtime/platform_detection.py +11 -7
- package/bundled/dev-pipeline/prizmkit_runtime/processes.py +26 -20
- package/bundled/dev-pipeline/prizmkit_runtime/reset.py +37 -4
- package/bundled/dev-pipeline/prizmkit_runtime/reset_preserve.py +20 -41
- package/bundled/dev-pipeline/prizmkit_runtime/runner_bookkeeping.py +74 -36
- package/bundled/dev-pipeline/prizmkit_runtime/runner_models.py +0 -66
- package/bundled/dev-pipeline/prizmkit_runtime/runners.py +271 -52
- package/bundled/dev-pipeline/prizmkit_runtime/runtime_commit.py +51 -13
- package/bundled/dev-pipeline/prizmkit_runtime/sessions.py +43 -15
- package/bundled/dev-pipeline/prizmkit_runtime/stream_progress.py +27 -24
- package/bundled/dev-pipeline/prizmkit_runtime/task_checkout.py +0 -1
- package/bundled/dev-pipeline/scripts/check-session-status.py +13 -1
- package/bundled/dev-pipeline/scripts/continuation.py +2 -3
- package/bundled/dev-pipeline/scripts/detect-stuck.py +19 -5
- package/bundled/dev-pipeline/scripts/generate-bootstrap-prompt.py +6 -14
- package/bundled/dev-pipeline/scripts/generate-bugfix-prompt.py +13 -8
- package/bundled/dev-pipeline/scripts/init-change-artifact.py +17 -2
- package/bundled/dev-pipeline/scripts/prompt_framework.py +39 -21
- package/bundled/dev-pipeline/scripts/update-checkpoint.py +27 -0
- package/bundled/dev-pipeline/templates/bootstrap-tier3.md +1 -1
- package/bundled/dev-pipeline/templates/bugfix-bootstrap-prompt.md +6 -6
- package/bundled/dev-pipeline/templates/sections/bugfix-phase-test.md +1 -1
- package/bundled/dev-pipeline/templates/sections/phase-prizmkit-test.md +1 -1
- package/bundled/skills/_metadata.json +1 -1
- package/package.json +1 -1
- package/bundled/dev-pipeline/tests/_helpers.py +0 -418
- package/bundled/dev-pipeline/tests/conftest.py +0 -73
- package/bundled/dev-pipeline/tests/live_ai_cli_log_smoke.py +0 -208
- package/bundled/dev-pipeline/tests/test_auto_skip.py +0 -1806
- package/bundled/dev-pipeline/tests/test_checkpoint_state.py +0 -1439
- package/bundled/dev-pipeline/tests/test_daemon_and_scripts.py +0 -257
- package/bundled/dev-pipeline/tests/test_e2e_pipeline_run.py +0 -500
- package/bundled/dev-pipeline/tests/test_generate_bootstrap_prompt.py +0 -1654
- package/bundled/dev-pipeline/tests/test_generate_bugfix_prompt.py +0 -629
- package/bundled/dev-pipeline/tests/test_python_runner_parity.py +0 -2973
- package/bundled/dev-pipeline/tests/test_recovery_workflow.py +0 -321
- package/bundled/dev-pipeline/tests/test_repository_bootstrap.py +0 -251
- package/bundled/dev-pipeline/tests/test_reset_modes.py +0 -1196
- package/bundled/dev-pipeline/tests/test_reset_preserve.py +0 -872
- package/bundled/dev-pipeline/tests/test_runner_bookkeeping.py +0 -766
- package/bundled/dev-pipeline/tests/test_runner_lifecycle.py +0 -1257
- package/bundled/dev-pipeline/tests/test_runtime_commit.py +0 -1113
- package/bundled/dev-pipeline/tests/test_runtime_helper.py +0 -380
- package/bundled/dev-pipeline/tests/test_session_launch.py +0 -1101
- package/bundled/dev-pipeline/tests/test_stream_progress.py +0 -585
- package/bundled/dev-pipeline/tests/test_unified_cli.py +0 -3625
- package/bundled/dev-pipeline/tests/test_utils.py +0 -170
|
@@ -1,1113 +0,0 @@
|
|
|
1
|
-
"""Tests for runtime-owned local commit execution and finalization."""
|
|
2
|
-
|
|
3
|
-
from __future__ import annotations
|
|
4
|
-
|
|
5
|
-
import json
|
|
6
|
-
import subprocess
|
|
7
|
-
from pathlib import Path
|
|
8
|
-
|
|
9
|
-
import pytest
|
|
10
|
-
|
|
11
|
-
from prizmkit_runtime.checkpoint_state import load_checkpoint_state
|
|
12
|
-
from prizmkit_runtime.runtime_commit import (
|
|
13
|
-
finalize_accepted_workspace_commit,
|
|
14
|
-
finalize_runtime_commit,
|
|
15
|
-
prepare_runtime_commit_handoff,
|
|
16
|
-
)
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
def _git(root: Path, *args: str) -> str:
|
|
20
|
-
completed = subprocess.run(
|
|
21
|
-
["git", *args],
|
|
22
|
-
cwd=root,
|
|
23
|
-
check=True,
|
|
24
|
-
stdout=subprocess.PIPE,
|
|
25
|
-
stderr=subprocess.PIPE,
|
|
26
|
-
text=True,
|
|
27
|
-
)
|
|
28
|
-
return completed.stdout.strip()
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
def _init_repo(root: Path) -> str:
|
|
32
|
-
_git(root, "init")
|
|
33
|
-
_git(root, "config", "user.email", "runtime@example.invalid")
|
|
34
|
-
_git(root, "config", "user.name", "Runtime Test")
|
|
35
|
-
(root / "tracked.txt").write_text("before\n", encoding="utf-8")
|
|
36
|
-
(root / ".gitignore").write_text(".prizmkit/\n", encoding="utf-8")
|
|
37
|
-
_git(root, "add", "tracked.txt", ".gitignore")
|
|
38
|
-
_git(root, "commit", "-m", "initial")
|
|
39
|
-
return _git(root, "rev-parse", "HEAD")
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
def _write_test_artifacts(artifact_dir: Path) -> None:
|
|
43
|
-
artifact_dir.mkdir(parents=True, exist_ok=True)
|
|
44
|
-
for filename in ("context-snapshot.md", "spec.md", "plan.md"):
|
|
45
|
-
(artifact_dir / filename).write_text(f"# {filename}\n", encoding="utf-8")
|
|
46
|
-
(artifact_dir / "review-report.md").write_text(
|
|
47
|
-
"# Review Report\n\n## Final Result\n\n- Verdict: PASS\n",
|
|
48
|
-
encoding="utf-8",
|
|
49
|
-
)
|
|
50
|
-
(artifact_dir / "test-report.md").write_text(
|
|
51
|
-
"# Test Report\n\n## Final Result\n\n- Result: TEST_PASS\n",
|
|
52
|
-
encoding="utf-8",
|
|
53
|
-
)
|
|
54
|
-
(artifact_dir / "test-result.json").write_text(
|
|
55
|
-
json.dumps(
|
|
56
|
-
{
|
|
57
|
-
"schema_version": 1,
|
|
58
|
-
"result": "TEST_PASS",
|
|
59
|
-
"report": "test-report.md",
|
|
60
|
-
"main_review_rounds": 1,
|
|
61
|
-
"independent_review": {
|
|
62
|
-
"status": "downgraded",
|
|
63
|
-
"responses": 0,
|
|
64
|
-
"downgrade_reason": "no eligible reviewer",
|
|
65
|
-
"final_state_rechecked": False,
|
|
66
|
-
},
|
|
67
|
-
"repair_rounds": 0,
|
|
68
|
-
"production_changed": False,
|
|
69
|
-
"unresolved_items": [],
|
|
70
|
-
}
|
|
71
|
-
),
|
|
72
|
-
encoding="utf-8",
|
|
73
|
-
)
|
|
74
|
-
(artifact_dir / "completion-summary.json").write_text(
|
|
75
|
-
'{"completion_notes":["Runtime commit fixture"]}\n', encoding="utf-8"
|
|
76
|
-
)
|
|
77
|
-
(artifact_dir / "retrospective-result.json").write_text(
|
|
78
|
-
json.dumps(
|
|
79
|
-
{
|
|
80
|
-
"schema_version": 1,
|
|
81
|
-
"outcome": "RETRO_COMPLETE",
|
|
82
|
-
"result": "NO_DOC_CHANGE",
|
|
83
|
-
"reason": "No durable documentation change in fixture",
|
|
84
|
-
"change_paths": ["tracked.txt"],
|
|
85
|
-
"documentation_paths": [],
|
|
86
|
-
"validation": [],
|
|
87
|
-
}
|
|
88
|
-
),
|
|
89
|
-
encoding="utf-8",
|
|
90
|
-
)
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
def _write_commit_ready_checkpoint(root: Path) -> tuple[Path, Path]:
|
|
94
|
-
artifact_dir = root / ".prizmkit" / "specs" / "001-runtime-commit"
|
|
95
|
-
_write_test_artifacts(artifact_dir)
|
|
96
|
-
skills = [
|
|
97
|
-
"context-snapshot-and-plan",
|
|
98
|
-
"prizmkit-implement",
|
|
99
|
-
"prizmkit-code-review",
|
|
100
|
-
"prizmkit-test",
|
|
101
|
-
"completion-summary",
|
|
102
|
-
"prizmkit-retrospective",
|
|
103
|
-
"prizmkit-committer",
|
|
104
|
-
]
|
|
105
|
-
steps = []
|
|
106
|
-
previous = None
|
|
107
|
-
for index, skill in enumerate(skills, start=1):
|
|
108
|
-
status = "in_progress" if skill == "prizmkit-committer" else "completed"
|
|
109
|
-
step = {
|
|
110
|
-
"id": f"S{index:02d}",
|
|
111
|
-
"skill": skill,
|
|
112
|
-
"name": skill,
|
|
113
|
-
"status": status,
|
|
114
|
-
"required_artifacts": [],
|
|
115
|
-
"depends_on": previous,
|
|
116
|
-
}
|
|
117
|
-
if skill == "context-snapshot-and-plan":
|
|
118
|
-
step["stage_result"] = "PLAN_READY"
|
|
119
|
-
step["required_artifacts"] = [
|
|
120
|
-
".prizmkit/specs/001-runtime-commit/context-snapshot.md",
|
|
121
|
-
".prizmkit/specs/001-runtime-commit/spec.md",
|
|
122
|
-
".prizmkit/specs/001-runtime-commit/plan.md",
|
|
123
|
-
]
|
|
124
|
-
elif skill == "prizmkit-implement":
|
|
125
|
-
step["stage_result"] = "IMPLEMENTED"
|
|
126
|
-
elif skill == "prizmkit-code-review":
|
|
127
|
-
step["stage_result"] = "REVIEW_PASS"
|
|
128
|
-
step["required_artifacts"] = [
|
|
129
|
-
".prizmkit/specs/001-runtime-commit/review-report.md"
|
|
130
|
-
]
|
|
131
|
-
elif skill == "prizmkit-test":
|
|
132
|
-
step["stage_result"] = "TEST_PASS"
|
|
133
|
-
step["required_artifacts"] = [
|
|
134
|
-
".prizmkit/specs/001-runtime-commit/test-report.md",
|
|
135
|
-
".prizmkit/specs/001-runtime-commit/test-result.json",
|
|
136
|
-
]
|
|
137
|
-
elif skill == "completion-summary":
|
|
138
|
-
step["required_artifacts"] = [
|
|
139
|
-
".prizmkit/specs/001-runtime-commit/completion-summary.json"
|
|
140
|
-
]
|
|
141
|
-
elif skill == "prizmkit-retrospective":
|
|
142
|
-
step["stage_result"] = "RETRO_COMPLETE"
|
|
143
|
-
step["required_artifacts"] = [
|
|
144
|
-
".prizmkit/specs/001-runtime-commit/retrospective-result.json"
|
|
145
|
-
]
|
|
146
|
-
elif skill == "prizmkit-committer":
|
|
147
|
-
step["stage_result"] = "COMMIT_PENDING"
|
|
148
|
-
step["required_artifacts"] = [
|
|
149
|
-
".prizmkit/specs/001-runtime-commit/runtime-commit-request.json"
|
|
150
|
-
]
|
|
151
|
-
steps.append(step)
|
|
152
|
-
previous = step["id"]
|
|
153
|
-
checkpoint = {
|
|
154
|
-
"version": 1,
|
|
155
|
-
"workflow_type": "feature-pipeline",
|
|
156
|
-
"item_id": "F-001",
|
|
157
|
-
"item_slug": "001-runtime-commit",
|
|
158
|
-
"session_id": "session-1",
|
|
159
|
-
"steps": steps,
|
|
160
|
-
"feature_state": {
|
|
161
|
-
"schema_version": 1,
|
|
162
|
-
"artifact_dir": ".prizmkit/specs/001-runtime-commit",
|
|
163
|
-
"orchestrator": "pipeline-runtime",
|
|
164
|
-
"stage": "committer",
|
|
165
|
-
"current_stage": "prizmkit-committer",
|
|
166
|
-
"status": "in_progress",
|
|
167
|
-
"stage_result": "COMMIT_PENDING",
|
|
168
|
-
"repair_round": 0,
|
|
169
|
-
"next_stage": "prizmkit-committer",
|
|
170
|
-
"terminal_status": None,
|
|
171
|
-
},
|
|
172
|
-
}
|
|
173
|
-
checkpoint_path = artifact_dir / "workflow-checkpoint.json"
|
|
174
|
-
checkpoint_path.write_text(json.dumps(checkpoint), encoding="utf-8")
|
|
175
|
-
return artifact_dir, checkpoint_path
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
def _rewind_to_ai_request_ready(checkpoint_path: Path) -> None:
|
|
179
|
-
"""Model the state after Committer wrote a request but before Runtime adoption."""
|
|
180
|
-
checkpoint = json.loads(checkpoint_path.read_text(encoding="utf-8"))
|
|
181
|
-
committer = next(
|
|
182
|
-
step for step in checkpoint["steps"]
|
|
183
|
-
if step["skill"] == "prizmkit-committer"
|
|
184
|
-
)
|
|
185
|
-
committer["status"] = "in_progress"
|
|
186
|
-
committer.pop("stage_result", None)
|
|
187
|
-
semantic = checkpoint["feature_state"]
|
|
188
|
-
semantic.update(
|
|
189
|
-
{
|
|
190
|
-
"stage": "committer",
|
|
191
|
-
"status": "in_progress",
|
|
192
|
-
"current_stage": "prizmkit-committer",
|
|
193
|
-
"next_stage": "prizmkit-committer",
|
|
194
|
-
"terminal_status": None,
|
|
195
|
-
}
|
|
196
|
-
)
|
|
197
|
-
semantic.pop("stage_result", None)
|
|
198
|
-
semantic.pop("blocked_reason", None)
|
|
199
|
-
checkpoint_path.write_text(json.dumps(checkpoint), encoding="utf-8")
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
def _write_request(root: Path, artifact_dir: Path, base_head: str) -> Path:
|
|
203
|
-
request_path = artifact_dir / "runtime-commit-request.json"
|
|
204
|
-
request_path.write_text(
|
|
205
|
-
json.dumps(
|
|
206
|
-
{
|
|
207
|
-
"schema_version": 2,
|
|
208
|
-
"artifact_dir": artifact_dir.relative_to(root).as_posix(),
|
|
209
|
-
"base_head": base_head,
|
|
210
|
-
"commit_message": "fix(runtime): finalize prepared task",
|
|
211
|
-
}
|
|
212
|
-
),
|
|
213
|
-
encoding="utf-8",
|
|
214
|
-
)
|
|
215
|
-
return request_path
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
def test_runtime_prepares_pending_from_ai_request_without_git_mutation(tmp_path):
|
|
219
|
-
base_head = _init_repo(tmp_path)
|
|
220
|
-
artifact_dir, checkpoint_path = _write_commit_ready_checkpoint(tmp_path)
|
|
221
|
-
_rewind_to_ai_request_ready(checkpoint_path)
|
|
222
|
-
(tmp_path / "tracked.txt").write_text("after\n", encoding="utf-8")
|
|
223
|
-
_write_request(tmp_path, artifact_dir, base_head)
|
|
224
|
-
|
|
225
|
-
result = prepare_runtime_commit_handoff(
|
|
226
|
-
tmp_path,
|
|
227
|
-
artifact_dir=artifact_dir,
|
|
228
|
-
checkpoint_path=checkpoint_path,
|
|
229
|
-
)
|
|
230
|
-
|
|
231
|
-
assert result.status == "ready"
|
|
232
|
-
assert result.reason == "runtime_commit_handoff_prepared"
|
|
233
|
-
assert _git(tmp_path, "rev-parse", "HEAD") == base_head
|
|
234
|
-
state = load_checkpoint_state(checkpoint_path, project_root=tmp_path)
|
|
235
|
-
assert state.semantic_commit_ready is True
|
|
236
|
-
committer = next(
|
|
237
|
-
step for step in state.steps if step.skill == "prizmkit-committer"
|
|
238
|
-
)
|
|
239
|
-
assert committer.status == "in_progress"
|
|
240
|
-
assert committer.stage_result == "COMMIT_PENDING"
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
def test_runtime_commit_auto_prepares_ai_request_and_finalizes(tmp_path):
|
|
244
|
-
base_head = _init_repo(tmp_path)
|
|
245
|
-
artifact_dir, checkpoint_path = _write_commit_ready_checkpoint(tmp_path)
|
|
246
|
-
_rewind_to_ai_request_ready(checkpoint_path)
|
|
247
|
-
(tmp_path / "tracked.txt").write_text("after\n", encoding="utf-8")
|
|
248
|
-
_write_request(tmp_path, artifact_dir, base_head)
|
|
249
|
-
|
|
250
|
-
result = finalize_runtime_commit(
|
|
251
|
-
tmp_path,
|
|
252
|
-
artifact_dir=artifact_dir,
|
|
253
|
-
checkpoint_path=checkpoint_path,
|
|
254
|
-
)
|
|
255
|
-
|
|
256
|
-
assert result.status == "committed"
|
|
257
|
-
assert result.commit_hash == _git(tmp_path, "rev-parse", "HEAD")
|
|
258
|
-
assert load_checkpoint_state(
|
|
259
|
-
checkpoint_path,
|
|
260
|
-
project_root=tmp_path,
|
|
261
|
-
).semantic_complete is True
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
def test_runner_adopts_request_without_ai_publishing_pending(tmp_path):
|
|
265
|
-
from types import SimpleNamespace
|
|
266
|
-
|
|
267
|
-
from prizmkit_runtime.runners import _finalize_prepared_runtime_commit
|
|
268
|
-
|
|
269
|
-
base_head = _init_repo(tmp_path)
|
|
270
|
-
artifact_dir, checkpoint_path = _write_commit_ready_checkpoint(tmp_path)
|
|
271
|
-
_rewind_to_ai_request_ready(checkpoint_path)
|
|
272
|
-
(tmp_path / "tracked.txt").write_text("after\n", encoding="utf-8")
|
|
273
|
-
_write_request(tmp_path, artifact_dir, base_head)
|
|
274
|
-
|
|
275
|
-
result = _finalize_prepared_runtime_commit(
|
|
276
|
-
tmp_path,
|
|
277
|
-
SimpleNamespace(
|
|
278
|
-
checkpoint_path=checkpoint_path,
|
|
279
|
-
artifact_path=artifact_dir,
|
|
280
|
-
),
|
|
281
|
-
)
|
|
282
|
-
|
|
283
|
-
assert result.status == "committed"
|
|
284
|
-
assert load_checkpoint_state(
|
|
285
|
-
checkpoint_path,
|
|
286
|
-
project_root=tmp_path,
|
|
287
|
-
).semantic_complete is True
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
def test_runtime_prepare_does_not_override_terminal_commit_block(tmp_path):
|
|
291
|
-
base_head = _init_repo(tmp_path)
|
|
292
|
-
artifact_dir, checkpoint_path = _write_commit_ready_checkpoint(tmp_path)
|
|
293
|
-
_rewind_to_ai_request_ready(checkpoint_path)
|
|
294
|
-
checkpoint = json.loads(checkpoint_path.read_text(encoding="utf-8"))
|
|
295
|
-
committer = next(
|
|
296
|
-
step for step in checkpoint["steps"]
|
|
297
|
-
if step["skill"] == "prizmkit-committer"
|
|
298
|
-
)
|
|
299
|
-
committer["status"] = "failed"
|
|
300
|
-
committer["stage_result"] = "COMMIT_BLOCKED"
|
|
301
|
-
checkpoint["feature_state"].update(
|
|
302
|
-
{
|
|
303
|
-
"status": "failed",
|
|
304
|
-
"stage_result": "COMMIT_BLOCKED",
|
|
305
|
-
"current_stage": None,
|
|
306
|
-
"next_stage": None,
|
|
307
|
-
"blocked_reason": "commit_blocked",
|
|
308
|
-
"terminal_status": "WORKFLOW_BLOCKED",
|
|
309
|
-
}
|
|
310
|
-
)
|
|
311
|
-
checkpoint_path.write_text(json.dumps(checkpoint), encoding="utf-8")
|
|
312
|
-
_write_request(tmp_path, artifact_dir, base_head)
|
|
313
|
-
|
|
314
|
-
result = prepare_runtime_commit_handoff(
|
|
315
|
-
tmp_path,
|
|
316
|
-
artifact_dir=artifact_dir,
|
|
317
|
-
checkpoint_path=checkpoint_path,
|
|
318
|
-
)
|
|
319
|
-
|
|
320
|
-
assert result.status == "not_ready"
|
|
321
|
-
assert result.reason == "workflow_checkpoint_blocked"
|
|
322
|
-
persisted = load_checkpoint_state(checkpoint_path, project_root=tmp_path)
|
|
323
|
-
assert persisted.semantic_blocked is True
|
|
324
|
-
assert _git(tmp_path, "rev-parse", "HEAD") == base_head
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
def test_runtime_prepare_rejects_stale_request_without_publishing_pending(tmp_path):
|
|
328
|
-
base_head = _init_repo(tmp_path)
|
|
329
|
-
artifact_dir, checkpoint_path = _write_commit_ready_checkpoint(tmp_path)
|
|
330
|
-
_rewind_to_ai_request_ready(checkpoint_path)
|
|
331
|
-
_write_request(tmp_path, artifact_dir, "a" * 40)
|
|
332
|
-
|
|
333
|
-
result = prepare_runtime_commit_handoff(
|
|
334
|
-
tmp_path,
|
|
335
|
-
artifact_dir=artifact_dir,
|
|
336
|
-
checkpoint_path=checkpoint_path,
|
|
337
|
-
)
|
|
338
|
-
|
|
339
|
-
assert result.status == "failed"
|
|
340
|
-
assert result.reason == "base_head_mismatch"
|
|
341
|
-
state = load_checkpoint_state(checkpoint_path, project_root=tmp_path)
|
|
342
|
-
assert state.semantic_commit_ready is False
|
|
343
|
-
assert state.current_step is not None
|
|
344
|
-
assert state.current_step.stage_result is None
|
|
345
|
-
assert _git(tmp_path, "rev-parse", "HEAD") == base_head
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
def test_runtime_commit_executes_complete_workspace_and_finalizes_only_checkpoint(tmp_path):
|
|
349
|
-
base_head = _init_repo(tmp_path)
|
|
350
|
-
artifact_dir, checkpoint_path = _write_commit_ready_checkpoint(tmp_path)
|
|
351
|
-
caller_state = tmp_path / ".prizmkit" / "state" / "workflows" / "caller.json"
|
|
352
|
-
caller_state.parent.mkdir(parents=True, exist_ok=True)
|
|
353
|
-
caller_state.write_text('{"owner":"external-coordinator"}\n', encoding="utf-8")
|
|
354
|
-
expected_caller_state = caller_state.read_bytes()
|
|
355
|
-
(tmp_path / "tracked.txt").write_text("after\n", encoding="utf-8")
|
|
356
|
-
_write_request(tmp_path, artifact_dir, base_head)
|
|
357
|
-
|
|
358
|
-
result = finalize_runtime_commit(
|
|
359
|
-
tmp_path,
|
|
360
|
-
artifact_dir=artifact_dir,
|
|
361
|
-
checkpoint_path=checkpoint_path,
|
|
362
|
-
)
|
|
363
|
-
|
|
364
|
-
assert result.status == "committed"
|
|
365
|
-
assert result.commit_hash == _git(tmp_path, "rev-parse", "HEAD")
|
|
366
|
-
assert _git(tmp_path, "log", "-1", "--pretty=%s") == "fix(runtime): finalize prepared task"
|
|
367
|
-
checkpoint = json.loads(checkpoint_path.read_text(encoding="utf-8"))
|
|
368
|
-
committer = next(step for step in checkpoint["steps"] if step["skill"] == "prizmkit-committer")
|
|
369
|
-
assert committer["status"] == "completed"
|
|
370
|
-
assert committer["stage_result"] == "COMMITTED"
|
|
371
|
-
assert checkpoint["feature_state"]["terminal_status"] == "WORKFLOW_COMPLETED"
|
|
372
|
-
assert checkpoint["feature_state"]["runtime_base_head"] == base_head
|
|
373
|
-
assert checkpoint["feature_state"]["runtime_commit_hash"] == result.commit_hash
|
|
374
|
-
assert caller_state.read_bytes() == expected_caller_state
|
|
375
|
-
assert not (artifact_dir / "runtime-commit-request.json").exists()
|
|
376
|
-
assert load_checkpoint_state(
|
|
377
|
-
checkpoint_path,
|
|
378
|
-
project_root=tmp_path,
|
|
379
|
-
).semantic_complete is True
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
def test_runtime_commit_finalizes_rehydrated_failure_wip(tmp_path):
|
|
383
|
-
from types import SimpleNamespace
|
|
384
|
-
|
|
385
|
-
from prizmkit_runtime.gitops import restore_runtime_wip
|
|
386
|
-
from prizmkit_runtime.runner_bookkeeping import commit_wip_changes
|
|
387
|
-
|
|
388
|
-
base_head = _init_repo(tmp_path)
|
|
389
|
-
branch = "dev/F-005-runtime-wip"
|
|
390
|
-
_git(tmp_path, "checkout", "-b", branch)
|
|
391
|
-
(tmp_path / "tracked.txt").write_text("preserved feature change\n", encoding="utf-8")
|
|
392
|
-
preserved = commit_wip_changes(
|
|
393
|
-
tmp_path,
|
|
394
|
-
SimpleNamespace(kind="feature"),
|
|
395
|
-
"F-005",
|
|
396
|
-
"failed",
|
|
397
|
-
)
|
|
398
|
-
assert preserved.committed is True
|
|
399
|
-
wip_head = _git(tmp_path, "rev-parse", "HEAD")
|
|
400
|
-
assert wip_head != base_head
|
|
401
|
-
assert _git(tmp_path, "status", "--porcelain", "--", "tracked.txt") == ""
|
|
402
|
-
|
|
403
|
-
restored = restore_runtime_wip(
|
|
404
|
-
tmp_path,
|
|
405
|
-
family_kind="feature",
|
|
406
|
-
item_id="F-005",
|
|
407
|
-
working_branch=branch,
|
|
408
|
-
)
|
|
409
|
-
assert restored.ok is True
|
|
410
|
-
assert restored.restored is True
|
|
411
|
-
assert restored.wip_head == wip_head
|
|
412
|
-
assert restored.restored_head == base_head
|
|
413
|
-
assert _git(tmp_path, "rev-parse", "HEAD") == base_head
|
|
414
|
-
assert "tracked.txt" in _git(tmp_path, "status", "--porcelain", "--", "tracked.txt")
|
|
415
|
-
|
|
416
|
-
artifact_dir, checkpoint_path = _write_commit_ready_checkpoint(tmp_path)
|
|
417
|
-
_write_request(tmp_path, artifact_dir, base_head)
|
|
418
|
-
result = finalize_runtime_commit(
|
|
419
|
-
tmp_path,
|
|
420
|
-
artifact_dir=artifact_dir,
|
|
421
|
-
checkpoint_path=checkpoint_path,
|
|
422
|
-
)
|
|
423
|
-
|
|
424
|
-
assert result.status == "committed"
|
|
425
|
-
assert result.reason == "runtime_commit_completed"
|
|
426
|
-
assert result.commit_hash == _git(tmp_path, "rev-parse", "HEAD")
|
|
427
|
-
assert _git(tmp_path, "show", "-s", "--format=%s", "HEAD") == "fix(runtime): finalize prepared task"
|
|
428
|
-
assert _git(tmp_path, "show", "HEAD:tracked.txt") == "preserved feature change"
|
|
429
|
-
assert _git(tmp_path, "rev-list", "--count", f"{base_head}..HEAD") == "1"
|
|
430
|
-
checkpoint = json.loads(checkpoint_path.read_text(encoding="utf-8"))
|
|
431
|
-
assert checkpoint["feature_state"]["runtime_base_head"] == base_head
|
|
432
|
-
assert checkpoint["feature_state"]["runtime_commit_hash"] == result.commit_hash
|
|
433
|
-
assert checkpoint["feature_state"]["terminal_status"] == "WORKFLOW_COMPLETED"
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
@pytest.mark.parametrize(
|
|
437
|
-
"durable_path",
|
|
438
|
-
[
|
|
439
|
-
".prizmkit/config.json",
|
|
440
|
-
".prizmkit/prizm-docs/src/counter.prizm",
|
|
441
|
-
],
|
|
442
|
-
)
|
|
443
|
-
def test_runtime_commit_includes_tracked_prizmkit_path_from_workspace(tmp_path, durable_path):
|
|
444
|
-
_init_repo(tmp_path)
|
|
445
|
-
durable = tmp_path / durable_path
|
|
446
|
-
durable.parent.mkdir(parents=True, exist_ok=True)
|
|
447
|
-
durable.write_text("before\n", encoding="utf-8")
|
|
448
|
-
_git(tmp_path, "add", "-f", durable_path)
|
|
449
|
-
_git(tmp_path, "commit", "-m", "track project-selected PrizmKit data")
|
|
450
|
-
base_head = _git(tmp_path, "rev-parse", "HEAD")
|
|
451
|
-
artifact_dir, checkpoint_path = _write_commit_ready_checkpoint(tmp_path)
|
|
452
|
-
(tmp_path / "tracked.txt").write_text("after\n", encoding="utf-8")
|
|
453
|
-
durable.write_text("after\n", encoding="utf-8")
|
|
454
|
-
_write_request(tmp_path, artifact_dir, base_head)
|
|
455
|
-
|
|
456
|
-
result = finalize_runtime_commit(
|
|
457
|
-
tmp_path,
|
|
458
|
-
artifact_dir=artifact_dir,
|
|
459
|
-
checkpoint_path=checkpoint_path,
|
|
460
|
-
)
|
|
461
|
-
|
|
462
|
-
assert result.status == "committed", result
|
|
463
|
-
changed = set(_git(
|
|
464
|
-
tmp_path,
|
|
465
|
-
"diff-tree",
|
|
466
|
-
"--no-commit-id",
|
|
467
|
-
"--name-only",
|
|
468
|
-
"-r",
|
|
469
|
-
"HEAD",
|
|
470
|
-
).splitlines())
|
|
471
|
-
assert changed == {"tracked.txt", durable_path}
|
|
472
|
-
assert durable.read_text(encoding="utf-8") == "after\n"
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
def test_runtime_commit_includes_valid_host_support_paths_from_workspace(tmp_path):
|
|
476
|
-
base_head = _init_repo(tmp_path)
|
|
477
|
-
artifact_dir, checkpoint_path = _write_commit_ready_checkpoint(tmp_path)
|
|
478
|
-
(tmp_path / "tracked.txt").write_text("after\n", encoding="utf-8")
|
|
479
|
-
(tmp_path / "AGENTS.md").write_text("@./AGENTS.private.md\n", encoding="utf-8")
|
|
480
|
-
codex_config = tmp_path / ".codex" / "config.toml"
|
|
481
|
-
codex_config.parent.mkdir()
|
|
482
|
-
codex_config.write_text("[project]\ntrusted = true\n", encoding="utf-8")
|
|
483
|
-
_write_request(tmp_path, artifact_dir, base_head)
|
|
484
|
-
|
|
485
|
-
result = finalize_runtime_commit(
|
|
486
|
-
tmp_path,
|
|
487
|
-
artifact_dir=artifact_dir,
|
|
488
|
-
checkpoint_path=checkpoint_path,
|
|
489
|
-
)
|
|
490
|
-
|
|
491
|
-
assert result.status == "committed"
|
|
492
|
-
changed = set(
|
|
493
|
-
_git(tmp_path, "diff-tree", "--no-commit-id", "--name-only", "-r", "HEAD").splitlines()
|
|
494
|
-
)
|
|
495
|
-
assert changed == {"tracked.txt", "AGENTS.md", ".codex/config.toml"}
|
|
496
|
-
assert _git(tmp_path, "status", "--porcelain") == ""
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
def test_runtime_commit_allows_task_path_adjacent_to_internal_namespace(tmp_path):
|
|
500
|
-
base_head = _init_repo(tmp_path)
|
|
501
|
-
artifact_dir, checkpoint_path = _write_commit_ready_checkpoint(tmp_path)
|
|
502
|
-
adjacent_path = tmp_path / ".prizmkitx" / "task.txt"
|
|
503
|
-
adjacent_path.parent.mkdir()
|
|
504
|
-
adjacent_path.write_text("task-owned\n", encoding="utf-8")
|
|
505
|
-
_write_request(tmp_path, artifact_dir, base_head)
|
|
506
|
-
|
|
507
|
-
result = finalize_runtime_commit(
|
|
508
|
-
tmp_path,
|
|
509
|
-
artifact_dir=artifact_dir,
|
|
510
|
-
checkpoint_path=checkpoint_path,
|
|
511
|
-
)
|
|
512
|
-
|
|
513
|
-
assert result.status == "committed"
|
|
514
|
-
assert _git(tmp_path, "diff-tree", "--no-commit-id", "--name-only", "-r", "HEAD") == ".prizmkitx/task.txt"
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
def test_runtime_commit_ignores_project_gitignored_transient_data(tmp_path):
|
|
518
|
-
_init_repo(tmp_path)
|
|
519
|
-
gitignore = tmp_path / ".gitignore"
|
|
520
|
-
gitignore.write_text(gitignore.read_text(encoding="utf-8") + "tmp/\n", encoding="utf-8")
|
|
521
|
-
_git(tmp_path, "add", ".gitignore")
|
|
522
|
-
_git(tmp_path, "commit", "-m", "ignore project transient data")
|
|
523
|
-
base_head = _git(tmp_path, "rev-parse", "HEAD")
|
|
524
|
-
artifact_dir, checkpoint_path = _write_commit_ready_checkpoint(tmp_path)
|
|
525
|
-
(tmp_path / "tracked.txt").write_text("after\n", encoding="utf-8")
|
|
526
|
-
transient = tmp_path / "tmp" / "tool-cache.json"
|
|
527
|
-
transient.parent.mkdir()
|
|
528
|
-
transient.write_text('{"cache":true}\n', encoding="utf-8")
|
|
529
|
-
_write_request(tmp_path, artifact_dir, base_head)
|
|
530
|
-
|
|
531
|
-
result = finalize_runtime_commit(
|
|
532
|
-
tmp_path,
|
|
533
|
-
artifact_dir=artifact_dir,
|
|
534
|
-
checkpoint_path=checkpoint_path,
|
|
535
|
-
)
|
|
536
|
-
|
|
537
|
-
assert result.status == "committed"
|
|
538
|
-
assert _git(tmp_path, "diff-tree", "--no-commit-id", "--name-only", "-r", "HEAD") == "tracked.txt"
|
|
539
|
-
assert transient.read_text(encoding="utf-8") == '{"cache":true}\n'
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
def test_runtime_commit_includes_preexisting_git_visible_change_without_manifest(tmp_path):
|
|
543
|
-
base_head = _init_repo(tmp_path)
|
|
544
|
-
artifact_dir, checkpoint_path = _write_commit_ready_checkpoint(tmp_path)
|
|
545
|
-
(tmp_path / "tracked.txt").write_text("after\n", encoding="utf-8")
|
|
546
|
-
(tmp_path / "preexisting.txt").write_text("validated existing work\n", encoding="utf-8")
|
|
547
|
-
_write_request(tmp_path, artifact_dir, base_head)
|
|
548
|
-
|
|
549
|
-
result = finalize_runtime_commit(
|
|
550
|
-
tmp_path,
|
|
551
|
-
artifact_dir=artifact_dir,
|
|
552
|
-
checkpoint_path=checkpoint_path,
|
|
553
|
-
)
|
|
554
|
-
|
|
555
|
-
assert result.status == "committed"
|
|
556
|
-
changed = set(
|
|
557
|
-
_git(tmp_path, "diff-tree", "--no-commit-id", "--name-only", "-r", "HEAD").splitlines()
|
|
558
|
-
)
|
|
559
|
-
assert changed == {"tracked.txt", "preexisting.txt"}
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
def test_runtime_commit_recovers_commit_created_before_state_finalization(tmp_path):
|
|
563
|
-
base_head = _init_repo(tmp_path)
|
|
564
|
-
artifact_dir, checkpoint_path = _write_commit_ready_checkpoint(tmp_path)
|
|
565
|
-
(tmp_path / "tracked.txt").write_text("after\n", encoding="utf-8")
|
|
566
|
-
_write_request(tmp_path, artifact_dir, base_head)
|
|
567
|
-
_git(tmp_path, "add", "tracked.txt")
|
|
568
|
-
_git(tmp_path, "commit", "-m", "fix(runtime): finalize prepared task")
|
|
569
|
-
committed_head = _git(tmp_path, "rev-parse", "HEAD")
|
|
570
|
-
|
|
571
|
-
result = finalize_runtime_commit(
|
|
572
|
-
tmp_path,
|
|
573
|
-
artifact_dir=artifact_dir,
|
|
574
|
-
checkpoint_path=checkpoint_path,
|
|
575
|
-
)
|
|
576
|
-
|
|
577
|
-
assert result.status == "committed"
|
|
578
|
-
assert result.commit_hash == committed_head
|
|
579
|
-
assert result.recovered is True
|
|
580
|
-
assert _git(tmp_path, "rev-list", "--count", f"{base_head}..HEAD") == "1"
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
def test_runtime_commit_rejects_recovery_commit_containing_causal_bookkeeping(tmp_path):
|
|
584
|
-
base_head = _init_repo(tmp_path)
|
|
585
|
-
artifact_dir, checkpoint_path = _write_commit_ready_checkpoint(tmp_path)
|
|
586
|
-
(tmp_path / "tracked.txt").write_text("after\n", encoding="utf-8")
|
|
587
|
-
request_path = _write_request(tmp_path, artifact_dir, base_head)
|
|
588
|
-
_git(
|
|
589
|
-
tmp_path,
|
|
590
|
-
"add",
|
|
591
|
-
"-f",
|
|
592
|
-
"tracked.txt",
|
|
593
|
-
checkpoint_path.relative_to(tmp_path).as_posix(),
|
|
594
|
-
request_path.relative_to(tmp_path).as_posix(),
|
|
595
|
-
)
|
|
596
|
-
_git(tmp_path, "commit", "-m", "fix(runtime): finalize prepared task")
|
|
597
|
-
|
|
598
|
-
result = finalize_runtime_commit(
|
|
599
|
-
tmp_path,
|
|
600
|
-
artifact_dir=artifact_dir,
|
|
601
|
-
checkpoint_path=checkpoint_path,
|
|
602
|
-
)
|
|
603
|
-
|
|
604
|
-
assert result.status == "failed"
|
|
605
|
-
assert result.reason == "base_head_mismatch"
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
def test_runtime_commit_recovers_after_checkpoint_finalization_failure(tmp_path, monkeypatch):
|
|
609
|
-
import prizmkit_runtime.runtime_commit as runtime_commit
|
|
610
|
-
|
|
611
|
-
base_head = _init_repo(tmp_path)
|
|
612
|
-
artifact_dir, checkpoint_path = _write_commit_ready_checkpoint(tmp_path)
|
|
613
|
-
(tmp_path / "tracked.txt").write_text("after\n", encoding="utf-8")
|
|
614
|
-
request_path = _write_request(tmp_path, artifact_dir, base_head)
|
|
615
|
-
|
|
616
|
-
original_finalize = runtime_commit._finalize_checkpoint
|
|
617
|
-
monkeypatch.setattr(
|
|
618
|
-
runtime_commit,
|
|
619
|
-
"_finalize_checkpoint",
|
|
620
|
-
lambda _path, **_kwargs: "checkpoint_commit_finalization_failed",
|
|
621
|
-
)
|
|
622
|
-
first = finalize_runtime_commit(
|
|
623
|
-
tmp_path,
|
|
624
|
-
artifact_dir=artifact_dir,
|
|
625
|
-
checkpoint_path=checkpoint_path,
|
|
626
|
-
)
|
|
627
|
-
|
|
628
|
-
assert first.status == "failed"
|
|
629
|
-
assert first.reason == "checkpoint_commit_finalization_failed"
|
|
630
|
-
committed_head = _git(tmp_path, "rev-parse", "HEAD")
|
|
631
|
-
request = json.loads(request_path.read_text(encoding="utf-8"))
|
|
632
|
-
assert request["runtime_commit_hash"] == committed_head
|
|
633
|
-
|
|
634
|
-
monkeypatch.setattr(runtime_commit, "_finalize_checkpoint", original_finalize)
|
|
635
|
-
second = finalize_runtime_commit(
|
|
636
|
-
tmp_path,
|
|
637
|
-
artifact_dir=artifact_dir,
|
|
638
|
-
checkpoint_path=checkpoint_path,
|
|
639
|
-
)
|
|
640
|
-
|
|
641
|
-
assert second.status == "committed"
|
|
642
|
-
assert second.recovered is True
|
|
643
|
-
assert second.commit_hash == committed_head
|
|
644
|
-
assert _git(tmp_path, "rev-list", "--count", f"{base_head}..HEAD") == "1"
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
def test_runtime_commit_recovers_cleanup_after_completed_checkpoint(tmp_path, monkeypatch):
|
|
648
|
-
base_head = _init_repo(tmp_path)
|
|
649
|
-
artifact_dir, checkpoint_path = _write_commit_ready_checkpoint(tmp_path)
|
|
650
|
-
(tmp_path / "tracked.txt").write_text("after\n", encoding="utf-8")
|
|
651
|
-
request_path = _write_request(tmp_path, artifact_dir, base_head)
|
|
652
|
-
|
|
653
|
-
original_unlink = Path.unlink
|
|
654
|
-
|
|
655
|
-
def fail_request_cleanup(path, *args, **kwargs):
|
|
656
|
-
if path == request_path:
|
|
657
|
-
raise OSError("simulated cleanup failure")
|
|
658
|
-
return original_unlink(path, *args, **kwargs)
|
|
659
|
-
|
|
660
|
-
monkeypatch.setattr(Path, "unlink", fail_request_cleanup)
|
|
661
|
-
first = finalize_runtime_commit(
|
|
662
|
-
tmp_path,
|
|
663
|
-
artifact_dir=artifact_dir,
|
|
664
|
-
checkpoint_path=checkpoint_path,
|
|
665
|
-
)
|
|
666
|
-
|
|
667
|
-
assert first.status == "failed"
|
|
668
|
-
assert first.reason == "commit_request_cleanup_failed"
|
|
669
|
-
assert request_path.is_file()
|
|
670
|
-
|
|
671
|
-
monkeypatch.setattr(Path, "unlink", original_unlink)
|
|
672
|
-
second = finalize_runtime_commit(
|
|
673
|
-
tmp_path,
|
|
674
|
-
artifact_dir=artifact_dir,
|
|
675
|
-
checkpoint_path=checkpoint_path,
|
|
676
|
-
)
|
|
677
|
-
|
|
678
|
-
assert second.status == "committed"
|
|
679
|
-
assert second.recovered is True
|
|
680
|
-
assert not request_path.exists()
|
|
681
|
-
assert _git(tmp_path, "rev-list", "--count", f"{base_head}..HEAD") == "1"
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
def test_runtime_commit_disables_repository_hooks(tmp_path):
|
|
685
|
-
base_head = _init_repo(tmp_path)
|
|
686
|
-
artifact_dir, checkpoint_path = _write_commit_ready_checkpoint(tmp_path)
|
|
687
|
-
hook = tmp_path / ".git" / "hooks" / "pre-commit"
|
|
688
|
-
hook.write_text(
|
|
689
|
-
"#!/bin/sh\nprintf 'hook mutation\\n' > hook-output.txt\ngit add hook-output.txt\n",
|
|
690
|
-
encoding="utf-8",
|
|
691
|
-
)
|
|
692
|
-
hook.chmod(0o755)
|
|
693
|
-
(tmp_path / "tracked.txt").write_text("after\n", encoding="utf-8")
|
|
694
|
-
_write_request(tmp_path, artifact_dir, base_head)
|
|
695
|
-
|
|
696
|
-
result = finalize_runtime_commit(
|
|
697
|
-
tmp_path,
|
|
698
|
-
artifact_dir=artifact_dir,
|
|
699
|
-
checkpoint_path=checkpoint_path,
|
|
700
|
-
)
|
|
701
|
-
|
|
702
|
-
assert result.status == "committed"
|
|
703
|
-
assert not (tmp_path / "hook-output.txt").exists()
|
|
704
|
-
assert _git(tmp_path, "diff-tree", "--no-commit-id", "--name-only", "-r", "HEAD") == "tracked.txt"
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
def test_runtime_commit_handles_rename_as_exact_delete_and_add(tmp_path):
|
|
708
|
-
_init_repo(tmp_path)
|
|
709
|
-
old_path = tmp_path / "old-name.txt"
|
|
710
|
-
old_path.write_text("rename me\n", encoding="utf-8")
|
|
711
|
-
_git(tmp_path, "add", "old-name.txt")
|
|
712
|
-
_git(tmp_path, "commit", "-m", "add rename source")
|
|
713
|
-
base_head = _git(tmp_path, "rev-parse", "HEAD")
|
|
714
|
-
artifact_dir, checkpoint_path = _write_commit_ready_checkpoint(tmp_path)
|
|
715
|
-
old_path.rename(tmp_path / "new-name.txt")
|
|
716
|
-
_write_request(tmp_path, artifact_dir, base_head)
|
|
717
|
-
|
|
718
|
-
result = finalize_runtime_commit(
|
|
719
|
-
tmp_path,
|
|
720
|
-
artifact_dir=artifact_dir,
|
|
721
|
-
checkpoint_path=checkpoint_path,
|
|
722
|
-
)
|
|
723
|
-
|
|
724
|
-
assert result.status == "committed"
|
|
725
|
-
changed = _git(
|
|
726
|
-
tmp_path,
|
|
727
|
-
"diff-tree",
|
|
728
|
-
"--no-commit-id",
|
|
729
|
-
"--name-only",
|
|
730
|
-
"--no-renames",
|
|
731
|
-
"-r",
|
|
732
|
-
"HEAD",
|
|
733
|
-
).splitlines()
|
|
734
|
-
assert set(changed) == {"old-name.txt", "new-name.txt"}
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
@pytest.mark.parametrize(
|
|
738
|
-
"unsafe_path",
|
|
739
|
-
[
|
|
740
|
-
".env",
|
|
741
|
-
"credentials.json",
|
|
742
|
-
"secrets.json",
|
|
743
|
-
"private.pem",
|
|
744
|
-
".codex/settings.local.json",
|
|
745
|
-
],
|
|
746
|
-
)
|
|
747
|
-
def test_runtime_commit_rejects_sensitive_git_visible_workspace_path(tmp_path, unsafe_path):
|
|
748
|
-
base_head = _init_repo(tmp_path)
|
|
749
|
-
artifact_dir, checkpoint_path = _write_commit_ready_checkpoint(tmp_path)
|
|
750
|
-
unsafe = tmp_path / unsafe_path
|
|
751
|
-
unsafe.parent.mkdir(parents=True, exist_ok=True)
|
|
752
|
-
unsafe.write_text("sensitive\n", encoding="utf-8")
|
|
753
|
-
_write_request(tmp_path, artifact_dir, base_head)
|
|
754
|
-
|
|
755
|
-
result = finalize_runtime_commit(
|
|
756
|
-
tmp_path,
|
|
757
|
-
artifact_dir=artifact_dir,
|
|
758
|
-
checkpoint_path=checkpoint_path,
|
|
759
|
-
)
|
|
760
|
-
|
|
761
|
-
assert result.status == "failed"
|
|
762
|
-
assert result.reason == "sensitive_workspace_path"
|
|
763
|
-
assert _git(tmp_path, "rev-parse", "HEAD") == base_head
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
def test_accepted_workspace_commit_stages_safe_complete_workspace(tmp_path):
|
|
767
|
-
base_head = _init_repo(tmp_path)
|
|
768
|
-
artifact_dir = tmp_path / ".prizmkit" / "specs" / "001-accepted"
|
|
769
|
-
artifact_dir.mkdir(parents=True)
|
|
770
|
-
checkpoint_path = artifact_dir / "workflow-checkpoint.json"
|
|
771
|
-
checkpoint_path.write_text('{"steps": []}\n', encoding="utf-8")
|
|
772
|
-
(tmp_path / "tracked.txt").write_text("accepted\n", encoding="utf-8")
|
|
773
|
-
(tmp_path / "new.txt").write_text("new\n", encoding="utf-8")
|
|
774
|
-
|
|
775
|
-
result = finalize_accepted_workspace_commit(
|
|
776
|
-
tmp_path,
|
|
777
|
-
artifact_dir=artifact_dir,
|
|
778
|
-
checkpoint_path=checkpoint_path,
|
|
779
|
-
base_head=base_head,
|
|
780
|
-
commit_message="chore: accept incomplete workflow output",
|
|
781
|
-
)
|
|
782
|
-
|
|
783
|
-
assert result.status == "committed"
|
|
784
|
-
assert _git(tmp_path, "show", "-s", "--format=%s", "HEAD") == "chore: accept incomplete workflow output"
|
|
785
|
-
assert set(_git(tmp_path, "diff-tree", "--no-commit-id", "--name-only", "-r", "HEAD").splitlines()) == {"new.txt", "tracked.txt"}
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
def test_accepted_workspace_commit_excludes_exact_causal_checkpoint(tmp_path):
|
|
789
|
-
_init_repo(tmp_path)
|
|
790
|
-
(tmp_path / ".gitignore").write_text("", encoding="utf-8")
|
|
791
|
-
artifact_dir = tmp_path / ".prizmkit" / "specs" / "001-accepted"
|
|
792
|
-
artifact_dir.mkdir(parents=True)
|
|
793
|
-
checkpoint_path = artifact_dir / "workflow-checkpoint.json"
|
|
794
|
-
checkpoint_path.write_text('{"steps": []}\n', encoding="utf-8")
|
|
795
|
-
_git(tmp_path, "add", ".gitignore", checkpoint_path.relative_to(tmp_path).as_posix())
|
|
796
|
-
_git(tmp_path, "commit", "-m", "track causal checkpoint")
|
|
797
|
-
base_head = _git(tmp_path, "rev-parse", "HEAD")
|
|
798
|
-
checkpoint_path.write_text('{"steps": [{"status": "in_progress"}]}\n', encoding="utf-8")
|
|
799
|
-
(tmp_path / "tracked.txt").write_text("accepted\n", encoding="utf-8")
|
|
800
|
-
|
|
801
|
-
result = finalize_accepted_workspace_commit(
|
|
802
|
-
tmp_path,
|
|
803
|
-
artifact_dir=artifact_dir,
|
|
804
|
-
checkpoint_path=checkpoint_path,
|
|
805
|
-
base_head=base_head,
|
|
806
|
-
commit_message="chore: accept incomplete workflow output",
|
|
807
|
-
)
|
|
808
|
-
|
|
809
|
-
assert result.status == "committed"
|
|
810
|
-
assert _git(tmp_path, "diff-tree", "--no-commit-id", "--name-only", "-r", "HEAD") == "tracked.txt"
|
|
811
|
-
assert checkpoint_path.relative_to(tmp_path).as_posix() in _git(tmp_path, "status", "--short")
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
@pytest.mark.parametrize("unsafe_path", [".env", "credentials.json", "private.pem"])
|
|
815
|
-
def test_accepted_workspace_commit_rejects_sensitive_paths(tmp_path, unsafe_path):
|
|
816
|
-
base_head = _init_repo(tmp_path)
|
|
817
|
-
artifact_dir = tmp_path / ".prizmkit" / "specs" / "001-accepted"
|
|
818
|
-
artifact_dir.mkdir(parents=True)
|
|
819
|
-
checkpoint_path = artifact_dir / "workflow-checkpoint.json"
|
|
820
|
-
checkpoint_path.write_text('{"steps": []}\n', encoding="utf-8")
|
|
821
|
-
unsafe = tmp_path / unsafe_path
|
|
822
|
-
unsafe.parent.mkdir(parents=True, exist_ok=True)
|
|
823
|
-
unsafe.write_text("sensitive\n", encoding="utf-8")
|
|
824
|
-
|
|
825
|
-
result = finalize_accepted_workspace_commit(
|
|
826
|
-
tmp_path,
|
|
827
|
-
artifact_dir=artifact_dir,
|
|
828
|
-
checkpoint_path=checkpoint_path,
|
|
829
|
-
base_head=base_head,
|
|
830
|
-
commit_message="chore: accept incomplete workflow output",
|
|
831
|
-
)
|
|
832
|
-
|
|
833
|
-
assert result.status == "failed"
|
|
834
|
-
assert result.reason == "sensitive_workspace_path"
|
|
835
|
-
assert _git(tmp_path, "rev-parse", "HEAD") == base_head
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
def test_accepted_workspace_commit_rejects_any_post_base_commit(tmp_path):
|
|
839
|
-
base_head = _init_repo(tmp_path)
|
|
840
|
-
unsafe = tmp_path / "credentials.json"
|
|
841
|
-
unsafe.write_text("sensitive\n", encoding="utf-8")
|
|
842
|
-
_git(tmp_path, "add", "credentials.json")
|
|
843
|
-
_git(tmp_path, "commit", "-m", "unsafe task commit")
|
|
844
|
-
artifact_dir = tmp_path / ".prizmkit" / "specs" / "001-accepted"
|
|
845
|
-
artifact_dir.mkdir(parents=True)
|
|
846
|
-
checkpoint_path = artifact_dir / "workflow-checkpoint.json"
|
|
847
|
-
checkpoint_path.write_text('{"steps": []}\n', encoding="utf-8")
|
|
848
|
-
|
|
849
|
-
result = finalize_accepted_workspace_commit(
|
|
850
|
-
tmp_path,
|
|
851
|
-
artifact_dir=artifact_dir,
|
|
852
|
-
checkpoint_path=checkpoint_path,
|
|
853
|
-
base_head=base_head,
|
|
854
|
-
commit_message="chore: accept incomplete workflow output",
|
|
855
|
-
)
|
|
856
|
-
|
|
857
|
-
assert result.status == "failed"
|
|
858
|
-
assert result.reason == "unexpected_existing_commit"
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
def test_accepted_workspace_commit_rejects_unresolved_merge_state(tmp_path):
|
|
862
|
-
_init_repo(tmp_path)
|
|
863
|
-
initial_branch = _git(tmp_path, "branch", "--show-current")
|
|
864
|
-
_git(tmp_path, "checkout", "-b", "other")
|
|
865
|
-
(tmp_path / "tracked.txt").write_text("other\n", encoding="utf-8")
|
|
866
|
-
_git(tmp_path, "add", "tracked.txt")
|
|
867
|
-
_git(tmp_path, "commit", "-m", "other change")
|
|
868
|
-
_git(tmp_path, "checkout", initial_branch)
|
|
869
|
-
(tmp_path / "tracked.txt").write_text("main\n", encoding="utf-8")
|
|
870
|
-
_git(tmp_path, "add", "tracked.txt")
|
|
871
|
-
_git(tmp_path, "commit", "-m", "main change")
|
|
872
|
-
base_head = _git(tmp_path, "rev-parse", "HEAD")
|
|
873
|
-
merged = subprocess.run(
|
|
874
|
-
["git", "merge", "other"],
|
|
875
|
-
cwd=tmp_path,
|
|
876
|
-
stdout=subprocess.PIPE,
|
|
877
|
-
stderr=subprocess.PIPE,
|
|
878
|
-
text=True,
|
|
879
|
-
check=False,
|
|
880
|
-
)
|
|
881
|
-
assert merged.returncode != 0
|
|
882
|
-
artifact_dir = tmp_path / ".prizmkit" / "specs" / "001-accepted"
|
|
883
|
-
artifact_dir.mkdir(parents=True)
|
|
884
|
-
checkpoint_path = artifact_dir / "workflow-checkpoint.json"
|
|
885
|
-
checkpoint_path.write_text('{"steps": []}\n', encoding="utf-8")
|
|
886
|
-
|
|
887
|
-
result = finalize_accepted_workspace_commit(
|
|
888
|
-
tmp_path,
|
|
889
|
-
artifact_dir=artifact_dir,
|
|
890
|
-
checkpoint_path=checkpoint_path,
|
|
891
|
-
base_head=base_head,
|
|
892
|
-
commit_message="chore: accept incomplete workflow output",
|
|
893
|
-
)
|
|
894
|
-
|
|
895
|
-
assert result.status == "failed"
|
|
896
|
-
assert result.reason == "unresolved_merge_state"
|
|
897
|
-
assert _git(tmp_path, "rev-parse", "HEAD") == base_head
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
def test_runtime_commit_rejects_empty_workspace(tmp_path):
|
|
901
|
-
base_head = _init_repo(tmp_path)
|
|
902
|
-
artifact_dir, checkpoint_path = _write_commit_ready_checkpoint(tmp_path)
|
|
903
|
-
_write_request(tmp_path, artifact_dir, base_head)
|
|
904
|
-
|
|
905
|
-
result = finalize_runtime_commit(
|
|
906
|
-
tmp_path,
|
|
907
|
-
artifact_dir=artifact_dir,
|
|
908
|
-
checkpoint_path=checkpoint_path,
|
|
909
|
-
)
|
|
910
|
-
|
|
911
|
-
assert result.status == "failed"
|
|
912
|
-
assert result.reason == "empty_workspace_change"
|
|
913
|
-
assert _git(tmp_path, "rev-parse", "HEAD") == base_head
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
def test_runtime_commit_rejects_unresolved_merge_state(tmp_path):
|
|
917
|
-
_init_repo(tmp_path)
|
|
918
|
-
initial_branch = _git(tmp_path, "branch", "--show-current")
|
|
919
|
-
_git(tmp_path, "checkout", "-b", "other")
|
|
920
|
-
(tmp_path / "tracked.txt").write_text("other\n", encoding="utf-8")
|
|
921
|
-
_git(tmp_path, "add", "tracked.txt")
|
|
922
|
-
_git(tmp_path, "commit", "-m", "other change")
|
|
923
|
-
_git(tmp_path, "checkout", initial_branch)
|
|
924
|
-
(tmp_path / "tracked.txt").write_text("master\n", encoding="utf-8")
|
|
925
|
-
_git(tmp_path, "add", "tracked.txt")
|
|
926
|
-
_git(tmp_path, "commit", "-m", "master change")
|
|
927
|
-
base_head = _git(tmp_path, "rev-parse", "HEAD")
|
|
928
|
-
merged = subprocess.run(
|
|
929
|
-
["git", "merge", "other"],
|
|
930
|
-
cwd=tmp_path,
|
|
931
|
-
stdout=subprocess.PIPE,
|
|
932
|
-
stderr=subprocess.PIPE,
|
|
933
|
-
text=True,
|
|
934
|
-
check=False,
|
|
935
|
-
)
|
|
936
|
-
assert merged.returncode != 0
|
|
937
|
-
artifact_dir, checkpoint_path = _write_commit_ready_checkpoint(tmp_path)
|
|
938
|
-
_write_request(tmp_path, artifact_dir, base_head)
|
|
939
|
-
|
|
940
|
-
result = finalize_runtime_commit(
|
|
941
|
-
tmp_path,
|
|
942
|
-
artifact_dir=artifact_dir,
|
|
943
|
-
checkpoint_path=checkpoint_path,
|
|
944
|
-
)
|
|
945
|
-
|
|
946
|
-
assert result.status == "failed"
|
|
947
|
-
assert result.reason == "unresolved_merge_state"
|
|
948
|
-
assert _git(tmp_path, "rev-parse", "HEAD") == base_head
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
def test_runtime_commit_rejects_already_staged_runtime_bookkeeping(tmp_path):
|
|
952
|
-
base_head = _init_repo(tmp_path)
|
|
953
|
-
artifact_dir, checkpoint_path = _write_commit_ready_checkpoint(tmp_path)
|
|
954
|
-
(tmp_path / "tracked.txt").write_text("after\n", encoding="utf-8")
|
|
955
|
-
request_path = _write_request(tmp_path, artifact_dir, base_head)
|
|
956
|
-
_git(
|
|
957
|
-
tmp_path,
|
|
958
|
-
"add",
|
|
959
|
-
"-f",
|
|
960
|
-
checkpoint_path.relative_to(tmp_path).as_posix(),
|
|
961
|
-
request_path.relative_to(tmp_path).as_posix(),
|
|
962
|
-
)
|
|
963
|
-
|
|
964
|
-
result = finalize_runtime_commit(
|
|
965
|
-
tmp_path,
|
|
966
|
-
artifact_dir=artifact_dir,
|
|
967
|
-
checkpoint_path=checkpoint_path,
|
|
968
|
-
)
|
|
969
|
-
|
|
970
|
-
assert result.status == "failed"
|
|
971
|
-
assert result.reason == "runtime_bookkeeping_staged"
|
|
972
|
-
assert _git(tmp_path, "rev-parse", "HEAD") == base_head
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
def test_runtime_commit_rejects_schema_v1_path_manifest(tmp_path):
|
|
976
|
-
base_head = _init_repo(tmp_path)
|
|
977
|
-
artifact_dir, checkpoint_path = _write_commit_ready_checkpoint(tmp_path)
|
|
978
|
-
(tmp_path / "tracked.txt").write_text("after\n", encoding="utf-8")
|
|
979
|
-
request_path = _write_request(tmp_path, artifact_dir, base_head)
|
|
980
|
-
request = json.loads(request_path.read_text(encoding="utf-8"))
|
|
981
|
-
request["schema_version"] = 1
|
|
982
|
-
request["intended_paths"] = ["tracked.txt"]
|
|
983
|
-
request_path.write_text(json.dumps(request), encoding="utf-8")
|
|
984
|
-
|
|
985
|
-
result = finalize_runtime_commit(
|
|
986
|
-
tmp_path,
|
|
987
|
-
artifact_dir=artifact_dir,
|
|
988
|
-
checkpoint_path=checkpoint_path,
|
|
989
|
-
)
|
|
990
|
-
|
|
991
|
-
assert result.status == "failed"
|
|
992
|
-
assert result.reason == "commit_request_invalid_schema"
|
|
993
|
-
assert _git(tmp_path, "rev-parse", "HEAD") == base_head
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
def test_runtime_commit_includes_already_staged_and_unstaged_workspace(tmp_path):
|
|
997
|
-
_init_repo(tmp_path)
|
|
998
|
-
support = tmp_path / "AGENTS.md"
|
|
999
|
-
support.write_text("before\n", encoding="utf-8")
|
|
1000
|
-
_git(tmp_path, "add", "AGENTS.md")
|
|
1001
|
-
_git(tmp_path, "commit", "-m", "track support")
|
|
1002
|
-
base_head = _git(tmp_path, "rev-parse", "HEAD")
|
|
1003
|
-
artifact_dir, checkpoint_path = _write_commit_ready_checkpoint(tmp_path)
|
|
1004
|
-
(tmp_path / "tracked.txt").write_text("after\n", encoding="utf-8")
|
|
1005
|
-
support.write_text("after\n", encoding="utf-8")
|
|
1006
|
-
_git(tmp_path, "add", "AGENTS.md")
|
|
1007
|
-
_write_request(tmp_path, artifact_dir, base_head)
|
|
1008
|
-
|
|
1009
|
-
result = finalize_runtime_commit(
|
|
1010
|
-
tmp_path,
|
|
1011
|
-
artifact_dir=artifact_dir,
|
|
1012
|
-
checkpoint_path=checkpoint_path,
|
|
1013
|
-
)
|
|
1014
|
-
|
|
1015
|
-
assert result.status == "committed"
|
|
1016
|
-
changed = set(
|
|
1017
|
-
_git(tmp_path, "diff-tree", "--no-commit-id", "--name-only", "-r", "HEAD").splitlines()
|
|
1018
|
-
)
|
|
1019
|
-
assert changed == {"AGENTS.md", "tracked.txt"}
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
def test_runtime_commit_keeps_tracked_post_commit_bookkeeping_out_of_snapshot(tmp_path):
|
|
1023
|
-
from prizmkit_runtime.gitops import HIDDEN_TOOL_WORKTREE_EXCLUDES
|
|
1024
|
-
|
|
1025
|
-
initial_head = _init_repo(tmp_path)
|
|
1026
|
-
artifact_dir, checkpoint_path = _write_commit_ready_checkpoint(tmp_path)
|
|
1027
|
-
request_path = _write_request(tmp_path, artifact_dir, initial_head)
|
|
1028
|
-
checkpoint_rel = checkpoint_path.relative_to(tmp_path).as_posix()
|
|
1029
|
-
request_rel = request_path.relative_to(tmp_path).as_posix()
|
|
1030
|
-
_git(tmp_path, "add", "-f", checkpoint_rel, request_rel)
|
|
1031
|
-
_git(tmp_path, "commit", "-m", "track runtime bookkeeping by project policy")
|
|
1032
|
-
base_head = _git(tmp_path, "rev-parse", "HEAD")
|
|
1033
|
-
_write_request(tmp_path, artifact_dir, base_head)
|
|
1034
|
-
(tmp_path / "tracked.txt").write_text("after\n", encoding="utf-8")
|
|
1035
|
-
|
|
1036
|
-
result = finalize_runtime_commit(
|
|
1037
|
-
tmp_path,
|
|
1038
|
-
artifact_dir=artifact_dir,
|
|
1039
|
-
checkpoint_path=checkpoint_path,
|
|
1040
|
-
)
|
|
1041
|
-
|
|
1042
|
-
assert result.status == "committed", result
|
|
1043
|
-
assert _git(tmp_path, "diff-tree", "--no-commit-id", "--name-only", "-r", "HEAD") == "tracked.txt"
|
|
1044
|
-
assert checkpoint_rel not in _git(tmp_path, "diff-tree", "--no-commit-id", "--name-only", "-r", "HEAD")
|
|
1045
|
-
visible = _git(
|
|
1046
|
-
tmp_path,
|
|
1047
|
-
"status",
|
|
1048
|
-
"--porcelain",
|
|
1049
|
-
"--",
|
|
1050
|
-
".",
|
|
1051
|
-
*HIDDEN_TOOL_WORKTREE_EXCLUDES,
|
|
1052
|
-
)
|
|
1053
|
-
assert visible == ""
|
|
1054
|
-
raw_status = _git(tmp_path, "status", "--porcelain", "--", checkpoint_rel, request_rel)
|
|
1055
|
-
assert checkpoint_rel in raw_status
|
|
1056
|
-
assert request_rel in raw_status
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
def test_runtime_commit_rejects_caller_orchestration_fields(tmp_path):
|
|
1060
|
-
base_head = _init_repo(tmp_path)
|
|
1061
|
-
artifact_dir, checkpoint_path = _write_commit_ready_checkpoint(tmp_path)
|
|
1062
|
-
(tmp_path / "tracked.txt").write_text("after\n", encoding="utf-8")
|
|
1063
|
-
request_path = _write_request(tmp_path, artifact_dir, base_head)
|
|
1064
|
-
request = json.loads(request_path.read_text(encoding="utf-8"))
|
|
1065
|
-
request["caller_state_path"] = ".runtime/caller-state.json"
|
|
1066
|
-
request_path.write_text(json.dumps(request), encoding="utf-8")
|
|
1067
|
-
|
|
1068
|
-
result = finalize_runtime_commit(
|
|
1069
|
-
tmp_path,
|
|
1070
|
-
artifact_dir=artifact_dir,
|
|
1071
|
-
checkpoint_path=checkpoint_path,
|
|
1072
|
-
)
|
|
1073
|
-
|
|
1074
|
-
assert result.status == "failed"
|
|
1075
|
-
assert result.reason == "commit_request_invalid_schema"
|
|
1076
|
-
assert _git(tmp_path, "rev-parse", "HEAD") == base_head
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
def test_runtime_commit_rejects_ai_supplied_premature_runtime_hash(tmp_path):
|
|
1080
|
-
base_head = _init_repo(tmp_path)
|
|
1081
|
-
artifact_dir, checkpoint_path = _write_commit_ready_checkpoint(tmp_path)
|
|
1082
|
-
(tmp_path / "tracked.txt").write_text("after\n", encoding="utf-8")
|
|
1083
|
-
request_path = _write_request(tmp_path, artifact_dir, base_head)
|
|
1084
|
-
request = json.loads(request_path.read_text(encoding="utf-8"))
|
|
1085
|
-
request["runtime_commit_hash"] = "a" * 40
|
|
1086
|
-
request_path.write_text(json.dumps(request), encoding="utf-8")
|
|
1087
|
-
|
|
1088
|
-
result = finalize_runtime_commit(
|
|
1089
|
-
tmp_path,
|
|
1090
|
-
artifact_dir=artifact_dir,
|
|
1091
|
-
checkpoint_path=checkpoint_path,
|
|
1092
|
-
)
|
|
1093
|
-
|
|
1094
|
-
assert result.status == "failed"
|
|
1095
|
-
assert result.reason == "premature_runtime_commit_hash"
|
|
1096
|
-
assert _git(tmp_path, "rev-parse", "HEAD") == base_head
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
def test_runtime_commit_rejects_stale_base_head(tmp_path):
|
|
1100
|
-
base_head = _init_repo(tmp_path)
|
|
1101
|
-
artifact_dir, checkpoint_path = _write_commit_ready_checkpoint(tmp_path)
|
|
1102
|
-
(tmp_path / "tracked.txt").write_text("after\n", encoding="utf-8")
|
|
1103
|
-
_write_request(tmp_path, artifact_dir, "a" * 40)
|
|
1104
|
-
|
|
1105
|
-
result = finalize_runtime_commit(
|
|
1106
|
-
tmp_path,
|
|
1107
|
-
artifact_dir=artifact_dir,
|
|
1108
|
-
checkpoint_path=checkpoint_path,
|
|
1109
|
-
)
|
|
1110
|
-
|
|
1111
|
-
assert result.status == "failed"
|
|
1112
|
-
assert result.reason == "base_head_mismatch"
|
|
1113
|
-
assert _git(tmp_path, "rev-parse", "HEAD") == base_head
|