Conversation
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…e ActiveTab via Exclude Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…lity Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…books list Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…rkBooksCreatedByUsers, getAvailableSolutionCategories Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…Y_USER admin guard Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…ttonGroup; SolutionTable uses SolutionTableProps Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…p+callback, removes store Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…s onclick prop Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…iminated union Props; rename gradeModesEachWorkbook Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…created_by_user tab Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
… add to .gitignore Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…ived Avoid calling buildTaskResultsByWorkBookId() 3 times in the template (once per tab). Consolidate into a single \$derived at the page level. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Make data-derived vars reactive with \$derived in +page.svelte - Fix unsafe loggedInUser null checks in +page.server.ts - Make AVAILABLE_CATEGORIES reactive with \$derived in SolutionWorkBookList - Replace as Roles cast with ?? Roles.USER fallback in WorkBookList - Remove gradeModesEachWorkbook from CreatedByUserTable (reuse SolutionTableProps) - Consolidate mockFindMany helper in workbooks.test.ts - Add VISIBILITY_CHECK_TIMEOUT constant in e2e tests - Single-pass partition via reduce in partitionWorkbooksAsMainAndReplenished - Convert SolutionTableProps comment from // to TSDoc - Update .gitignore: consolidate VS Code section - Update phase-4/8/9 docs to reflect production code Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Rename getPublishedWorkbooksByPlacement to getWorkbooksByPlacement with includeUnpublished flag - Pass includeUnpublished=true to route handler when admin is logged in - Add sessionStorage-based URL state restore on /workbooks mount - Show EmptyWorkbookList when CreatedByUserTable has no workbooks - Add e2e tests for Phase 12 scenarios Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…e phase-12 notes Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…onCategories type Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…rtition, onMount spacing Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…age to AGENTS.md and coding-style.md
…igh) to refactor.md for user decision
|
Caution Review failedAn error occurred during the review process. Please try again later. 📝 WalkthroughWalkthrough/workbooks ページを URL 駆動のタブ・フィルタへ移行。サーバー側でタブ/グレード/カテゴリに応じた問題集取得と管理者アクセス制御を追加。クライアントはストア依存を削除して親→子プロップ駆動へ変更し、sessionStorage による復元と goto によるナビゲーションを実装。 Changes
Sequence Diagram(s)sequenceDiagram
participant User as User
participant Browser as +page.svelte
participant Utils as workbook_url_params
participant Server as +page.server.ts
participant DB as Database
User->>Browser: タブ/フィルタ選択
Browser->>Utils: buildWorkbooksUrl(tab, grade?, category?)
Utils-->>Browser: URL
Browser->>Browser: goto(URL)
Browser->>Server: HTTP load({ url })
Server->>Utils: parseWorkBookTab/Grade/Category
Utils-->>Server: WorkBookTab / TaskGrade / SolutionCategory
Server->>Server: fetchWorkbooksByTab()
alt tab == CURRICULUM
Server->>DB: getWorkbooksByPlacement(taskGrade)
else tab == SOLUTION
Server->>DB: getWorkbooksByPlacement(solutionCategory)
Server->>DB: getAvailableSolutionCategories()
else tab == CREATED_BY_USER
Server->>DB: getWorkBooksCreatedByUsers()
end
DB-->>Server: workbooks[]
Server-->>Browser: { workbooks, tab, selectedGrade, availableCategories, ... }
Browser->>Browser: $derived 更新・UI 再描画
Browser->>Browser: sessionStorage に URL 保存
sequenceDiagram
participant onMount as onMount
participant Session as sessionStorage
participant Page as +page.svelte
participant goto as goto()
onMount->>Session: getItem('WORKBOOKS_URL_KEY')
alt セッション URL が存在 & 現在クエリが空
Session-->>onMount: URL
onMount->>goto: goto(URL)
else
Page->>Page: 通常初期化
end
Page->>Session: $effect で現在 URL を保存
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 9
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In @.claude/rules/svelte-components.md:
- Around line 44-48: The example block showing Bad/Good Svelte usage is mashed
into one line; split it into separate lines and paragraphs so each variant is
readable: replace the single-line examples with a multi-line fenced ```svelte```
block where the "Bad" section has comments and lines for let user =
data.loggedInUser and const categories = availableCategories.filter(...), then a
blank line and a "Good" section showing let user = $derived(data.loggedInUser)
and let categories = $derived(availableCategories.filter(...)); ensure you keep
the $derived, data.loggedInUser, availableCategories.filter, user and categories
identifiers so readers can find the original examples.
In `@e2e/workbooks_list.spec.ts`:
- Around line 166-167: The test currently returns to the workbooks page by
calling page.goto(WORKBOOK_LIST_URL) which contradicts the comment that it
should return "via nav link"; replace the page.goto(WORKBOOK_LIST_URL) call with
a click on the actual navigation link used in the app (the anchor/button that
routes to the workbooks list) and then wait for navigation/settling (replace the
use of page.goto(WORKBOOK_LIST_URL) with clicking the nav link selector and
awaiting navigation), ensuring you use the same page instance and keep any
assertions that follow.
- Around line 243-247: The test currently calls test.skip() when
editLink.isVisible() is false, which hides environment-dependent failures;
instead, remove the conditional skip and assert the expected visibility so the
test fails if the fixture/data is missing. Replace the early return using
editLink.isVisible() with an explicit assertion (or throw) that
editLink.isVisible() is true and include a clear message indicating missing test
data/fixtures (reference editLink.isVisible() and the call to test.skip()) so CI
surfaces the regression; additionally ensure necessary test setup/fixture
creation runs before this check.
In `@src/features/workbooks/components/list/CreatedByUserTable.svelte`:
- Around line 26-28: The template currently checks workbooks.length to decide
whether to render <EmptyWorkbookList />, which misses the case where workbooks
exist but all are filtered out by canRead and result in an empty <tbody>; change
the empty-state check to use the computed/filtered list (the collection you
render after applying the canRead filter) instead of raw workbooks — e.g.,
compute or reference the visibleWorkbooks/filteredWorkbooks used in the tbody
rendering and use visibleWorkbooks.length === 0 to show EmptyWorkbookList;
update both the top-level conditional (where EmptyWorkbookList is rendered) and
the tbody rendering logic (lines ~41-65) to rely on that same filtered list so
the empty state is consistent.
In `@src/features/workbooks/components/list/CurriculumWorkBookList.svelte`:
- Around line 74-85: The Svelte {`#each`} block iterating AVAILABLE_GRADES needs a
stable key to avoid list diffing issues; update the loop that renders Button
components (referencing AVAILABLE_GRADES, grade, filterByGradeMode,
currentGrade, getTaskGradeLabel) to include a unique key (e.g., the grade value
or grade.id) so the each block becomes keyed and each Button has a stable
identity during updates.
In `@src/features/workbooks/components/list/SolutionWorkBookList.svelte`:
- Around line 49-58: The `#each` block over AVAILABLE_CATEGORIES is missing a key,
causing a svelte warning; update the each block in SolutionWorkBookList.svelte
to add a key using the enum value (category) so each iteration is uniquely
identified (e.g., use {`#each` AVAILABLE_CATEGORIES as category (category)}).
Locate the block that renders Button (references: AVAILABLE_CATEGORIES,
category, onCategoryChange, currentCategory, SOLUTION_LABELS) and add the key
expression to the `#each` declaration to eliminate the warning.
In `@src/features/workbooks/services/workbooks.ts`:
- Around line 126-134: getAvailableSolutionCategories currently hardcodes
isPublished: true so categories that exist only on unpublished workbooks are
omitted; change the function signature (e.g.,
getAvailableSolutionCategories(includeUnpublished: boolean) or isAdmin flag) and
make the query condition for workBook.isPublished conditional (use no filter or
isPublished: true depending on includeUnpublished), update the
db.workBookPlacement.findMany call (and any callers) to pass the flag, and
ensure the distinct/select logic (solutionCategory) remains unchanged so admin
callers can see categories from unpublished workbooks.
In `@src/routes/`(admin)/workbooks/order/_types/kanban.ts:
- Around line 12-15: The import of WorkBookTab is separated from the other
imports; move the line "import type { WorkBookTab } from
'$features/workbooks/types/workbook';" into the top import block so all imports
are grouped, leaving the ActiveTab type definition unchanged (ActiveTab =
Exclude<WorkBookTab, 'created_by_user'>) and ensuring only import ordering is
adjusted.
In `@src/routes/workbooks/`+page.server.ts:
- Around line 56-63: The current Promise.all always calls
getAvailableSolutionCategories() causing unnecessary DB queries for non-solution
tabs; change the logic so getAvailableSolutionCategories() is only invoked when
the tab indicates the solution view (e.g., tab === 'solution'). Update the
Promise.all setup (the array that currently contains fetchWorkbooksByTab,
getAvailableSolutionCategories, taskCrud.getTasksByTaskId, and
taskResultsCrud.getTaskResultsOnlyResultExists) to conditionally include either
getAvailableSolutionCategories() or a resolved empty value (e.g.,
Promise.resolve([]) or null) and ensure the corresponding result is assigned to
availableCategories after awaiting Promise.all; keep fetchWorkbooksByTab,
taskCrud.getTasksByTaskId, and taskResultsCrud.getTaskResultsOnlyResultExists
unchanged.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
Run ID: adbfe5aa-e9e8-4c0d-9efa-7a671fb21d4d
📒 Files selected for processing (30)
.claude/rules/coding-style.md.claude/rules/svelte-components.md.claude/rules/testing.md.gitignoreAGENTS.mddocs/dev-notes/2026-03-20/workbooks-list-url-params/plan.mddocs/dev-notes/2026-03-20/workbooks-list-url-params/refactor.mde2e/workbooks_list.spec.tssrc/features/workbooks/components/list/CreatedByUserTable.sveltesrc/features/workbooks/components/list/CurriculumTable.sveltesrc/features/workbooks/components/list/CurriculumWorkBookList.sveltesrc/features/workbooks/components/list/SolutionTable.sveltesrc/features/workbooks/components/list/SolutionWorkBookList.sveltesrc/features/workbooks/components/list/WorkBookList.sveltesrc/features/workbooks/components/list/WorkbookTabItem.sveltesrc/features/workbooks/services/workbooks.test.tssrc/features/workbooks/services/workbooks.tssrc/features/workbooks/stores/active_workbook_tab.test.tssrc/features/workbooks/stores/active_workbook_tab.tssrc/features/workbooks/stores/task_grades_by_workbook_type.test.tssrc/features/workbooks/stores/task_grades_by_workbook_type.tssrc/features/workbooks/types/workbook.tssrc/features/workbooks/types/workbook_placement.tssrc/features/workbooks/utils/workbook_url_params.test.tssrc/features/workbooks/utils/workbook_url_params.tssrc/features/workbooks/utils/workbooks.test.tssrc/features/workbooks/utils/workbooks.tssrc/routes/(admin)/workbooks/order/_types/kanban.tssrc/routes/workbooks/+page.server.tssrc/routes/workbooks/+page.svelte
💤 Files with no reviewable changes (4)
- src/features/workbooks/stores/active_workbook_tab.ts
- src/features/workbooks/stores/active_workbook_tab.test.ts
- src/features/workbooks/stores/task_grades_by_workbook_type.ts
- src/features/workbooks/stores/task_grades_by_workbook_type.test.ts
There was a problem hiding this comment.
Actionable comments posted: 5
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In @.claude/rules/coding-style.md:
- Around line 74-77: Language Policy セクションの文言が CodeRabbit の「verbatim
転記」ルールと衝突するため、'Language Policy' 見出しを修正して refactor.md
のような特定ドキュメントに関しては原文のままの転記(英語等)を明示的に許容する例外規定を追加してください。具体的には
.claude/rules/coding-style.md の 'Language Policy' ブロックを編集し、"refactor.md" と
CodeRabbit の所見(参照: "verbatim" ルール)を例示して「所見が原文である場合は原文をそのまま引用して良い」「原文引用箇所には
[verbatim-original] タグまたは注釈を付与する」旨を追記し、同様の例外を 172-173 行付近の関連セクションにも反映させてください。
In @.claude/rules/testing.md:
- Around line 136-160: The examples in the testing rules are self-contradictory:
the guideline forbids importing types from src/ but the parameterized test
example uses TaskGrade.Q10 which implies importing a project enum; update the
example to use local primitive values (e.g., string or number constants) instead
of TaskGrade, and clarify in the text that parameter loops should iterate local
constants rather than project types; change the example usage of
TaskGrade.Q10/Q9/Q8 to a simple array of local values and update the surrounding
sentence to reference "local constants" instead of "project enums" so readers
won't be tempted to import from src/.
In `@docs/dev-notes/2026-03-20/workbooks-list-url-params/plan.md`:
- Line 5: The plan reads as if types/functions already exist; update the
document to explicitly mark which items are new versus existing by adding labels
like "新規追加予定" or "導入後" next to each symbol (e.g. WorkBookTab,
getWorkbooksByPlacement, getAvailableSolutionCategories) and clarify expected
runtime behavior vs current code state (e.g. that +page.server.ts will be
changed to parse URL params and call getWorkbooksByPlacement(query) for
CURRICULUM/SOLUTION, getWorkBooksCreatedByUsers() for CREATED_BY_USER with
admin-only redirect, and removal of client-side grade filtering in favor of
goto()+buildWorkbooksUrl()); apply the same clarifications to the other
referenced sections so readers can tell what must be implemented vs what already
exists.
- Around line 103-119: The checklist in the plan is incomplete (missing the E2E
run and several manual verification items) so update the document: either run
`pnpm test:e2e -- --grep "workbooks"` and complete all manual checks (tick off
`/session-close`, the listed manual steps such as `/workbooks` behavior,
tab/category button checks, admin/user redirect, etc.) and mark them checked, or
explicitly mark the plan as "未完了のため未リリース" if you cannot complete those steps
now; ensure the checklist items `pnpm test:e2e -- --grep "workbooks"` and
`/session-close` plus the manual verification bullet items are reflected
accurately in the file.
- Line 17: 現在の一文「placement レコードがない問題集は表示しない(Prisma のネスト where フィルタが IS NOT NULL
を暗黙的に含む)」は不正確なので、該当行を置き換えて使用している relation の種類と filter 演算子を明示し、Prisma
の正しい挙動を記述してください:一対一では暗黙の IS NOT NULL はなく明示的に `isNot: null` が必要であること、一対多で
`some`/`every` を使うと関連レコードが存在しない親は暗黙的に除外されること、`none`
を使うと関連レコードがない親を取得できることを短く追記(例として "one-to-one: use isNot: null; one-to-many
(some/every): excludes null relations; none: includes null relations"
のように文言を置く)。
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
Run ID: cb34ff00-5288-4c4d-8bf9-934be4bdeb48
📒 Files selected for processing (3)
.claude/rules/coding-style.md.claude/rules/testing.mddocs/dev-notes/2026-03-20/workbooks-list-url-params/plan.md
…or workbooks list - Restore filter state via nav link click instead of direct URL navigation in E2E test - Pass includeUnpublished flag to getAvailableSolutionCategories for admin users - Fix empty state check in CreatedByUserTable to use visible (readable) count - Add keyed #each blocks in CurriculumWorkBookList and SolutionWorkBookList - Move import to top of kanban.ts to fix declaration order - Update coding-style rule with CodeRabbit Findings exception - Fix code block formatting in svelte-components rule - Add E2E note about avoiding src/ imports in testing rule Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
Actionable comments posted: 5
♻️ Duplicate comments (2)
.claude/rules/svelte-components.md (1)
44-50:⚠️ Potential issue | 🟡 Minorコード例のフォーマットが崩れたままです(既知の問題)。
Bad/Good の例が1行に圧縮されており、可読性が極めて低い状態です。さらに、コードブロックの識別子が
md になっていますが、内容は Svelte/TypeScript コードなのでsvelte に修正すべきです。📝 修正案
-```md +```svelte // Bad: captures only the initial value — won't update when data reloads -let user = data.loggedInUser; const categories = availableCategories.filter(...); +let user = data.loggedInUser; +const categories = availableCategories.filter(...); // Good -let user = $derived(data.loggedInUser); let categories = $derived(availableCategories.filter(...)); +let user = $derived(data.loggedInUser); +let categories = $derived(availableCategories.filter(...)); ```🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In @.claude/rules/svelte-components.md around lines 44 - 50, Update the broken example block: change the code-fence language from ```md to ```svelte and expand the compressed Bad/Good lines so each statement is on its own line (e.g. separate "let user = data.loggedInUser" and "const categories = availableCategories.filter(...)" and likewise separate "let user = $derived(data.loggedInUser)" and "let categories = $derived(availableCategories.filter(...))"), preserving the Bad/Good comments and overall example structure.e2e/workbooks_list.spec.ts (1)
243-247:⚠️ Potential issue | 🟠 Major管理者導線を
test.skip()で隠さないでくださいここがデータ依存で常時 skip になると、
編集/削除の回帰を CI が拾えません。前提データを固定して失敗させるか、少なくともこの分岐は外してください。♻️ 最小修正例
- if (!(await editLink.isVisible())) { - // No workbooks visible for the current grade → skip - test.skip(); - return; - } - await expect(editLink).toBeVisible({ timeout: TIMEOUT }); await expect(deleteButton).toBeVisible({ timeout: TIMEOUT });🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@e2e/workbooks_list.spec.ts` around lines 243 - 247, The test currently calls test.skip() when editLink.isVisible() is false which hides the admin edit/delete regressions; remove this conditional branch and ensure the test always runs by either (A) creating/setup deterministic fixture data at the start of the spec so editLink.isVisible() will be true, or (B) assert/setup the expected absence/presence and fail when the precondition is not met; update the logic around editLink.isVisible() in e2e/workbooks_list.spec.ts (search for editLink.isVisible()) to remove the early test.skip() and replace it with deterministic fixture creation or a failing assertion so CI catches regressions.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In @.claude/rules/coding-style.md:
- Line 31: 定数命名例の改善提案: 現在の例示 `EXISTING_TABS` は用途寄りの名称なので、値を表す名称に変更してください(候補:
`ALL_TAB_VALUES` または `TAB_ENUM_SET`);TSDoc のデフォルト値説明では `includeUnpublished` のような
optional パラメータ例をサンプルブロックに追加して「- Defaults to false.」を明示化してください(参照: TSDoc
サンプル周辺の記述で `@param includeUnpublished` を追加);および冗長なフレーズ `"potential_issue
(medium) and above (including critical / high)"` は短く `(medium/high/critical)`
のように簡潔化して置き換えてください.
In `@src/features/workbooks/components/list/CreatedByUserTable.svelte`:
- Around line 25-27: Compute the filtered list once instead of calling canRead
twice: create a derived store (e.g., visibleWorkbooks) from workbooks that
applies workbooks.filter(w => canRead(w.isPublished, userId, w.authorId)), then
set visibleCount to the length of that derived store and have the template use
visibleWorkbooks (for example in your {`#if`} and iteration) rather than
re-calling canRead; update references to visibleCount, workbooks, and the
template condition so everything reads from visibleWorkbooks.
In `@src/features/workbooks/components/list/CurriculumWorkBookList.svelte`:
- Around line 21-39: The props rename introduced in
CurriculumWorkBookList.svelte (gradeModesEachWorkbook, currentGrade,
onGradeChange) is out of sync with WorkBookList.svelte which still passes
workbookGradeModes and omits currentGrade/onGradeChange, and
CurriculumTable.svelte which expects workbookGradeModes; fix by reconciling
names and forwarding: either restore the original prop name workbookGradeModes
in CurriculumWorkBookList or update WorkBookList to pass the new names (pass
gradeModesEachWorkbook, currentGrade, and onGradeChange) and update
CurriculumTable to accept the same prop name (or add a compatibility mapping
inside CurriculumWorkBookList that forwards workbookGradeModes =>
gradeModesEachWorkbook and ensures onGradeChange and currentGrade are defined
before invoking), referencing components CurriculumWorkBookList.svelte,
WorkBookList.svelte, and CurriculumTable.svelte and the props
gradeModesEachWorkbook, workbookGradeModes, currentGrade, and onGradeChange.
In `@src/features/workbooks/components/list/SolutionWorkBookList.svelte`:
- Around line 61-62: The SolutionTable component is being rendered without the
required workbookGradeModes prop declared in WorkbookTableProps; update the
SolutionWorkBookList.svelte SolutionTable invocation to pass through the parent
workbookGradeModes value (e.g., add workbookGradeModes={workbookGradeModes}) so
the props contract is satisfied, or alternatively refactor SolutionTable's props
type (WorkbookTableProps) to make workbookGradeModes optional or split into a
separate prop type if the prop truly isn't used there; locate references to
SolutionTable, WorkbookTableProps and workbookGradeModes to apply the chosen fix
consistently.
In `@src/features/workbooks/services/workbooks.test.ts`:
- Around line 144-245: Tests for getWorkbooksByPlacement,
getWorkBooksCreatedByUsers (and getAvailableSolutionCategories) are not
asserting the full Prisma call shape (include.user,
include.workBookTasks.orderBy, and for getAvailableSolutionCategories the
select/distinct), so update the expectations to assert prisma.workBook.findMany
is called with those keys present: for getWorkbooksByPlacement assert
objectContaining includes include: { user: true, workBookTasks: { orderBy: {
priority: 'asc' } } } (or appropriate orderBy), for getWorkBooksCreatedByUsers
assert include.user is present and orderBy: { id: 'asc' }, and for
getAvailableSolutionCategories assert prisma.workBook.findMany call includes
select with the expected fields and distinct array; adjust mocks (mockFindMany)
if needed so the included relations/selected fields exist to avoid false
positives.
---
Duplicate comments:
In @.claude/rules/svelte-components.md:
- Around line 44-50: Update the broken example block: change the code-fence
language from ```md to ```svelte and expand the compressed Bad/Good lines so
each statement is on its own line (e.g. separate "let user = data.loggedInUser"
and "const categories = availableCategories.filter(...)" and likewise separate
"let user = $derived(data.loggedInUser)" and "let categories =
$derived(availableCategories.filter(...))"), preserving the Bad/Good comments
and overall example structure.
In `@e2e/workbooks_list.spec.ts`:
- Around line 243-247: The test currently calls test.skip() when
editLink.isVisible() is false which hides the admin edit/delete regressions;
remove this conditional branch and ensure the test always runs by either (A)
creating/setup deterministic fixture data at the start of the spec so
editLink.isVisible() will be true, or (B) assert/setup the expected
absence/presence and fail when the precondition is not met; update the logic
around editLink.isVisible() in e2e/workbooks_list.spec.ts (search for
editLink.isVisible()) to remove the early test.skip() and replace it with
deterministic fixture creation or a failing assertion so CI catches regressions.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
Run ID: 52ff57c9-d53a-4a3e-913d-b3523bd70261
📒 Files selected for processing (11)
.claude/rules/coding-style.md.claude/rules/svelte-components.md.claude/rules/testing.mde2e/workbooks_list.spec.tssrc/features/workbooks/components/list/CreatedByUserTable.sveltesrc/features/workbooks/components/list/CurriculumWorkBookList.sveltesrc/features/workbooks/components/list/SolutionWorkBookList.sveltesrc/features/workbooks/services/workbooks.test.tssrc/features/workbooks/services/workbooks.tssrc/routes/(admin)/workbooks/order/_types/kanban.tssrc/routes/workbooks/+page.server.ts
… assertions to tests
- Replace visibleCount + inner {#if} with visibleWorkbooks derived list
- Add include clause assertions (user, workBookTasks) to getWorkbooksByPlacement and getWorkBooksCreatedByUsers tests
- Update svelte-components rule: prefer filtering before #each over inner {#if}
- Clarify CodeRabbit severity triage wording in AGENTS.md and coding-style.md
- Extend testing rule: include clause must be asserted when return value depends on relation
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
close #3269
Summary by CodeRabbit
新機能
改善