from pathlib import Path API = Path("frontend/src/api/dataRules.js") AUTHORING = Path("frontend/src/components/DataRules/RuleAuthoringPanel.vue") STANDARD = Path( "frontend/src/views/dataGovernance/dataStandard/components/edit.vue" ) DATAFLOW = Path( "frontend/src/views/dataGovernance/dataProcess/components/edit.vue" ) FACTORY = Path( "frontend/src/views/dataFactory/workflow/ProductionLineDeployment.vue" ) FACTORY_INDEX = Path("frontend/src/views/dataFactory/workflow/index.vue") def test_rule_api_client_exposes_versions_publish_and_server_side_release(): source = API.read_text(encoding="utf-8") assert "http.get('/rules/capabilities')" in source assert "http.post('/rules/interpret'" in source assert "http.post('/rules/validate'" in source assert "http.post('/rules/production-lines/resolve'" in source assert "http.post('/rules/rule-versions'" in source assert "http.post(`/rules/rule-versions/${versionId}/publish`)" in source assert "http.post('/rules/standard-versions'" in source assert "http.post(`/rules/standard-versions/${versionId}/publish`)" in source assert "http.post(`/rules/production-lines/${dataflowUid}/release`" in source assert "/activate" not in source def test_reusable_authoring_panel_preserves_human_review_gate(): source = AUTHORING.read_text(encoding="utf-8") assert "authoringSurface" in source assert "interpretRule" in source assert "clarification_required" in source assert "$emit('candidate'" in source assert "createRuleVersion" in source assert "createStandardVersion" in source assert "publishRuleVersion" in source assert "rules:publish" in source assert "$emit('version'" in source assert "自动执行" not in source def test_standard_and_dataflow_both_embed_ai_rule_authoring(): standard = STANDARD.read_text(encoding="utf-8") dataflow = DATAFLOW.read_text(encoding="utf-8") assert 'authoring-surface="data_standard"' in standard assert "handleRuleCandidate" in standard assert '@version="handleRuleVersion"' in standard assert 'authoring-surface="data_flow"' in dataflow assert "handleRuleCandidate" in dataflow assert '@version="handleRuleVersion"' in dataflow assert "rule_spec" in dataflow def test_data_factory_exposes_release_ready_but_no_fake_activation(): page = FACTORY.read_text(encoding="utf-8") index = FACTORY_INDEX.read_text(encoding="utf-8") assert "数据生产线投产" in page assert "getRuleCapabilities" in page assert "production_line_release" in page assert "data_factory_activation" in page assert "发布版本" in page assert "执行计划" in page assert "发布与执行计划已经可用" in page assert "投产激活仍保持关闭" in page assert "ProductionLineDeployment" in index