def evaluate(c):
    decisive=['customization_request_id','canonical_core_ref','tenant_or_deploy_scope','variation_type','extension_or_config_ref','compatibility_window','upgrade_test_ref','security_patch_path','support_owner','support_tier_impact','divergence_budget','fork_trigger','evidence_ref']
    if any(not c.get(k) for k in decisive):
        return _out('HOLD_EVIDENCE_MISSING','UNKNOWN','UNKNOWN','UNKNOWN','UNKNOWN','DECISIVE_EVIDENCE_MISSING')
    if c.get('security_patch_mergeable') is False:
        return _out('BLOCKED_SECURITY_PATCH','DIVERGED' if c.get('source_divergence') else 'CANONICAL','STALE','BLOCKED','ESCALATED','URGENT_PATCH_CANNOT_PROPAGATE')
    if c.get('source_divergence') and not c.get('bounded_fork_exception'):
        return _out('BLOCKED_SOURCE_DIVERGENCE','DIVERGED','STALE','RISK','ESCALATED','CUSTOMER_SOURCE_BRANCH_BECOMES_SYSTEM_OF_RECORD')
    if c.get('variation_type')=='CONFIG' and not (c.get('config_documented') and c.get('config_tested') and c.get('config_owner')):
        return _out('HOLD_CONFIG_UNBOUNDED','CANONICAL','UNKNOWN','UNKNOWN','UNOWNED','CONFIG_SURFACE_NOT_GOVERNED')
    if c.get('uses_internal_unversioned_api') or c.get('upgrade_test_pass') is False:
        return _out('HOLD_COMPATIBILITY','CANONICAL','FAILED','PATCHABLE','PARTIAL','EXTENSION_COMPATIBILITY_UNPROVEN')
    if c.get('isolation_option') and c.get('isolation_contract_explicit'):
        return _out('ISOLATE_SERVICE','CANONICAL','PASS','PATCHABLE','BOUNDED','CUSTOMER_LOGIC_ISOLATED_BEHIND_EXPLICIT_CONTRACT')
    if c.get('upstream_candidate') and c.get('shared_product_fit'):
        return _out('UPSTREAM','CANONICAL','PLANNED','PATCHABLE','CORE_OWNED','SHARED_CAPABILITY_BELONGS_UPSTREAM')
    if c.get('bounded_fork_exception'):
        if not (c.get('fork_exception_owner') and c.get('sunset_or_rejoin_condition')):
            return _out('HOLD_EVIDENCE_MISSING','DIVERGED','PARTIAL','RISK','ESCALATED','FORK_EXCEPTION_AUTHORITY_OR_REJOIN_MISSING')
        return _out('FORK_EXCEPTION','BOUNDED_DIVERGENCE','TIME_BOUNDED','PATCHABLE','ESCALATED','EXPLICIT_TIME_BOUNDED_EXCEPTION')
    return _out('ACCEPT_STANDARD','CANONICAL','PASS','PATCHABLE','BOUNDED','BOUNDED_VARIATION_WITH_CANONICAL_CORE')

def _out(decision,core,compat,security,support,reason):
    return {'decision_state':decision,'core_state':core,'compatibility_state':compat,'security_state':security,'support_state':support,'reason_code':reason}
