WIP: preserve failed Codex job issue-279-19j8bk0h

このコミットが含まれているのは:
Codex Night Worker
2026-11-16 00:57:37 +09:00
コミット 2d455f6914
2個のファイルの変更、31行の追加、2行の削除
+2 -2
ファイルの表示
@@ -47,8 +47,8 @@ class PostsController < ApplicationController
.preload(tags: { tag_name: :wiki_page })
.with_attached_thumbnail
q = q.where('posts.url LIKE ?', "%#{ url }%") if url
q = q.where('posts.title LIKE ?', "%#{ title }%") if title
q = q.where('posts.url LIKE ?', "%#{ Post.sanitize_sql_like(url).tr('*?', '%_') }%") if url
q = q.where('posts.title LIKE ?', "%#{ Post.sanitize_sql_like(title).tr('*?', '%_') }%") if title
if original_created_from
q = q.where('posts.original_created_before > ?', original_created_from)
end
+29
ファイルの表示
@@ -287,6 +287,35 @@ RSpec.describe 'Posts API', type: :request do
end
end
[:title, :url].each do |field|
context "when #{field} contains wildcards" do
let!(:search_posts) do
['needle%25end', 'needleX25end', 'needle_end', 'needleXend', 'needleABend'].map do |value|
Post.create!(uploaded_user: user, title: "prefix #{value} suffix",
url: "https://example.com/prefix-#{value}-suffix")
end
end
{
'needle%25end' => [0],
'needle_end' => [2],
'needle*end' => [0, 1, 2, 3, 4],
'needle?end' => [2, 3],
'needle%*end' => [0],
'needle_?nd' => [2]
}.each do |query, expected_indices|
it "matches #{query.inspect} using only * and ? as wildcards" do
get '/posts', params: { field => query }
expect(response).to have_http_status(:ok)
expected_ids = expected_indices.map { |i| search_posts[i].id }
expect(json.fetch('posts').map { |p| p['id'] }).to match_array(expected_ids)
expect(json.fetch('count')).to eq(expected_ids.size)
end
end
end
end
context 'when created_from/created_to are provided' do
let(:t_created_hit) { Time.zone.local(2010, 1, 5, 12, 0, 0) }
let(:t_created_miss) { Time.zone.local(2012, 1, 5, 12, 0, 0) }