Skip to content

chore: use restates proto generated ingress instead for better type safety#4113

Merged
Flo4604 merged 8 commits intomainfrom
eng-2118-use-restates-proto-generated-ingress-instead-for-better
Oct 22, 2025
Merged

chore: use restates proto generated ingress instead for better type safety#4113
Flo4604 merged 8 commits intomainfrom
eng-2118-use-restates-proto-generated-ingress-instead-for-better

Conversation

@Flo4604
Copy link
Member

@Flo4604 Flo4604 commented Oct 20, 2025

What does this PR do?

Fixes #4097

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • Chore (refactoring code, technical debt, workflow improvements)
  • Enhancement (small improvements)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How should this be tested?

Run the control plane and check all operations that use restate, if they still work. E.g deployment/rollback/promotion

Checklist

Required

  • Filled out the "How to test" section in this PR
  • Read Contributing Guide
  • Self-reviewed my own code
  • Commented on my code in hard-to-understand areas
  • Ran pnpm build
  • Ran pnpm fmt
  • Checked for warnings, there are none
  • Removed all console.logs
  • Merged the latest changes from main onto my branch with git pull origin main
  • My changes don't cause any responsiveness issues

Appreciated

  • If a UI change was made: Added a screen recording or screenshots to this PR
  • Updated the Unkey Docs if changes were necessary

@linear
Copy link

linear bot commented Oct 20, 2025

@changeset-bot
Copy link

changeset-bot bot commented Oct 20, 2025

⚠️ No Changeset found

Latest commit: 3da72aa

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@vercel
Copy link

vercel bot commented Oct 20, 2025

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

2 Skipped Deployments
Project Deployment Preview Comments Updated (UTC)
dashboard Ignored Ignored Preview Oct 22, 2025 5:04pm
engineering Ignored Ignored Preview Oct 22, 2025 5:04pm

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 20, 2025

📝 Walkthrough

Walkthrough

Migrates deployment service calls from the generic Restate ingress usage to proto-generated, typed ingress clients; updates docs to show the typed client pattern; adds a helper on Service to build the typed client and bumps restatedev/sdk-go and related deps.

Changes

Cohort / File(s) Summary
Documentation & Examples
apps/engineering/content/docs/architecture/workflows/creating-services.mdx
Replace generic ingress examples with typed ingress client examples (Service struct, typed client accessor, endpoint-scoped Request/Send flows), update blocking and fire-and-forget sections, add benefits and setup notes.
Deployment: create
go/apps/ctrl/services/deployment/create_deployment.go
Replace previous restateingress.WorkflowSend synchronous invocation with a fire-and-forget call via s.deploymentClient(project.ID).Deploy().Send(...); remove restateingress import and adjust error handling to check Send's error.
Deployment: promote
go/apps/ctrl/services/deployment/promote.go
Replace restateingress invocation with fluent typed client call s.deploymentClient(...).Promote().Request(...); maintain payload and adjust call path.
Deployment: rollback
go/apps/ctrl/services/deployment/rollback.go
Replace blocking restate invocation with s.deploymentClient(...).Rollback().Request(ctx, ...); remove restateingress import and keep existing control flow and logging.
Service helper & config
go/apps/ctrl/services/deployment/service.go
Add unexported deploymentClient helper that builds a Hydra DeploymentServiceIngressClient from the existing restate client; add Restate *restateingress.Client and Logger logging.Logger to Config; add hydrav1 import alias.
Dependencies
go/go.mod
Bump restatedev/sdk-go to v0.21.0; update google.golang.org/protobuf and github.com/mailru/easyjson versions; remove older indirect sdk-go version.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant API as Ctrl Service
  participant Client as Service.deploymentClient
  participant Ingress as Restate Ingress (typed)

  rect rgb(235,245,255)
    note right of API: Create deployment (fire-and-forget)
    API->>Client: Deploy().Send(ctx, DeployRequest)
    Client->>Ingress: Deploy endpoint (typed)
    Ingress-->>Client: ack / error
    Client-->>API: Send returned (nil or error)
  end

  rect rgb(245,250,235)
    note right of API: Promote / Rollback (Request flow)
    API->>Client: Promote().Request(ctx, PromoteRequest)
    Client->>Ingress: Promote endpoint (typed)
    Ingress-->>Client: Response / error
    Client-->>API: Response / error
  end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Pre-merge checks and finishing touches

✅ Passed checks (5 passed)
Check name Status Explanation
Title Check ✅ Passed The title "chore: use restates proto generated ingress instead for better type safety" clearly summarizes the main change in the pull request: migrating from generic ingress to restates proto-generated typed clients. The title is specific, concise, and directly reflects the core objective visible in the changeset, where all deployment-related operations (create, promote, rollback) have been updated to use typed client methods instead of untyped ingress calls.
Linked Issues Check ✅ Passed The coding changes fully satisfy the linked issue #4097 objective to replace current ingress usage with restates proto-generated ingress for better type safety. The pull request replaces generic restateingress calls with typed client methods across all three deployment operations (create_deployment, promote, and rollback), introduces a typed deploymentClient helper method using Hydra's proto-generated DeploymentServiceIngressClient, updates the go.mod dependency to include the latest SDK, and updates documentation to reflect the typed client pattern. All changes directly support the goal of stronger static typing.
Out of Scope Changes Check ✅ Passed All changes in the pull request are directly in-scope and support the primary objective of migrating to proto-generated typed ingress. The documentation updates demonstrate the new typed pattern, the three deployment service files are all updated consistently with typed client calls, the service helper method enables this pattern, and the dependency update provides the necessary typed SDK. No extraneous refactoring, unrelated feature additions, or unrelated dependency changes are present.
Description Check ✅ Passed The pull request description follows the required template structure and provides the necessary information: it references the linked issue (#4097), specifies the type of change (marked as Enhancement), includes clear testing instructions (run control plane and verify deployment/rollback/promotion operations), and completes most checklist items. The description contains sufficient detail about what is being tested and confirms the author has performed self-review and code quality checks, meeting the template requirements adequately.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch eng-2118-use-restates-proto-generated-ingress-instead-for-better

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between e40692d and 5b95773.

📒 Files selected for processing (1)
  • go/apps/ctrl/services/deployment/create_deployment.go (1 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
go/apps/ctrl/services/deployment/create_deployment.go (1)
go/gen/proto/hydra/v1/deployment.pb.go (3)
  • DeployRequest (25-32)
  • DeployRequest (45-45)
  • DeployRequest (60-62)
⏰ 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). (3)
  • GitHub Check: Test Go API Local / Test
  • GitHub Check: Build / Build
  • GitHub Check: Test Packages / Test
🔇 Additional comments (1)
go/apps/ctrl/services/deployment/create_deployment.go (1)

137-149: LGTM! Type safety improvement successfully implemented.

The migration to the typed proto-generated client is well-executed. The error handling is appropriate, and the previous issue with the "1. " prefix in the error message (line 148) has been properly addressed.

The "fire-and-forget" comment accurately conveys the intent—the workflow is started asynchronously without waiting for completion, while still verifying that the request was successfully sent.


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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@Flo4604 Flo4604 marked this pull request as ready for review October 20, 2025 15:21
@github-actions
Copy link
Contributor

github-actions bot commented Oct 20, 2025

Thank you for following the naming conventions for pull request titles! 🙏

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between c764837 and e40692d.

⛔ Files ignored due to path filters (4)
  • go/gen/proto/hydra/v1/certificate_restate.pb.go is excluded by !**/*.pb.go, !**/gen/**
  • go/gen/proto/hydra/v1/deployment_restate.pb.go is excluded by !**/*.pb.go, !**/gen/**
  • go/gen/proto/hydra/v1/routing_restate.pb.go is excluded by !**/*.pb.go, !**/gen/**
  • go/go.sum is excluded by !**/*.sum
📒 Files selected for processing (6)
  • apps/engineering/content/docs/architecture/workflows/creating-services.mdx (1 hunks)
  • go/apps/ctrl/services/deployment/create_deployment.go (1 hunks)
  • go/apps/ctrl/services/deployment/promote.go (1 hunks)
  • go/apps/ctrl/services/deployment/rollback.go (1 hunks)
  • go/apps/ctrl/services/deployment/service.go (2 hunks)
  • go/go.mod (3 hunks)
🧰 Additional context used
🧬 Code graph analysis (4)
go/apps/ctrl/services/deployment/rollback.go (2)
internal/proto/generated/ctrl/v1/deployment_pb.ts (1)
  • RollbackRequest (398-408)
go/gen/proto/hydra/v1/deployment.pb.go (3)
  • RollbackRequest (121-127)
  • RollbackRequest (140-140)
  • RollbackRequest (155-157)
go/apps/ctrl/services/deployment/service.go (1)
go/gen/proto/hydra/v1/deployment_restate.pb.go (2)
  • DeploymentServiceIngressClient (64-68)
  • NewDeploymentServiceIngressClient (76-82)
go/apps/ctrl/services/deployment/create_deployment.go (1)
go/gen/proto/hydra/v1/deployment.pb.go (3)
  • DeployRequest (25-32)
  • DeployRequest (45-45)
  • DeployRequest (60-62)
go/apps/ctrl/services/deployment/promote.go (1)
go/gen/proto/hydra/v1/deployment.pb.go (3)
  • PromoteRequest (209-214)
  • PromoteRequest (227-227)
  • PromoteRequest (242-244)
⏰ 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). (4)
  • GitHub Check: Test Go API Local / Test
  • GitHub Check: Test Packages / Test
  • GitHub Check: Build / Build
  • GitHub Check: Analyze (javascript-typescript)
🔇 Additional comments (6)
go/go.mod (1)

33-33: LGTM! SDK upgrade enables typed ingress clients.

The upgrade from v0.20.0 to v0.21.0 provides the proto-generated ingress client support used throughout this PR.

go/apps/ctrl/services/deployment/service.go (1)

21-25: LGTM! Clean helper encapsulates typed client creation.

The deploymentClient helper properly constructs a typed ingress client keyed by project ID, ensuring serialization of operations per project via Restate's Virtual Object pattern.

go/apps/ctrl/services/deployment/promote.go (1)

34-38: LGTM! Correctly migrated to typed ingress client.

The promotion flow now uses the typed client with proper blocking semantics via Request(). Type safety is improved while maintaining the same error handling and logging behavior.

go/apps/ctrl/services/deployment/rollback.go (1)

36-41: LGTM! Consistent with promote pattern.

The rollback flow correctly adopts the typed client approach with blocking semantics, maintaining consistency with the promote implementation.

apps/engineering/content/docs/architecture/workflows/creating-services.mdx (1)

133-183: LGTM! Documentation accurately reflects the new pattern.

The updated documentation clearly demonstrates the typed client approach with practical examples that match the actual implementation. The Benefits section effectively communicates the value of this migration.

go/apps/ctrl/services/deployment/create_deployment.go (1)

138-144: LGTM! Correctly uses async Send() for deployment workflow.

The fire-and-forget pattern with Send() is appropriate for the async deployment workflow, and the typed client provides compile-time type safety for the request payload.

…or-better' of github.com:unkeyed/unkey into eng-2118-use-restates-proto-generated-ingress-instead-for-better
Copy link
Contributor

@imeyer imeyer left a comment

Choose a reason for hiding this comment

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

LGTM

@graphite-app
Copy link

graphite-app bot commented Oct 20, 2025

Cartoon gif. Batman from Batman: The Animated Series stands in the corner of a cave and stares down at us. He gives us a thumbs up, never changing expressions during it. (Added via Giphy)

@graphite-app
Copy link

graphite-app bot commented Oct 20, 2025

Graphite Automations

"Post a GIF when PR approved" took an action on this PR • (10/20/25)

1 gif was posted to this PR based on Andreas Thomas's automation.

@ogzhanolguncu ogzhanolguncu added this pull request to the merge queue Oct 21, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Oct 21, 2025
@Flo4604 Flo4604 enabled auto-merge October 22, 2025 17:04
@Flo4604 Flo4604 added this pull request to the merge queue Oct 22, 2025
Merged via the queue into main with commit b8ba1c2 Oct 22, 2025
17 of 18 checks passed
@Flo4604 Flo4604 deleted the eng-2118-use-restates-proto-generated-ingress-instead-for-better branch October 22, 2025 17:18
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.

Use restates proto generated ingress instead for better types

3 participants