Skip to content

feat(planetscale): add webhook triggers - #8444

Open
BillLeoutsakosvl346 wants to merge 2 commits into
stagingfrom
feat/planetscale-triggers
Open

BillLeoutsakosvl346 wants to merge 2 commits into
stagingfrom
feat/planetscale-triggers

Conversation

@BillLeoutsakosvl346

@BillLeoutsakosvl346 BillLeoutsakosvl346 commented Sep 30, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Add 16 typed PlanetScale triggers and a Selected Events trigger covering all 19 documented production events, with engine labels and database selectors.
  • Register and recover service-token subscriptions, encrypt signing secrets, authenticate raw-body HMAC signatures, and execute durable deliveries with payload-based deduplication and retryable cleanup.
  • Scope action/trigger canonical fields and protect credentials in webhook persistence errors and execution traces.
  • Originally stacked on feat(planetscale): add management actions #8438. That dependency merged during review; this PR now targets current staging and contains only trigger commits. Leave this PR unmerged.

Type of Change

  • New feature
  • Bug fix
  • Documentation

Testing

  • 1,035 focused and related tests passed across 111 files; regression guards demonstrated failing before their fixes.
  • Four real-infrastructure application scenarios passed with disposable PostgreSQL/Redis, real authentication, Next, deployment/outbox processing, signed HTTP ingress, workflow execution, and authenticated stored-output reads. Only PlanetScale transport was intercepted.
  • Actual browser validation covered 17 trigger choices, 19 generic events, masked credentials, action/trigger switching, selector/manual input and label hydration, nested output tags, draft/deploy/delivery/update/undeploy, and credential-free execution traces.
  • Independent validate-trigger/validate-selector audit completed with zero critical issues and zero warnings.
  • All 26 workspace type-checks, lint, 52 audits, block-registry checks, generator drift checks, docs manifest, and whitespace checks passed. JSON/HTTP reports, real run evidence, and redacted screenshots retained.

Live PlanetScale testing deferred. Verify token permissions, public HTTPS callbacks, engine-specific real deliveries, provider retries, updates near the five-webhook limit, and undeploy cleanup with a disposable PlanetScale database before production use.

PlanetScale limits databases to five webhooks; candidate-first updates temporarily need another slot. Deduplication retains the signed native timestamp to distinguish repeated events. PlanetScale documents no immutable delivery ID or creation-idempotency guarantee: payload-changing retries and creation failures without a returned ID cannot guarantee exactly-once behavior. Failed partial-creation cleanup may require removing the unused subscription manually.

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

@vercel

vercel Bot commented Sep 30, 2026 •

Copy link
Copy Markdown

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

Project Deployment Actions Updated
docs Ready Ready Preview Sep 30, 2026 2:06am UTC

Request Review

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

1 issue found across 40 files

Confidence score: 4/5

  • In apps/sim/triggers/planetscale/utils.ts, projectResource and other nullable projections can emit null where the trigger output schema allows only strings, risking validation failures; update the schema to represent nullable values.
Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="apps/sim/triggers/planetscale/utils.ts">

<violation number="1" location="apps/sim/triggers/planetscale/utils.ts:155">
P2: `projectResource` can emit `null` for `createdAt`, but this output schema declares only `string`; the same mismatch affects the other nullable projections. Add nullable metadata to the trigger output schema and mark each affected field `nullable: true`.

(Based on your team's feedback about always-present nullable outputs.)</violation>
</file>

Tip: cubic can generate docs of your entire codebase and keep them up to date. Try it here.

Fix all with cubic | Re-trigger cubic

Comment thread apps/sim/triggers/planetscale/utils.ts
Base automatically changed from feat/planetscale-actions to staging September 30, 2026 01:49
@greptile-apps

greptile-apps Bot commented Sep 30, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 5/5

[High risk] Adds webhook integration for PlanetScale database events.

No outstanding finding from this review prevents merging, though live PlanetScale delivery remains unverified as noted by the PR author.

Summary

The PR adds typed PlanetScale webhook triggers, signed delivery handling, subscription lifecycle management, and regression coverage. The changes since the previous review capture provider state before checkpoints for rollback and retain a bounded SQLSTATE without exposing persistence errors.

  • The two earlier lifecycle and diagnostic findings are fixed.
  • The conditional shared-input finding was resolved with an implementation explanation; no new finding warrants a comment.
Diagram
%%{init: {'theme': 'neutral'}}%%
flowchart LR
  Deploy[Deploy workflow] --> Candidate[Prepare registration candidate]
  Candidate --> Provider[Create or recover PlanetScale webhook]
  Provider --> Checkpoint[Checkpoint provider ID and encrypted secret]
  Checkpoint --> Activate[Activate registration]
  Event[Signed PlanetScale event] --> Verify[Verify raw-body HMAC and filter event]
  Verify --> Queue[Queue workflow execution]
  Activate --> Verify
Loading

Reviews (3) · Last reviewed commit: "fix(webhooks): retain rollback state and..."

Comment thread apps/sim/lib/webhooks/providers/planetscale.ts
Comment thread apps/sim/lib/webhooks/registration-store.ts
@BillLeoutsakosvl346

Copy link
Copy Markdown
Contributor Author

@greptile

@BillLeoutsakosvl346

Copy link
Copy Markdown
Contributor Author

@cubic-dev-ai review this PR

@cubic-dev-ai

cubic-dev-ai Bot commented Sep 30, 2026

Copy link
Copy Markdown
Contributor

@cubic-dev-ai review this PR

@BillLeoutsakosvl346 I have started the AI code review. It will take a few minutes to complete.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

No issues found across 42 files

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

Tip: cubic can generate docs of your entire codebase and keep them up to date. Try it here.

Re-trigger cubic

Comment thread apps/sim/blocks/blocks/planetscale.ts
@BillLeoutsakosvl346

Copy link
Copy Markdown
Contributor Author

@greptile

@BillLeoutsakosvl346

Copy link
Copy Markdown
Contributor Author

@cubic-dev-ai review this PR

@cubic-dev-ai

cubic-dev-ai Bot commented Sep 30, 2026

Copy link
Copy Markdown
Contributor

@cubic-dev-ai review this PR

@BillLeoutsakosvl346 I have started the AI code review. It will take a few minutes to complete.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

No issues found across 42 files

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

Tip: cubic can generate docs of your entire codebase and keep them up to date. Try it here.

Re-trigger cubic

This branch was successfully deployed

1 active deployment
Preview — 3f7d698c Deployed Sep 30, 2026 by vercel[bot]
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