Repository navigation
Skills M4 (4/9): run display-review on the shared review toolset - #35730
valentinpalkovic wants to merge 1 commit into
Conversation
|
WalkthroughThe review flow now uses the shared core ChangesReview toolset migration
Sequence Diagram(s)sequenceDiagram
participant MCPClient
participant review.create
participant coreReviewService
participant StorybookUI
MCPClient->>review.create: Submit review input
review.create->>coreReviewService: Publish review
coreReviewService-->>review.create: Return review state
review.create-->>MCPClient: Return review URL and counts
MCPClient->>StorybookUI: Open review URL
Possibly related issues
Possibly related PRs
✨ Finishing Touches📝 Generate docstrings
Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
code/core/src/shared/open-service/toolsets/review/definition.test.ts (1)
41-54: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winUse
vi.mocked()forsetReview.The setup accesses
setReviewdirectly and castsgetServicetoToolsetCtx['getService']. Type the mock as theReviewServicecommand and access its implementation throughvi.mocked(setReview). This keeps the mock return type aligned with the service contract.As per coding guidelines, “Use
vi.mocked()to type and access the mocked functions in Vitest tests” and “Avoid direct function mocking withoutvi.mocked()in Vitest tests.”🤖 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 `@code/core/src/shared/open-service/toolsets/review/definition.test.ts` around lines 41 - 54, Update the beforeEach setup for setReview to use vi.mocked(setReview) for configuring its implementation, and type the mocked service command as the ReviewService contract. Remove the direct getService cast by exposing the correctly typed mocked command through the existing cliCtx setup, preserving the current serviceError behavior.Source: Coding guidelines
🤖 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.
Nitpick comments:
In `@code/core/src/shared/open-service/toolsets/review/definition.test.ts`:
- Around line 41-54: Update the beforeEach setup for setReview to use
vi.mocked(setReview) for configuring its implementation, and type the mocked
service command as the ReviewService contract. Remove the direct getService cast
by exposing the correctly typed mocked command through the existing cliCtx
setup, preserving the current serviceError behavior.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: ff3713f5-aa46-4014-a3fd-42ab9a9a22e0
📒 Files selected for processing (15)
code/addons/mcp/src/constants.tscode/addons/mcp/src/test-support/register-core-toolsets.tscode/addons/mcp/src/tools/display-review.test.tscode/addons/mcp/src/tools/display-review.tscode/addons/mcp/src/tools/tool-registry.tscode/addons/mcp/src/tools/toolset-tools.tscode/core/src/core-server/index.tscode/core/src/core-server/presets/common-preset.tscode/core/src/core-server/server-channel/review-channel.test.tscode/core/src/core-server/server-channel/review-channel.tscode/core/src/server-errors.tscode/core/src/shared/open-service/toolsets/review/definition.test.tscode/core/src/shared/open-service/toolsets/review/definition.tscode/core/src/shared/review/events.tscode/core/src/shared/review/review-state.ts
💤 Files with no reviewable changes (6)
- code/addons/mcp/src/constants.ts
- code/addons/mcp/src/tools/display-review.test.ts
- code/core/src/core-server/server-channel/review-channel.test.ts
- code/addons/mcp/src/tools/display-review.ts
- code/core/src/core-server/server-channel/review-channel.ts
- code/core/src/core-server/presets/common-preset.ts
Closes #
Part 4 of 9 of the Skills M4 migration. Stacked on #35729, replaces #35677.
What I did
The display-review tool hands a set of stories to Storybook's review UI so a human can walk through what an agent changed. Until now it did that indirectly: the MCP server emitted an event, the manager picked it up over a channel, and the manager was the one that actually created the review. It now calls the review service in the same process, and both the event and its consumer are gone.
Behavior change worth challenging: when applying the review to the review service failed, the old path swallowed it with a warning in the server log. The agent was handed a URL and told the review had been displayed, even though the page it pointed at had never received anything. Those failures now reach the agent as errors. To be precise about the scope, this is not about story IDs that do not exist - those were already validated up front and already produced an error. It is the rest: the review service being unavailable, or anything going wrong while the state is applied.
The producer and the consumer have to change in the same commit. Split apart, either reviews stop arriving in the manager or the tool emits into nothing.
Checklist for Contributors
Testing
The changes in this PR are covered in the following automated tests:
Manual testing
Caution
This section is mandatory for all contributions. If you believe no manual test is necessary, please state so explicitly. Thanks!
yarn nx run-many -t compile.test-storybooks/mcp, runyarn installand thenyarn storybook. That Storybook has the review feature enabled and its MCP endpoint comes up athttp://localhost:6006/mcp.display-reviewwith a few valid story IDs. You should get back a review URL, and opening it in the browser should show exactly those stories in the review UI, as before.Documentation
MIGRATION.MD
Checklist for Maintainers
When this PR is ready for testing, make sure to add
ci:normal,ci:mergedorci:dailyGH label to it to run a specific set of sandboxes. The particular set of sandboxes can be found incode/lib/cli-storybook/src/sandbox-templates.tsDeclare whether manual QA will be needed for this PR during the next release, through
qa:neededorqa:skipMake sure this PR contains one of the labels below:
Available labels
bug: Internal changes that fixes incorrect behavior.maintenance: User-facing maintenance tasks.dependencies: Upgrading (sometimes downgrading) dependencies.build: Internal-facing build tooling & test updates. Will not show up in release changelog.cleanup: Minor cleanup style change. Will not show up in release changelog.documentation: Documentation only changes. Will not show up in release changelog.feature request: Introducing a new feature.BREAKING CHANGE: Changes that break compatibility in some way with current major version.other: Changes that don't fit in the above categories.🦋 Canary release
This PR does not have a canary release associated. You can request a canary release of this pull request by mentioning the
@storybookjs/coreteam here.core team members can create a canary release here or locally with
gh workflow run --repo storybookjs/storybook publish.yml --field pr=<PR_NUMBER>