Skip to content

feat: planned events via wizard-proxy HTTP (BA-47) and signup dashboard_url#405

Open
kelsonpw wants to merge 6 commits intomainfrom
feat/ba47-planned-events-http
Open

feat: planned events via wizard-proxy HTTP (BA-47) and signup dashboard_url#405
kelsonpw wants to merge 6 commits intomainfrom
feat/ba47-planned-events-http

Conversation

@kelsonpw
Copy link
Copy Markdown
Collaborator

@kelsonpw kelsonpw commented Apr 30, 2026

Summary

This branch combines two related improvements:

BA-47 — Planned events registration

  • Registers planned events through the wizard-proxy HTTP path instead of relying solely on the Amplitude MCP create_events tool.
  • Short-circuits when the MCP exposes no create_events tool (see prior fix on this branch).

Signup UX — Provisioning dashboard_url

  • Parses optional dashboard_url from the agentic signup response (amplitude/javascript provisioning API).
  • Surfaces it as signupMagicLinkUrl in session/TUI so the success outro prefers the magic link over the checklist dashboard open URL.
  • Agent mode: uses the link for continueUrl, opens the browser when non-CI; diagnostics only expose a boolean (signup_magic_link_available), not the URL (sensitive query params).
  • Hardening: runDirectSignupIfRequested treats undefined like null from performSignupOrAuth so tests and edge cases do not crash.

Test plan

  • pnpm vitest run (pre-push)
  • Updated/added unit tests for direct-signup, signup-or-auth, wizard-session, OutroScreen, planned-events

Made with Cursor


Note

Medium Risk
Touches signup/auth flow and adds a new network path for planned-event creation; failures are handled defensively, but regressions could affect onboarding UX and event-plan persistence.

Overview
Adds a new primary path for committing agent-planned events by POSTing to the wizard-proxy /v1/planned-events endpoint (zone-aware, bearer auth, typed success/error parsing, 404 fallback to MCP create_events), while keeping MCP update_event for descriptions.

Extends direct signup to parse and propagate an optional provisioning dashboard_url as signupMagicLinkUrl across session/state, making the outro (and agent continue URL) prefer the magic-link and opening it automatically in agent non-CI runs, with diagnostics only emitting availability (not the URL). Test coverage is updated/added for the new HTTP flow, error mapping, and the new signup URL plumbing.

Reviewed by Cursor Bugbot for commit 879e615. Bugbot is set up for automated code reviews on this repo. Configure here.

@kelsonpw kelsonpw requested a review from a team as a code owner April 30, 2026 01:11
@github-actions
Copy link
Copy Markdown
Contributor

🧙 Wizard CI

Run the Wizard CI and test your changes against wizard-workbench example apps by replying with a GitHub comment using one of the following commands:

Test all apps:

  • /wizard-ci all

Test all apps in a directory:

  • /wizard-ci django
  • /wizard-ci fastapi
  • /wizard-ci flask
  • /wizard-ci javascript-node
  • /wizard-ci javascript-web
  • /wizard-ci next-js
  • /wizard-ci python
  • /wizard-ci react-router
  • /wizard-ci vue

Test an individual app:

  • /wizard-ci django/django3-saas
  • /wizard-ci fastapi/fastapi3-ai-saas
  • /wizard-ci flask/flask3-social-media
Show more apps
  • /wizard-ci javascript-node/express-todo
  • /wizard-ci javascript-node/fastify-blog
  • /wizard-ci javascript-node/hono-links
  • /wizard-ci javascript-node/koa-notes
  • /wizard-ci javascript-node/native-http-contacts
  • /wizard-ci javascript-web/saas-dashboard
  • /wizard-ci next-js/15-app-router-saas
  • /wizard-ci next-js/15-app-router-todo
  • /wizard-ci next-js/15-pages-router-saas
  • /wizard-ci next-js/15-pages-router-todo
  • /wizard-ci python/meeting-summarizer
  • /wizard-ci react-router/react-router-v7-project
  • /wizard-ci react-router/rrv7-starter
  • /wizard-ci react-router/saas-template
  • /wizard-ci react-router/shopper
  • /wizard-ci vue/movies

Results will be posted here when complete.

@kelsonpw kelsonpw force-pushed the feat/ba47-planned-events-http branch from b920914 to 97064bc Compare April 30, 2026 01:26
Copy link
Copy Markdown
Contributor

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Autofix Details

Bugbot Autofix prepared a fix for the issue found in the latest run.

  • ✅ Fixed: Zod schema rejects null dashboard_url breaking signup
    • Changed z.string().min(1).optional() to z.string().min(1).nullish() so the schema accepts both undefined and null values for dashboard_url, preventing valid API responses with null from failing parse.

Create PR

Or push these changes by commenting:

@cursor push 23a085bc20
Preview (23a085bc20)
diff --git a/src/utils/direct-signup.ts b/src/utils/direct-signup.ts
--- a/src/utils/direct-signup.ts
+++ b/src/utils/direct-signup.ts
@@ -19,7 +19,7 @@
 const OAuthProvisioningSchema = z.object({
   type: z.literal('oauth'),
   oauth: z.object({ code: z.string().min(1) }),
-  dashboard_url: z.string().min(1).optional(),
+  dashboard_url: z.string().min(1).nullish(),
 });
 
 const RedirectSchema = z.object({

You can send follow-ups to the cloud agent here.

Comment thread src/utils/direct-signup.ts Outdated
Replace MCP create_events with POST {wizardProxy}/v1/planned-events using the same OAuth access token and zone-aware base URL as createAmplitudeApp.

- On HTTP 404 (route not deployed), fall back to MCP create_events.
- Event descriptions still use MCP update_event until a proxy endpoint exists.
- commitPlannedEvents now requires zone; agent-runner passes us/eu from cloudRegion.

Stacks on wizard PR #385. Coordinate release with amplitude/javascript#109119 (Thunder wizard-proxy).

Made-with: Cursor
- Parse optional dashboard_url from agentic signup response; forward as
  dashboardUrl through performSignupOrAuth without NDJSON exposure
- Session + TUI store carry signupMagicLinkUrl; Outro prefers it over
  checklist open URL; diagnostics expose boolean only
- Agent signup outro uses magic link for continueUrl; open browser in
  agent mode when non-CI
- Tests for direct-signup, signup-or-auth, session defaults, OutroScreen

Made-with: Cursor
@kelsonpw kelsonpw force-pushed the feat/ba47-planned-events-http branch from 97064bc to 5bb285c Compare April 30, 2026 01:44
kelsonpw and others added 3 commits April 29, 2026 19:16
z.string().min(1).optional() rejects explicit null. APIs commonly
return null for absent optional string fields; the entire signup
breaks even though the auth code was successfully obtained. Switch
to .nullish() so null, undefined, and absent are all valid;
downstream already coalesces with `?? null`.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Copy link
Copy Markdown
Contributor

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

Bugbot Autofix prepared a fix for the issue found in the latest run.

  • ✅ Fixed: Strict min(1) on optional dashboard_url breaks signup
    • Removed min(1) from the dashboard_url schema field and changed ?? null to || null so empty strings are treated as null instead of causing parse failure.

Create PR

Or push these changes by commenting:

@cursor push 2de7b7e0ce
Preview (2de7b7e0ce)
diff --git a/src/utils/direct-signup.ts b/src/utils/direct-signup.ts
--- a/src/utils/direct-signup.ts
+++ b/src/utils/direct-signup.ts
@@ -19,7 +19,7 @@
 const OAuthProvisioningSchema = z.object({
   type: z.literal('oauth'),
   oauth: z.object({ code: z.string().min(1) }),
-  dashboard_url: z.string().min(1).nullish(),
+  dashboard_url: z.string().nullish(),
 });
 
 const RedirectSchema = z.object({
@@ -224,6 +224,6 @@
       expiresAt,
       zone: input.zone,
     },
-    dashboardUrl: parsedCode.data.dashboard_url ?? null,
+    dashboardUrl: parsedCode.data.dashboard_url || null,
   };
 }

You can send follow-ups to the cloud agent here.

Reviewed by Cursor Bugbot for commit f43111b. Configure here.

Comment thread src/utils/direct-signup.ts Outdated
Bugbot follow-up: `.min(1).nullish()` still rejects empty strings.
If the provisioning API ever returns `"dashboard_url": ""`, the
entire schema fails and the valid OAuth code in the same response
is discarded — signup breaks. An optional metadata field shouldn't
gate the critical signup path. Drop `min(1)` and coerce empty to
null at the read site.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@kelsonpw
Copy link
Copy Markdown
Collaborator Author

Conflicts against current main. Could you rebase + force-push? I'll admin-merge once green.

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