prizmkit 1.1.191 → 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/adapters/antigravity/skill-adapter.js +13 -4
- package/bundled/adapters/codex/skill-adapter.js +28 -8
- package/bundled/adapters/cursor/skill-adapter.js +13 -4
- package/bundled/adapters/pi/skill-adapter.js +28 -7
- package/bundled/dev-pipeline/.env.example +4 -12
- package/bundled/dev-pipeline/README.md +28 -44
- package/bundled/dev-pipeline/assets/feature-list-example.json +0 -1
- package/bundled/dev-pipeline/assets/skill-subagent-integration.md +6 -6
- package/bundled/dev-pipeline/prizmkit_runtime/atomic_io.py +48 -0
- package/bundled/dev-pipeline/prizmkit_runtime/checkpoint_state.py +66 -23
- package/bundled/dev-pipeline/prizmkit_runtime/cli.py +10 -7
- package/bundled/dev-pipeline/prizmkit_runtime/commands.py +2 -21
- package/bundled/dev-pipeline/prizmkit_runtime/config.py +48 -78
- package/bundled/dev-pipeline/prizmkit_runtime/daemon.py +127 -67
- package/bundled/dev-pipeline/prizmkit_runtime/gitops.py +158 -462
- package/bundled/dev-pipeline/prizmkit_runtime/heartbeat.py +102 -50
- package/bundled/dev-pipeline/prizmkit_runtime/interoperability.py +1 -25
- package/bundled/dev-pipeline/prizmkit_runtime/paths.py +0 -6
- package/bundled/dev-pipeline/prizmkit_runtime/platform_detection.py +47 -21
- package/bundled/dev-pipeline/prizmkit_runtime/processes.py +217 -156
- package/bundled/dev-pipeline/prizmkit_runtime/reset.py +39 -27
- package/bundled/dev-pipeline/prizmkit_runtime/reset_preserve.py +34 -174
- package/bundled/dev-pipeline/prizmkit_runtime/results.py +25 -0
- package/bundled/dev-pipeline/prizmkit_runtime/runner_bookkeeping.py +133 -110
- package/bundled/dev-pipeline/prizmkit_runtime/runner_classification.py +15 -5
- package/bundled/dev-pipeline/prizmkit_runtime/runner_models.py +1 -95
- package/bundled/dev-pipeline/prizmkit_runtime/runner_prompts.py +0 -2
- package/bundled/dev-pipeline/prizmkit_runtime/runner_status.py +7 -2
- package/bundled/dev-pipeline/prizmkit_runtime/runners.py +540 -262
- package/bundled/dev-pipeline/prizmkit_runtime/runtime_commit.py +175 -135
- package/bundled/dev-pipeline/prizmkit_runtime/runtime_helper.py +90 -9
- package/bundled/dev-pipeline/prizmkit_runtime/sessions.py +214 -133
- package/bundled/dev-pipeline/prizmkit_runtime/status.py +1 -3
- package/bundled/dev-pipeline/prizmkit_runtime/stream_progress.py +2783 -0
- package/bundled/dev-pipeline/prizmkit_runtime/task_checkout.py +27 -102
- package/bundled/dev-pipeline/prizmkit_runtime/test_result.py +58 -4
- package/bundled/dev-pipeline/scripts/check-session-status.py +56 -20
- package/bundled/dev-pipeline/scripts/continuation.py +8 -7
- package/bundled/dev-pipeline/scripts/detect-stuck.py +47 -33
- package/bundled/dev-pipeline/scripts/generate-bootstrap-prompt.py +13 -16
- package/bundled/dev-pipeline/scripts/generate-bugfix-prompt.py +20 -10
- package/bundled/dev-pipeline/scripts/init-bugfix-pipeline.py +10 -7
- package/bundled/dev-pipeline/scripts/init-change-artifact.py +25 -4
- package/bundled/dev-pipeline/scripts/init-pipeline.py +14 -69
- package/bundled/dev-pipeline/scripts/parse-stream-progress.py +31 -2616
- package/bundled/dev-pipeline/scripts/patch-completion-notes.py +4 -24
- package/bundled/dev-pipeline/scripts/prompt_framework.py +85 -20
- package/bundled/dev-pipeline/scripts/status_common.py +591 -0
- package/bundled/dev-pipeline/scripts/update-bug-status.py +85 -463
- package/bundled/dev-pipeline/scripts/update-checkpoint.py +254 -65
- package/bundled/dev-pipeline/scripts/update-feature-status.py +76 -509
- package/bundled/dev-pipeline/scripts/utils.py +5 -12
- package/bundled/dev-pipeline/templates/bootstrap-tier3.md +5 -5
- package/bundled/dev-pipeline/templates/bug-fix-list-schema.json +7 -0
- package/bundled/dev-pipeline/templates/bugfix-bootstrap-prompt.md +7 -7
- package/bundled/dev-pipeline/templates/sections/artifact-manifest.md +1 -1
- package/bundled/dev-pipeline/templates/sections/bugfix-phase-manual-verification.md +1 -1
- package/bundled/dev-pipeline/templates/sections/bugfix-phase-review.md +1 -1
- package/bundled/dev-pipeline/templates/sections/bugfix-phase-test.md +2 -1
- package/bundled/dev-pipeline/templates/sections/checkpoint-system.md +1 -1
- package/bundled/dev-pipeline/templates/sections/phase-browser-verification-auto.md +1 -1
- package/bundled/dev-pipeline/templates/sections/phase-browser-verification-opencli.md +2 -2
- package/bundled/dev-pipeline/templates/sections/phase-browser-verification.md +2 -2
- package/bundled/dev-pipeline/templates/sections/phase-prizmkit-test.md +2 -1
- package/bundled/dev-pipeline/templates/sections/phase-review-full.md +1 -1
- package/bundled/dev-pipeline/templates/sections/phase-specify-plan-full.md +3 -6
- package/bundled/dev-pipeline/templates/session-status-schema.json +2 -5
- package/bundled/skills/_metadata.json +9 -63
- package/bundled/skills/app-planner/SKILL.md +32 -303
- package/bundled/skills/app-planner/references/app-design-guide.md +0 -4
- package/bundled/skills/app-planner/references/generated-plan-review.md +2 -1
- package/bundled/skills/app-planner/references/project-brief-guide.md +14 -0
- package/bundled/skills/app-planner/references/project-conventions-discovery.md +4 -6
- package/bundled/skills/app-planner/references/project-state-detection.md +2 -3
- package/bundled/skills/bug-fix-workflow/SKILL.md +1 -2
- package/bundled/skills/bug-fix-workflow/references/bug-diagnosis.md +4 -7
- package/bundled/skills/bug-planner/SKILL.md +54 -435
- package/bundled/skills/bug-planner/references/generated-plan-review.md +3 -2
- package/bundled/skills/bug-planner/references/input-formats.md +32 -0
- package/bundled/skills/bugfix-pipeline-launcher/SKILL.md +4 -6
- package/bundled/skills/bugfix-pipeline-launcher/references/configuration.md +4 -28
- package/bundled/skills/feature-pipeline-launcher/SKILL.md +4 -6
- package/bundled/skills/feature-pipeline-launcher/references/configuration.md +4 -28
- package/bundled/skills/feature-planner/SKILL.md +60 -439
- package/bundled/skills/feature-planner/assets/planning-guide.md +1 -1
- package/bundled/skills/feature-planner/references/completeness-review.md +34 -0
- package/bundled/skills/feature-planner/references/decomposition-patterns.md +2 -2
- package/bundled/skills/feature-planner/references/error-recovery.md +1 -1
- package/bundled/skills/feature-planner/references/generated-plan-review.md +3 -2
- package/bundled/skills/feature-planner/references/incremental-feature-planning.md +3 -1
- package/bundled/skills/feature-workflow/SKILL.md +1 -2
- package/bundled/skills/prizmkit/SKILL.md +7 -1
- package/bundled/skills/prizmkit-code-review/SKILL.md +14 -6
- package/bundled/skills/prizmkit-code-review/references/independent-code-review.md +7 -4
- package/bundled/skills/prizmkit-code-review/references/review-report-template.md +16 -0
- package/bundled/skills/prizmkit-code-review/scripts/render_review_report.py +58 -20
- package/bundled/skills/prizmkit-implement/SKILL.md +1 -1
- package/bundled/skills/prizmkit-init/SKILL.md +24 -127
- package/bundled/skills/prizmkit-init/assets/project-brief-template.md +3 -3
- package/bundled/skills/prizmkit-plan/SKILL.md +6 -8
- package/bundled/skills/prizmkit-plan/references/clarify-guide.md +1 -1
- package/bundled/skills/prizmkit-plan/references/independent-plan-review.md +5 -2
- package/bundled/skills/prizmkit-plan/references/review-plan-spec-loop.md +6 -5
- package/bundled/skills/prizmkit-prizm-docs/SKILL.md +1 -13
- package/bundled/skills/prizmkit-prizm-docs/references/op-update.md +1 -1
- package/bundled/skills/prizmkit-retrospective/SKILL.md +6 -4
- package/bundled/skills/prizmkit-test/SKILL.md +25 -133
- package/bundled/skills/prizmkit-test/references/independent-test-review.md +5 -2
- package/bundled/skills/prizmkit-test/references/test-coverage-model.md +6 -0
- package/bundled/skills/prizmkit-workflow/SKILL.md +2 -3
- package/bundled/skills/prizmkit-workflow/references/workflow-state-protocol.md +4 -3
- package/bundled/skills/recovery-workflow/SKILL.md +7 -7
- package/bundled/skills/recovery-workflow/evals/evals.json +1 -1
- package/bundled/skills/recovery-workflow/references/detection.md +1 -3
- package/bundled/skills/recovery-workflow/scripts/detect-recovery-state.py +0 -6
- package/bundled/templates/project-memory-template.md +1 -2
- package/package.json +1 -1
- package/src/scaffold.js +28 -7
- package/bundled/dev-pipeline/SCHEMA_ANALYSIS.md +0 -53
- package/bundled/dev-pipeline/scripts/generate-refactor-prompt.py +0 -649
- package/bundled/dev-pipeline/scripts/init-refactor-pipeline.py +0 -463
- package/bundled/dev-pipeline/scripts/update-refactor-status.py +0 -1512
- package/bundled/dev-pipeline/templates/refactor-bootstrap-prompt.md +0 -240
- package/bundled/dev-pipeline/templates/refactor-list-schema.json +0 -266
- package/bundled/dev-pipeline/templates/sections/refactor-critical-paths.md +0 -15
- package/bundled/dev-pipeline/templates/sections/refactor-mission.md +0 -9
- package/bundled/dev-pipeline/templates/sections/refactor-phase-commit-report.md +0 -24
- package/bundled/dev-pipeline/templates/sections/refactor-phase-implement.md +0 -16
- package/bundled/dev-pipeline/templates/sections/refactor-phase-init.md +0 -9
- package/bundled/dev-pipeline/templates/sections/refactor-phase-plan.md +0 -22
- package/bundled/dev-pipeline/templates/sections/refactor-phase-review.md +0 -19
- package/bundled/dev-pipeline/templates/sections/refactor-phase-test.md +0 -24
- package/bundled/dev-pipeline/templates/sections/refactor-reminders.md +0 -12
- package/bundled/dev-pipeline/templates/sections/refactor-session-context.md +0 -6
- package/bundled/dev-pipeline/templates/sections/refactor-task-contract.md +0 -52
- package/bundled/dev-pipeline/tests/conftest.py +0 -29
- package/bundled/dev-pipeline/tests/live_ai_cli_log_smoke.py +0 -208
- package/bundled/dev-pipeline/tests/test_auto_skip.py +0 -1871
- package/bundled/dev-pipeline/tests/test_checkpoint_state.py +0 -1314
- package/bundled/dev-pipeline/tests/test_generate_bootstrap_prompt.py +0 -1712
- package/bundled/dev-pipeline/tests/test_generate_bugfix_prompt.py +0 -627
- package/bundled/dev-pipeline/tests/test_generate_refactor_prompt.py +0 -478
- package/bundled/dev-pipeline/tests/test_python_runner_parity.py +0 -5641
- package/bundled/dev-pipeline/tests/test_recovery_workflow.py +0 -322
- package/bundled/dev-pipeline/tests/test_repository_bootstrap.py +0 -252
- package/bundled/dev-pipeline/tests/test_reset_modes.py +0 -1208
- package/bundled/dev-pipeline/tests/test_reset_preserve.py +0 -957
- package/bundled/dev-pipeline/tests/test_runtime_commit.py +0 -1113
- package/bundled/dev-pipeline/tests/test_runtime_helper.py +0 -303
- package/bundled/dev-pipeline/tests/test_unified_cli.py +0 -5504
- package/bundled/dev-pipeline/tests/test_utils.py +0 -170
- package/bundled/skills/feature-planner/assets/evaluation-guide.md +0 -44
- package/bundled/skills/refactor-pipeline-launcher/SKILL.md +0 -219
- package/bundled/skills/refactor-pipeline-launcher/references/configuration.md +0 -78
- package/bundled/skills/refactor-planner/SKILL.md +0 -467
- package/bundled/skills/refactor-planner/assets/planning-guide.md +0 -291
- package/bundled/skills/refactor-planner/references/behavior-preservation.md +0 -187
- package/bundled/skills/refactor-planner/references/error-recovery.md +0 -45
- package/bundled/skills/refactor-planner/references/fast-path.md +0 -59
- package/bundled/skills/refactor-planner/references/generated-plan-review.md +0 -107
- package/bundled/skills/refactor-planner/references/planning-phases.md +0 -172
- package/bundled/skills/refactor-planner/references/refactor-scoping-guide.md +0 -230
- package/bundled/skills/refactor-planner/scripts/validate-and-generate-refactor.py +0 -1120
- package/bundled/skills/refactor-workflow/SKILL.md +0 -205
|
@@ -1,627 +0,0 @@
|
|
|
1
|
-
"""Tests for generate-bugfix-prompt.py core functions."""
|
|
2
|
-
|
|
3
|
-
from argparse import Namespace
|
|
4
|
-
from pathlib import Path
|
|
5
|
-
import json
|
|
6
|
-
import os
|
|
7
|
-
|
|
8
|
-
from generate_bugfix_prompt import (
|
|
9
|
-
build_replacements,
|
|
10
|
-
find_bug,
|
|
11
|
-
format_acceptance_criteria,
|
|
12
|
-
format_global_context,
|
|
13
|
-
format_error_source_details,
|
|
14
|
-
format_environment,
|
|
15
|
-
generate_bugfix_checkpoint,
|
|
16
|
-
bugfix_checkpoint_metadata,
|
|
17
|
-
merge_bugfix_checkpoint_state,
|
|
18
|
-
route_bugfix_repair,
|
|
19
|
-
process_conditional_blocks,
|
|
20
|
-
render_template,
|
|
21
|
-
assemble_bugfix_sections,
|
|
22
|
-
)
|
|
23
|
-
from continuation import append_continuation_handoff
|
|
24
|
-
|
|
25
|
-
REMOVED_MAX_LOG_ENV = "MAX_" + "LOG_SIZE"
|
|
26
|
-
REMOVED_MAX_LOG_HUMAN = REMOVED_MAX_LOG_ENV + "_HUMAN"
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
# ---------------------------------------------------------------------------
|
|
30
|
-
# find_bug
|
|
31
|
-
# ---------------------------------------------------------------------------
|
|
32
|
-
|
|
33
|
-
class TestFindBug:
|
|
34
|
-
def test_found(self):
|
|
35
|
-
bugs = [{"id": "B-001", "title": "A"}, {"id": "B-002", "title": "B"}]
|
|
36
|
-
assert find_bug(bugs, "B-002") == {"id": "B-002", "title": "B"}
|
|
37
|
-
|
|
38
|
-
def test_not_found(self):
|
|
39
|
-
assert find_bug([{"id": "B-001"}], "B-999") is None
|
|
40
|
-
|
|
41
|
-
def test_empty_list(self):
|
|
42
|
-
assert find_bug([], "B-001") is None
|
|
43
|
-
|
|
44
|
-
def test_non_dict_items(self):
|
|
45
|
-
assert find_bug(["garbage", 42, None, {"id": "B-001"}], "B-001") == {"id": "B-001"}
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
# ---------------------------------------------------------------------------
|
|
49
|
-
# format_error_source_details
|
|
50
|
-
# ---------------------------------------------------------------------------
|
|
51
|
-
|
|
52
|
-
class TestFormatErrorSourceDetails:
|
|
53
|
-
def test_none(self):
|
|
54
|
-
result = format_error_source_details(None)
|
|
55
|
-
assert "no error source" in result
|
|
56
|
-
|
|
57
|
-
def test_empty_dict(self):
|
|
58
|
-
result = format_error_source_details({})
|
|
59
|
-
assert "no error source" in result
|
|
60
|
-
|
|
61
|
-
def test_stack_trace(self):
|
|
62
|
-
source = {"type": "stack_trace", "stack_trace": "Error at line 42"}
|
|
63
|
-
result = format_error_source_details(source)
|
|
64
|
-
assert "Error at line 42" in result
|
|
65
|
-
assert "Stack Trace" in result
|
|
66
|
-
|
|
67
|
-
def test_error_message(self):
|
|
68
|
-
source = {"type": "unknown", "error_message": "Something went wrong"}
|
|
69
|
-
result = format_error_source_details(source)
|
|
70
|
-
assert "Something went wrong" in result
|
|
71
|
-
|
|
72
|
-
def test_log_pattern(self):
|
|
73
|
-
source = {"type": "log_pattern", "log_snippet": "FATAL: connection refused"}
|
|
74
|
-
result = format_error_source_details(source)
|
|
75
|
-
assert "connection refused" in result
|
|
76
|
-
|
|
77
|
-
def test_failed_test(self):
|
|
78
|
-
source = {"type": "failed_test", "failed_test_path": "tests/auth.test.js"}
|
|
79
|
-
result = format_error_source_details(source)
|
|
80
|
-
assert "tests/auth.test.js" in result
|
|
81
|
-
|
|
82
|
-
def test_user_report(self):
|
|
83
|
-
source = {"type": "user_report", "reproduction_steps": ["Click login", "Enter bad password"]}
|
|
84
|
-
result = format_error_source_details(source)
|
|
85
|
-
assert "Click login" in result
|
|
86
|
-
assert "Enter bad password" in result
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
# ---------------------------------------------------------------------------
|
|
90
|
-
# format_environment
|
|
91
|
-
# ---------------------------------------------------------------------------
|
|
92
|
-
|
|
93
|
-
class TestFormatEnvironment:
|
|
94
|
-
def test_none(self):
|
|
95
|
-
assert "not specified" in format_environment(None)
|
|
96
|
-
|
|
97
|
-
def test_empty(self):
|
|
98
|
-
assert "not specified" in format_environment({})
|
|
99
|
-
|
|
100
|
-
def test_with_values(self):
|
|
101
|
-
result = format_environment({"os": "Linux", "node": "20.1"})
|
|
102
|
-
assert "**node**: 20.1" in result
|
|
103
|
-
assert "**os**: Linux" in result
|
|
104
|
-
|
|
105
|
-
def test_skips_empty_values(self):
|
|
106
|
-
result = format_environment({"os": "Linux", "browser": ""})
|
|
107
|
-
assert "**os**: Linux" in result
|
|
108
|
-
assert "browser" not in result
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
# ---------------------------------------------------------------------------
|
|
112
|
-
# process_conditional_blocks
|
|
113
|
-
# ---------------------------------------------------------------------------
|
|
114
|
-
|
|
115
|
-
class TestProcessConditionalBlocks:
|
|
116
|
-
def test_automated_removes_manual_block(self):
|
|
117
|
-
tpl = "before\n{{IF_VERIFICATION_MANUAL_OR_HYBRID}}\nmanual content\n{{END_IF_VERIFICATION_MANUAL_OR_HYBRID}}\nafter"
|
|
118
|
-
bug = {"verification_type": "automated"}
|
|
119
|
-
result = process_conditional_blocks(tpl, bug)
|
|
120
|
-
assert "manual content" not in result
|
|
121
|
-
assert "before" in result
|
|
122
|
-
assert "after" in result
|
|
123
|
-
|
|
124
|
-
def test_manual_keeps_block(self):
|
|
125
|
-
tpl = "before\n{{IF_VERIFICATION_MANUAL_OR_HYBRID}}\nmanual content\n{{END_IF_VERIFICATION_MANUAL_OR_HYBRID}}\nafter"
|
|
126
|
-
bug = {"verification_type": "manual"}
|
|
127
|
-
result = process_conditional_blocks(tpl, bug)
|
|
128
|
-
assert "manual content" in result
|
|
129
|
-
assert "IF_VERIFICATION" not in result
|
|
130
|
-
|
|
131
|
-
def test_hybrid_keeps_block(self):
|
|
132
|
-
tpl = "{{IF_VERIFICATION_MANUAL_OR_HYBRID}}hybrid{{END_IF_VERIFICATION_MANUAL_OR_HYBRID}}"
|
|
133
|
-
bug = {"verification_type": "hybrid"}
|
|
134
|
-
result = process_conditional_blocks(tpl, bug)
|
|
135
|
-
assert "hybrid" in result
|
|
136
|
-
|
|
137
|
-
def test_default_is_automated(self):
|
|
138
|
-
tpl = "{{IF_VERIFICATION_MANUAL_OR_HYBRID}}content{{END_IF_VERIFICATION_MANUAL_OR_HYBRID}}"
|
|
139
|
-
bug = {}
|
|
140
|
-
result = process_conditional_blocks(tpl, bug)
|
|
141
|
-
assert "content" not in result
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
# ---------------------------------------------------------------------------
|
|
145
|
-
# render_template (integration)
|
|
146
|
-
# ---------------------------------------------------------------------------
|
|
147
|
-
|
|
148
|
-
class TestRenderTemplate:
|
|
149
|
-
def test_placeholders_replaced(self):
|
|
150
|
-
tpl = "Bug: {{BUG_ID}} — {{BUG_TITLE}}"
|
|
151
|
-
replacements = {"{{BUG_ID}}": "B-042", "{{BUG_TITLE}}": "Login crash"}
|
|
152
|
-
bug = {"verification_type": "automated"}
|
|
153
|
-
result = render_template(tpl, replacements, bug)
|
|
154
|
-
assert result == "Bug: B-042 — Login crash"
|
|
155
|
-
|
|
156
|
-
def test_conditional_and_replacement(self):
|
|
157
|
-
tpl = (
|
|
158
|
-
"{{IF_VERIFICATION_MANUAL_OR_HYBRID}}manual{{END_IF_VERIFICATION_MANUAL_OR_HYBRID}}"
|
|
159
|
-
"id={{BUG_ID}}"
|
|
160
|
-
)
|
|
161
|
-
replacements = {"{{BUG_ID}}": "B-001"}
|
|
162
|
-
bug = {"verification_type": "automated"}
|
|
163
|
-
result = render_template(tpl, replacements, bug)
|
|
164
|
-
assert "manual" not in result
|
|
165
|
-
assert "id=B-001" in result
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
class TestExplicitProjectRoot:
|
|
169
|
-
def test_build_replacements_uses_cli_project_root_for_rendered_paths(self, tmp_path, monkeypatch):
|
|
170
|
-
monkeypatch.setenv("PRIZMKIT_PLATFORM", "claude")
|
|
171
|
-
execution_root = tmp_path / "worktree"
|
|
172
|
-
main_checkout = tmp_path / "main"
|
|
173
|
-
execution_root.mkdir()
|
|
174
|
-
main_checkout.mkdir()
|
|
175
|
-
args = Namespace(
|
|
176
|
-
bug_list=str(main_checkout / ".prizmkit" / "plans" / "bug-fix-list.json"),
|
|
177
|
-
bug_id="B-001",
|
|
178
|
-
session_id="session-1",
|
|
179
|
-
run_id="run-1",
|
|
180
|
-
retry_count="0",
|
|
181
|
-
resume_phase="null",
|
|
182
|
-
state_dir=str(main_checkout / ".prizmkit" / "state" / "bugfix"),
|
|
183
|
-
output=str(main_checkout / ".prizmkit" / "state" / "bugfix" / "B-001" / "sessions" / "session-1" / "bootstrap-prompt.md"),
|
|
184
|
-
template=None,
|
|
185
|
-
project_root=str(execution_root),
|
|
186
|
-
)
|
|
187
|
-
bug = {"id": "B-001", "title": "Worktree Bug", "description": "d"}
|
|
188
|
-
|
|
189
|
-
replacements = build_replacements(
|
|
190
|
-
args,
|
|
191
|
-
bug,
|
|
192
|
-
{},
|
|
193
|
-
str(main_checkout / "dev-pipeline" / "scripts"),
|
|
194
|
-
)
|
|
195
|
-
|
|
196
|
-
assert replacements["{{PROJECT_ROOT}}"] == str(execution_root.resolve())
|
|
197
|
-
assert "{{SESSION_STATUS_PATH}}" not in replacements
|
|
198
|
-
assert "{{" + "DEV_" + "SUBAGENT_PATH" + "}}" not in replacements
|
|
199
|
-
assert replacements["{{SESSION_LOG_PATH}}"].endswith(
|
|
200
|
-
".prizmkit/state/bugfix/B-001/sessions/session-1/logs/session.log"
|
|
201
|
-
)
|
|
202
|
-
assert "{{" + REMOVED_MAX_LOG_ENV + "}}" not in replacements
|
|
203
|
-
assert "{{" + REMOVED_MAX_LOG_HUMAN + "}}" not in replacements
|
|
204
|
-
assert "### Checkpoint Update Helper" in replacements["{{CHECKPOINT_SYSTEM}}"]
|
|
205
|
-
assert "{{CHECKPOINT_PYTHON_CMD}}" in replacements["{{CHECKPOINT_SYSTEM}}"]
|
|
206
|
-
assert "pipeline progress mechanism" not in replacements["{{CHECKPOINT_SYSTEM}}"]
|
|
207
|
-
assert "prizmkit-runtime-helper.py" in replacements["{{RUNTIME_HELPER_CMD}}"]
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
# ---------------------------------------------------------------------------
|
|
211
|
-
# Reuse shared helpers (same as bootstrap prompt — verify they are present)
|
|
212
|
-
# ---------------------------------------------------------------------------
|
|
213
|
-
|
|
214
|
-
class TestSharedHelpers:
|
|
215
|
-
def test_format_acceptance_criteria_items(self):
|
|
216
|
-
result = format_acceptance_criteria(["Fix works", "No regression"])
|
|
217
|
-
assert "- Fix works" in result
|
|
218
|
-
assert "- No regression" in result
|
|
219
|
-
|
|
220
|
-
def test_format_acceptance_criteria_empty(self):
|
|
221
|
-
assert "none specified" in format_acceptance_criteria([])
|
|
222
|
-
|
|
223
|
-
def test_format_global_context_dict(self):
|
|
224
|
-
result = format_global_context({"lang": "Python"})
|
|
225
|
-
assert "**lang**: Python" in result
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
# ---------------------------------------------------------------------------
|
|
229
|
-
# Active compaction harness rollback
|
|
230
|
-
# ---------------------------------------------------------------------------
|
|
231
|
-
|
|
232
|
-
class TestHeadlessRecoveryReframing:
|
|
233
|
-
def test_bugfix_source_has_no_deleted_log_size_injection(self):
|
|
234
|
-
deleted_section = "log-size-" + "awareness.md"
|
|
235
|
-
loader = "load_" + "log_size_section"
|
|
236
|
-
placeholder = "{{LOG_" + "SIZE_AWARENESS}}"
|
|
237
|
-
deleted_title = "Session " + "Checkpoint Awareness"
|
|
238
|
-
source = Path("dev-pipeline/scripts/generate-bugfix-prompt.py").read_text(encoding="utf-8")
|
|
239
|
-
template = Path("dev-pipeline/templates/bugfix-bootstrap-prompt.md").read_text(encoding="utf-8")
|
|
240
|
-
|
|
241
|
-
assert (Path("dev-pipeline/templates/sections") / deleted_section).exists() is False
|
|
242
|
-
for content in (source, template):
|
|
243
|
-
for forbidden in (deleted_section, loader, placeholder, deleted_title):
|
|
244
|
-
assert forbidden not in content
|
|
245
|
-
|
|
246
|
-
def test_bugfix_template_does_not_spawn_monitor_or_require_compact(self):
|
|
247
|
-
content = Path("dev-pipeline/templates/bugfix-bootstrap-prompt.md").read_text(encoding="utf-8")
|
|
248
|
-
|
|
249
|
-
assert "On execution-unit timeout, preserve the active checkout and artifacts" in content
|
|
250
|
-
assert "follow the owning contract's recovery or downgrade path" in content
|
|
251
|
-
assert "Do not spawn persistent background subagents for headless recovery" not in content
|
|
252
|
-
assert REMOVED_MAX_LOG_ENV not in content
|
|
253
|
-
assert REMOVED_MAX_LOG_HUMAN not in content
|
|
254
|
-
assert ("209" + "7152") not in content
|
|
255
|
-
assert ("2" + "MB") not in content
|
|
256
|
-
assert "log-size monitor" not in content
|
|
257
|
-
assert "monitor-log" not in content
|
|
258
|
-
assert "COMPACT_NEEDED" not in content
|
|
259
|
-
assert "Run this command and keep it running" not in content
|
|
260
|
-
assert "Execute `/compact`" not in content
|
|
261
|
-
assert "run `/compact` after" not in content
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
class TestBugfixContinuationHandoff:
|
|
265
|
-
def test_writes_specs_and_task_local_summaries(self, tmp_path):
|
|
266
|
-
args = Namespace(
|
|
267
|
-
output=str(tmp_path / ".prizmkit/state/bugfix/B-007/sessions/B-007-new/bootstrap-prompt.md"),
|
|
268
|
-
state_dir=str(tmp_path / ".prizmkit/state/bugfix"),
|
|
269
|
-
continuation_mode="ai_error",
|
|
270
|
-
failure_classification="ai_runtime_or_provider_error",
|
|
271
|
-
code_retry_count="1",
|
|
272
|
-
infra_error_count="2",
|
|
273
|
-
max_code_retries="3",
|
|
274
|
-
max_infra_retries="3",
|
|
275
|
-
no_progress_count="0",
|
|
276
|
-
progress_fingerprint=json.dumps({"git_diff_fingerprint": "diff", "head_commit": "abc", "checkpoint_cursor": "S03:pending"}),
|
|
277
|
-
previous_session_id="B-007-old",
|
|
278
|
-
continuation_count="1",
|
|
279
|
-
context_overflow_count="1",
|
|
280
|
-
active_dev_branch="bugfix/B-007",
|
|
281
|
-
base_branch="main",
|
|
282
|
-
continuation_summary_path=".prizmkit/specs/B-007/continuation-summary.md",
|
|
283
|
-
)
|
|
284
|
-
prompt = append_continuation_handoff(
|
|
285
|
-
"BUGFIX PROMPT", args, str(tmp_path), "bugfix", "B-007", "B-007",
|
|
286
|
-
{"steps": [{"id": "S01", "skill": "diagnose", "name": "Diagnose", "status": "pending"}]},
|
|
287
|
-
)
|
|
288
|
-
|
|
289
|
-
assert prompt.startswith("BUGFIX PROMPT")
|
|
290
|
-
assert "This is an automatic continuation after the previous launched AI session ended with `ai_runtime_or_provider_error`." in prompt
|
|
291
|
-
assert "Do not attempt `/compact` as the recovery mechanism." not in prompt
|
|
292
|
-
assert ("Log " + "monitor") not in prompt
|
|
293
|
-
assert ("log-" + "monitor") not in prompt
|
|
294
|
-
assert (tmp_path / ".prizmkit/specs/B-007/continuation-summary.md").exists()
|
|
295
|
-
assert (tmp_path / ".prizmkit/bugfix/B-007/continuation-summary.md").exists()
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
HEADLESS_FORBIDDEN_PROMPT_STRINGS = [
|
|
299
|
-
"### Interactive Claude Code Note",
|
|
300
|
-
"### Project Conventions",
|
|
301
|
-
"Scaffold / generated file awareness",
|
|
302
|
-
"### Resume Behavior",
|
|
303
|
-
"[NEEDS CLARIFICATION]",
|
|
304
|
-
"pause for interactive input",
|
|
305
|
-
"prizmkit-test-gate.py",
|
|
306
|
-
"/compact",
|
|
307
|
-
"Session " + "Checkpoint Awareness",
|
|
308
|
-
"{{LOG_" + "SIZE_AWARENESS}}",
|
|
309
|
-
]
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
def test_template_source_is_clean_for_headless_prompt_contract():
|
|
313
|
-
content = Path("dev-pipeline/templates/bugfix-bootstrap-prompt.md").read_text(encoding="utf-8")
|
|
314
|
-
for forbidden in HEADLESS_FORBIDDEN_PROMPT_STRINGS:
|
|
315
|
-
assert forbidden not in content
|
|
316
|
-
assert "FAST_PATH=true" not in content
|
|
317
|
-
assert "prizmkit-workflow" not in content
|
|
318
|
-
assert "/prizmkit-test scope=this-change artifact_dir=.prizmkit/bugfix/{{BUG_ID}}/" in content
|
|
319
|
-
assert "operation=prepare-runtime-commit" in content
|
|
320
|
-
assert "local_commit_authorized" not in content
|
|
321
|
-
assert "push_authorized" not in content
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
def test_bugfix_prompt_keeps_fine_grained_phases_out_of_external_status_contract():
|
|
325
|
-
content = Path("dev-pipeline/templates/bugfix-bootstrap-prompt.md").read_text(encoding="utf-8")
|
|
326
|
-
old_statuses = ["triaging", "reproducing", "fixing", "verifying"]
|
|
327
|
-
|
|
328
|
-
assert "external bug-list status field" in content
|
|
329
|
-
assert "pending`, `in_progress`, `completed`, `failed`, `skipped`, or `needs_info`" in content
|
|
330
|
-
for status in old_statuses:
|
|
331
|
-
assert f"status=\"{status}\"" not in content
|
|
332
|
-
assert f"status = \"{status}\"" not in content
|
|
333
|
-
assert f"status='{status}'" not in content
|
|
334
|
-
assert f"status = '{status}'" not in content
|
|
335
|
-
assert f"Set bug status to `{status}`" not in content
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
# ---------------------------------------------------------------------------
|
|
339
|
-
# Anti-Bash regression guardrails (F-039)
|
|
340
|
-
# Note: grep -n, sed -n, grep -q, wc -l excluded — referenced in bugfix context
|
|
341
|
-
# budget rules as AI tool hints, not as operational shell snippets.
|
|
342
|
-
# | sed (trailing space) only matches pipe-to-sed operational patterns.
|
|
343
|
-
# ---------------------------------------------------------------------------
|
|
344
|
-
|
|
345
|
-
RETIRED_EXTRACTED_SNIPPETS_BUGFIX = [
|
|
346
|
-
"find . -maxdepth",
|
|
347
|
-
"| sed ",
|
|
348
|
-
r"grep -c '^\- \[ \]'",
|
|
349
|
-
"2>/dev/null",
|
|
350
|
-
"/dev/null",
|
|
351
|
-
"$DEV_PORT",
|
|
352
|
-
"$!",
|
|
353
|
-
"$HOME",
|
|
354
|
-
"if [ ",
|
|
355
|
-
"which playwright-cli",
|
|
356
|
-
"which opencli",
|
|
357
|
-
"lsof -ti",
|
|
358
|
-
"xargs",
|
|
359
|
-
" kill -",
|
|
360
|
-
"kill -",
|
|
361
|
-
"|| echo",
|
|
362
|
-
"mkdir -p",
|
|
363
|
-
"touch .prizmkit",
|
|
364
|
-
]
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
def _render_bugfix_prompt(tmp_path, platform="claude"):
|
|
368
|
-
"""Render a complete bugfix prompt through the generator."""
|
|
369
|
-
from generate_bugfix_prompt import main as bugfix_main
|
|
370
|
-
|
|
371
|
-
project = tmp_path / "bugfix-anti-bash"
|
|
372
|
-
project.mkdir(parents=True)
|
|
373
|
-
(project / ".prizmkit").mkdir(exist_ok=True)
|
|
374
|
-
(project / ".prizmkit" / "config.json").write_text(
|
|
375
|
-
json.dumps({"platform": platform, "ai_cli": platform}), encoding="utf-8"
|
|
376
|
-
)
|
|
377
|
-
_ensure_skill_files(project)
|
|
378
|
-
bug_list = project / ".prizmkit" / "plans" / "bug-fix-list.json"
|
|
379
|
-
bug_list.parent.mkdir(parents=True)
|
|
380
|
-
bug_list.write_text(json.dumps({
|
|
381
|
-
"bugs": [{"id": "B-001", "title": "Broken", "description": "Fix it",
|
|
382
|
-
"acceptance_criteria": ["Works"]}],
|
|
383
|
-
"global_context": {"language": "Python"},
|
|
384
|
-
}), encoding="utf-8")
|
|
385
|
-
output = project / "bugfix-prompt.md"
|
|
386
|
-
old_argv = os.sys.argv
|
|
387
|
-
old_platform = os.environ.get("PRIZMKIT_PLATFORM")
|
|
388
|
-
try:
|
|
389
|
-
os.environ.pop("PRIZMKIT_PLATFORM", None)
|
|
390
|
-
os.sys.argv = [
|
|
391
|
-
"generate-bugfix-prompt.py",
|
|
392
|
-
"--bug-list", str(bug_list),
|
|
393
|
-
"--bug-id", "B-001",
|
|
394
|
-
"--session-id", "session-1",
|
|
395
|
-
"--run-id", "run-1",
|
|
396
|
-
"--retry-count", "0",
|
|
397
|
-
"--resume-phase", "null",
|
|
398
|
-
"--state-dir", str(project / ".prizmkit" / "state" / "bugfix"),
|
|
399
|
-
"--project-root", str(project),
|
|
400
|
-
"--output", str(output),
|
|
401
|
-
]
|
|
402
|
-
try:
|
|
403
|
-
bugfix_main()
|
|
404
|
-
except SystemExit as exc:
|
|
405
|
-
if exc.code not in (0, None):
|
|
406
|
-
raise
|
|
407
|
-
finally:
|
|
408
|
-
os.sys.argv = old_argv
|
|
409
|
-
if old_platform is None:
|
|
410
|
-
os.environ.pop("PRIZMKIT_PLATFORM", None)
|
|
411
|
-
else:
|
|
412
|
-
os.environ["PRIZMKIT_PLATFORM"] = old_platform
|
|
413
|
-
return output.read_text(encoding="utf-8")
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
def _ensure_skill_files(project, platforms=None):
|
|
417
|
-
"""Create minimal skill files so platform resolution succeeds."""
|
|
418
|
-
if platforms is None:
|
|
419
|
-
platforms = ("claude", "codex")
|
|
420
|
-
for plat in platforms:
|
|
421
|
-
if plat == "codex":
|
|
422
|
-
skill_dir = project / ".agents" / "skills" / "prizmkit"
|
|
423
|
-
skill_dir.mkdir(parents=True, exist_ok=True)
|
|
424
|
-
(skill_dir / "SKILL.md").write_text("skill\n", encoding="utf-8")
|
|
425
|
-
elif plat == "codebuddy":
|
|
426
|
-
skill_dir = project / ".codebuddy" / "skills" / "prizmkit"
|
|
427
|
-
skill_dir.mkdir(parents=True, exist_ok=True)
|
|
428
|
-
(skill_dir / "SKILL.md").write_text("skill\n", encoding="utf-8")
|
|
429
|
-
else:
|
|
430
|
-
command_dir = project / ".claude" / "commands"
|
|
431
|
-
command_dir.mkdir(parents=True, exist_ok=True)
|
|
432
|
-
(command_dir / "prizmkit.md").write_text("skill\n", encoding="utf-8")
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
class TestBugfixBootstrapShellExtraction:
|
|
436
|
-
"""Regression guardrails: bugfix rendered prompts and source use helper, not shell."""
|
|
437
|
-
|
|
438
|
-
def test_rendered_bugfix_prompt_uses_runtime_helper_not_extracted_bash(self, tmp_path):
|
|
439
|
-
prompt = _render_bugfix_prompt(tmp_path)
|
|
440
|
-
for snippet in RETIRED_EXTRACTED_SNIPPETS_BUGFIX:
|
|
441
|
-
assert snippet not in prompt, f"Retired shell snippet found in bugfix prompt: {snippet}"
|
|
442
|
-
assert "{{RUNTIME_HELPER_CMD}}" not in prompt
|
|
443
|
-
assert "python" in prompt.lower()
|
|
444
|
-
assert ".prizmkit/dev-pipeline/scripts/prizmkit-runtime-helper.py" in prompt
|
|
445
|
-
assert "artifact ensure-dir .prizmkit/bugfix/B-001" in prompt
|
|
446
|
-
assert "text final-verdict .prizmkit/bugfix/B-001/review-report.md" in prompt
|
|
447
|
-
|
|
448
|
-
def test_bugfix_template_source_is_clean_of_helper_covered_snippets(self):
|
|
449
|
-
content = Path("dev-pipeline/templates/bugfix-bootstrap-prompt.md").read_text(encoding="utf-8")
|
|
450
|
-
for snippet in RETIRED_EXTRACTED_SNIPPETS_BUGFIX:
|
|
451
|
-
assert snippet not in content, f"Shell snippet in bugfix template: {snippet}"
|
|
452
|
-
|
|
453
|
-
def test_continuation_source_is_clean_of_helper_covered_snippets(self):
|
|
454
|
-
content = Path("dev-pipeline/scripts/continuation.py").read_text(encoding="utf-8")
|
|
455
|
-
for snippet in RETIRED_EXTRACTED_SNIPPETS_BUGFIX:
|
|
456
|
-
assert snippet not in content, f"Shell snippet in continuation.py: {snippet}"
|
|
457
|
-
|
|
458
|
-
def test_bugfix_generator_source_is_clean_of_helper_covered_snippets(self):
|
|
459
|
-
content = Path("dev-pipeline/scripts/generate-bugfix-prompt.py").read_text(encoding="utf-8")
|
|
460
|
-
for snippet in RETIRED_EXTRACTED_SNIPPETS_BUGFIX:
|
|
461
|
-
assert snippet not in content, f"Shell snippet in generate-bugfix-prompt.py: {snippet}"
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
class TestBugfixCheckpointGeneration:
|
|
465
|
-
def test_checkpoint_merge_preserves_family_handoff_state(self, tmp_path):
|
|
466
|
-
fresh = generate_bugfix_checkpoint("B-001", "new")
|
|
467
|
-
existing = generate_bugfix_checkpoint("B-001", "old")
|
|
468
|
-
existing["bugfix_state"] = bugfix_checkpoint_metadata(
|
|
469
|
-
".prizmkit/bugfix/B-001",
|
|
470
|
-
stage="test",
|
|
471
|
-
status="failed",
|
|
472
|
-
stage_result="TEST_BLOCKED",
|
|
473
|
-
repair_round=2,
|
|
474
|
-
next_stage="prizmkit-test",
|
|
475
|
-
resume_from="prizmkit-test",
|
|
476
|
-
)
|
|
477
|
-
|
|
478
|
-
merged = merge_bugfix_checkpoint_state(existing, fresh, str(tmp_path))
|
|
479
|
-
|
|
480
|
-
assert merged["bugfix_state"]["status"] == "failed"
|
|
481
|
-
assert merged["bugfix_state"]["stage_result"] == "TEST_BLOCKED"
|
|
482
|
-
assert merged["bugfix_state"]["resume_from"] == "prizmkit-test"
|
|
483
|
-
|
|
484
|
-
def test_default_checkpoint_has_all_atomic_gates_in_order(self):
|
|
485
|
-
checkpoint = generate_bugfix_checkpoint("B-001", "session-1")
|
|
486
|
-
|
|
487
|
-
assert [step["skill"] for step in checkpoint["steps"]] == [
|
|
488
|
-
"prizmkit-init",
|
|
489
|
-
"bug-diagnosis-and-plan",
|
|
490
|
-
"prizmkit-implement",
|
|
491
|
-
"prizmkit-code-review",
|
|
492
|
-
"prizmkit-test",
|
|
493
|
-
"bug-report",
|
|
494
|
-
"prizmkit-retrospective",
|
|
495
|
-
"prizmkit-committer",
|
|
496
|
-
]
|
|
497
|
-
plan_step = checkpoint["steps"][1]
|
|
498
|
-
review_step = checkpoint["steps"][3]
|
|
499
|
-
test_step = checkpoint["steps"][4]
|
|
500
|
-
assert plan_step["required_artifacts"] == [
|
|
501
|
-
".prizmkit/bugfix/B-001/context-snapshot.md",
|
|
502
|
-
".prizmkit/bugfix/B-001/spec.md",
|
|
503
|
-
".prizmkit/bugfix/B-001/plan.md",
|
|
504
|
-
]
|
|
505
|
-
assert review_step["required_artifacts"] == [
|
|
506
|
-
".prizmkit/bugfix/B-001/review-report.md"
|
|
507
|
-
]
|
|
508
|
-
assert test_step["depends_on"] == "S04"
|
|
509
|
-
assert test_step["required_artifacts"] == [
|
|
510
|
-
".prizmkit/bugfix/B-001/test-report.md",
|
|
511
|
-
".prizmkit/bugfix/B-001/test-result.json",
|
|
512
|
-
]
|
|
513
|
-
assert checkpoint["steps"][5]["depends_on"] == "S05"
|
|
514
|
-
|
|
515
|
-
def test_bugfix_result_routing_owns_bounded_test_repair(self):
|
|
516
|
-
review = route_bugfix_repair(
|
|
517
|
-
"REVIEW_NEEDS_FIXES", repair_scope="production", repair_round=0,
|
|
518
|
-
)
|
|
519
|
-
needs_fixes = route_bugfix_repair(
|
|
520
|
-
"TEST_NEEDS_FIXES", repair_scope="production", repair_round=1,
|
|
521
|
-
)
|
|
522
|
-
blocked = route_bugfix_repair("TEST_BLOCKED", repair_round=1)
|
|
523
|
-
|
|
524
|
-
assert review["route"] == [
|
|
525
|
-
"prizmkit-implement", "prizmkit-code-review", "prizmkit-test",
|
|
526
|
-
]
|
|
527
|
-
assert review["repair_round"] == 1
|
|
528
|
-
assert needs_fixes["blocked"] is False
|
|
529
|
-
assert needs_fixes["route"] == [
|
|
530
|
-
"prizmkit-implement", "prizmkit-code-review", "prizmkit-test",
|
|
531
|
-
]
|
|
532
|
-
assert needs_fixes["repair_round"] == 2
|
|
533
|
-
assert blocked["blocked"] is True
|
|
534
|
-
assert blocked["resumable"] is False
|
|
535
|
-
assert blocked["next_stage"] is None
|
|
536
|
-
assert blocked["terminal_status"] == "WORKFLOW_BLOCKED"
|
|
537
|
-
assert blocked["blocked_reason"] == "test_blocked"
|
|
538
|
-
unsafe = route_bugfix_repair("REVIEW_NEEDS_FIXES", repair_round=0)
|
|
539
|
-
assert unsafe["blocked_reason"] == "unsafe_repair_scope"
|
|
540
|
-
|
|
541
|
-
def test_bugfix_checkpoint_metadata_has_no_evidence_handoff(self):
|
|
542
|
-
metadata = bugfix_checkpoint_metadata(
|
|
543
|
-
".prizmkit/bugfix/B-001",
|
|
544
|
-
stage="test",
|
|
545
|
-
status="failed",
|
|
546
|
-
stage_result="TEST_NEEDS_FIXES",
|
|
547
|
-
repair_round=0,
|
|
548
|
-
next_stage=None,
|
|
549
|
-
resume_from=None,
|
|
550
|
-
)
|
|
551
|
-
|
|
552
|
-
assert metadata["artifact_dir"] == ".prizmkit/bugfix/B-001"
|
|
553
|
-
assert metadata["status"] == "failed"
|
|
554
|
-
assert metadata["stage_result"] == "TEST_NEEDS_FIXES"
|
|
555
|
-
assert "authoritative_evidence_paths" not in metadata
|
|
556
|
-
|
|
557
|
-
def test_manual_bugfix_uses_automatic_verification_and_keeps_commit_gate(self):
|
|
558
|
-
sections = assemble_bugfix_sections(
|
|
559
|
-
"dev-pipeline/templates/sections", False, True,
|
|
560
|
-
)
|
|
561
|
-
names = [name for name, _ in sections]
|
|
562
|
-
|
|
563
|
-
assert "bugfix-manual-gate" in names
|
|
564
|
-
assert names.index("bugfix-manual-gate") < names.index("bugfix-phase-test")
|
|
565
|
-
assert "runtime-commit-handoff" in names
|
|
566
|
-
assert "bugfix-phase-commit-report" in names
|
|
567
|
-
checkpoint = generate_bugfix_checkpoint(
|
|
568
|
-
"B-001", "session", sections=sections,
|
|
569
|
-
)
|
|
570
|
-
skills = [step["skill"] for step in checkpoint["steps"]]
|
|
571
|
-
assert skills.index("prizmkit-code-review") < skills.index(
|
|
572
|
-
"manual-verification"
|
|
573
|
-
) < skills.index("prizmkit-test")
|
|
574
|
-
compatibility = generate_bugfix_checkpoint(
|
|
575
|
-
"B-001",
|
|
576
|
-
"session",
|
|
577
|
-
browser_enabled=True,
|
|
578
|
-
manual_gate=True,
|
|
579
|
-
)
|
|
580
|
-
compatibility_skills = [step["skill"] for step in compatibility["steps"]]
|
|
581
|
-
assert compatibility_skills.index("prizmkit-code-review") < compatibility_skills.index(
|
|
582
|
-
"browser-verification"
|
|
583
|
-
) < compatibility_skills.index("manual-verification") < compatibility_skills.index(
|
|
584
|
-
"prizmkit-test"
|
|
585
|
-
)
|
|
586
|
-
|
|
587
|
-
def test_rendered_bugfix_prompt_is_atomic_headless_and_local_commit_only(self, tmp_path):
|
|
588
|
-
prompt = _render_bugfix_prompt(tmp_path)
|
|
589
|
-
|
|
590
|
-
assert prompt.index("/prizmkit-code-review") < prompt.index(
|
|
591
|
-
"/prizmkit-test scope=this-change artifact_dir=.prizmkit/bugfix/B-001/"
|
|
592
|
-
) < prompt.index("### Bug Fix Report") < prompt.index("### Retrospective") < prompt.index("### Runtime Commit Handoff")
|
|
593
|
-
assert "FAST_PATH=true" not in prompt
|
|
594
|
-
assert "prizmkit-workflow" not in prompt
|
|
595
|
-
assert "local_commit_authorized" not in prompt
|
|
596
|
-
assert "operation=prepare-runtime-commit" in prompt
|
|
597
|
-
assert "NEVER ask for user confirmation" in prompt
|
|
598
|
-
assert "The Python runtime, not the AI session, executes" in prompt
|
|
599
|
-
assert "complete final Git-visible workspace" in prompt
|
|
600
|
-
assert '"schema_version": 2' in prompt
|
|
601
|
-
assert '"intended_paths"' not in prompt
|
|
602
|
-
assert "Ignored paths remain local" in prompt
|
|
603
|
-
assert "push_authorized\": true" not in prompt
|
|
604
|
-
assert ".prizmkit/bugfix/B-001/" in prompt
|
|
605
|
-
assert "write the session status" not in prompt.lower()
|
|
606
|
-
|
|
607
|
-
def test_setup_section_skips_and_finalization_group_expands(self):
|
|
608
|
-
checkpoint = generate_bugfix_checkpoint(
|
|
609
|
-
"B-001",
|
|
610
|
-
"session-1",
|
|
611
|
-
sections=[
|
|
612
|
-
("bugfix-phase-init", "setup"),
|
|
613
|
-
("bugfix-phase-implement", "implement"),
|
|
614
|
-
("bugfix-phase-commit-report", "report"),
|
|
615
|
-
("retrospective", "retrospective"),
|
|
616
|
-
("runtime-commit-handoff", "commit"),
|
|
617
|
-
],
|
|
618
|
-
)
|
|
619
|
-
|
|
620
|
-
assert [step["skill"] for step in checkpoint["steps"]] == [
|
|
621
|
-
"prizmkit-init",
|
|
622
|
-
"prizmkit-implement",
|
|
623
|
-
"bug-report",
|
|
624
|
-
"prizmkit-retrospective",
|
|
625
|
-
"prizmkit-committer",
|
|
626
|
-
]
|
|
627
|
-
assert checkpoint["steps"][2]["depends_on"] == "S02"
|