Skip to content

Close the CreateTemplateServer hook gap#6

Open
cdvelop wants to merge 1 commit into
mainfrom
fix-createtemplateserver-hook-gap-2583130832842740185
Open

Close the CreateTemplateServer hook gap#6
cdvelop wants to merge 1 commit into
mainfrom
fix-createtemplateserver-hook-gap-2583130832842740185

Conversation

@cdvelop
Copy link
Copy Markdown
Collaborator

@cdvelop cdvelop commented May 17, 2026

The CreateTemplateServer method was identified as a separate entry point that transitions the server from internal to external mode but bypassed the BeforeExternalServerStart hook. This change ensures that the hook is invoked symmetrically across all transition paths to external mode, allowing orchestrators to flush state or prepare assets before the external binary starts.

Specifically:

  • In switch_mode.go, CreateTemplateServer now calls h.BeforeExternalServerStart() before s.Start(nil).
  • Documentation in docs/SERVER_INTERFACE.md was updated to reflect this.
  • New test cases were added to verify the hook invocation and error propagation in the CreateTemplateServer flow.
  • An existing test was updated to use a temporary directory, preventing interference from local files.

PR created automatically by Jules for task 2583130832842740185 started by @cdvelop

This commit closes the hook gap where CreateTemplateServer would start
the external server strategy without invoking the
BeforeExternalServerStart hook.

Changes:
- Modified switch_mode.go to call BeforeExternalServerStart in
  CreateTemplateServer and handle its errors.
- Updated docs/SERVER_INTERFACE.md to include CreateTemplateServer as
  an invocation point for the hook.
- Added TestCreateTemplateServer_InvokesBeforeHook and
  TestCreateTemplateServer_HookErrorAbortsStart to
  test/before_external_hook_test.go.
- Fixed a side effect in TestStartServer_InternalModeSkipsBeforeHook by
  using a temporary directory for AppRootDir.

Co-authored-by: cdvelop <44058491+cdvelop@users.noreply.github.com>
@google-labs-jules
Copy link
Copy Markdown
Contributor

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

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.

1 participant