/**
 * Dual-layer mechanism definitions — governance section.
 * Auto-extracted from the monolithic dual_layer_mechanism_registry.
 */
export const MECHANISM_CONTRACTS_GOVERNANCE = [
    // ── 机制运行时健康度 ──
    {
        mechanism_id: "mc-mechanism-health",
        mechanism_name: "机制运行时健康度",
        owner_issue_id: "Q5长期机制化",
        priority: "P1",
        template_layer: {
            required: true,
            assets: [{ path: "templates/internal/rules/机制自治理规则.md", asset_kind: "knowledge_rule", consumption_mode: "required" }],
            injected_routes: ["verification", "operation"],
            injected_workflows: ["validate-mechanisms", "validate-release"],
            target_hosts: ["claude_code"],
            language_policy: "zh_first",
        },
        enforcement_layer: {
            required: true,
            enforcers: ["src/engine/contracts/mechanism_health_check.ts"],
            registries: ["dual_layer_mechanism_registry", "mechanism_contract_registry", "explicit_asset_registry"],
            entrypoints: ["runFullHealthCheck", "detectLazyDeadImports", "detectUnconsumedMechanismIds"],
            state_effects: [],
            hard_fail_conditions: ["lazy import 未调用", "机制资产未注册", "机制身份未消费"],
            degradation_behavior: "离线治理机制，仅发布和维护命令阻断",
        },
        evidence_layer: {
            outputs: ["MechanismHealthReport"],
            reports: ["mechanism_health_report"],
            diagnostic_codes: [],
            task_context_facts: [],
        },
        verification_layer: {
            tests: ["tests/engine/mechanism_health_check.test.ts"],
            runtime_checks: ["validate-release 历史问题长期机制化行为验证"],
            regression_cases: ["lazy import 未调用 → hard_fail", "机制资产缺失 → hard_fail"],
            drift_checks: ["注册表与消费路径一致"],
        },
        status: "dual_layer_enforced",
    },
    {
        mechanism_id: "mc-config-write-boundary",
        mechanism_name: "配置落盘边界",
        owner_issue_id: "Q6长期机制化",
        priority: "P2",
        template_layer: {
            required: true,
            assets: [{ path: "templates/internal/rules/配置落盘边界规则.md", asset_kind: "knowledge_rule", consumption_mode: "required" }],
            injected_routes: ["operation"],
            injected_workflows: ["init", "sync-templates"],
            target_hosts: ["claude_code"],
            language_policy: "zh_first",
        },
        enforcement_layer: {
            required: true,
            enforcers: ["src/engine/config/config_write_boundary.ts"],
            registries: ["mechanism_contract_registry", "explicit_asset_registry"],
            entrypoints: ["classifyConfigContext", "isWriteAllowed", "validateWriteBoundary"],
            state_effects: [],
            hard_fail_conditions: ["运行时推断自动落盘", "已有项目未确认写入"],
            degradation_behavior: "空项目初始化允许，已有项目需要确认",
        },
        evidence_layer: {
            outputs: ["ConfigWriteDecision"],
            reports: ["write_boundary_violation"],
            diagnostic_codes: [],
            task_context_facts: [],
        },
        verification_layer: {
            tests: ["tests/engine/config_write_boundary.test.ts"],
            runtime_checks: ["validate-release 历史问题长期机制化行为验证"],
            regression_cases: ["runtime inference 写配置 → blocked", "greenfield init → allowed"],
            drift_checks: ["CLI 写入路径与边界一致"],
        },
        status: "dual_layer_enforced",
    },
    {
        mechanism_id: "mc-knowledge-governance",
        mechanism_name: "知识治理统一入口",
        owner_issue_id: "Q7/Q10/Q14/Q21/Q41长期机制化",
        priority: "P0",
        template_layer: {
            required: true,
            assets: [{ path: "templates/internal/rules/知识治理规则.md", asset_kind: "knowledge_rule", consumption_mode: "required" }],
            injected_routes: ["verification", "operation", "knowledge_update"],
            injected_workflows: ["validate", "sync-templates", "validate-release"],
            target_hosts: ["claude_code"],
            language_policy: "zh_first",
        },
        enforcement_layer: {
            required: true,
            enforcers: ["src/engine/knowledge/knowledge_governance_gate.ts"],
            registries: ["mechanism_contract_registry", "explicit_asset_registry"],
            entrypoints: ["runKnowledgeGovernanceCheck", "checkSemanticCompliance", "checkEvolutionEvidence", "checkDocumentationGovernance"],
            state_effects: [],
            hard_fail_conditions: ["知识晋级无证据", "中文语义污染", "设计文档承载未验证事实"],
            degradation_behavior: "validate 输出治理报告，apply 与 release gate 执行阻断",
        },
        evidence_layer: {
            outputs: ["KnowledgeGovernanceReport"],
            reports: ["knowledge_governance_report"],
            diagnostic_codes: [],
            task_context_facts: [],
        },
        verification_layer: {
            tests: ["tests/engine/knowledge_injection_boundary.test.ts"],
            runtime_checks: ["validate-release 历史问题长期机制化行为验证"],
            regression_cases: ["知识晋级无证据 → hard_fail", "中文语义污染 → warning"],
            drift_checks: ["知识治理入口调用下游模块"],
        },
        status: "dual_layer_enforced",
    },
    {
        mechanism_id: "mc-log-governance",
        mechanism_name: "日志治理与用户输出纯净",
        owner_issue_id: "Q59/Q29长期机制化",
        priority: "P0",
        template_layer: {
            required: true,
            assets: [{ path: "templates/internal/rules/日志治理规则.md", asset_kind: "knowledge_rule", consumption_mode: "required" }],
            injected_routes: ["verification", "operation"],
            injected_workflows: ["sf_learn", "sf_verify", "validate-release"],
            target_hosts: ["claude_code"],
            language_policy: "zh_first",
        },
        enforcement_layer: {
            required: true,
            enforcers: ["src/engine/core/log_governance.ts"],
            registries: ["mechanism_contract_registry", "explicit_asset_registry"],
            entrypoints: ["enforceLogGovernance", "evaluateFeedbackOutputQuality", "assessOutputNoise"],
            state_effects: [],
            hard_fail_conditions: ["内部噪音输出", "JSON stdout 污染", "直接 console 输出"],
            degradation_behavior: "默认不影响正常输出，仅阻断噪音和污染",
        },
        evidence_layer: {
            outputs: ["LogGovernanceReport"],
            reports: ["log_governance_report"],
            diagnostic_codes: [],
            task_context_facts: [],
        },
        verification_layer: {
            tests: ["tests/engine/log_governance.test.ts"],
            runtime_checks: ["validate-release 历史问题长期机制化行为验证"],
            regression_cases: ["内部噪音 → hard_fail", "正常中文输出 → pass"],
            drift_checks: ["logger 与输出治理一致"],
        },
        status: "dual_layer_enforced",
    },
    // ── 门禁引擎 ──
    {
        mechanism_id: "mc-stage-gate-engine",
        mechanism_name: "门禁引擎",
        owner_issue_id: "问题六十九",
        priority: "P1",
        template_layer: {
            required: true,
            assets: [
                { path: "templates/gates/shared/gate-任务规划.yaml", asset_kind: "stage_gate", consumption_mode: "copy_only" },
                { path: "templates/gates/shared/gate-编码与单元测试.yaml", asset_kind: "stage_gate", consumption_mode: "copy_only" },
                { path: "templates/gates/existing-system/gate-现有系统分析.yaml", asset_kind: "stage_gate", consumption_mode: "copy_only" },
                { path: "templates/gates/existing-system/gate-编码与单元测试.yaml", asset_kind: "stage_gate", consumption_mode: "copy_only" },
                { path: "templates/gates/existing-system/gate-试运行.yaml", asset_kind: "stage_gate", consumption_mode: "copy_only" },
            ],
            injected_routes: ["code_change", "analysis"],
            injected_workflows: ["pipeline"],
            target_hosts: ["claude_code"],
            language_policy: "zh_first",
        },
        enforcement_layer: {
            required: true,
            enforcers: ["src/engine/pipeline/stage_gate_engine.ts"],
            registries: ["mechanism_contract_registry", "consumable_asset_registry"],
            entrypoints: ["executeStageGate", "loadGateConfig"],
            state_effects: ["gate_result → allow/block"],
            hard_fail_conditions: ["门禁配置缺失", "校验产物不完整"],
            degradation_behavior: "缺失配置时 advisory 不阻断",
        },
        evidence_layer: {
            outputs: ["GateCheckResult"],
            reports: ["StageGateReport"],
            diagnostic_codes: ["gate-config-missing", "gate-artifact-incomplete"],
            task_context_facts: ["gate_status"],
        },
        verification_layer: {
            tests: ["tests/engine/design_lifecycle_contract.test.ts"],
            runtime_checks: ["gate_checked_before_stage"],
            regression_cases: ["missing_config_advisory", "artifact_incomplete_blocked"],
            drift_checks: ["gate_config_matches_registry"],
        },
        status: "dual_layer_enforced",
    },
    // ── 回退路由 ──
    {
        mechanism_id: "mc-rollback-router",
        mechanism_name: "回退路由",
        owner_issue_id: "问题六十九",
        priority: "P1",
        template_layer: {
            required: true,
            assets: [
                { path: "templates/rules/existing-system/耦合检测规则.md", asset_kind: "pipeline_rule", consumption_mode: "copy_only" },
                { path: "templates/rules/existing-system/试运行熔断规则.md", asset_kind: "pipeline_rule", consumption_mode: "copy_only" },
            ],
            injected_routes: ["code_change", "analysis"],
            injected_workflows: ["pipeline"],
            target_hosts: ["claude_code"],
            language_policy: "zh_first",
        },
        enforcement_layer: {
            required: true,
            enforcers: ["src/engine/pipeline/rollback_router.ts"],
            registries: ["mechanism_contract_registry"],
            entrypoints: ["resolveRollbackTarget", "executeRollback"],
            state_effects: ["rollback → 上游阶段"],
            hard_fail_conditions: ["回退目标不存在", "回退循环"],
            degradation_behavior: "无可用回退路径时 stop_escalate",
        },
        evidence_layer: {
            outputs: ["RollbackTarget"],
            reports: ["RollbackReport"],
            diagnostic_codes: ["rollback-target-missing", "rollback-cycle"],
            task_context_facts: ["rollback_history"],
        },
        verification_layer: {
            tests: ["tests/engine/design_lifecycle_contract.test.ts"],
            runtime_checks: ["rollback_target_resolved"],
            regression_cases: ["no_rollback_target_stop", "rollback_cycle_prevented"],
            drift_checks: ["rollback_paths_match_design"],
        },
        status: "dual_layer_enforced",
    },
    // ── 切片执行器 ──
    {
        mechanism_id: "mc-slice-executor",
        mechanism_name: "切片执行器",
        owner_issue_id: "问题六十九",
        priority: "P1",
        template_layer: {
            required: true,
            assets: [
                { path: "templates/artifacts/shared/切片计划模版.md", asset_kind: "pipeline_artifact", consumption_mode: "copy_only" },
            ],
            injected_routes: ["code_change"],
            injected_workflows: ["pipeline"],
            target_hosts: ["claude_code"],
            language_policy: "zh_first",
        },
        enforcement_layer: {
            required: true,
            enforcers: ["src/engine/pipeline/slice_executor.ts"],
            registries: ["mechanism_contract_registry"],
            entrypoints: ["createSliceContext", "reviewSlice", "getNextSlice"],
            state_effects: ["slice_context → 隔离执行"],
            hard_fail_conditions: ["切片间隔离违反", "切片依赖循环"],
            degradation_behavior: "隔离违反时阻断当前切片",
        },
        evidence_layer: {
            outputs: ["SliceExecutionResult", "SliceReviewResult"],
            reports: ["SliceExecutionReport"],
            diagnostic_codes: ["slice-isolation-violation", "slice-dependency-cycle"],
            task_context_facts: ["completed_slices"],
        },
        verification_layer: {
            tests: ["tests/engine/design_lifecycle_contract.test.ts"],
            runtime_checks: ["slice_isolation_enforced"],
            regression_cases: ["isolation_violation_blocked", "single_slice_reviewable"],
            drift_checks: ["slice_plan_matches_registry"],
        },
        status: "dual_layer_enforced",
    },
];
//# sourceMappingURL=mechanisms_governance.js.map