Skip to content

fix: load dashboard playbooks by exact ID - #143

Merged
yyiilluu merged 1 commit into
mainfrom
codex/fix-dashboard-playbook-id
Jul 25, 2026
Merged

yyiilluu merged 1 commit into
mainfrom
codex/fix-dashboard-playbook-id

Conversation

@yyiilluu

@yyiilluu yyiilluu commented Jul 25, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Make project skill detail routes resolve the requested user playbook instead of searching only the first paginated result set.
  • Send the numeric route ID to Reflexio as user_playbook_id with a one-record limit.
  • Reject invalid route IDs before issuing an API request.

Changes

  • Add exact user playbook ID filtering to the dashboard Reflexio client.
  • Update /skills/project/[id] to request and render the exact API result.

Test Plan

  • npx biome check 'app/skills/project/[id]/page.tsx' lib/reflexio-client.ts
  • npx tsc --noEmit
  • npm run build
  • uv run --project plugin pytest --rootdir . -o addopts= tests/test_dashboard_install.py tests/test_dashboard_managed_reflexio.py -q
  • Verified http://localhost:3001/skills/project/87 renders playbook 87 through the dashboard API proxy.

Follow-ups

@coderabbitai

coderabbitai Bot commented Jul 25, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

The project skill page now validates route IDs and requests a matching playbook directly. The Reflexio client supports passing userPlaybookId to the get_user_playbooks endpoint, and invalid IDs render the not-found view.

Changes

Project skill lookup

Layer / File(s) Summary
User playbook ID request filter
plugin/dashboard/lib/reflexio-client.ts
getUserPlaybooks accepts userPlaybookId and maps it to user_playbook_id in the request payload.
Validated project skill loading
plugin/dashboard/app/skills/project/[id]/page.tsx
The route ID is parsed and validated, targeted playbook retrieval replaces client-side filtering, effect dependencies use the numeric ID, and invalid IDs select the not-found view.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant ProjectSkillPage
  participant ReflexioClient
  participant GetUserPlaybooksEndpoint
  participant ProjectSkillUI
  ProjectSkillPage->>ProjectSkillPage: Parse and validate params.id
  ProjectSkillPage->>ReflexioClient: getUserPlaybooks({ userPlaybookId, limit: 1 })
  ReflexioClient->>GetUserPlaybooksEndpoint: POST user_playbook_id
  GetUserPlaybooksEndpoint-->>ReflexioClient: Return matching playbook
  ReflexioClient-->>ProjectSkillPage: Return first playbook
  ProjectSkillPage->>ProjectSkillUI: Render playbook or not-found view
Loading

Suggested reviewers: yilu331

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly matches the main change: fetching dashboard playbooks by exact ID instead of broadly searching.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/fix-dashboard-playbook-id

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
plugin/dashboard/app/skills/project/[id]/page.tsx (1)

76-95: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Reset route-scoped state before the next lookup.

The effect reruns for a new userPlaybookId, but notFound, playbook, and error can remain from the previous route. After navigating from a missing ID to a valid /skills/project/87, a successful response can set playbook while the not-found guard renders first; invalid-to-valid navigation can also show stale errors/form and valid-to-valid navigation can show stale content/errors while fetching.

Suggested fix
   useEffect(() => {
     let cancelled = false;
+    setNotFound(false);
+    setPlaybook(null);
+    setError(null);
+    setEditing(false);
     if (invalidId) return;

Also add a missing-to-valid navigation regression test.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@plugin/dashboard/app/skills/project/`[id]/page.tsx around lines 76 - 95,
Reset route-scoped state at the start of the effect that loads the playbook for
each new userPlaybookId: clear notFound, error, playbook, and the form state
before validating or fetching. Preserve the existing cancellation and response
handling, and add a regression test covering navigation from a missing ID to a
valid ID to ensure stale not-found state does not block the loaded playbook.

Sources: Coding guidelines, MCP tools

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Outside diff comments:
In `@plugin/dashboard/app/skills/project/`[id]/page.tsx:
- Around line 76-95: Reset route-scoped state at the start of the effect that
loads the playbook for each new userPlaybookId: clear notFound, error, playbook,
and the form state before validating or fetching. Preserve the existing
cancellation and response handling, and add a regression test covering
navigation from a missing ID to a valid ID to ensure stale not-found state does
not block the loaded playbook.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 473f7988-181d-401d-a978-cb27c32aa401

📥 Commits

Reviewing files that changed from the base of the PR and between 951e081 and cb848ee.

📒 Files selected for processing (2)
  • plugin/dashboard/app/skills/project/[id]/page.tsx
  • plugin/dashboard/lib/reflexio-client.ts

@yyiilluu
yyiilluu merged commit e46185a into main Jul 25, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant