feat(web): 分野詳細に「この分野を設定している項目」逆参照を追加#10
Closed
kentalow wants to merge 2 commits into
Closed
Conversation
CFSubject 詳細ページ(/uri/{subject})に、同一テナント内でこの分野を
subjectURI で参照している CFItem の一覧を表示する。上位20件をSSR、件数表示、
「もっと見る」で HTMX フラグメント(/{tenant}/subject/{id}/items)から次ページを
自己再帰的に追記(ツリーの遅延ロードと同作法)。
- cf_item_repository: list_items_by_subject / count_items_by_subject
(subject_uri @> 包含・GIN索引利用・テナントスコープ・安定ソート・ページング)
- web.py: _detail_extras に CFSubject 分岐、subject_items を _DETAIL_EXTRAS_KEYS
と pane_extras 両方に追加、subject_items_fragment ルート(CFSubject 検証・
limit+1 で has_more 判定・Cache-Control フラグメント)
- 再利用フラグメント fragments/subject_items.html(SSR include と HTMX 両用)、
resource_detail.html の lookup 分岐に CFSubject ゲートで挿入
- i18n: subject_items_label / subject_items_count / show_more
- tests: unit(包含/テナントスコープ/ページング/count/空)+ integration
(分野ページ/フラグメント/検証404・400/cache/空状態)計13件
- docs: web-ui.md(分野逆参照節・フラグメントルート)
テナント内のみ(分野はテナント所有)。subject 文字列のみの参照は対象外。
GIN索引は先行PR、デモデータ(subjectURI付与)は別途対応。
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XXFogp18twGiPFBAZcqJw2
CFSubject をツリーの Definitions からクリックして右ペインに開いたとき、 _pane_fragment_response が _detail_extras を普通に呼ぶため「この分野を設定して いる項目」が出てしまっていた(初期SSRの pane_extras では空にしていたが、HTMX ペイン更新経路が漏れていた)。 _detail_extras に include_subject_items 引数を追加し、ペイン経路(in_pane)では False を渡して計算自体を抑止(テンプレ条件だけでなくクエリも走らせない)。 単独 /uri/ ページのみ表示する。 - 回帰テスト2件追加(_detail_extras のフラグ挙動 / ペインフラグメントで非表示) Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XXFogp18twGiPFBAZcqJw2
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
概要
CFSubject(分野)詳細ページに、同一テナント内でこの分野を
subjectURIで参照している CFItem の一覧を表示します(CFItem→CFSubject の逆引き)。上位20件を SSR、件数表示、「もっと見る」で次ページを HTMX で自己再帰的に追記(ツリーの遅延ロードと同じ作法・別ページに飛ばない案A)。実装
cf_item_repository:list_items_by_subject/count_items_by_subject—subject_uri @> '[{"identifier": ...}]'包含クエリ(GIN索引ix_cf_items_subject_uri_ginを使用=EXPLAIN で Bitmap Index Scan 確認済み)、テナントスコープ、human_coding_scheme→full_statement→identifierの安定ソート、offset ページング。web.py:_detail_extrasにCFSubject分岐、subject_itemsを_DETAIL_EXTRAS_KEYSとpane_extrasの両方に追加(KeyError 回避)、GET /{tenant}/subject/{id}/itemsフラグメントルート(対象が当該テナントの CFSubject か検証、limit+1でhas_more判定=再 COUNT 無し、Cache-Control: public, max-age=86400)。fragments/subject_items.html(SSR include と HTMX 応答の二刀流)、resource_detail.htmlの lookup 分岐にCFSubjectゲートで挿入。各行は項目の所属ドキュメントのツリーへリンク。subject_items_label/subject_items_count/show_more(en/ja)。スコープ
subject文字列のみ(subjectURI無し)で参照する項目は対象外。テスト(計13件 / 全690 pass)
ドキュメント
docs/spec/web-ui.md: 分野逆参照節・/{tenant}/subject/{id}/itemsフラグメントルート・再利用フラグメントの旨。デモで実データを出すための subjectURI 付与は別途対応します(compeito 側テストは合成データで完結)。
🤖 Generated with Claude Code