Display summary provided by DCR when it has nothing specific to comment on

What does this MR do and why?

Discussed in #538977 (comment 2485869445).

We should display the text within <review></review> tag if it is available and if there were no <comment> tags found in the response. The text will be added to the summary comment.

Before:

I finished my review and found nothing to comment on. Nice work! 🎉

After:

I finished my review and found nothing to comment on. Nice work! 🎉

The changes look good. The MR adds the environment variable `export GITLAB_SIMULATE_SAAS=0` to the documentation for setting up a cloud license via CustomersDot. This aligns with the MR description which mentions that this variable is needed when running a self-managed instance to add subscriptions. The change is straightforward and correctly placed in the documentation.

References

Screenshots or screen recordings

It's hard to get a response from llm which has a summary. So hard code it here:

          def response_body
            ai_response&.dig('content', 0, 'text')
+++            "<review>This MR blah blah...\n<comment file=\"go/server.go\" priority=\"2\" old_line=\"\" new_line=\"16\">\nConsider making the port configurable through an environment variable or command-line flag rather than hardcoding it. This would make the server more flexible for different deployment environments.\n\n<from>\n\tif err := http.ListenAndServe(\":8080\", nil); err != nil {\n</from>\n<to>\n\tport := \":8080\" // Consider using an environment variable here\n\tif err := http.ListenAndServe(port, nil); err != nil {\n</to>\n</comment>\n\n<comment file=\"go/server.go\" priority=\"3\" old_line=\"\" new_line=\"22\">\nThe homeHandler function doesn't handle HTTP methods properly. It should check if the request method is GET and return a 405 Method Not Allowed for other methods.\n\n<from>\nfunc homeHandler(w http.ResponseWriter, r *http.Request) {\n\tif r.URL.Path != \"/\" {\n\t\thttp.NotFound(w, r)\n\t\treturn\n\t}\n</from>\n<to>\nfunc homeHandler(w http.ResponseWriter, r *http.Request) {\n\tif r.URL.Path != \"/\" {\n\t\thttp.NotFound(w, r)\n\t\treturn\n\t}\n\tif r.Method != http.MethodGet {\n\t\thttp.Error(w, \"Method not allowed\", http.StatusMethodNotAllowed)\n\t\treturn\n\t}\n</to>\n</comment>\n\n<comment file=\"go/server.go\" priority=\"3\" old_line=\"\" new_line=\"29\">\nSimilar to homeHandler, helloHandler should also check the request method.\n\n<from>\nfunc helloHandler(w http.ResponseWriter, r *http.Request) {\n</from>\n<to>\nfunc helloHandler(w http.ResponseWriter, r *http.Request) {\n\tif r.Method != http.MethodGet {\n\t\thttp.Error(w, \"Method not allowed\", http.StatusMethodNotAllowed)\n\t\treturn\n\t}\n</to>\n</comment>\n</review>"
          end

click on request review:

Screenshot_2025-05-15_at_4.20.43_PM

now the review looks like:

Screenshot_2025-05-15_at_4.39.33_PM

Before After

How to set up and validate locally

MR acceptance checklist

Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Related to #541694 (closed)

Edited by Tian Gao

Merge request reports

Loading