Skip to content

Fix metadata.get() returning wrapper instead of content#249

Merged
hotlong merged 3 commits intocopilot/fix-runtimeplugin-issuesfrom
copilot/fix-action-run-issue-again
Jan 29, 2026
Merged

Fix metadata.get() returning wrapper instead of content#249
hotlong merged 3 commits intocopilot/fix-runtimeplugin-issuesfrom
copilot/fix-action-run-issue-again

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Jan 29, 2026

The metadata stub in ObjectQL was returning the internal wrapper object {type, id, path, package, content} instead of unwrapping to return just the content property. This caused app.metadata.get('object', 'user') to return an object without the expected name field.

Changes

  • Added unwrapContent() helper to extract content property from wrapped metadata items
  • Updated metadata.get() stub to unwrap before returning
  • Updated metadata.list() stub to map items through unwrapper

This aligns the SchemaRegistry-backed stub with the original MetadataRegistry behavior:

// Before: returned {type: 'object', id: 'user', path: '...', content: {...}}
// After: returns {name: 'user', label: 'Users', fields: {...}}
const userMetadata = app.metadata.get('object', 'user');
expect(userMetadata.name).toBe('user'); // Now passes

Resolves CI failure in examples/integrations/express-server metadata tests.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • fastdl.mongodb.org
    • Triggering command: /usr/local/bin/node /usr/local/bin/node /home/REDACTED/work/objectql/objectql/node_modules/.pnpm/jest-worker@30.2.0/node_modules/jest-worker/build/processChild.js (dns block)
  • fonts.googleapis.com
    • Triggering command: /usr/local/bin/node node /home/REDACTED/work/objectql/objectql/apps/site/node_modules/.bin/../next/dist/bin/next build (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

引用: https://github.com/objectstack-ai/objectql/actions/runs/21474950703/job/61856512670#step:10: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
Copy link
Copy Markdown

vercel bot commented Jan 29, 2026

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

Project Deployment Review Updated (UTC)
objectql Ready Ready Preview, Comment Jan 29, 2026 10:58am

Request Review

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 issue with action run in CI workflow Fix metadata.get() returning wrapper instead of content Jan 29, 2026
Copilot AI requested a review from hotlong January 29, 2026 11:01
@hotlong hotlong marked this pull request as ready for review January 29, 2026 11:02
Copilot AI review requested due to automatic review settings January 29, 2026 11:02
@github-actions
Copy link
Copy Markdown
Contributor

⚠️ No Changeset Found

This PR does not include a changeset file.
If this PR includes user-facing changes, please add a changeset by running:

pnpm changeset

@hotlong hotlong merged commit ba06716 into copilot/fix-runtimeplugin-issues Jan 29, 2026
2 checks passed
@hotlong hotlong deleted the copilot/fix-action-run-issue-again branch January 29, 2026 11:03
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

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 fixes the ObjectQL core metadata stub so that it returns unwrapped metadata content, matching the original MetadataRegistry behavior and restoring downstream metadata tests (e.g., in the Express integration).

Changes:

  • Added a local unwrapContent() helper that mirrors MetadataRegistry’s logic for returning item.content when present.
  • Updated the metadata.get() stub to call SchemaRegistry.getItem() and return only the unwrapped content.
  • Updated the metadata.list() stub to map the results of SchemaRegistry.listItems() through unwrapContent, so callers receive arrays of content objects rather than wrapper entries.
Comments suppressed due to low confidence (3)

packages/foundation/core/src/app.ts:24

  • Unused imports LoaderPlugin, MetadataItem.
import { 
    MetadataRegistry,
    MetadataItem,
    Driver, 
    ObjectConfig, 
    ObjectQLContext, 
    ObjectQLContextOptions, 
    IObjectQL, 
    ObjectQLConfig,
    HookName,
    HookHandler,
    HookContext,
    ActionHandler,
    ActionContext,
    LoaderPlugin
} from '@objectql/types';

packages/foundation/core/src/app.ts:126

  • Unused variable type.
                     for (const [type, collection] of metadata.entries()) {

packages/foundation/core/src/app.ts:445

  • Unused variable key.
            for (const [key, obj] of Object.entries(this.config.objects)) {

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants