<commit_before>class Api::V4::RunsController < Api::V4::ApplicationController
  before_action :set_run, only: [:show, :update, :destroy, :disown, :runners, :splits]
  before_action :verify_ownership!, only: [:update, :destroy, :disown]

  before_action :set_link_headers, if: -> { @run.present? }

  def show
    if params[:historic] == '1'
      @run.parse(fast: false)
      render json: @run, serializer: Api::V4::RunWithHistorySerializer
    else
      render json: @run, serializer: Api::V4::RunSerializer
    end
  end

  def create
    @run = Run.create(run_params)
    if !@run.persisted?
      render status: 400, json: {
        status: 400,
        message: "Couldn't reserve run. Please try again."
      }
      return
    end

    presigned_request = s3_bucket.presigned_post(
      key: "splits/#{@run.id36}",
      key_starts_with: "splits/#{@run.id36}",
      content_length_range: 1..(10*1024)
    )

    render status: 201, location: api_v4_run_url(@run), json: {
      status: 201,
      message: "Run reserved. Use the included presigned request to upload the file to S3, with an additional `file` field containing the run file.",<commit_msg>Up S3 filesize limit from 10KB -> 100MB<commit_after>class Api::V4::RunsController < Api::V4::ApplicationController
  before_action :set_run, only: [:show, :update, :destroy, :disown, :runners, :splits]
  before_action :verify_ownership!, only: [:update, :destroy, :disown]

  before_action :set_link_headers, if: -> { @run.present? }

  def show
    if params[:historic] == '1'
      @run.parse(fast: false)
      render json: @run, serializer: Api::V4::RunWithHistorySerializer
    else
      render json: @run, serializer: Api::V4::RunSerializer
    end
  end

  def create
    @run = Run.create(run_params)
    if !@run.persisted?
      render status: 400, json: {
        status: 400,
        message: "Couldn't reserve run. Please try again."
      }
      return
    end

    presigned_request = s3_bucket.presigned_post(
      key: "splits/#{@run.id36}",
      key_starts_with: "splits/#{@run.id36}",
      content_length_range: 1..(100*1024*1024)
    )

    render status: 201, location: api_v4_run_url(@run), json: {
      status: 201,
      message: "Run reserved. Use the included presigned request to upload the file to S3, with an additional `file` field containing the run file.",
{'fraction_non_alphanumeric': 0.12765055131467345, 'fraction_numerical': 0.03095843935538592, 'mean_word_length': 3.4093457943925234, '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': '5616477', 'n_tokens_mistral': 834, 'n_tokens_neox': 777, 'n_words': 209}