Skip to content

Clarify Plugin Lifecycle terminology to distinguish from database Triggers#101

Closed
Copilot wants to merge 3 commits intomainfrom
copilot/review-zod-usage
Closed

Clarify Plugin Lifecycle terminology to distinguish from database Triggers#101
Copilot wants to merge 3 commits intomainfrom
copilot/review-zod-usage

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Jan 24, 2026

Reviewed all Zod schemas to assess whether an old "hook" specification needed preservation. No separate hook specification exists in the codebase. Found terminology overlap: Plugin Lifecycle used "hook" in descriptions, creating confusion with database Triggers which serve a different purpose.

Changes

  • Renamed type: PluginLifecycleHooksPluginLifecycleCallbacks
  • Updated descriptions: "Hook called on..." → "Lifecycle callback on..."
  • Added analysis doc: HOOK_TRIGGER_CLARIFICATION.md documenting the semantic differences

Semantic Distinction

// Database-level business logic hooks (before/after CRUD operations)
export const TriggerSchema = z.object({
  timing: z.enum(['before', 'after']),
  action: z.enum(['insert', 'update', 'delete']),
  execute: z.function().args(TriggerContextSchema)...
});

// Plugin system lifecycle callbacks (install/enable/disable/uninstall)
export const PluginLifecycleSchema = z.object({
  onInstall: z.function().describe('Lifecycle callback on plugin installation'),
  onEnable: z.function().describe('Lifecycle callback when plugin is enabled'),
  ...
});

Recommendation

Do not implement the planned hooks.zod.ts (Hook Registry Protocol) mentioned in the roadmap. Current Trigger specification already covers database-level extension points (beforeObjectCreate, afterRecordSave, etc.). Adding a separate hook registry would be redundant.

Original prompt

审核所有的zod,我们之前有定义一个类似现在trigger的hook规范,现在还需要保留吗


💡 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 24, 2026

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

Project Deployment Review Updated (UTC)
spec Error Error Jan 24, 2026 11:55am

Request Review

Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
Copilot AI changed the title [WIP] Review existing Zod schema and hook specifications Clarify Plugin Lifecycle terminology to distinguish from database Triggers Jan 24, 2026
Copilot AI requested a review from hotlong January 24, 2026 11:39
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