Skip to content

Draft: Updating a Wiki page can result in a job payload exceeding the limit

What does this MR do and why?

  • Throw UpdateError when payload exceeds or is equal to 5MB.
  • Write specs for the same.

Screenshots or screen recordings

N/A

How to set up and validate locally

Run bundle exec rspec spec/services/wiki_pages/update_service_spec.rb

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Related to #367628 (closed)

Pinging @oregand for continuing the old MR.

From the previous MR (!106027 (closed))...

Am I correct in my assumption that we can add this omit logic in the WikiPageBuilder as I had suggested in the beginning of the issue? Something akin to (please excuse my terrible pseudocode in this example):

def build
 wiki_page
   .attributes
   .merge(
     'content' => wiki_page_content(wiki_page)
   )
end


def wiki_page_content(wiki_page)
 return unless wiki_page.content.size <= 5.megabytes.freeze

  absolute_image_urls(wiki_page.content)
end

I would rather opt to simply omit the context rather than truncate it as this might cause other issues we cannot predict.

Merge request reports