refactor: simplify distillation data layout

This commit is contained in:
Jerry
2026-07-27 17:40:16 +08:00
parent 8895178844
commit c8dbc51549
34 changed files with 132 additions and 7791 deletions
@@ -58,7 +58,7 @@ Write `cad-task.json` beside the task artifacts with this minimum shape:
],
"parameters": {},
"experience": {
"library": "../../../designir-pipeline/workspace/promotion/promoted/library.json",
"library": "../../../designir-pipeline/output/library.json",
"context_kind": "generalized_cad_experience_query",
"methods_applied": []
},
@@ -74,10 +74,10 @@ have a sibling `*.designir.json` that owns its coordinate system, datums,
parameters, expressions, features, constraints, edit interface, and validation
contract. See `designir-2.0.md`.
For an uploaded STEP, keep teacher geometry in the protected ingestion and
acceptance workspace. The reconstruction task contains private evidence,
DesignIR, backend source, and rebuilt STEP but no teacher STEP or imported
B-Rep.
For an uploaded STEP, keep teacher geometry in `designir-pipeline/input/` and
all private evidence, DesignIR candidates, rebuilds, and acceptance reports in
`designir-pipeline/runs/`. The reconstruction task receives evidence but no
teacher STEP or imported B-Rep.
## Backend adapter requirements
+7 -11
View File
@@ -241,15 +241,13 @@ def default_experience_library() -> Path | None:
configured = os.environ.get("CAD_EXPERIENCE_LIBRARY", "").strip()
if configured:
return Path(configured).expanduser()
workspace_candidate = (
published_candidate = (
SKILL_ROOT.parents[2]
/ "designir-pipeline"
/ "workspace"
/ "promotion"
/ "promoted"
/ "output"
/ "library.json"
)
return workspace_candidate if workspace_candidate.is_file() else None
return published_candidate if published_candidate.is_file() else None
def classify_edit_context(
@@ -265,20 +263,18 @@ def classify_edit_context(
(
SKILL_ROOT.parents[2]
/ "designir-pipeline"
/ "workspace"
/ "teacher"
/ "input"
).resolve(),
(
SKILL_ROOT.parents[2]
/ "designir-pipeline"
/ "workspace"
/ "acceptance"
/ "runs"
).resolve(),
]
if any(source == root or root in source.parents for root in protected_roots):
raise ValueError(
"cad-router reconstruction cannot read the teacher or acceptance "
"vault; pass the ingestion job reference or an editable DesignIR"
"cad-router reconstruction cannot read distillation input or run "
"artifacts; pass an editable DesignIR outside the private pipeline"
)
suffix = source.suffix.lower() if source else ""
text = request.lower()
@@ -363,12 +363,10 @@ class CadRouterTests(unittest.TestCase):
teacher_source = (
Path(__file__).resolve().parents[5]
/ "designir-pipeline"
/ "workspace"
/ "teacher"
/ "inbox"
/ "input"
/ "part.step"
)
with self.assertRaisesRegex(ValueError, "cannot read the teacher"):
with self.assertRaisesRegex(ValueError, "cannot read distillation input"):
route_module.route(
self.parse(
"修改这个零件",
@@ -377,6 +375,23 @@ class CadRouterTests(unittest.TestCase):
)
)
def test_private_run_artifact_is_rejected_as_edit_source(self) -> None:
run_source = (
Path(__file__).resolve().parents[5]
/ "designir-pipeline"
/ "runs"
/ "designir"
/ "part.designir.json"
)
with self.assertRaisesRegex(ValueError, "cannot read distillation input"):
route_module.route(
self.parse(
"修改这个零件",
"--edit-source",
str(run_source),
)
)
if __name__ == "__main__":
unittest.main()