Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jan 20, 2026

CI failure in plugin.test.ts due to incomplete mock PluginContext objects. Zod validation rejected lifecycle hook invocations because mocks were missing required schema fields.

Changes

  • Added missing required fields to all PluginContext test mocks:

    • ql.query function
    • os.getCurrentUser and os.getConfig functions
    • storage object (get/set/delete)
    • i18n object (t/getLocale)
    • app.router object (get/post/use)
    • Complete logger methods (debug/warn added to existing info/error)
  • Updated 7 test cases across PluginContextSchema validation tests and lifecycle scenario tests

Example

// Before (incomplete, failed validation)
await parsed.onUninstall({
  ql: { object: () => ({ dropTable: async () => {} }) },
  os: {},
  logger: { info: () => {}, error: () => {} },
  metadata: {},
  events: {},
} as any);

// After (complete, passes validation)
await parsed.onUninstall({
  ql: { 
    object: () => ({ dropTable: async () => {} }),
    query: async () => ({})
  },
  os: {
    getCurrentUser: async () => ({ id: 'test-user' }),
    getConfig: async () => 'test-config'
  },
  storage: { get: async () => null, set: async () => {}, delete: async () => {} },
  i18n: { t: () => '', getLocale: () => 'en' },
  logger: { debug: () => {}, info: () => {}, warn: () => {}, error: () => {} },
  metadata: {},
  events: {},
  app: { router: { get: () => {}, post: () => {}, use: () => {} } }
} as any);

All 17 plugin tests now pass.

Original prompt

引用: https://github.com/objectstack-ai/spec/actions/runs/21185704366/job/60940481482#step:8:1


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

@vercel
Copy link

vercel bot commented Jan 20, 2026

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

Project Deployment Review Updated (UTC)
spec Ready Ready Preview, Comment Jan 20, 2026 8:30pm

Request Review

Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix GitHub Action error in workflow Fix plugin test mocks to satisfy PluginContextSchema validation Jan 20, 2026
Copilot AI requested a review from hotlong January 20, 2026 20:31
@hotlong hotlong marked this pull request as ready for review January 20, 2026 21:38
Copilot AI review requested due to automatic review settings January 20, 2026 21:38
@hotlong hotlong merged commit 6b01250 into copilot/release-version-update Jan 20, 2026
9 checks passed
Copy link
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 CI test failures in plugin.test.ts by completing incomplete PluginContext mock objects that were failing Zod schema validation. The test mocks were missing required fields defined in PluginContextSchema, causing lifecycle hook tests to fail.

Changes:

  • Added all required PluginContext fields to 7 test mocks: ql.query, os.getCurrentUser/getConfig, storage (get/set/delete), i18n (t/getLocale), app.router (get/post/use), and complete logger methods (debug/warn)
  • Updated test cases in PluginContextSchema validation tests and Plugin Lifecycle Scenarios tests
  • All mock implementations now satisfy the complete PluginContextSchema requirements

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.

2 participants