Kaynağa Gözat

工作区适配:贯通 GoalCoverage 的产物装配

工作区 Artifact 装配读取并保留 Host 派生的 goal_coverage。

旧结构投影的内部临时候选补齐最小不可变来源和覆盖信息,使投影仍使用统一 StructuredScript 合同而不新增兼容分支。
SamLee 23 saat önce
ebeveyn
işleme
ce67c4ce83

+ 8 - 1
script_build_host/src/script_build_host/application/legacy_projection.py

@@ -11,6 +11,7 @@ from sqlalchemy import or_, select
 from sqlalchemy.ext.asyncio import AsyncSession, async_sessionmaker
 
 from script_build_host.domain.errors import BuildNotFound, LegacyCanonicalIdentityConflict
+from script_build_host.domain.goal_coverage import GoalCoverage
 from script_build_host.domain.phase_three_artifacts import (
     LegacyProjectionCanonicalV1,
     canonicalize_legacy_projection,
@@ -250,7 +251,13 @@ class LegacyDetailProjectionService:
             paragraphs=candidate_paragraphs,
             elements=candidate_elements,
             paragraph_element_links=tuple(links),
-            source_artifact_refs=(),
+            source_artifact_refs=("script-build://artifact-versions/1",),
+            goal_coverage=(
+                GoalCoverage(
+                    "legacy-projection",
+                    ("script-build://artifact-versions/1",),
+                ),
+            ),
             evidence_refs=(),
             acceptance_notes=(),
         )

+ 5 - 0
script_build_host/src/script_build_host/repositories/workspace.py

@@ -18,6 +18,7 @@ from script_build_host.domain.artifacts import (
     ArtifactState,
     ArtifactVersion,
 )
+from script_build_host.domain.goal_coverage import GoalCoverage
 from script_build_host.domain.phase_two_artifacts import (
     CandidateLineageV1,
     ElementSetArtifactV1,
@@ -1331,6 +1332,10 @@ def _workspace_artifact(
             elements=snapshot.elements,
             paragraph_element_links=snapshot.links,
             source_artifact_refs=tuple(structured_script.get("source_artifact_refs", ())),
+            goal_coverage=tuple(
+                item if isinstance(item, GoalCoverage) else GoalCoverage.from_payload(item)
+                for item in structured_script.get("goal_coverage", ())
+            ),
             evidence_refs=tuple(structured_script.get("evidence_refs", ())),
             acceptance_notes=tuple(structured_script.get("acceptance_notes", ())),
         )