feat(skill-learning): merge plugin skill updates

This commit is contained in:
2026-06-16 11:55:55 +08:00
parent c9e6c37b5c
commit a34b1219bc
15 changed files with 860 additions and 5 deletions

View File

@ -222,3 +222,80 @@ def test_publish_blocks_failed_preservation_report(tmp_path: Path) -> None:
with pytest.raises(ValueError, match="preservation"):
pipeline.publish(draft.skill_name, draft.draft_id, publisher="tester")
def test_publish_blocks_plugin_three_way_without_plugin_preservation_report(tmp_path: Path) -> None:
pipeline = _pipeline(tmp_path)
draft = pipeline.draft_service.create_plugin_update_draft(
skill_name="plugin-skill",
base_version="v0001",
proposed_content="# Plugin\n\nDo it.",
proposed_frontmatter={"description": "plugin", "tools": []},
created_by="test",
reason="plugin update",
provenance={"merge_mode": "three_way"},
)
pipeline.learning_store.write_eval_report(
SkillDraftEvalReport(
report_id="eval-plugin",
skill_name=draft.skill_name,
draft_id=draft.draft_id,
candidate_id="candidate-1",
passed=True,
baseline_score_avg=0.8,
candidate_score_avg=0.9,
score_delta=0.1,
regression_count=0,
improved_count=1,
unchanged_count=0,
confidence="medium",
mode="replay",
eval_version="replay-v1",
preservation_report={"passed": True, "mode": "ordinary"},
)
)
pipeline.submit_review(draft.skill_name, draft.draft_id, requested_by="tester")
pipeline.check_safety(draft.skill_name, draft.draft_id)
with pytest.raises(ValueError, match="three-way preservation"):
pipeline.publish(draft.skill_name, draft.draft_id, publisher="tester")
def test_publish_blocks_plugin_update_with_unresolved_supporting_file_conflicts(tmp_path: Path) -> None:
pipeline = _pipeline(tmp_path)
draft = pipeline.draft_service.create_plugin_update_draft(
skill_name="plugin-skill",
base_version="v0001",
proposed_content="# Plugin\n\nDo it.",
proposed_frontmatter={"description": "plugin", "tools": []},
created_by="test",
reason="plugin update",
provenance={
"merge_mode": "three_way",
"supporting_file_plan": {"conflicts": [{"path": "a.txt", "reason": "diverged"}]},
},
)
pipeline.learning_store.write_eval_report(
SkillDraftEvalReport(
report_id="eval-plugin-conflict",
skill_name=draft.skill_name,
draft_id=draft.draft_id,
candidate_id="candidate-1",
passed=True,
baseline_score_avg=0.8,
candidate_score_avg=0.9,
score_delta=0.1,
regression_count=0,
improved_count=1,
unchanged_count=0,
confidence="medium",
mode="replay",
eval_version="replay-v1",
preservation_report={"passed": True, "mode": "plugin_three_way", "unresolved_conflicts": []},
)
)
pipeline.submit_review(draft.skill_name, draft.draft_id, requested_by="tester")
pipeline.check_safety(draft.skill_name, draft.draft_id)
with pytest.raises(ValueError, match="supporting-file conflicts"):
pipeline.publish(draft.skill_name, draft.draft_id, publisher="tester")