AI リサーチ用 #486

オープン
みてるぞが2026-11-19 22:59:05 +09:00に作成 · 19件のコメント
オーナー

AI リサーチ用の課題です.
閉鎖しないこと.

AI リサーチ用の課題です. 閉鎖しないこと.
共同作業者

Codex 調査提案 P-0001 (未承認・コード変更なし)

Hidden history identifiers bypass summary masking

調査対象: backend / 調査時コミット: f05d8a4b3a13

Evidence: backend/app/services/counts_axes.rb:5 at f05d8a4b3a132216b900c2d4b69001211b23e381

Type: security
Certainty: confirmed

Reason: PUBLIC_FIELDS now includes resource_id, version_no, and user. CountsAxes#expressions therefore leaves these coordinates unmasked. CountsTableQuery initializes summary populations with authorisation_flg: false (line 24), groups those unrestricted records, and returns their coordinates in cells and headers. The user axis additionally resolves actor names through User.where(id: values). This exposes identifiers and actor associations belonging to versions that HistoryAccess would exclude.

Impact: Non-admin callers can enumerate discarded resources and their hidden version numbers and actors through summary axes. These values also reach summary exports. The Counts exception permits numerical counts, not hidden identifiers or aggregate labels.

Verification (NOT RUN): Not executed: in an isolated development fixture, create a resource with create and discard versions attributed to a user. As a non-admin, request GET /counts/query?resource=posts&definition=history&mode=summary&rows=resource_id%20version_no%20user&cols=. Inspect cells, row_headers, and axis_labels for the hidden resource ID, version numbers, and actor. Repeat with a summary export.

Proposed change (NOT IMPLEMENTED): Separate predicate eligibility from output masking. Keep hidden resource_id, version_no, and user coordinates masked regardless of whether count-only filtering on those fields is allowed; resolve actor labels only from authorised records.

※ 自動調査による候補です。現在のコードで再確認し、Issue 化・実装する場合は別途承認してください。

<!-- codex-proposal:1 --> **Codex 調査提案 P-0001** (未承認・コード変更なし) ### Hidden history identifiers bypass summary masking **調査対象**: `backend` / **調査時コミット**: `f05d8a4b3a13` **Evidence**: `backend/app/services/counts_axes.rb:5` at `f05d8a4b3a132216b900c2d4b69001211b23e381` **Type**: security **Certainty**: confirmed **Reason**: PUBLIC_FIELDS now includes resource_id, version_no, and user. CountsAxes#expressions therefore leaves these coordinates unmasked. CountsTableQuery initializes summary populations with authorisation_flg: false (line 24), groups those unrestricted records, and returns their coordinates in cells and headers. The user axis additionally resolves actor names through User.where(id: values). This exposes identifiers and actor associations belonging to versions that HistoryAccess would exclude. **Impact**: Non-admin callers can enumerate discarded resources and their hidden version numbers and actors through summary axes. These values also reach summary exports. The Counts exception permits numerical counts, not hidden identifiers or aggregate labels. **Verification (NOT RUN)**: Not executed: in an isolated development fixture, create a resource with create and discard versions attributed to a user. As a non-admin, request GET /counts/query?resource=posts&definition=history&mode=summary&rows=resource_id%20version_no%20user&cols=. Inspect cells, row_headers, and axis_labels for the hidden resource ID, version numbers, and actor. Repeat with a summary export. **Proposed change (NOT IMPLEMENTED)**: Separate predicate eligibility from output masking. Keep hidden resource_id, version_no, and user coordinates masked regardless of whether count-only filtering on those fields is allowed; resolve actor labels only from authorised records. ※ 自動調査による候補です。現在のコードで再確認し、Issue 化・実装する場合は別途承認してください。
共同作業者

Codex 調査提案 P-0002 (未承認・コード変更なし)

Counts documentation describes removed filter restrictions

調査対象: docs / 調査時コミット: f05d8a4b3a13

Evidence: docs/counts-exports.md:154 at f05d8a4b3a132216b900c2d4b69001211b23e381

Type: documentation
Certainty: confirmed

Reason: Lines 154–157 say non-admin summary filters outside timestamps/event types and auxiliary tag searches are rejected. CountsAxes::PUBLIC_FIELDS now also includes resource_id, version_no and user. CountsTableQuery#validate_summary_conditions! no longer rejects private-field predicates; CountsPopulation#condition_scope restricts those predicates to visible records, including auxiliary tag searches.

Impact: API consumers are told supported searches are forbidden. The release checklist at docs/counts-release-checklist.md:47 also expects a 403 for behavior this commit intentionally permits.

Verification (NOT RUN): Not executed: in an isolated environment, submit a non-admin summary query filtering a visible title and an auxiliary tag. Confirm successful responses containing only authorized matches rather than the documented rejection.

Proposed change (NOT IMPLEMENTED): Update the documented public fields and explain visibility-restricted private predicates. Align the checklist with successful authorized searches and exclusion of hidden matches.

※ 自動調査による候補です。現在のコードで再確認し、Issue 化・実装する場合は別途承認してください。

<!-- codex-proposal:2 --> **Codex 調査提案 P-0002** (未承認・コード変更なし) ### Counts documentation describes removed filter restrictions **調査対象**: `docs` / **調査時コミット**: `f05d8a4b3a13` **Evidence**: `docs/counts-exports.md:154` at `f05d8a4b3a132216b900c2d4b69001211b23e381` **Type**: documentation **Certainty**: confirmed **Reason**: Lines 154–157 say non-admin summary filters outside timestamps/event types and auxiliary tag searches are rejected. CountsAxes::PUBLIC_FIELDS now also includes resource_id, version_no and user. CountsTableQuery#validate_summary_conditions! no longer rejects private-field predicates; CountsPopulation#condition_scope restricts those predicates to visible records, including auxiliary tag searches. **Impact**: API consumers are told supported searches are forbidden. The release checklist at docs/counts-release-checklist.md:47 also expects a 403 for behavior this commit intentionally permits. **Verification (NOT RUN)**: Not executed: in an isolated environment, submit a non-admin summary query filtering a visible title and an auxiliary tag. Confirm successful responses containing only authorized matches rather than the documented rejection. **Proposed change (NOT IMPLEMENTED)**: Update the documented public fields and explain visibility-restricted private predicates. Align the checklist with successful authorized searches and exclusion of hidden matches. ※ 自動調査による候補です。現在のコードで再確認し、Issue 化・実装する場合は別途承認してください。
共同作業者

Codex 調査提案 P-0003 (未承認・コード変更なし)

Documented pivot counting preserves multiplicity that the code now masks

調査対象: docs / 調査時コミット: f05d8a4b3a13

Evidence: docs/counts-exports.md:97 at f05d8a4b3a132216b900c2d4b69001211b23e381

Type: documentation
Certainty: confirmed

Reason: Lines 97–100 claim changed_field includes only real changes with predecessors and that private tag/change contributions remain intact with only labels protected. CountsAxes#joins instead substitutes one synthetic tag for every hidden version and one synthetic changed_field when visibility fails. Its grouped_sql also masks membership identities before DISTINCT counting.

Impact: Readers can incorrectly interpret masked totals as actual tag or changed-field counts. Hidden empty collections and versions without predecessors can contribute synthetic entries, and totals can differ between admin and non-admin queries.

Verification (NOT RUN): Not executed: compare admin and non-admin summary queries over hidden versions with empty and multi-tag snapshots, including a first version, using tags and changed_field axes. Check ordinary cells and grand totals against the documented multiplicity claims.

Proposed change (NOT IMPLEMENTED): Document the single opaque contribution for hidden collections and changes, including empty collections and missing predecessors, and explain the resulting role-dependent totals.

※ 自動調査による候補です。現在のコードで再確認し、Issue 化・実装する場合は別途承認してください。

<!-- codex-proposal:3 --> **Codex 調査提案 P-0003** (未承認・コード変更なし) ### Documented pivot counting preserves multiplicity that the code now masks **調査対象**: `docs` / **調査時コミット**: `f05d8a4b3a13` **Evidence**: `docs/counts-exports.md:97` at `f05d8a4b3a132216b900c2d4b69001211b23e381` **Type**: documentation **Certainty**: confirmed **Reason**: Lines 97–100 claim changed_field includes only real changes with predecessors and that private tag/change contributions remain intact with only labels protected. CountsAxes#joins instead substitutes one synthetic tag for every hidden version and one synthetic changed_field when visibility fails. Its grouped_sql also masks membership identities before DISTINCT counting. **Impact**: Readers can incorrectly interpret masked totals as actual tag or changed-field counts. Hidden empty collections and versions without predecessors can contribute synthetic entries, and totals can differ between admin and non-admin queries. **Verification (NOT RUN)**: Not executed: compare admin and non-admin summary queries over hidden versions with empty and multi-tag snapshots, including a first version, using tags and changed_field axes. Check ordinary cells and grand totals against the documented multiplicity claims. **Proposed change (NOT IMPLEMENTED)**: Document the single opaque contribution for hidden collections and changes, including empty collections and missing predecessors, and explain the resulting role-dependent totals. ※ 自動調査による候補です。現在のコードで再確認し、Issue 化・実装する場合は別途承認してください。
共同作業者

Codex 調査提案 P-0004 (未承認・コード変更なし)

Unknown condition fields crash the Counts controls

調査対象: frontend / 調査時コミット: f05d8a4b3a13

Evidence: frontend/src/components/counts/CountsAdditionalConditions.tsx:186 at f05d8a4b3a132216b900c2d4b69001211b23e381

Type: bug
Certainty: confirmed

Reason: URL conditions reach this component without field validation. For a set operator such as 'in', metadata.find(...) can return undefined; the non-null assertion provides no runtime protection. CountsConditionValues.tsx:30 then reads field.candidateSource unconditionally.

Impact: A malformed or stale Counts URL containing an unknown condition field causes a rendering exception instead of allowing the user to inspect or remove the invalid condition.

Verification (NOT RUN): Not executed: open /counts/posts?conditions=&conditions.0.field=unknown_field&conditions.0.operator=in. After the definition loads, inspect the rendering exception caused by accessing candidateSource on undefined.

Proposed change (NOT IMPLEMENTED): Resolve and validate condition metadata before rendering CountsConditionValues. Keep unknown conditions removable without passing undefined metadata to the child.

※ 自動調査による候補です。現在のコードで再確認し、Issue 化・実装する場合は別途承認してください。

<!-- codex-proposal:4 --> **Codex 調査提案 P-0004** (未承認・コード変更なし) ### Unknown condition fields crash the Counts controls **調査対象**: `frontend` / **調査時コミット**: `f05d8a4b3a13` **Evidence**: `frontend/src/components/counts/CountsAdditionalConditions.tsx:186` at `f05d8a4b3a132216b900c2d4b69001211b23e381` **Type**: bug **Certainty**: confirmed **Reason**: URL conditions reach this component without field validation. For a set operator such as 'in', metadata.find(...) can return undefined; the non-null assertion provides no runtime protection. CountsConditionValues.tsx:30 then reads field.candidateSource unconditionally. **Impact**: A malformed or stale Counts URL containing an unknown condition field causes a rendering exception instead of allowing the user to inspect or remove the invalid condition. **Verification (NOT RUN)**: Not executed: open /counts/posts?conditions=&conditions.0.field=unknown_field&conditions.0.operator=in. After the definition loads, inspect the rendering exception caused by accessing candidateSource on undefined. **Proposed change (NOT IMPLEMENTED)**: Resolve and validate condition metadata before rendering CountsConditionValues. Keep unknown conditions removable without passing undefined metadata to the child. ※ 自動調査による候補です。現在のコードで再確認し、Issue 化・実装する場合は別途承認してください。
共同作業者

Codex 調査提案 P-0005 (未承認・コード変更なし)

Similarity refresh destroys the previous results before calculation succeeds

調査対象: issue:65 / 調査時コミット: f05d8a4b3a13

Evidence: backend/app/services/similarity/calc.rb:9 at f05d8a4b3a132216b900c2d4b69001211b23e381

Type: reliability
Certainty: confirmed

Reason: delete_all runs before loading associations and calculating similarities. Replacement rows are subsequently inserted in separate 1,000-row batches at lines 92–101, without a transaction or staging table.

Impact: A calculation failure leaves the table empty; an insertion failure leaves partial results. Concurrent runs can interleave deletion and insertion and encounter composite-primary-key conflicts.

Verification (NOT RUN): Not executed: In an isolated database with existing similarities, inject a failure before the first insert and another after the first batch. Inspect whether the original complete result set survives.

Proposed change (NOT IMPLEMENTED): Calculate replacement rows first, then serialize refreshes and atomically replace the table contents in a transaction.

※ 自動調査による候補です。現在のコードで再確認し、Issue 化・実装する場合は別途承認してください。

<!-- codex-proposal:5 --> **Codex 調査提案 P-0005** (未承認・コード変更なし) ### Similarity refresh destroys the previous results before calculation succeeds **調査対象**: `issue:65` / **調査時コミット**: `f05d8a4b3a13` **Evidence**: `backend/app/services/similarity/calc.rb:9` at `f05d8a4b3a132216b900c2d4b69001211b23e381` **Type**: reliability **Certainty**: confirmed **Reason**: delete_all runs before loading associations and calculating similarities. Replacement rows are subsequently inserted in separate 1,000-row batches at lines 92–101, without a transaction or staging table. **Impact**: A calculation failure leaves the table empty; an insertion failure leaves partial results. Concurrent runs can interleave deletion and insertion and encounter composite-primary-key conflicts. **Verification (NOT RUN)**: Not executed: In an isolated database with existing similarities, inject a failure before the first insert and another after the first batch. Inspect whether the original complete result set survives. **Proposed change (NOT IMPLEMENTED)**: Calculate replacement rows first, then serialize refreshes and atomically replace the table contents in a transaction. ※ 自動調査による候補です。現在のコードで再確認し、Issue 化・実装する場合は別途承認してください。
共同作業者

Codex 調査提案 P-0006 (未承認・コード変更なし)

Top-20 storage does not bound the quadratic calculation

調査対象: issue:65 / 調査時コミット: f05d8a4b3a13

Evidence: backend/app/services/similarity/calc.rb:76 at f05d8a4b3a132216b900c2d4b69001211b23e381

Type: performance
Certainty: confirmed

Reason: The tag task passes every non-deprecated tag to this service. The nested loops visit every unordered tag pair, including pairs with no shared posts, and intersection_size scans their sorted post IDs. The 20-result limit only bounds retained results.

Impact: For T tags, each scheduled refresh evaluates T(T−1)/2 pairs. Large tag catalogs and popular tags can make the daily job expensive despite the small output per tag.

Verification (NOT RUN): Not executed: Profile isolated datasets with increasing tag counts and sparse co-occurrence. Compare pair counts and elapsed time when doubling the tag population.

Proposed change (NOT IMPLEMENTED): Accumulate intersections through a post-to-tags inverted index and calculate cosine scores only for pairs sharing a post; explicitly define whether zero-score fallback results are needed.

※ 自動調査による候補です。現在のコードで再確認し、Issue 化・実装する場合は別途承認してください。

<!-- codex-proposal:6 --> **Codex 調査提案 P-0006** (未承認・コード変更なし) ### Top-20 storage does not bound the quadratic calculation **調査対象**: `issue:65` / **調査時コミット**: `f05d8a4b3a13` **Evidence**: `backend/app/services/similarity/calc.rb:76` at `f05d8a4b3a132216b900c2d4b69001211b23e381` **Type**: performance **Certainty**: confirmed **Reason**: The tag task passes every non-deprecated tag to this service. The nested loops visit every unordered tag pair, including pairs with no shared posts, and intersection_size scans their sorted post IDs. The 20-result limit only bounds retained results. **Impact**: For T tags, each scheduled refresh evaluates T(T−1)/2 pairs. Large tag catalogs and popular tags can make the daily job expensive despite the small output per tag. **Verification (NOT RUN)**: Not executed: Profile isolated datasets with increasing tag counts and sparse co-occurrence. Compare pair counts and elapsed time when doubling the tag population. **Proposed change (NOT IMPLEMENTED)**: Accumulate intersections through a post-to-tags inverted index and calculate cosine scores only for pairs sharing a post; explicitly define whether zero-score fallback results are needed. ※ 自動調査による候補です。現在のコードで再確認し、Issue 化・実装する場合は別途承認してください。
共同作業者

Codex 調査提案 P-0007 (未承認・コード変更なし)

[P1] 手動実行する楽曲タグ付与バッチが未実装

調査対象: issue:138 / 調査時コミット: f05d8a4b3a13

Evidence: backend/lib/tasks/sync_posts.rake:3 at f05d8a4b3a132216b900c2d4b69001211b23e381

Type: missing_functionality
Certainty: confirmed

Reason: 投稿処理の post:sync は Youtube::Sync.new.sync! を呼ぶだけです。backend/lib/tasks、app/services、app/jobs に楽曲タグを判定・付与する処理や手動実行用エントリポイントがありません。既存のニコニコ同期は外部タグの連携先を付与しますが、bot操作タグの付いた投稿だけを対象とする楽曲タグ付与処理ではありません。

Impact: Issue #138 で要求された、bot操作タグの付いた投稿に限定した楽曲タグの自動付与を手動実行できません。

Verification (NOT RUN): 未実行。Rake タスク定義と呼出先を確認し、楽曲タグ付与用の手動エントリポイントが存在するか確認する。実装後は、bot操作タグ付きの対象投稿と同タグなしの投稿を用意し、前者だけに楽曲タグが付与されることを確認する。

Proposed change (NOT IMPLEMENTED): 既存のタグ関連付けと版記録処理を再利用し、bot操作タグ付き投稿だけを対象とする手動実行用 Rake タスクを追加する。楽曲タグの判定規則は実装前に確定する。

※ 自動調査による候補です。現在のコードで再確認し、Issue 化・実装する場合は別途承認してください。

<!-- codex-proposal:7 --> **Codex 調査提案 P-0007** (未承認・コード変更なし) ### [P1] 手動実行する楽曲タグ付与バッチが未実装 **調査対象**: `issue:138` / **調査時コミット**: `f05d8a4b3a13` **Evidence**: `backend/lib/tasks/sync_posts.rake:3` at `f05d8a4b3a132216b900c2d4b69001211b23e381` **Type**: missing_functionality **Certainty**: confirmed **Reason**: 投稿処理の post:sync は Youtube::Sync.new.sync! を呼ぶだけです。backend/lib/tasks、app/services、app/jobs に楽曲タグを判定・付与する処理や手動実行用エントリポイントがありません。既存のニコニコ同期は外部タグの連携先を付与しますが、bot操作タグの付いた投稿だけを対象とする楽曲タグ付与処理ではありません。 **Impact**: Issue #138 で要求された、bot操作タグの付いた投稿に限定した楽曲タグの自動付与を手動実行できません。 **Verification (NOT RUN)**: 未実行。Rake タスク定義と呼出先を確認し、楽曲タグ付与用の手動エントリポイントが存在するか確認する。実装後は、bot操作タグ付きの対象投稿と同タグなしの投稿を用意し、前者だけに楽曲タグが付与されることを確認する。 **Proposed change (NOT IMPLEMENTED)**: 既存のタグ関連付けと版記録処理を再利用し、bot操作タグ付き投稿だけを対象とする手動実行用 Rake タスクを追加する。楽曲タグの判定規則は実装前に確定する。 ※ 自動調査による候補です。現在のコードで再確認し、Issue 化・実装する場合は別途承認してください。
共同作業者

Codex 調査提案 P-0008 (未承認・コード変更なし)

Content cannot trigger a noindex HTTP header

調査対象: issue:403 / 調査時コミット: f05d8a4b3a13

Evidence: frontend/server.mjs:65 at f05d8a4b3a132216b900c2d4b69001211b23e381

Type: missing_boundary_case
Certainty: confirmed

Reason: X-Robots-Tag is set only when isCountsPath(pathname) returns true. After rendering at lines 103–104, the server inserts result.head and result.html without evaluating their content or any content-derived indexing decision. Existing robots meta tags are separate from this header logic.

Impact: A page outside Counts receives no content-triggered noindex header, regardless of its wording. The mechanism discussed in #403 is therefore absent at this commit; whether any particular page should be suppressed remains unspecified.

Verification (NOT RUN): Not executed: after defining the trigger wording and matching scope, serve two otherwise identical public pages outside Counts, one containing that wording. Inspect GET and HEAD responses and verify that only the matching page receives X-Robots-Tag: noindex.

Proposed change (NOT IMPLEMENTED): Define the trigger wording and matching scope, compute an explicit indexing decision during SSR, and apply it before response.writeHead for both GET and HEAD. Preserve existing route-based suppression.

※ 自動調査による候補です。現在のコードで再確認し、Issue 化・実装する場合は別途承認してください。

<!-- codex-proposal:8 --> **Codex 調査提案 P-0008** (未承認・コード変更なし) ### Content cannot trigger a noindex HTTP header **調査対象**: `issue:403` / **調査時コミット**: `f05d8a4b3a13` **Evidence**: `frontend/server.mjs:65` at `f05d8a4b3a132216b900c2d4b69001211b23e381` **Type**: missing_boundary_case **Certainty**: confirmed **Reason**: X-Robots-Tag is set only when isCountsPath(pathname) returns true. After rendering at lines 103–104, the server inserts result.head and result.html without evaluating their content or any content-derived indexing decision. Existing robots meta tags are separate from this header logic. **Impact**: A page outside Counts receives no content-triggered noindex header, regardless of its wording. The mechanism discussed in #403 is therefore absent at this commit; whether any particular page should be suppressed remains unspecified. **Verification (NOT RUN)**: Not executed: after defining the trigger wording and matching scope, serve two otherwise identical public pages outside Counts, one containing that wording. Inspect GET and HEAD responses and verify that only the matching page receives X-Robots-Tag: noindex. **Proposed change (NOT IMPLEMENTED)**: Define the trigger wording and matching scope, compute an explicit indexing decision during SSR, and apply it before response.writeHead for both GET and HEAD. Preserve existing route-based suppression. ※ 自動調査による候補です。現在のコードで再確認し、Issue 化・実装する場合は別途承認してください。
共同作業者

Codex 調査提案 P-0009 (未承認・コード変更なし)

Caller-supplied limit overrides the programme listing cap

調査対象: backend / 調査時コミット: e13a52db9a6f

Evidence: backend/app/controllers/theatre_programmes_controller.rb:14 at e13a52db9a6f6619fa125a215602ac7a9ea72984

Type: performance
Certainty: confirmed

Reason: The relation applies .limit(100), then .limit(limit). Active Record replaces the earlier limit. The caller-controlled limit has a default for nonpositive values but no upper bound.

Impact: A large positive limit can load and serialize the entire matching programme history, including associated posts, increasing database work, response size, and worker memory.

Verification (NOT RUN): Not executed: in an isolated development environment with more than 100 programme rows, request the endpoint with limit=10000 and inspect the returned row count and SQL LIMIT.

Proposed change (NOT IMPLEMENTED): Clamp the requested limit to 100 and apply .limit once.

※ 自動調査による候補です。現在のコードで再確認し、Issue 化・実装する場合は別途承認してください。

<!-- codex-proposal:9 --> **Codex 調査提案 P-0009** (未承認・コード変更なし) ### Caller-supplied limit overrides the programme listing cap **調査対象**: `backend` / **調査時コミット**: `e13a52db9a6f` **Evidence**: `backend/app/controllers/theatre_programmes_controller.rb:14` at `e13a52db9a6f6619fa125a215602ac7a9ea72984` **Type**: performance **Certainty**: confirmed **Reason**: The relation applies .limit(100), then .limit(limit). Active Record replaces the earlier limit. The caller-controlled limit has a default for nonpositive values but no upper bound. **Impact**: A large positive limit can load and serialize the entire matching programme history, including associated posts, increasing database work, response size, and worker memory. **Verification (NOT RUN)**: Not executed: in an isolated development environment with more than 100 programme rows, request the endpoint with limit=10000 and inspect the returned row count and SQL LIMIT. **Proposed change (NOT IMPLEMENTED)**: Clamp the requested limit to 100 and apply .limit once. ※ 自動調査による候補です。現在のコードで再確認し、Issue 化・実装する場合は別途承認してください。
共同作業者

Codex 調査提案 P-0010 (未承認・コード変更なし)

Material ZIP downloads retain all source files and the archive in memory

調査対象: backend / 調査時コミット: e13a52db9a6f

Evidence: backend/app/services/material_zip_exporter.rb:53 at e13a52db9a6f6619fa125a215602ac7a9ea72984

Type: resource_exhaustion_risk
Certainty: confirmed

Reason: build_entries downloads every selected blob into an Entry.data string. ZipWriter.write then copies their contents into a StringIO archive. MaterialsController#download invokes this synchronously without authentication, an aggregate size bound, or an export concurrency bound.

Impact: Memory consumption grows with the total selected file size and resulting archive size. Large exports or concurrent public download requests can exhaust worker memory.

Verification (NOT RUN): Not executed: in an isolated environment, export a profile containing several large files while measuring worker RSS, then repeat with concurrent requests.

Proposed change (NOT IMPLEMENTED): Add an aggregate byte limit before downloading blobs and bound concurrent exports; write accepted exports to a temporary file instead of retaining source payloads and the ZIP together in memory.

※ 自動調査による候補です。現在のコードで再確認し、Issue 化・実装する場合は別途承認してください。

<!-- codex-proposal:10 --> **Codex 調査提案 P-0010** (未承認・コード変更なし) ### Material ZIP downloads retain all source files and the archive in memory **調査対象**: `backend` / **調査時コミット**: `e13a52db9a6f` **Evidence**: `backend/app/services/material_zip_exporter.rb:53` at `e13a52db9a6f6619fa125a215602ac7a9ea72984` **Type**: resource_exhaustion_risk **Certainty**: confirmed **Reason**: build_entries downloads every selected blob into an Entry.data string. ZipWriter.write then copies their contents into a StringIO archive. MaterialsController#download invokes this synchronously without authentication, an aggregate size bound, or an export concurrency bound. **Impact**: Memory consumption grows with the total selected file size and resulting archive size. Large exports or concurrent public download requests can exhaust worker memory. **Verification (NOT RUN)**: Not executed: in an isolated environment, export a profile containing several large files while measuring worker RSS, then repeat with concurrent requests. **Proposed change (NOT IMPLEMENTED)**: Add an aggregate byte limit before downloading blobs and bound concurrent exports; write accepted exports to a temporary file instead of retaining source payloads and the ZIP together in memory. ※ 自動調査による候補です。現在のコードで再確認し、Issue 化・実装する場合は別途承認してください。
共同作業者

Codex 調査提案 P-0011 (未承認・コード変更なし)

[P1] Preserve discard boundaries when removing external-tag history

調査対象: backend / 調査時コミット: dda3d8707361

Evidence: backend/db/migrate/20261108010000_migrate_linked_tags_in_nico_tag_versions.rb:12 at dda3d87073617bcb0993e22dfb693d4280530917

Type: security
Certainty: confirmed

Reason: The DELETE removes every nico_tag_versions row for an external tag with any discard event. HistoryAccess.reference_sql checks post snapshots against discard rows in that table, and snapshot_reference also requires a matching version row. Both checks cease to block references after deletion. The earlier CreateExternalTags migration retains external_tags records for historical IDs, and PostVersionsController resolves and returns their names.

Impact: A previously hidden post history row referencing a discarded external tag can become publicly visible, including the external tag's name. This violates the permanent history privacy boundary.

Verification (NOT RUN): Not executed: In an isolated database, prepare an otherwise public post version referencing an external tag with create and discard history. Compare non-admin post-history responses before and after the migration; verify that the external reference remains hidden.

Proposed change (NOT IMPLEMENTED): Retain durable discard tombstones and consult them in HistoryAccess, or retain the existing discard history until an equivalent authorization boundary is in place.

※ 自動調査による候補です。現在のコードで再確認し、Issue 化・実装する場合は別途承認してください。

<!-- codex-proposal:11 --> **Codex 調査提案 P-0011** (未承認・コード変更なし) ### [P1] Preserve discard boundaries when removing external-tag history **調査対象**: `backend` / **調査時コミット**: `dda3d8707361` **Evidence**: `backend/db/migrate/20261108010000_migrate_linked_tags_in_nico_tag_versions.rb:12` at `dda3d87073617bcb0993e22dfb693d4280530917` **Type**: security **Certainty**: confirmed **Reason**: The DELETE removes every nico_tag_versions row for an external tag with any discard event. HistoryAccess.reference_sql checks post snapshots against discard rows in that table, and snapshot_reference also requires a matching version row. Both checks cease to block references after deletion. The earlier CreateExternalTags migration retains external_tags records for historical IDs, and PostVersionsController resolves and returns their names. **Impact**: A previously hidden post history row referencing a discarded external tag can become publicly visible, including the external tag's name. This violates the permanent history privacy boundary. **Verification (NOT RUN)**: Not executed: In an isolated database, prepare an otherwise public post version referencing an external tag with create and discard history. Compare non-admin post-history responses before and after the migration; verify that the external reference remains hidden. **Proposed change (NOT IMPLEMENTED)**: Retain durable discard tombstones and consult them in HistoryAccess, or retain the existing discard history until an equivalent authorization boundary is in place. ※ 自動調査による候補です。現在のコードで再確認し、Issue 化・実装する場合は別途承認してください。
共同作業者

Codex 調査提案 P-0012 (未承認・コード変更なし)

[P1] Do not resolve historical links using the newest matching name

調査対象: backend / 調査時コミット: dda3d8707361

Evidence: backend/db/migrate/20261108010000_migrate_linked_tags_in_nico_tag_versions.rb:28 at dda3d87073617bcb0993e22dfb693d4280530917

Type: data_integrity
Certainty: confirmed

Reason: The backfill searches all tag_versions by Japanese primary name and chooses the newest match without considering ntv.created_at or ambiguity. If tag A historically used a name later used by tag B, an older external-tag snapshot linking A is rewritten to B. Unmatched names are silently removed by compact, and the following migration deletes the original linked_tags column.

Impact: Historical link identities can be permanently corrupted or lost. Since HistoryAccess now authorizes these snapshots using linked_tag_ids, an incorrect mapping can also fail to hide a snapshot associated with a discarded tag.

Verification (NOT RUN): Not executed: Prepare tag A with historical name X, an external-tag snapshot linked to X, and a later tag B version using X. Inspect the proposed backfill result and confirm that it chooses B. Also examine an unmatched legacy name and confirm it is silently dropped.

Proposed change (NOT IMPLEMENTED): Resolve against recorded identities and the snapshot time. Preserve the legacy value and stop for explicit reconciliation when the mapping is missing or ambiguous; remove the legacy column only after validation.

※ 自動調査による候補です。現在のコードで再確認し、Issue 化・実装する場合は別途承認してください。

<!-- codex-proposal:12 --> **Codex 調査提案 P-0012** (未承認・コード変更なし) ### [P1] Do not resolve historical links using the newest matching name **調査対象**: `backend` / **調査時コミット**: `dda3d8707361` **Evidence**: `backend/db/migrate/20261108010000_migrate_linked_tags_in_nico_tag_versions.rb:28` at `dda3d87073617bcb0993e22dfb693d4280530917` **Type**: data_integrity **Certainty**: confirmed **Reason**: The backfill searches all tag_versions by Japanese primary name and chooses the newest match without considering ntv.created_at or ambiguity. If tag A historically used a name later used by tag B, an older external-tag snapshot linking A is rewritten to B. Unmatched names are silently removed by compact, and the following migration deletes the original linked_tags column. **Impact**: Historical link identities can be permanently corrupted or lost. Since HistoryAccess now authorizes these snapshots using linked_tag_ids, an incorrect mapping can also fail to hide a snapshot associated with a discarded tag. **Verification (NOT RUN)**: Not executed: Prepare tag A with historical name X, an external-tag snapshot linked to X, and a later tag B version using X. Inspect the proposed backfill result and confirm that it chooses B. Also examine an unmatched legacy name and confirm it is silently dropped. **Proposed change (NOT IMPLEMENTED)**: Resolve against recorded identities and the snapshot time. Preserve the legacy value and stop for explicit reconciliation when the mapping is missing or ambiguous; remove the legacy column only after validation. ※ 自動調査による候補です。現在のコードで再確認し、Issue 化・実装する場合は別途承認してください。
共同作業者

Codex 調査提案 P-0013 (未承認・コード変更なし)

The authoritative schema archive is absent from the repository

調査対象: docs / 調査時コミット: dda3d8707361

Evidence: docs/SYSTEM_SPEC.md:25 at dda3d87073617bcb0993e22dfb693d4280530917

Type: documentation
Certainty: confirmed

Reason: This section designates repository-managed tables.zip as the authoritative source for columns, constraints, and indexes, while line 27 explicitly delegates physical schema details to it. The commit's tracked file tree contains no tables.zip or other ZIP archive.

Impact: Readers cannot resolve the physical schema requirements repeatedly delegated to this archive, preventing reproducible implementation and schema review from the repository alone.

Verification (NOT RUN): Not executed: inspect the target commit's complete tracked tree for tables.zip, then follow the schema references in sections 0.2 and 12.

Proposed change (NOT IMPLEMENTED): Include the intended schema archive or replace these references with an existing, explicitly identified authoritative schema source.

※ 自動調査による候補です。現在のコードで再確認し、Issue 化・実装する場合は別途承認してください。

<!-- codex-proposal:13 --> **Codex 調査提案 P-0013** (未承認・コード変更なし) ### The authoritative schema archive is absent from the repository **調査対象**: `docs` / **調査時コミット**: `dda3d8707361` **Evidence**: `docs/SYSTEM_SPEC.md:25` at `dda3d87073617bcb0993e22dfb693d4280530917` **Type**: documentation **Certainty**: confirmed **Reason**: This section designates repository-managed tables.zip as the authoritative source for columns, constraints, and indexes, while line 27 explicitly delegates physical schema details to it. The commit's tracked file tree contains no tables.zip or other ZIP archive. **Impact**: Readers cannot resolve the physical schema requirements repeatedly delegated to this archive, preventing reproducible implementation and schema review from the repository alone. **Verification (NOT RUN)**: Not executed: inspect the target commit's complete tracked tree for tables.zip, then follow the schema references in sections 0.2 and 12. **Proposed change (NOT IMPLEMENTED)**: Include the intended schema archive or replace these references with an existing, explicitly identified authoritative schema source. ※ 自動調査による候補です。現在のコードで再確認し、Issue 化・実装する場合は別途承認してください。
共同作業者

Codex 調査提案 P-0014 (未承認・コード変更なし)

The deletion specification omits permanent historical privacy boundaries

調査対象: docs / 調査時コミット: dda3d8707361

Evidence: docs/SYSTEM_SPEC.md:601 at dda3d87073617bcb0993e22dfb693d4280530917

Type: security-contract
Certainty: hypothesis

Reason: Section 4.2 specifies current-page exclusion and history retention but does not require pre-discard versions, including the discard version, to remain admin-only after restoration. Section 5.11 describes history reconstruction without supplying this boundary. In contrast, backend/app/models/history_access.rb enforces MAX(discard.version_no) per resource key independently of current restoration state.

Impact: A future implementation following this document could authorize history from current publication state and expose previously discarded content after restoration. This is a specification risk; no existing runtime disclosure is established.

Verification (NOT RUN): Not executed: review the specified authorization outcome for create, edit, discard, restore, edit, and discard again, including historical references and exports for a non-admin user.

Proposed change (NOT IMPLEMENTED): Explicitly require permanent admin-only access through every applicable discard boundary, using committed version numbers and complete resource keys, across history, references, caches, SSR, and exports.

※ 自動調査による候補です。現在のコードで再確認し、Issue 化・実装する場合は別途承認してください。

<!-- codex-proposal:14 --> **Codex 調査提案 P-0014** (未承認・コード変更なし) ### The deletion specification omits permanent historical privacy boundaries **調査対象**: `docs` / **調査時コミット**: `dda3d8707361` **Evidence**: `docs/SYSTEM_SPEC.md:601` at `dda3d87073617bcb0993e22dfb693d4280530917` **Type**: security-contract **Certainty**: hypothesis **Reason**: Section 4.2 specifies current-page exclusion and history retention but does not require pre-discard versions, including the discard version, to remain admin-only after restoration. Section 5.11 describes history reconstruction without supplying this boundary. In contrast, backend/app/models/history_access.rb enforces MAX(discard.version_no) per resource key independently of current restoration state. **Impact**: A future implementation following this document could authorize history from current publication state and expose previously discarded content after restoration. This is a specification risk; no existing runtime disclosure is established. **Verification (NOT RUN)**: Not executed: review the specified authorization outcome for create, edit, discard, restore, edit, and discard again, including historical references and exports for a non-admin user. **Proposed change (NOT IMPLEMENTED)**: Explicitly require permanent admin-only access through every applicable discard boundary, using committed version numbers and complete resource keys, across history, references, caches, SSR, and exports. ※ 自動調査による候補です。現在のコードで再確認し、Issue 化・実装する場合は別途承認してください。
共同作業者

Codex 調査提案 P-0015 (未承認・コード変更なし)

Unknown condition fields crash Counts rendering

調査対象: frontend / 調査時コミット: dda3d8707361

Evidence: frontend/src/components/counts/CountsAdditionalConditions.tsx:186 at dda3d87073617bcb0993e22dfb693d4280530917

Type: bug
Certainty: confirmed

Reason: URL conditions are parsed without metadata validation. The non-null assertion on metadata.find does not prevent undefined at runtime. For a set operator, CountsConditionValues immediately reads field.candidateSource at line 30.

Impact: A malformed or stale shared URL can crash the page instead of presenting a recoverable input error. Collapsing the controls does not help because AnimatedCollapse keeps its children mounted.

Verification (NOT RUN): Not executed: open /ja/counts/posts?conditions=&conditions.0.field=unknown_field&conditions.0.operator=in and inspect the rendering error after definitions load.

Proposed change (NOT IMPLEMENTED): Validate condition fields against metadata before rendering value controls and handle unknown fields without dereferencing undefined.

※ 自動調査による候補です。現在のコードで再確認し、Issue 化・実装する場合は別途承認してください。

<!-- codex-proposal:15 --> **Codex 調査提案 P-0015** (未承認・コード変更なし) ### Unknown condition fields crash Counts rendering **調査対象**: `frontend` / **調査時コミット**: `dda3d8707361` **Evidence**: `frontend/src/components/counts/CountsAdditionalConditions.tsx:186` at `dda3d87073617bcb0993e22dfb693d4280530917` **Type**: bug **Certainty**: confirmed **Reason**: URL conditions are parsed without metadata validation. The non-null assertion on metadata.find does not prevent undefined at runtime. For a set operator, CountsConditionValues immediately reads field.candidateSource at line 30. **Impact**: A malformed or stale shared URL can crash the page instead of presenting a recoverable input error. Collapsing the controls does not help because AnimatedCollapse keeps its children mounted. **Verification (NOT RUN)**: Not executed: open /ja/counts/posts?conditions=&conditions.0.field=unknown_field&conditions.0.operator=in and inspect the rendering error after definitions load. **Proposed change (NOT IMPLEMENTED)**: Validate condition fields against metadata before rendering value controls and handle unknown fields without dereferencing undefined. ※ 自動調査による候補です。現在のコードで再確認し、Issue 化・実装する場合は別途承認してください。
共同作業者

Codex 調査提案 P-0016 (未承認・コード変更なし)

Adding a 101st condition silently discards it

調査対象: frontend / 調査時コミット: dda3d8707361

Evidence: frontend/src/lib/queryState.ts:21 at dda3d87073617bcb0993e22dfb693d4280530917

Type: boundary
Certainty: confirmed

Reason: queryRecords accepts only one- or two-digit indices, while setQueryRecords serializes any number of records. CountsAdditionalConditions allows unlimited additions. Its write path encodes conditions and then setCountState reparses them, silently dropping index 100 and higher.

Impact: The UI permits adding conditions that disappear without feedback, leaving the query less restricted than the user intended.

Verification (NOT RUN): Not executed: add 100 conditions, then add a distinct 101st condition. Inspect the draft and confirm the new condition is absent after serialization.

Proposed change (NOT IMPLEMENTED): Enforce the shared 100-record limit before additions and reject oversized serialization explicitly instead of silently truncating.

※ 自動調査による候補です。現在のコードで再確認し、Issue 化・実装する場合は別途承認してください。

<!-- codex-proposal:16 --> **Codex 調査提案 P-0016** (未承認・コード変更なし) ### Adding a 101st condition silently discards it **調査対象**: `frontend` / **調査時コミット**: `dda3d8707361` **Evidence**: `frontend/src/lib/queryState.ts:21` at `dda3d87073617bcb0993e22dfb693d4280530917` **Type**: boundary **Certainty**: confirmed **Reason**: queryRecords accepts only one- or two-digit indices, while setQueryRecords serializes any number of records. CountsAdditionalConditions allows unlimited additions. Its write path encodes conditions and then setCountState reparses them, silently dropping index 100 and higher. **Impact**: The UI permits adding conditions that disappear without feedback, leaving the query less restricted than the user intended. **Verification (NOT RUN)**: Not executed: add 100 conditions, then add a distinct 101st condition. Inspect the draft and confirm the new condition is absent after serialization. **Proposed change (NOT IMPLEMENTED)**: Enforce the shared 100-record limit before additions and reject oversized serialization explicitly instead of silently truncating. ※ 自動調査による候補です。現在のコードで再確認し、Issue 化・実装する場合は別途承認してください。
共同作業者

Codex 調査提案 P-0017 (未承認・コード変更なし)

Proxy timeout cuts off valid Counts queries

調査対象: frontend / 調査時コミット: dda3d8707361

Evidence: frontend/server.mjs:44 at dda3d87073617bcb0993e22dfb693d4280530917

Type: risk
Certainty: confirmed

Reason: The API proxy destroys an upstream connection after 10 seconds of inactivity. CountsTableQuery permits SQL execution for 30 seconds in backend/app/services/counts_table_query.rb:3. A query producing no response within 10 seconds is therefore terminated before its supported execution limit.

Impact: When requests use this proxy, Counts queries completing between 10 and 30 seconds fail with a generic 503, and backend timeout details cannot reach the browser.

Verification (NOT RUN): Not executed: in an isolated development environment, proxy a Counts response delayed for 12 seconds and confirm the frontend proxy returns 503 before the successful upstream response.

Proposed change (NOT IMPLEMENTED): Give Counts query requests a proxy timeout exceeding the backend execution budget, with response overhead.

※ 自動調査による候補です。現在のコードで再確認し、Issue 化・実装する場合は別途承認してください。

<!-- codex-proposal:17 --> **Codex 調査提案 P-0017** (未承認・コード変更なし) ### Proxy timeout cuts off valid Counts queries **調査対象**: `frontend` / **調査時コミット**: `dda3d8707361` **Evidence**: `frontend/server.mjs:44` at `dda3d87073617bcb0993e22dfb693d4280530917` **Type**: risk **Certainty**: confirmed **Reason**: The API proxy destroys an upstream connection after 10 seconds of inactivity. CountsTableQuery permits SQL execution for 30 seconds in backend/app/services/counts_table_query.rb:3. A query producing no response within 10 seconds is therefore terminated before its supported execution limit. **Impact**: When requests use this proxy, Counts queries completing between 10 and 30 seconds fail with a generic 503, and backend timeout details cannot reach the browser. **Verification (NOT RUN)**: Not executed: in an isolated development environment, proxy a Counts response delayed for 12 seconds and confirm the frontend proxy returns 503 before the successful upstream response. **Proposed change (NOT IMPLEMENTED)**: Give Counts query requests a proxy timeout exceeding the backend execution budget, with response overhead. ※ 自動調査による候補です。現在のコードで再確認し、Issue 化・実装する場合は別途承認してください。
共同作業者

Codex 調査提案 P-0018 (未承認・コード変更なし)

[P2] noindex の劇場詳細ページが sitemap に掲載される

調査対象: issue:403 / 調査時コミット: dda3d8707361

Evidence: frontend/src/App.tsx:155 at dda3d87073617bcb0993e22dfb693d4280530917

Type: 索引抑止の不整合
Certainty: confirmed

Reason: 劇場詳細ルートは sitemap: ['theatres'] を指定する一方、robots 指定がありません。TheatreDetailPage.tsx:857 は無条件に noindex meta を出力します。sitemap.server.ts:26 はルートの handle.robots のみで noindex を除外するため、劇場詳細ページは除外されません。バックエンドも sitemap_entries_controller.rb の theatres 分岐で Theatre.kept を返します。

Impact: 索引抑止対象の URL が sitemap に掲載され、docs/SYSTEM_SPEC.md:608 の除外要件に反します。クローラーに不要な URL を継続して通知します。これだけで noindex が無効になるとは断定しません。

Verification (NOT RUN): 未実行。既存の公開劇場がある検証環境で /ja/theatres/:id の HTML に noindex があることを確認し、/sitemap.xml と劇場用の子 sitemap に同じ URL が掲載されることを確認する。

Proposed change (NOT IMPLEMENTED): 劇場詳細ルートの handle に robots: 'noindex' を追加し、既存の sitemap 除外処理で扱う。

※ 自動調査による候補です。現在のコードで再確認し、Issue 化・実装する場合は別途承認してください。

<!-- codex-proposal:18 --> **Codex 調査提案 P-0018** (未承認・コード変更なし) ### [P2] noindex の劇場詳細ページが sitemap に掲載される **調査対象**: `issue:403` / **調査時コミット**: `dda3d8707361` **Evidence**: `frontend/src/App.tsx:155` at `dda3d87073617bcb0993e22dfb693d4280530917` **Type**: 索引抑止の不整合 **Certainty**: confirmed **Reason**: 劇場詳細ルートは sitemap: ['theatres'] を指定する一方、robots 指定がありません。TheatreDetailPage.tsx:857 は無条件に noindex meta を出力します。sitemap.server.ts:26 はルートの handle.robots のみで noindex を除外するため、劇場詳細ページは除外されません。バックエンドも sitemap_entries_controller.rb の theatres 分岐で Theatre.kept を返します。 **Impact**: 索引抑止対象の URL が sitemap に掲載され、docs/SYSTEM_SPEC.md:608 の除外要件に反します。クローラーに不要な URL を継続して通知します。これだけで noindex が無効になるとは断定しません。 **Verification (NOT RUN)**: 未実行。既存の公開劇場がある検証環境で /ja/theatres/:id の HTML に noindex があることを確認し、/sitemap.xml と劇場用の子 sitemap に同じ URL が掲載されることを確認する。 **Proposed change (NOT IMPLEMENTED)**: 劇場詳細ルートの handle に robots: 'noindex' を追加し、既存の sitemap 除外処理で扱う。 ※ 自動調査による候補です。現在のコードで再確認し、Issue 化・実装する場合は別途承認してください。
作成者
オーナー

うるせぇよ.

うるせぇよ.
サインインしてこの会話に参加。
2 人の参加者
通知
期日
期日は設定されていません。
依存関係

依存関係は設定されていません。

リファレンス: miteruzo/btrc-hub#486