WIP: unverified Codex job issue-485-obzs08at

このコミットが含まれているのは:
Codex Night Worker
2026-11-21 01:11:13 +09:00
コミット 1c0cc28dd1
5個のファイルの変更、61行の追加、14行の削除
+9 -2
ファイルの表示
@@ -8,7 +8,12 @@ RSpec.describe 'Post history privacy', type: :request do
let!(:other_post) do
create(:post, created_at: origin, updated_at: origin + 3.days + 1.hour)
end
let!(:tag) { create(:tag, primary_name: 'private-history-tag') }
let!(:tag) do
# Locale completion in the tag factory can create its own version 1.
create(:tag, primary_tag_name: nil).tap do |record|
create(:tag_name, tag: record, name: 'private-history-tag')
end
end
let!(:external) { create(:external_tag, name: 'external-history-tag') }
before do
@@ -138,7 +143,9 @@ RSpec.describe 'Post history privacy', type: :request do
end
it 'paginates public tag additions and removals using the same exact count' do
public_tag = create(:tag, primary_name: 'public-history-tag')
public_tag = create(:tag, primary_tag_name: nil).tap do |record|
create(:tag_name, tag: record, name: 'public-history-tag')
end
public_external = create(:external_tag)
TagVersion.create!(tag: public_tag, version_no: 1, event_type: 'create',
name: 'public-history-tag', category: 'general', aliases: '', parent_tag_ids: '',
+31
ファイルの表示
@@ -418,6 +418,37 @@ test ('YouTube posts return HTTP 200 with the embed rendered by SSR', async t =>
}
})
test ('post history HTTP requests preserve filters for every role', async t => {
const accounts = [
{ role: 'guest', cookie: null },
{ role: 'member', cookie: await authenticatedCookie ('second-recovery-secret') },
{ role: 'admin', cookie: await authenticatedCookie () }]
for (const account of accounts) {
for (const prefix of ['', '/ja', '/ain-Kana']) {
await t.test (`${account.role} ${prefix || 'no locale prefix'}`, async () => {
for (const query of ['', '?id=1&page=2&limit=5']) {
const start = requests.length
const response = await fetch (
`${httpOrigin}${prefix}/posts/changes${query}`, {
headers: account.cookie == null ? {} : { Cookie: account.cookie } })
assert.equal (response.status, 200)
const html = await response.text ()
assert.match (html, /<table/)
assert.doesNotMatch (html, /Switched to client rendering|template id="B:/)
const calls = requests.slice (start).map (request => new URL (request.url, apiURL))
.filter (url => url.pathname === '/posts/versions')
assert.equal (calls.length, 1)
assert.equal (calls[0].searchParams.get ('post'), query ? '1' : null)
assert.equal (calls[0].searchParams.get ('page'), query ? '2' : '1')
assert.equal (calls[0].searchParams.get ('limit'), query ? '5' : '20')
assert.equal (calls[0].searchParams.get ('locale'), prefix === '/ain-Kana'
? 'ain-Kana' : 'ja')
}
})
}
}
})
test ('parallel localized requests keep list data isolated', async () => {
const start = requests.length
const pages = await Promise.all (['ja', 'ain-Kana', 'ja', 'ain-Kana'].map (locale =>
+10 -2
ファイルの表示
@@ -127,15 +127,23 @@ describe ('prefetchForURL', () => {
.toEqual ({ versions: [], count: 0 })
})
it ('prefetches unfiltered post history with its own cache key', async () => {
it ('keeps one post history separate from unfiltered history in the cache', async () => {
const client = qc ()
const params = { page: 2, limit: 5 }
const postParams = { ...params, post: '12' }
const history = { versions: [], count: 7 }
postsApi.fetchPostChanges.mockResolvedValueOnce (history)
await prefetchForURL (client, '/ja/posts/changes?id=12&page=2&limit=5')
await prefetchForURL (client, '/ja/posts/changes?page=2&limit=5')
expect (postsApi.fetchPostChanges).toHaveBeenCalledExactlyOnceWith (params, 'ja')
expect (postsApi.fetchPostChanges).toHaveBeenCalledTimes (2)
expect (postsApi.fetchPostChanges).toHaveBeenNthCalledWith (1, postParams, 'ja')
expect (postsApi.fetchPostChanges).toHaveBeenNthCalledWith (2, params, 'ja')
expect (client.getQueryData (postsKeys.changes (postParams, 'ja'))).toEqual (history)
expect (client.getQueryData (postsKeys.changes (params, 'ja')))
.toEqual ({ versions: [], count: 0 })
expect (client.getQueryCache ().getAll ()).toHaveLength (2)
})
it ('prefetches tag indexes from query parameters', async () => {
+4 -2
ファイルの表示
@@ -21,7 +21,9 @@ if (typeof originalTransform === 'function')
}
}
export default defineConfig ({
export default defineConfig (({ command }) => ({
// Production React does not provide jsxDEV, regardless of the build environment.
esbuild: command === 'build' ? { jsxDev: false } : undefined,
plugins: [{ name: 'request-render-context', enforce: 'pre',
resolveId (id, _importer, options) {
const contextPath = path.resolve (__dirname, './src/lib/renderContext')
@@ -40,4 +42,4 @@ export default defineConfig ({
rewrite: requestPath => requestPath.replace (/^\/api/, ''),
secure: false } },
watch: { usePolling: true,
interval: 100 } } })
interval: 100 } } }))
+7 -8
ファイルの表示
@@ -3,11 +3,10 @@ import { defineConfig, mergeConfig } from 'vitest/config'
import viteConfig from './vite.config'
export default mergeConfig (
viteConfig,
defineConfig ({
test: { environment: 'jsdom',
testTimeout: 30_000,
exclude: ['**/node_modules/**', '**/dist/**', 'server.ssr.test.mjs'],
setupFiles: './src/test/setup.ts',
globals: false } }))
export default defineConfig (env => mergeConfig (
viteConfig (env),
{ test: { environment: 'jsdom',
testTimeout: 30_000,
exclude: ['**/node_modules/**', '**/dist/**', 'server.ssr.test.mjs'],
setupFiles: './src/test/setup.ts',
globals: false } }))