Expose handler type with preload on - #697
Conversation
WalkthroughThe template for generated code now emits three type aliases in the preload_handlers branch: handlerArgs, handler, and contractRegister, replacing a previously empty output. The non-preload branch remains unchanged. No Rust public API signatures were modified; only generated string content was updated. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Assessment against linked issues
Assessment against linked issues: Out-of-scope changes
Possibly related PRs
Poem
Tip 🔌 Remote MCP (Model Context Protocol) integration is now available!Pro plan users can now connect to remote MCP servers from the Integrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats. ✨ Finishing Touches
🧪 Generate unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR/Issue comments)Type Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (1)
codegenerator/cli/src/hbs_templating/codegen_templates.rs (1)
462-469: Preload branch types look correct; consider also exposing loaderArgs and confirm 'unit is the intended loader return.
- Emitting
handlerArgs,handler, andcontractRegisterunderpreload_handlersis aligned with the PR goal and seems correct.- Given Issue #540’s objective to generate types for both loaderArgs and handlerArgs per event, it may be beneficial to also expose
loaderArgsin the preload branch for ergonomics (typing loaders created outside registration), even if loaders are preloaded at runtime.- Please confirm that hard-coding the loader return to
unitinhandlerArgsis the intended semantics when preloading is enabled. If handler code is expected to access loader results even in preload mode,unitmay be too restrictive.Proposed addition of
loaderArgsin the preload branch:format!( r#"@genType +type loaderArgs = Internal.genericLoaderArgs<event, loaderContext> +@genType type handlerArgs = Internal.genericHandlerArgs<event, handlerContext, unit> @genType type handler = Internal.genericHandler<handlerArgs> @genType type contractRegister = Internal.genericContractRegister<Internal.genericContractRegisterArgs<event, contractRegistrations>>"# )Follow-ups:
- If you want, I can add a minimal test asserting that
module_codecontains the new preload-specific types whenpreload_handlers = true(e.g., check fortype handlerArgs = Internal.genericHandlerArgs<event, handlerContext, unit>andtype loaderArgs = Internal.genericLoaderArgs<event, loaderContext>). Do you want me to draft that test?
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
💡 Knowledge Base configuration:
- MCP integration is disabled by default for public repositories
- Jira integration is disabled by default for public repositories
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (1)
codegenerator/cli/src/hbs_templating/codegen_templates.rs(1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: build_and_test
Fixes #540
Summary by CodeRabbit
New Features
Chores