Skip to content

Add new specialized AI issue entity

Gosia Ksionek requested to merge mk-new-issue-entity into master

What does this MR do and why?

This MR refactors two serializers that were poorly placed in the Llm directory in favour of new entities for AI serialization. It's also adding new method to noteable module that refactors method that was before duplicated.

It also solves #421850 (closed) as in the noteable model I added ordering on the batch.

Screenshots or screen recordings

Plans: query

explain  SELECT "notes"."note", "notes"."noteable_type", "notes"."author_id", "notes"."created_at", "notes"."updated_at", "notes"."project_id", "notes"."attachment", "notes"."line_code", "notes"."commit_id", "notes"."noteable_id", "notes"."system", "notes"."st_diff", "notes"."updated_by_id", "notes"."type", "notes"."position", "notes"."original_position", "notes"."resolved_at", "notes"."resolved_by_id", "notes"."discussion_id", "notes"."note_html", "notes"."cached_markdown_version", "notes"."change_position", "notes"."resolved_by_push", "notes"."review_id", "notes"."confidential", "notes"."last_edited_at", "notes"."internal", "notes"."id", "notes"."namespace_id" FROM "notes" INNER JOIN "users" ON "users"."id" = "notes"."author_id" WHERE "notes"."noteable_id" = 131529984 AND "notes"."noteable_type" = 'Issue' AND "notes"."system" = FALSE AND "users"."user_type" = 0 ORDER BY "notes"."created_at" ASC, "notes"."id" ASC
Sort  (cost=30.93..30.95 rows=8 width=3241) (actual time=37.607..37.610 rows=0 loops=1)
   Sort Key: notes.created_at, notes.id
   Sort Method: quicksort  Memory: 25kB
   Buffers: shared hit=9 read=10
   I/O Timings: read=37.352 write=0.000
   ->  Nested Loop  (cost=1.26..30.81 rows=8 width=3241) (actual time=37.584..37.586 rows=0 loops=1)
         Buffers: shared hit=3 read=10
         I/O Timings: read=37.352 write=0.000
         ->  Index Scan using index_notes_on_noteable_id_and_noteable_type_and_system on public.notes  (cost=0.70..12.67 rows=8 width=3241) (actual time=22.485..22.490 rows=1 loops=1)
               Index Cond: ((notes.noteable_id = 131529984) AND ((notes.noteable_type)::text = 'Issue'::text) AND (notes.system = false))
               Buffers: shared read=6
               I/O Timings: read=22.390 write=0.000
         ->  Index Only Scan using index_users_on_user_type_and_id on public.users  (cost=0.56..2.27 rows=1 width=4) (actual time=15.086..15.086 rows=0 loops=1)
               Index Cond: ((users.user_type = 0) AND (users.id = notes.author_id))
               Heap Fetches: 0
               Buffers: shared hit=3 read=4
               I/O Timings: read=14.962 write=0.000
Time: 57.353 ms  
  - planning: 19.661 ms  
  - execution: 37.692 ms  
    - I/O read: 37.352 ms  
    - I/O write: 0.000 ms  
  
Shared buffers:  
  - hits: 9 (~72.00 KiB) from the buffer pool  
  - reads: 10 (~80.00 KiB) from the OS file cache, including disk I/O  
  - dirtied: 0  
  - writes: 0  

How to set up and validate locally

Numbered steps to set up and validate the change are strongly suggested.

MR acceptance checklist

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

resolves #420297 (closed)

Edited by Gosia Ksionek

Merge request reports