<commit_before>class TreeBuilderComplianceHistory < TreeBuilder
  has_kids_for Compliance, [:x_get_compliance_kids]
  has_kids_for ComplianceDetail, %i[x_get_compliance_detail_kids parents]

  def override(node, _object)
    node[:selectable] = false
  end

  def initialize(name, sandbox, build = true, **params)
    sandbox[:ch_root] = TreeBuilder.build_node_id(params[:root]) if params[:root]
    @root = params[:root]
    unless @root
      model, id = TreeBuilder.extract_node_model_and_id(sandbox[:ch_root])
      @root = model.constantize.find_by(:id => id)
    end
    super(name, sandbox, build)
  end

  private

  def tree_init_options
    {:full_ids => true}
  end

  def x_get_tree_roots(count_only)
    count_only_or_objects(count_only, @root.compliances.order("timestamp DESC").limit(10))
  end
<commit_msg>Do not rely on the obsolete sandbox variable in ComplianceHistory🌳<commit_after>class TreeBuilderComplianceHistory < TreeBuilder
  has_kids_for Compliance, [:x_get_compliance_kids]
  has_kids_for ComplianceDetail, %i[x_get_compliance_detail_kids parents]

  def override(node, _object)
    node[:selectable] = false
  end

  def initialize(name, sandbox, build = true, **params)
    @root = params[:root]
    super(name, sandbox, build)
  end

  private

  def tree_init_options
    {:full_ids => true}
  end

  def x_get_tree_roots(count_only)
    count_only_or_objects(count_only, @root.compliances.order("timestamp DESC").limit(10))
  end

{'fraction_non_alphanumeric': 0.09836065573770492, 'fraction_numerical': 0.00273224043715847, 'mean_word_length': 4.979591836734694, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 6, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2883952', 'n_tokens_mistral': 532, 'n_tokens_neox': 489, 'n_words': 102}