Refs #450 Branch mode: `new`; base: `main`; head: `feature/450` Implementation model: `gpt-6.1-sol` / reasoning: `high` ## Automated implementation (requires human review) 実装しました。 - `/posts` の履歴集計を廃止し、更新日時の表示・絞り込み・並び順を `posts.updated_at` に統一しました。 - 現在テーブルに対する履歴判定と、不要になった共通メソッドを削除しました。 - `_versions` を読む処理の認可は維持しています。 `git diff --check` は通過しました。指定に従い、テスト・lint・ビルド・マイグレーションは未実行です。 ## Verification - Tests/builds/migrations were not authorized and were not invoked by the controller. - Codex was instructed not to run them; inspect its command transcript. - The repository owner alone reviews changes. No AI review is executed. - Do not merge before human acceptance and required checks. --------- Co-authored-by: Codex Night Worker <codex-night@localhost> Co-authored-by: みてるぞ <miteruzo@naver.com> Reviewed-on: #462 Co-authored-by: テツノニジカ <969+codex-bot@noreply.localhost>
59 行
2.5 KiB
Ruby
59 行
2.5 KiB
Ruby
require 'rails_helper'
|
|
|
|
RSpec.describe 'History boundaries shared with Counts', type: :request do
|
|
let!(:tag) { create(:tag, primary_name: 'description tag') }
|
|
let!(:description) do
|
|
TagDescription.create!(tag:, language_code: 'ja', version_no: 2, body: 'private body')
|
|
end
|
|
|
|
before do
|
|
['create', 'discard'].each_with_index do |event, index|
|
|
TagDescriptionVersion.create!(tag_id: tag.id, language_code: 'ja',
|
|
version_no: index + 1, event_type: event, body: 'private body',
|
|
created_at: Time.utc(2024))
|
|
end
|
|
end
|
|
|
|
it 'keeps discarded history private while exposing the current description' do
|
|
get '/counts/query', params: { resource: 'tag_descriptions', definition: 'history',
|
|
mode: 'details', locale: 'ja', execution_at: '2025-01-01T00:00:00Z' }
|
|
expect(response).to have_http_status(:ok)
|
|
expect(response.parsed_body).to include('count' => 0, 'output_count' => 2,
|
|
'excluded_count' => 2, 'versions' => [])
|
|
paths = [
|
|
"/wiki/#{ description.id }", '/wiki/title/description%20tag',
|
|
"/tags/#{ tag.id }/description"]
|
|
paths.each do |path|
|
|
get path, params: { locale: 'ja' }
|
|
expect(response).to have_http_status(:ok)
|
|
expect(response.parsed_body.fetch('body')).to eq(description.body)
|
|
end
|
|
get '/sitemap_entries/descriptions', params: { locale: 'ja' }
|
|
expect(response).to have_http_status(:ok)
|
|
expect(response.parsed_body['ids']).not_to include(description.id)
|
|
end
|
|
|
|
it 'omits private revision references and rejects history and diff requests' do
|
|
get "/wiki/#{ description.id }", params: { locale: 'ja' }
|
|
expect(response).to have_http_status(:ok)
|
|
expect(response.parsed_body).to include(
|
|
'revision_id' => nil, 'pred' => nil, 'succ' => nil,
|
|
'updated_at' => description.updated_at.iso8601(3))
|
|
|
|
version = TagDescriptionVersion.find_by!(
|
|
tag_id: tag.id, language_code: 'ja', version_no: 2)
|
|
get "/wiki/#{ description.id }", params: { locale: 'ja', version: version.id }
|
|
expect(response).to have_http_status(:not_found)
|
|
get "/wiki/#{ description.id }/diff", params: { locale: 'ja' }
|
|
expect(response).to have_http_status(:not_found)
|
|
end
|
|
|
|
it 'permits the server-authenticated administrator to read the discarded description' do
|
|
sign_in_as(create(:user, :admin))
|
|
get "/tags/#{ tag.id }/description", params: { locale: 'ja' }
|
|
expect(response).to have_http_status(:ok)
|
|
expect(response.parsed_body['body']).to eq('private body')
|
|
expect(response.headers['Cache-Control']).to include('no-store')
|
|
end
|
|
end
|