wip: phase_z2 evidence 파이프라인 + matching 실험(phase2~26) + 프론트 trace 패널 진행분 스냅샷
- src: phase_z2 composition/mapper/pipeline/placement_planner/retry, ai_fallback(prompts/schema/validate), mdx_text_atoms 신규 - Front: PipelineTracePanel 신규, FramePanel/SlideCanvas/Home/designAgentApi 등 갱신 + 테스트 4종 추가 - templates/phase_z2: catalog(component_expansion_registry, node_slot_mapping 신규), frames, families, slide_base 갱신 - tests/matching: phase2~26 매칭 실험 스크립트·리포트·온톨로지 전체 (미커밋 진행분) - tests: b4_v4 evidence, task5~28.5 시리즈, regression(imp95 baseline) 등 신규 테스트 대량 추가 - docs/reference: MDX 구조 인벤토리, MDX→Frame 구조 계약 문서 - scripts: mdx 계약/parity/coverage/viewport 체크, gitea comment, run sync 유틸 - .gitignore: tmp*.json, chromedriver, .orchestrator, *.pkl, Front_test* 등 임시/스냅샷 제외 미완성 작업의 보존용 스냅샷 커밋 (2026-07-02) Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,176 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { buildAiTraceSummary, buildPipelineTraceSummary } from "../src/services/designAgentApi";
|
||||
|
||||
describe("#98 Task 6 pipeline trace summary", () => {
|
||||
it("connects sections, units, zones, and render-blocked warnings", () => {
|
||||
const trace = buildPipelineTraceSummary({
|
||||
normalized: {
|
||||
data: {
|
||||
sections: [
|
||||
{ section_id: "01-1", title: "S1" },
|
||||
{ section_id: "01-2", title: "S2" },
|
||||
],
|
||||
},
|
||||
},
|
||||
compositionPlan: {
|
||||
data: {
|
||||
selected_units: [
|
||||
{
|
||||
source_section_ids: ["01-1"],
|
||||
frame_template_id: "frame_a",
|
||||
label: "use_as_is",
|
||||
selection_path: "rank_1",
|
||||
},
|
||||
{
|
||||
source_section_ids: ["01-2"],
|
||||
frame_template_id: "frame_b",
|
||||
label: "use_as_is",
|
||||
selection_path: "provisional_rank_1",
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
applicationPlan: {
|
||||
data: {
|
||||
units: [
|
||||
{
|
||||
unit_id: "01-1",
|
||||
current_default_candidate: "frame_a",
|
||||
sorted_candidate_evidence: [
|
||||
{ template_id: "frame_a", label: "use_as_is", confidence: 0.9 },
|
||||
],
|
||||
},
|
||||
{
|
||||
unit_id: "01-2",
|
||||
current_default_candidate: "frame_b",
|
||||
sorted_candidate_evidence: [
|
||||
{ template_id: "frame_b", label: "use_as_is", confidence: 0.8 },
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
slotPayload: {
|
||||
data: {
|
||||
per_zone: [
|
||||
{ position: "top", template_id: "frame_a", slot_payload: { title: "S1" } },
|
||||
{ position: "bottom", template_id: "__empty__", slot_payload: {} },
|
||||
],
|
||||
},
|
||||
},
|
||||
slideStatus: {
|
||||
data: {
|
||||
overall: "PARTIAL_COVERAGE",
|
||||
covered_section_ids: ["01-1", "01-2"],
|
||||
content_rendered_section_ids: ["01-1"],
|
||||
filtered_section_ids: ["01-2"],
|
||||
render_blocked_section_ids: ["01-2"],
|
||||
adapter_needed_count: 1,
|
||||
adapter_needed_units: [
|
||||
{
|
||||
position: "bottom",
|
||||
source_section_ids: ["01-2"],
|
||||
reason: "fit_error",
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
expect(trace.sections.map((section) => [section.id, section.state])).toEqual([
|
||||
["01-1", "rendered"],
|
||||
["01-2", "render_blocked"],
|
||||
]);
|
||||
expect(trace.sections[1].reasons).toEqual([
|
||||
"fit_error",
|
||||
"filtered",
|
||||
]);
|
||||
expect(trace.units.map((unit) => [unit.unit_id, unit.candidate_count])).toEqual([
|
||||
["01-1", 1],
|
||||
["01-2", 1],
|
||||
]);
|
||||
expect(trace.zones[1]).toMatchObject({
|
||||
position: "bottom",
|
||||
source_section_ids: ["01-2"],
|
||||
template_id: "__empty__",
|
||||
slot_status: "empty",
|
||||
warnings: ["__empty__", "empty_slot_payload", "fit_error"],
|
||||
});
|
||||
expect(trace.warnings).toContain("render_blocked:01-2");
|
||||
expect(trace.warnings).toContain("adapter_needed:1");
|
||||
});
|
||||
});
|
||||
|
||||
describe("#98 Task 7 AI trace summary", () => {
|
||||
it("summarizes AI called/skipped/error state from step12_ai_repair", () => {
|
||||
const trace = buildAiTraceSummary(
|
||||
{
|
||||
step_status: "done",
|
||||
data: {
|
||||
per_unit: [
|
||||
{
|
||||
unit_index: 0,
|
||||
source_section_ids: ["04-1"],
|
||||
frame_template_id: "frame_reject",
|
||||
route_hint: "ai_adaptation_required",
|
||||
provisional: true,
|
||||
ai_called: false,
|
||||
skip_reason: "router_short_circuit",
|
||||
apply_status: "no_proposal",
|
||||
api_error_kind: null,
|
||||
error: null,
|
||||
},
|
||||
{
|
||||
unit_index: 1,
|
||||
source_section_ids: ["04-2"],
|
||||
frame_template_id: "frame_auto",
|
||||
route_hint: "direct_render",
|
||||
provisional: false,
|
||||
ai_called: false,
|
||||
skip_reason: "not_provisional",
|
||||
apply_status: "no_proposal",
|
||||
api_error_kind: null,
|
||||
error: null,
|
||||
},
|
||||
],
|
||||
coverage_invariant: { status: "ok" },
|
||||
},
|
||||
},
|
||||
{
|
||||
status: "ok",
|
||||
counts: { total: 2, applied: 0, no_proposal: 2, no_zone_match: 0, unsupported_kind: 0, error: 0 },
|
||||
unsupported_kind_records: [],
|
||||
error_records: [],
|
||||
coverage_status: "ok",
|
||||
dropped_section_ids: [],
|
||||
human_review_required: false,
|
||||
},
|
||||
);
|
||||
|
||||
expect(trace.artifact_present).toBe(true);
|
||||
expect(trace.ai_enabled).toBe(false);
|
||||
expect(trace.ai_called_count).toBe(0);
|
||||
expect(trace.eligible_count).toBe(1);
|
||||
expect(trace.skip_reasons).toEqual({
|
||||
router_short_circuit: 1,
|
||||
not_provisional: 1,
|
||||
});
|
||||
expect(trace.warnings).toContain("router_short_circuit");
|
||||
expect(trace.units[0]).toMatchObject({
|
||||
source_section_ids: ["04-1"],
|
||||
route_hint: "ai_adaptation_required",
|
||||
provisional: true,
|
||||
ai_called: false,
|
||||
skip_reason: "router_short_circuit",
|
||||
});
|
||||
});
|
||||
|
||||
it("surfaces missing step12 AI artifact as an explicit warning", () => {
|
||||
const trace = buildAiTraceSummary(null, null);
|
||||
|
||||
expect(trace.artifact_present).toBe(false);
|
||||
expect(trace.ai_enabled).toBeNull();
|
||||
expect(trace.status).toBe("missing_artifact");
|
||||
expect(trace.warnings).toEqual(["step12_ai_repair.json missing"]);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user