@@ -105,9 +105,9 @@ def initialize(path)
105105 def upsert_commit ( sha :, subject :, body :, authored_at :, committed_at :,
106106 author_name :, author_email :, committer_name :, committer_email :,
107107 branches :, versions :, stage : "walked" )
108- params = [ sha , subject , body , authored_at , committed_at ,
108+ params = [ sha , subject , body , authored_at , committed_at ,
109109 author_name , author_email , committer_name , committer_email ,
110- JSON . generate ( branches ) , JSON . generate ( versions ) , stage , Time . now . utc . iso8601 ]
110+ JSON . generate ( branches ) , JSON . generate ( versions ) , stage , Time . now . utc . iso8601 ]
111111 @db . execute ( <<~SQL , params )
112112 INSERT INTO commits (sha, subject, body, authored_at, committed_at,
113113 author_name, author_email, committer_name, committer_email,
@@ -119,96 +119,96 @@ def upsert_commit(sha:, subject:, body:, authored_at:, committed_at:,
119119 end
120120
121121 def commit ( sha )
122- @db . execute ( "SELECT * FROM commits WHERE sha = ?" , [ sha ] ) . first
122+ @db . execute ( "SELECT * FROM commits WHERE sha = ?" , [ sha ] ) . first
123123 end
124124
125125 def set_stage ( sha , stage )
126126 @db . execute ( "UPDATE commits SET stage = ?, updated_at = ? WHERE sha = ?" ,
127- [ stage , Time . now . utc . iso8601 , sha ] )
127+ [ stage , Time . now . utc . iso8601 , sha ] )
128128 end
129129
130130 def add_relation ( from_sha :, to_sha :, kind :, confidence :, method :)
131- @db . execute ( <<~SQL , [ from_sha , to_sha , kind , confidence , method ] )
131+ @db . execute ( <<~SQL , [ from_sha , to_sha , kind , confidence , method ] )
132132 INSERT OR IGNORE INTO commit_relations (from_sha, to_sha, kind, confidence, method)
133133 VALUES (?,?,?,?,?)
134134 SQL
135135 end
136136
137137 def relations_for ( sha )
138- @db . execute ( "SELECT * FROM commit_relations WHERE from_sha = ?" , [ sha ] )
138+ @db . execute ( "SELECT * FROM commit_relations WHERE from_sha = ?" , [ sha ] )
139139 end
140140
141141 def api_cache_get ( key )
142- row = @db . execute ( "SELECT response FROM api_cache WHERE request_key = ?" , [ key ] ) . first
142+ row = @db . execute ( "SELECT response FROM api_cache WHERE request_key = ?" , [ key ] ) . first
143143 row && row [ "response" ]
144144 end
145145
146146 def api_cache_put ( key , response )
147147 @db . execute ( "INSERT OR REPLACE INTO api_cache (request_key, response, fetched_at) VALUES (?,?,?)" ,
148- [ key , response , Time . now . utc . iso8601 ] )
148+ [ key , response , Time . now . utc . iso8601 ] )
149149 end
150150
151151 def add_candidate ( sha :, topic_id :, source :, prefilter_score :, metadata :)
152- @db . execute ( <<~SQL , [ sha , topic_id , source , prefilter_score , JSON . generate ( metadata ) ] )
152+ @db . execute ( <<~SQL , [ sha , topic_id , source , prefilter_score , JSON . generate ( metadata ) ] )
153153 INSERT OR REPLACE INTO thread_candidates (sha, topic_id, source, prefilter_score, metadata)
154154 VALUES (?,?,?,?,?)
155155 SQL
156156 end
157157
158158 def candidates_for ( sha )
159- @db . execute ( "SELECT * FROM thread_candidates WHERE sha = ?" , [ sha ] )
159+ @db . execute ( "SELECT * FROM thread_candidates WHERE sha = ?" , [ sha ] )
160160 end
161161
162162 def llm_cache_get ( key )
163- row = @db . execute ( "SELECT response FROM llm_cache WHERE prompt_hash = ?" , [ key ] ) . first
163+ row = @db . execute ( "SELECT response FROM llm_cache WHERE prompt_hash = ?" , [ key ] ) . first
164164 row && row [ "response" ]
165165 end
166166
167167 def llm_cache_put ( key , response , model )
168168 @db . execute ( "INSERT OR REPLACE INTO llm_cache (prompt_hash, response, model, created_at) VALUES (?,?,?,?)" ,
169- [ key , response , model , Time . now . utc . iso8601 ] )
169+ [ key , response , model , Time . now . utc . iso8601 ] )
170170 end
171171
172172 def add_link ( sha :, topic_id :, mailing_list :, method :, confidence :, verdict :, evidence :, external_message_id :)
173- @db . execute ( <<~SQL , [ sha , topic_id , mailing_list , method , confidence , verdict , evidence , external_message_id ] )
173+ @db . execute ( <<~SQL , [ sha , topic_id , mailing_list , method , confidence , verdict , evidence , external_message_id ] )
174174 INSERT OR REPLACE INTO thread_links
175175 (sha, topic_id, mailing_list, method, confidence, verdict, evidence, external_message_id)
176176 VALUES (?,?,?,?,?,?,?,?)
177177 SQL
178178 end
179179
180180 def links_for ( sha )
181- @db . execute ( "SELECT * FROM thread_links WHERE sha = ?" , [ sha ] )
181+ @db . execute ( "SELECT * FROM thread_links WHERE sha = ?" , [ sha ] )
182182 end
183183
184184 def add_fact ( sha :, kind :, value :, method :, confidence :, evidence :)
185- @db . execute ( <<~SQL , [ sha , kind , value , method , confidence , evidence ] )
185+ @db . execute ( <<~SQL , [ sha , kind , value , method , confidence , evidence ] )
186186 INSERT OR IGNORE INTO commit_facts (sha, kind, value, method, confidence, evidence)
187187 VALUES (?,?,?,?,?,?)
188188 SQL
189189 end
190190
191191 def facts_for ( sha )
192- @db . execute ( "SELECT * FROM commit_facts WHERE sha = ?" , [ sha ] )
192+ @db . execute ( "SELECT * FROM commit_facts WHERE sha = ?" , [ sha ] )
193193 end
194194
195195 def each_commit
196196 @db . execute ( "SELECT * FROM commits ORDER BY committed_at" ) . each { |row | yield row }
197197 end
198198
199199 def each_commit_at_stage ( stage )
200- @db . execute ( "SELECT * FROM commits WHERE stage = ? ORDER BY committed_at" , [ stage ] ) . each { |r | yield r }
200+ @db . execute ( "SELECT * FROM commits WHERE stage = ? ORDER BY committed_at" , [ stage ] ) . each { |r | yield r }
201201 end
202202
203203 def set_message_ids ( sha , ids )
204204 ids . each do |id |
205205 @db . execute ( "INSERT OR IGNORE INTO commit_facts (sha, kind, value, method, confidence, evidence) VALUES (?,?,?,?,?,?)" ,
206- [ sha , "discussion_message_id" , id , "trailer" , 1.0 , "Discussion: #{ id } " ] )
206+ [ sha , "discussion_message_id" , id , "trailer" , 1.0 , "Discussion: #{ id } " ] )
207207 end
208208 end
209209
210210 def message_ids_for ( sha )
211- @db . execute ( "SELECT value FROM commit_facts WHERE sha = ? AND kind = 'discussion_message_id'" , [ sha ] )
211+ @db . execute ( "SELECT value FROM commit_facts WHERE sha = ? AND kind = 'discussion_message_id'" , [ sha ] )
212212 . map { |r | r [ "value" ] }
213213 end
214214 end
@@ -314,7 +314,7 @@ def default_refs
314314 out = git ( "for-each-ref" , "--format=%(refname:short)" , "refs/remotes/origin" )
315315 rel = out . lines . map ( &:strip ) . map { |r | r . sub ( %r{\A origin/} , "" ) }
316316 . select { |r | r == "master" || r . start_with? ( "REL" ) }
317- ( [ "master" ] + rel ) . uniq
317+ ( [ "master" ] + rel ) . uniq
318318 end
319319
320320 def version_for_ref ( ref )
@@ -357,7 +357,7 @@ def detect_backport_twins(shas)
357357 row = @store . commit ( sha )
358358 next unless row
359359 next if row [ "subject" ] . to_s . strip . length < 10 # too generic to match safely
360- key = [ row [ "subject" ] , row [ "author_email" ] ]
360+ key = [ row [ "subject" ] , row [ "author_email" ] ]
361361 by_key [ key ] << row
362362 end
363363
@@ -376,10 +376,10 @@ def detect_backport_twins(shas)
376376
377377 def list_shas ( ref )
378378 args = if ref_exists? ( "origin/#{ ref } " )
379- [ "rev-list" , "origin/#{ ref } " ]
380- else
381- [ "rev-list" , ref ]
382- end
379+ [ "rev-list" , "origin/#{ ref } " ]
380+ else
381+ [ "rev-list" , ref ]
382+ end
383383 args << "--max-count=#{ @limit } " if @limit
384384 args << "--since=#{ @since } " if @since
385385 git ( *args ) . lines . map ( &:strip ) . reject ( &:empty? )
@@ -509,7 +509,7 @@ def discover(commit, facts:, message_ids:)
509509 from , to = date_window ( commit [ "committed_at" ] )
510510
511511 search_added = 0
512- [ true , false ] . each do |patches_only |
512+ [ true , false ] . each do |patches_only |
513513 hits = @api . search_candidates ( q : terms . join ( " " ) , from : from , to : to ,
514514 mailing_lists : [ ] , patches_only : patches_only ,
515515 limit : @config . candidate_limit )
@@ -626,7 +626,7 @@ def parse_meta(candidate)
626626 end
627627
628628 def build_user_prompt ( commit , candidates )
629- lines = [ "COMMIT subject: #{ commit [ 'subject' ] } " , "COMMIT body:" , commit [ "body" ] . to_s , "" , "CANDIDATE THREADS:" ]
629+ lines = [ "COMMIT subject: #{ commit [ 'subject' ] } " , "COMMIT body:" , commit [ "body" ] . to_s , "" , "CANDIDATE THREADS:" ]
630630 candidates . each do |c |
631631 meta = parse_meta ( c )
632632 lines << "- topic_id=#{ c [ 'topic_id' ] } lists=#{ Array ( meta [ 'mailing_lists' ] ) . join ( ',' ) } " \
0 commit comments