prizmkit 1.1.160 → 1.1.162

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.
Files changed (31) hide show
  1. package/bundled/VERSION.json +3 -3
  2. package/bundled/dev-pipeline/README.md +3 -1
  3. package/bundled/dev-pipeline/prizmkit_runtime/heartbeat.py +9 -6
  4. package/bundled/dev-pipeline/prizmkit_runtime/runners.py +63 -4
  5. package/bundled/dev-pipeline/prizmkit_runtime/runtime_commit.py +268 -110
  6. package/bundled/dev-pipeline/scripts/update-bug-status.py +8 -4
  7. package/bundled/dev-pipeline/scripts/update-feature-status.py +10 -6
  8. package/bundled/dev-pipeline/scripts/update-refactor-status.py +8 -4
  9. package/bundled/dev-pipeline/templates/bootstrap-prompt.md +1 -1
  10. package/bundled/dev-pipeline/templates/bootstrap-tier3.md +2 -2
  11. package/bundled/dev-pipeline/templates/bugfix-bootstrap-prompt.md +1 -1
  12. package/bundled/dev-pipeline/templates/refactor-bootstrap-prompt.md +1 -1
  13. package/bundled/dev-pipeline/templates/sections/runtime-commit-handoff.md +9 -15
  14. package/bundled/dev-pipeline/tests/test_generate_bootstrap_prompt.py +8 -5
  15. package/bundled/dev-pipeline/tests/test_generate_bugfix_prompt.py +4 -2
  16. package/bundled/dev-pipeline/tests/test_generate_refactor_prompt.py +4 -2
  17. package/bundled/dev-pipeline/tests/test_python_runner_parity.py +221 -6
  18. package/bundled/dev-pipeline/tests/test_runtime_commit.py +308 -67
  19. package/bundled/dev-pipeline/tests/test_unified_cli.py +172 -4
  20. package/bundled/rules/prizm/prizm-commit-workflow.md +12 -5
  21. package/bundled/skills/_metadata.json +1 -1
  22. package/bundled/skills/prizmkit-code-review/SKILL.md +5 -5
  23. package/bundled/skills/prizmkit-code-review/references/independent-code-review.md +4 -5
  24. package/bundled/skills/prizmkit-code-review/references/review-report-template.md +4 -6
  25. package/bundled/skills/prizmkit-code-review/scripts/render_review_report.py +1 -4
  26. package/bundled/skills/prizmkit-committer/SKILL.md +47 -63
  27. package/bundled/skills/prizmkit-test/SKILL.md +2 -2
  28. package/bundled/skills/prizmkit-test/references/test-coverage-model.md +1 -1
  29. package/bundled/skills/prizmkit-workflow/SKILL.md +4 -6
  30. package/bundled/skills/prizmkit-workflow/references/workflow-state-protocol.md +10 -8
  31. package/package.json +1 -1
@@ -5,31 +5,25 @@ The Python runtime, not the AI session, executes the pipeline's local Git commit
5
5
  After Code Review, all configured verification, `TEST_PASS`, family reports/summaries, and retrospective have completed:
6
6
 
7
7
  1. As the session orchestrator, validate every required stage artifact and result first. Atomic Skills do not perform this sequencing check.
8
- 2. Invoke `/prizmkit-committer` with the same artifact root, exact readiness evidence, and request path:
8
+ 2. Re-inventory the complete final Git-visible workspace: staged, unstaged, added, deleted, renamed, copied, and non-ignored untracked content. Confirm Code Review and Test authority covers every behavior-affecting change, including correct work that predated this session or lives in framework, generated, instruction, lock, or host-support paths. If production behavior changed after those gates, re-enter them before commit preparation.
9
+ 3. Invoke `/prizmkit-committer` with the same artifact root, exact readiness evidence, and request path:
9
10
 
10
11
  ```text
11
- /prizmkit-committer operation=prepare-runtime-commit artifact_dir={{ARTIFACT_DIR}} evidence_paths=<exact validated artifact paths> excluded_paths={{ARTIFACT_DIR}}/workflow-checkpoint.json request_path={{ARTIFACT_DIR}}/runtime-commit-request.json
12
+ /prizmkit-committer operation=prepare-runtime-commit artifact_dir={{ARTIFACT_DIR}} evidence_paths=<exact validated artifact paths> request_path={{ARTIFACT_DIR}}/runtime-commit-request.json
12
13
  ```
13
14
 
14
- 3. The committer validates only the supplied evidence and final diff, then classifies paths by semantic role before writing the request:
15
- - safe Git-visible `.prizmkit/**` requirement output is admitted like any other exact task path and needs no documentation-specific evidence;
16
- - ignored paths remain absent and are never force-added; project ignore policy is not changed or interpreted;
17
- - exact Runtime request/checkpoint/state, installed Runtime/host payloads, and local host settings remain support/bookkeeping outside the task commit;
18
- - global Secret checks still apply, and every unrelated or unknown Git-visible path blocks rather than disappearing.
19
-
20
- It then rejects sensitive/unrelated/unknown paths, generates one Conventional Commit message, and writes this request without staging or committing:
15
+ 4. The committer validates the complete final workspace without a caller-supplied path manifest or provenance classification. Ignored paths remain local and never block or require force-add. Merge conflicts, Secrets, sensitive local content, known incorrect or incoherent changes, unverifiable content, and stale readiness evidence still block. It generates one truthful Conventional Commit message and writes this request without staging or committing:
21
16
 
22
17
  ```json
23
18
  {
24
- "schema_version": 1,
19
+ "schema_version": 2,
25
20
  "artifact_dir": "{{ARTIFACT_DIR}}",
26
21
  "base_head": "<current HEAD commit hash>",
27
- "commit_message": "<type>(<scope>): <description>",
28
- "intended_paths": ["<exact project-relative changed path>"]
22
+ "commit_message": "<type>(<scope>): <description>"
29
23
  }
30
24
  ```
31
25
 
32
- 4. Require the stage-local result `COMMIT_REQUEST_READY`. Then this injected session—not the Skill—marks `prizmkit-committer` `in_progress` with `stage_result=COMMIT_PENDING` through the checkpoint helper. Do not mark it completed or write `COMMITTED`.
33
- 5. Stop normal work after the valid request and checkpoint handoff exist. Do not run `git add`, `git commit`, `git commit --amend`, merge, push, or create additional files.
26
+ 5. Require the stage-local result `COMMIT_REQUEST_READY`. Then this injected session—not the Skill—marks `prizmkit-committer` `in_progress` with `stage_result=COMMIT_PENDING` through the checkpoint helper. Do not mark it completed or write `COMMITTED`.
27
+ 6. Stop normal work after the valid request and checkpoint handoff exist. Do not run `git add`, `git commit`, `git commit --amend`, merge, push, or create additional task files.
34
28
 
35
- The Runtime validates exact task-owned path coverage outside recognized semantic support/bookkeeping, does not reject a safe path solely because it is under `.prizmkit/**`, stages only requested literal paths, verifies staged/committed set equality and the Git receipt, and only then writes the Runtime-owned receipt/checkpoint and performs configured integration. Those post-commit writes are never inserted retroactively into the committed snapshot or allowed to falsify integration. Unknown Git-visible paths are not silently ignored: they produce a mismatch and preserve the task checkout for recovery. A malformed, stale, unsafe, incomplete, or contradictory request also blocks without deleting user data.
29
+ The Runtime validates the pathless schema, base, complete non-ignored workspace, sensitive path safeguards, merge state, and causal bookkeeping boundary. It stages the complete workspace, omitting only the exact active request/checkpoint whose final receipt cannot truthfully precede the commit; verifies a non-empty commit with the expected parent and message; records its Git receipt; and only then finalizes `COMMITTED` and performs configured integration. A malformed, stale, unsafe, incomplete, or contradictory handoff blocks without deleting user data.
@@ -1381,6 +1381,9 @@ class TestHeadlessPromptCleanupF033:
1381
1381
  assert artifact in prompt
1382
1382
  assert "Atomic Skills write only their stage-owned artifacts and domain results" in prompt
1383
1383
  assert "COMMIT_REQUEST_READY" in prompt
1384
+ assert '"schema_version": 2' in prompt
1385
+ assert '"intended_paths"' not in prompt
1386
+ assert "complete final Git-visible workspace" in prompt
1384
1387
  assert "workflow_state_path" not in prompt
1385
1388
  assert "outcome=RETRO_COMPLETE" in prompt
1386
1389
  assert "Never recreate the testing-local repair loop" in prompt
@@ -1554,12 +1557,12 @@ class TestFeatureBootstrapShellExtraction:
1554
1557
  assert "text search . --pattern \"123-prompt-cleanup\" --json" in tier3
1555
1558
  assert "text count .prizmkit/specs/123-prompt-cleanup/plan.md --pattern \"- [ ]\"" in tier3
1556
1559
  assert "/prizmkit-committer operation=prepare-runtime-commit" in tier3
1557
- assert "Require `COMMIT_REQUEST_READY`; this session records `COMMIT_PENDING`" in tier3
1558
- assert "The Python runtime validates the request" in tier3
1559
- assert "classify paths by semantic role rather than a blanket `.prizmkit/**` exclusion" in tier3
1560
- assert "Safe Git-visible framework paths" in tier3
1560
+ assert "Require a schema-v2 pathless request and `COMMIT_REQUEST_READY`" in tier3
1561
+ assert "The Python runtime re-enumerates and commits the complete non-ignored workspace" in tier3
1562
+ assert "validate the complete Git-visible workspace" in tier3
1563
+ assert "Code Review and Test authority must cover every behavior-affecting visible change" in tier3
1564
+ assert "Ignored paths remain naturally absent" in tier3
1561
1565
  assert "Never force-add or change/interpret project ignore policy" in tier3
1562
- assert "unknown Git-visible paths block" in tier3
1563
1566
  assert "git add" not in tier3
1564
1567
  assert "git commit" not in tier3
1565
1568
 
@@ -596,8 +596,10 @@ class TestBugfixCheckpointGeneration:
596
596
  assert "operation=prepare-runtime-commit" in prompt
597
597
  assert "NEVER ask for user confirmation" in prompt
598
598
  assert "The Python runtime, not the AI session, executes" in prompt
599
- assert "safe Git-visible `.prizmkit/**` requirement output is admitted" in prompt
600
- assert "unknown Git-visible path blocks" 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
601
603
  assert "push_authorized\": true" not in prompt
602
604
  assert ".prizmkit/bugfix/B-001/" in prompt
603
605
  assert "write the session status" not in prompt.lower()
@@ -435,8 +435,10 @@ class TestRefactorCheckpointGeneration:
435
435
  assert "local_commit_authorized" not in prompt
436
436
  assert "operation=prepare-runtime-commit" in prompt
437
437
  assert "The Python runtime, not the AI session, executes" in prompt
438
- assert "safe Git-visible `.prizmkit/**` requirement output is admitted" in prompt
439
- assert "unknown Git-visible path blocks" in prompt
438
+ assert "complete final Git-visible workspace" in prompt
439
+ assert '"schema_version": 2' in prompt
440
+ assert '"intended_paths"' not in prompt
441
+ assert "Ignored paths remain local" in prompt
440
442
  assert "automatic push" not in prompt.lower()
441
443
  assert "push_authorized\": true" not in prompt
442
444
  assert "write the session status" not in prompt.lower()
@@ -1301,6 +1301,16 @@ def _install_runner_session_fakes(monkeypatch, runners, *, statuses=("success",)
1301
1301
  monkeypatch.setattr(runners, "commit_pre_branch_bookkeeping", lambda *args, **kwargs: None)
1302
1302
  monkeypatch.setattr(runners, "commit_final_bookkeeping", lambda *args, **kwargs: None)
1303
1303
  monkeypatch.setattr(runners, "commit_task_branch_changes", lambda *args, **kwargs: None)
1304
+ monkeypatch.setattr(
1305
+ runners,
1306
+ "finalize_accepted_workspace_commit",
1307
+ lambda *args, **kwargs: SimpleNamespace(
1308
+ status="not_needed",
1309
+ reason="accepted_workspace_clean",
1310
+ committed=False,
1311
+ commit_hash="",
1312
+ ),
1313
+ )
1304
1314
  monkeypatch.setattr(runners, "current_branch", lambda _root: "main")
1305
1315
  monkeypatch.setattr(runners, "_session_id", lambda item_id: f"{item_id}-session-{len(prompt_calls) + 1}")
1306
1316
  monkeypatch.setattr(
@@ -1398,6 +1408,169 @@ def _install_runner_session_fakes(monkeypatch, runners, *, statuses=("success",)
1398
1408
 
1399
1409
 
1400
1410
 
1411
+ def test_workflow_skipped_is_finalized_as_completed_with_one_warning(monkeypatch, tmp_path, capsys):
1412
+ from prizmkit_runtime import runners
1413
+ from prizmkit_runtime.runner_models import family_for, parse_invocation
1414
+
1415
+ paths = _make_paths(tmp_path / "accepted-workflow-skip")
1416
+ family = family_for("refactor", paths)
1417
+ invocation = parse_invocation(family, "run", ())
1418
+ invocation = invocation.__class__(**{**invocation.__dict__, "list_path": paths.refactor_plan})
1419
+ observed = _install_runner_session_fakes(
1420
+ monkeypatch,
1421
+ runners,
1422
+ statuses=("workflow_skipped",),
1423
+ update_status="completed",
1424
+ )
1425
+ plans = []
1426
+ wip_calls = []
1427
+ accepted_commit_calls = []
1428
+
1429
+ def fake_accepted_commit(project_root, **kwargs):
1430
+ accepted_commit_calls.append((project_root, kwargs))
1431
+ return SimpleNamespace(
1432
+ status="not_needed",
1433
+ reason="accepted_workspace_clean",
1434
+ committed=False,
1435
+ commit_hash="",
1436
+ )
1437
+
1438
+ def fake_run_git_plan(_project_root, plan):
1439
+ plans.append(plan.name)
1440
+ return SimpleNamespace(ok=True, reason="", results=())
1441
+
1442
+ monkeypatch.setattr(runners, "run_git_plan", fake_run_git_plan)
1443
+ monkeypatch.setattr(runners, "finalize_accepted_workspace_commit", fake_accepted_commit)
1444
+ monkeypatch.setattr(
1445
+ runners,
1446
+ "commit_wip_changes",
1447
+ lambda *args, **kwargs: (wip_calls.append((args, kwargs)) or SimpleNamespace(ok=True)),
1448
+ )
1449
+
1450
+ status = runners._process_item(family, invocation, "R-001", paths, initial_metadata={})
1451
+ captured = capsys.readouterr()
1452
+
1453
+ assert status == "completed"
1454
+ assert plans == ["branch_create", "branch_merge"]
1455
+ assert wip_calls == []
1456
+ assert len(accepted_commit_calls) == 1
1457
+ accepted_root, accepted_kwargs = accepted_commit_calls[0]
1458
+ assert accepted_root == paths.project_root
1459
+ assert accepted_kwargs["base_head"] == "base-head"
1460
+ assert accepted_kwargs["artifact_dir"] == paths.project_root / ".prizmkit" / "specs" / "001-low"
1461
+ assert accepted_kwargs["checkpoint_path"] == accepted_kwargs["artifact_dir"] / "workflow-checkpoint.json"
1462
+ assert "R-001" in accepted_kwargs["commit_message"]
1463
+ assert observed.updates[0][0] == "success"
1464
+ assert "classification_reason" not in observed.updates[0][2]
1465
+ assert "accept_workflow_skipped" not in observed.updates[0][2]
1466
+ session_status = json.loads(
1467
+ (
1468
+ paths.refactor_state_dir
1469
+ / "R-001"
1470
+ / "sessions"
1471
+ / "R-001-session-1"
1472
+ / "session-status.json"
1473
+ ).read_text(encoding="utf-8")
1474
+ )
1475
+ assert session_status["status"] == "workflow_skipped"
1476
+ assert session_status["reason"] == "workflow_skipped"
1477
+ assert captured.err.count("[WARN]") == 1
1478
+ assert captured.err.count("accepted with incomplete workflow evidence") == 1
1479
+ assert "Reason: workflow_skipped" in captured.err
1480
+
1481
+
1482
+ def test_workflow_skipped_uses_successful_worktree_merge_path(monkeypatch, tmp_path, capsys):
1483
+ from prizmkit_runtime import runners
1484
+ from prizmkit_runtime.runner_models import family_for, parse_invocation
1485
+
1486
+ monkeypatch.setenv("USE_WORKTREE", "1")
1487
+ monkeypatch.setenv("DEV_BRANCH", "dev/F-001-accepted")
1488
+ paths = _make_paths(tmp_path / "accepted-worktree-skip")
1489
+ family = family_for("feature", paths)
1490
+ invocation = parse_invocation(family, "run", ())
1491
+ invocation = invocation.__class__(**{**invocation.__dict__, "list_path": paths.feature_plan})
1492
+ observed = _install_runner_session_fakes(
1493
+ monkeypatch,
1494
+ runners,
1495
+ statuses=("workflow_skipped",),
1496
+ update_status="completed",
1497
+ )
1498
+
1499
+ def fake_setup(runtime):
1500
+ runtime.worktree_path.mkdir(parents=True, exist_ok=True)
1501
+ return SimpleNamespace(ok=True, runtime=runtime, reason="")
1502
+
1503
+ monkeypatch.setattr(runners, "ensure_linked_worktree", fake_setup)
1504
+ monkeypatch.setattr(
1505
+ runners,
1506
+ "materialize_worktree_support_assets",
1507
+ lambda *args, **kwargs: SimpleNamespace(ok=True, reason=""),
1508
+ )
1509
+
1510
+ status = runners._process_item(family, invocation, "F-001", paths, initial_metadata={})
1511
+ captured = capsys.readouterr()
1512
+
1513
+ assert status == "completed"
1514
+ assert observed.updates[0][0] == "success"
1515
+ assert len(observed.merge_calls) == 1
1516
+ assert observed.wip_calls == []
1517
+ assert captured.err.count("[WARN]") == 1
1518
+ assert captured.err.count("accepted with incomplete workflow evidence") == 1
1519
+
1520
+
1521
+ def test_workflow_skipped_safety_failure_stays_hard_without_acceptance_warning(monkeypatch, tmp_path, capsys):
1522
+ from prizmkit_runtime import runners
1523
+ from prizmkit_runtime.runner_models import family_for, parse_invocation
1524
+
1525
+ paths = _make_paths(tmp_path / "rejected-workflow-skip")
1526
+ family = family_for("refactor", paths)
1527
+ invocation = parse_invocation(family, "run", ())
1528
+ invocation = invocation.__class__(**{**invocation.__dict__, "list_path": paths.refactor_plan})
1529
+ observed = _install_runner_session_fakes(
1530
+ monkeypatch,
1531
+ runners,
1532
+ statuses=("workflow_skipped",),
1533
+ update_status="pending",
1534
+ )
1535
+ plans = []
1536
+ wip_calls = []
1537
+
1538
+ monkeypatch.setattr(
1539
+ runners,
1540
+ "finalize_accepted_workspace_commit",
1541
+ lambda *args, **kwargs: SimpleNamespace(
1542
+ status="not_ready",
1543
+ reason="accepted_workspace_not_finalized",
1544
+ committed=False,
1545
+ commit_hash="",
1546
+ ),
1547
+ )
1548
+ monkeypatch.setattr(
1549
+ runners,
1550
+ "run_git_plan",
1551
+ lambda _root, plan: (plans.append(plan.name) or SimpleNamespace(ok=True, reason="", results=())),
1552
+ )
1553
+ monkeypatch.setattr(
1554
+ runners,
1555
+ "commit_wip_changes",
1556
+ lambda *args, **kwargs: (wip_calls.append((args, kwargs)) or SimpleNamespace(ok=True)),
1557
+ )
1558
+ monkeypatch.setattr(
1559
+ runners,
1560
+ "branch_ensure_return",
1561
+ lambda *args, **kwargs: SimpleNamespace(ok=True),
1562
+ )
1563
+
1564
+ status = runners._process_item(family, invocation, "R-001", paths, initial_metadata={})
1565
+ captured = capsys.readouterr()
1566
+
1567
+ assert status == "pending"
1568
+ assert plans == ["branch_create"]
1569
+ assert len(wip_calls) == 1
1570
+ assert observed.updates[0][0] == "commit_missing"
1571
+ assert "accepted with incomplete workflow evidence" not in captured.err
1572
+
1573
+
1401
1574
  def test_runner_launch_config_preserves_artifact_paths_live_output_and_split_thresholds(monkeypatch, tmp_path):
1402
1575
  from prizmkit_runtime import runners
1403
1576
  from prizmkit_runtime.runner_models import family_for, parse_invocation
@@ -4231,7 +4404,7 @@ def test_terminal_success_text_does_not_hide_provider_failure(tmp_path):
4231
4404
  ("kind", "item_id"),
4232
4405
  [("feature", "F-001"), ("bugfix", "B-001"), ("refactor", "R-001")],
4233
4406
  )
4234
- def test_family_status_skips_semantic_completion_failure_without_retry_spend(
4407
+ def test_family_success_completion_is_terminal_without_warning_metadata(
4235
4408
  tmp_path, kind, item_id
4236
4409
  ):
4237
4410
  from prizmkit_runtime.runner_models import family_for, parse_invocation
@@ -4259,7 +4432,7 @@ def test_family_status_skips_semantic_completion_failure_without_retry_spend(
4259
4432
  family,
4260
4433
  invocation,
4261
4434
  item_id,
4262
- "workflow_skipped",
4435
+ "success",
4263
4436
  "session-1",
4264
4437
  paths.project_root,
4265
4438
  checkpoint_state={},
@@ -4267,12 +4440,54 @@ def test_family_status_skips_semantic_completion_failure_without_retry_spend(
4267
4440
  status = json.loads((family.state_dir / item_id / "status.json").read_text(encoding="utf-8"))
4268
4441
 
4269
4442
  assert result.ok is True
4270
- assert result.data["new_status"] == "skipped"
4271
- assert result.data["restart_policy"] == "terminal_skipped"
4443
+ assert result.data["new_status"] == "completed"
4272
4444
  assert status["retry_count"] == 0
4273
4445
  assert status["infra_error_count"] == 0
4274
- assert status["needs_attention"] is True
4275
- assert status["skipped_reason"] == "workflow_completion_evidence_invalid"
4446
+ assert "completion_warning" not in status
4447
+ assert "completion_warning_reason" not in status
4448
+ assert status["resume_from_phase"] is None
4449
+
4450
+
4451
+ @pytest.mark.parametrize(
4452
+ ("kind", "item_id"),
4453
+ [("feature", "F-001"), ("bugfix", "B-001"), ("refactor", "R-001")],
4454
+ )
4455
+ def test_family_status_preserves_direct_raw_workflow_skip(
4456
+ tmp_path, kind, item_id
4457
+ ):
4458
+ from prizmkit_runtime.runner_models import family_for, parse_invocation
4459
+ from prizmkit_runtime.runner_status import start_item, update_item
4460
+
4461
+ paths = _make_paths(tmp_path / f"historical-{kind}")
4462
+ item = {
4463
+ "id": item_id,
4464
+ "title": "Historical workflow skip",
4465
+ "status": "pending",
4466
+ "priority": "high",
4467
+ "dependencies": [],
4468
+ }
4469
+ if kind == "bugfix":
4470
+ item.update(severity="high", description="invalid evidence", reproduction_steps=["run"])
4471
+ elif kind == "refactor":
4472
+ item.update(description="invalid evidence", targets=["src"], goals=["preserve"])
4473
+ _write_family_plan(paths, kind, [item])
4474
+ family = family_for(kind, paths)
4475
+ invocation = parse_invocation(family, "run", ())
4476
+ invocation = invocation.__class__(**{**invocation.__dict__, "list_path": family.plan_path})
4477
+ assert start_item(family, invocation, item_id, paths.project_root).ok is True
4478
+
4479
+ result = update_item(
4480
+ family,
4481
+ invocation,
4482
+ item_id,
4483
+ "workflow_skipped",
4484
+ "historical-session",
4485
+ paths.project_root,
4486
+ )
4487
+
4488
+ assert result.ok is True
4489
+ assert result.data["new_status"] == "skipped"
4490
+ assert result.data["restart_policy"] == "terminal_skipped"
4276
4491
 
4277
4492
 
4278
4493
  def test_invalid_existing_checkpoint_skips_terminal_success_with_completion_summary(tmp_path):