Skip to content

Fix MSW endpoint mismatch: /metadata/object → /meta/object - #356

Merged
hotlong merged 3 commits into
mainfrom
copilot/fix-build-issue-in-actions
Feb 2, 2026
Merged

Fix MSW endpoint mismatch: /metadata/object → /meta/object#356
hotlong merged 3 commits into
mainfrom
copilot/fix-build-issue-in-actions

Conversation

Copilot AI commented Feb 2, 2026

Copy link
Copy Markdown
Contributor

CI tests failing because MSW handlers intercepted /api/v1/metadata/object/:name while ObjectStack client calls /api/v1/meta/object/:name, causing unhandled fetch requests.

Changes

  • Test MSW handlers - Updated endpoint paths in:

    • packages/plugin-grid/src/ObjectGrid.msw.test.tsx
    • packages/plugin-form/src/ObjectForm.msw.test.tsx
    • packages/plugin-calendar/src/ObjectCalendar.msw.test.tsx
    • .storybook/msw-browser.ts
  • Console mock server - Added missing /meta/object/:name handler to apps/console/src/mocks/server.ts (already had /meta/objects/:name plural variant)

Before:

http.get(`${BASE_URL}/api/v1/metadata/object/contact`, () => { ... })

After:

http.get(`${BASE_URL}/api/v1/meta/object/contact`, () => { ... })
Original prompt

引用: https://github.com/objectstack-ai/objectui/actions/runs/21591319949/job/62211927313#step:8:1


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

@vercel

vercel Bot commented Feb 2, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
objectui Ready Ready Preview, Comment Feb 2, 2026 1:45pm
objectui-components Ready Ready Preview, Comment Feb 2, 2026 1:45pm
objectui-crm-app Error Error Feb 2, 2026 1:45pm

Request Review

@xuyushun441-sys

Copy link
Copy Markdown
Contributor

@copilot 继续

Copilot AI and others added 2 commits February 2, 2026 13:32
Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix build issue in GitHub Actions Fix MSW endpoint mismatch: /metadata/object → /meta/object Feb 2, 2026
Copilot AI requested a review from hotlong February 2, 2026 13:45
Copilot AI requested a review from xuyushun441-sys February 2, 2026 13:47
@hotlong
hotlong marked this pull request as ready for review February 2, 2026 13:56
Copilot AI review requested due to automatic review settings February 2, 2026 13:56
@hotlong
hotlong merged commit c25ec8e into main Feb 2, 2026
4 of 5 checks passed

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR aligns MSW mock endpoints with the ObjectStack client’s actual /api/v1/meta/object/:name usage so that tests and Storybook no longer generate unhandled request errors, and adds the missing console mock handler for the singular meta-object route.

Changes:

  • Updated MSW handlers in grid, form, and calendar plugin tests from /api/v1/metadata/object/... to /api/v1/meta/object/... to match the ObjectStack client.
  • Adjusted Storybook’s browser MSW configuration to use /api/v1/meta/object/:objectName for metadata requests.
  • Extended the console mock server to handle the singular /meta/object/:objectName endpoint in addition to existing plural/legacy variants.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
packages/plugin-grid/src/ObjectGrid.msw.test.tsx Updates the grid test’s schema fetch handler to /api/v1/meta/object/contact, matching the adapter’s expected endpoint.
packages/plugin-form/src/ObjectForm.msw.test.tsx Updates the form test’s generic schema handler to /api/v1/meta/object/:name, avoiding unhandled MSW requests during form schema loading.
packages/plugin-calendar/src/ObjectCalendar.msw.test.tsx Points the calendar test’s metadata query to /api/v1/meta/object/events to align with the ObjectStack client.
apps/console/src/mocks/server.ts Adds a new /meta/object/:objectName handler (parallel to the existing /metadata/object/:objectName handler) so the console mock server supports the singular meta-object route used by the client.
.storybook/msw-browser.ts Switches the Storybook metadata handler to /api/v1/meta/object/:objectName, ensuring Storybook stories use the same meta-object path as the runtime client.

Comment on lines +123 to +135
http.get(`${baseUrl}/meta/object/:objectName`, async ({ params }) => {
console.log('MSW: getting meta item for /meta/object', params.objectName);
try {
const response = await protocol.getMetaItem({
type: 'object',
name: params.objectName as string
});

// Unwrap item if present
const payload = (response && response.item) ? response.item : response;

return HttpResponse.json(payload || { error: 'Not found' }, { status: payload ? 200 : 404 });
} catch (e) {

Copilot AI Feb 2, 2026

Copy link

Choose a reason for hiding this comment

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

The new handler for ${baseUrl}/meta/object/:objectName duplicates almost the same logic as the existing ${baseUrl}/metadata/object/:objectName handler below (logging, getMetaItem call, payload unwrapping, and error handling). To reduce maintenance overhead and risk of future drift between these endpoints, consider extracting a shared helper (e.g., a function that takes the path or a common handler factory) and reuse it for both routes.

Copilot uses AI. Check for mistakes.
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.

4 participants