Skip to content

feat(platform): general service functions - #2997

Draft
jeremi wants to merge 583 commits into
mainfrom
feat/general-service-functions
Draft

jeremi wants to merge 583 commits into
mainfrom
feat/general-service-functions

Conversation

@jeremi

@jeremi jeremi commented Dec 5, 2026 •

Copy link
Copy Markdown
Member

This PR adds general service functions at 2a242a1c61. You can call them from a signed-in page, a machine client or a Coordinator workflow. The same service declaration controls what runs in rstack dev and what the Compose reference deployment or Helm chart serves.

Service functions

A single application host serves the page and the functions in the bundle. Each function exports a handler through defineFunction. Registry Session authorises calls and supplies a short-lived pass for declared product calls. The binding exposes typed clients for the signed-in person or for a declared service role.

What changes

  • Declare the service. In service.yaml, name the service in service.publicService and define functions in a map keyed by function ID. Set the allowed page, machine and Coordinator callers for each function.
  • Build the bundle. Use rstack dev export-preview to build the page and function modules. The manifest carries caller rules and each function's limits, secret names and connections.
  • Connect to PostgreSQL or TCP. Declare named postgres or tcp connections in the service and list the connections a function uses. Set the destinations in the deployment. PostgreSQL also needs a database and a secret reference. The generated binding gives the function a PostgreSQL URL or TCP address through ctx.connections. The reference deployments give each mapping its own relay.
  • Keep retry keys stable. Machine writes require an Idempotency-Key. rstack function call can generate the key and prints it for reuse. The binding derives product write keys from the incoming key, the function and the verified caller. It also uses the operation and its position within the call. Give a write an explicit stable label if the order of writes can change.
  • Report uncertain outcomes. The binding adds Registry-Function-Outcome: unknown to an error answer when a write may have taken effect. The gateway carries the response marker. A page attempt retains its key through later failed retries. Only a successful replay with the same method, path and key settles the earlier attempt.

Tests

  • TypeScript clients checks the generated binding, page retries and route parity. It also runs the installed rstack dev previews in Chromium.
  • Registry Session gateway filters checks the generated gateway with Envoy, including which requests can reach functions and how answers carry the call ID and outcome.
  • Rust tests (developer-tools) checks service declarations and preview startup. Runtime configuration conformance and Public identifier catalog check the generated configuration contracts.
  • Deployment checks validates the Compose and Helm configurations. Reference host smoke (breg), Reference host smoke (casework) and Reference host smoke (coordinator) exercise the Compose deployment. The journeys cover a registration retry that writes once, a code-only rollout that preserves the session, and a function deadline through the gateway.
  • Reference host smoke (source) exercises live Casework source reads. Chart cluster run checks the functions block against the declaration before rendering Helm. Docs checks covers the guides.

Local verification at this head passed 994 TypeScript tests, 27 route parity cases and 11 installed Chromium preview proofs. Three opt-in TypeScript cases were skipped in that suite.

CI at this head passed every job it ran. The deployment checks, reference host smokes and installed previews took 5:11 more total job time than the median of comparable main runs, within the 10-minute allowance. The longest smoke took 4:13.

Intended differences from main

  • service.yaml now selects the functions and callers. Remove preview.functions and preview.coordinatorFunctions from dev.yaml. Use rstack service session-functions to generate and check the Session functions block.
  • The reference deployments serve the service's declared functions through the same bundle contract as the preview. The separate generated host client is retired.
  • Casework uses Session's review door for current source reads. Replace the old sender settings with the review door configuration before upgrading.

Deployment boundaries

Functions in a service share an application process and network. The deployed connection relays are separate from the local development setup. In development, rstack dev starts disposable PostgreSQL databases and uses TCP destinations from dev.yaml.

The v0.53.0 notes record two limits to the chart test coverage:

  • Render tests check refusal of private and metadata IPv6 destinations returned by DNS. A live cluster test with an IPv6 DNS answer is planned.
  • A local Linux arm64 cluster test exercised mapped connections. A function reached PostgreSQL over verified TLS. The test also checked refusal of a wrong certificate identity and of direct database access. A second TCP connection used its own relay. The automated amd64 cluster run currently covers the chart without a mapped connection.

Follow-up work

@jeremi jeremi added the ci:full Run the heavy integration tier on this pull request label Dec 5, 2026
@jeremi jeremi added this to the v0.53.0 milestone Dec 5, 2026
This was referenced Dec 5, 2026
jeremi added 30 commits December 6, 2026 05:39
Signed-off-by: Jeremi Joslin <jeremi@joslin.fr>
Signed-off-by: Jeremi Joslin <jeremi@joslin.fr>
Signed-off-by: Jeremi Joslin <jeremi@joslin.fr>
Signed-off-by: Jeremi Joslin <jeremi@joslin.fr>
Signed-off-by: Jeremi Joslin <jeremi@joslin.fr>
Signed-off-by: Jeremi Joslin <jeremi@joslin.fr>
Signed-off-by: Jeremi Joslin <jeremi@joslin.fr>
Signed-off-by: Jeremi Joslin <jeremi@joslin.fr>
Signed-off-by: Jeremi Joslin <jeremi@joslin.fr>
Signed-off-by: Jeremi Joslin <jeremi@joslin.fr>
Signed-off-by: Jeremi Joslin <jeremi@joslin.fr>
Signed-off-by: Jeremi Joslin <jeremi@joslin.fr>
Signed-off-by: Jeremi Joslin <jeremi@joslin.fr>
Signed-off-by: Jeremi Joslin <jeremi@joslin.fr>
Signed-off-by: Jeremi Joslin <jeremi@joslin.fr>
Signed-off-by: Jeremi Joslin <jeremi@joslin.fr>
Signed-off-by: Jeremi Joslin <jeremi@joslin.fr>
Signed-off-by: Jeremi Joslin <jeremi@joslin.fr>
Signed-off-by: Jeremi Joslin <jeremi@joslin.fr>
Signed-off-by: Jeremi Joslin <jeremi@joslin.fr>
Signed-off-by: Jeremi Joslin <jeremi@joslin.fr>
Signed-off-by: Jeremi Joslin <jeremi@joslin.fr>
Signed-off-by: Jeremi Joslin <jeremi@joslin.fr>
Signed-off-by: Jeremi Joslin <jeremi@joslin.fr>
…wers

Signed-off-by: Jeremi Joslin <jeremi@joslin.fr>
Signed-off-by: Jeremi Joslin <jeremi@joslin.fr>
Signed-off-by: Jeremi Joslin <jeremi@joslin.fr>
Signed-off-by: Jeremi Joslin <jeremi@joslin.fr>
Signed-off-by: Jeremi Joslin <jeremi@joslin.fr>
Signed-off-by: Jeremi Joslin <jeremi@joslin.fr>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci:full Run the heavy integration tier on this pull request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants