ENGINEERING SPECS
Use Case Transactions
This document defines target transactional behavior after the breaking model alignment.
View source1. Status
This document defines target transactional behavior after the breaking model alignment.
The old gateway and client-configuration transactions should be removed during implementation.
2. Create Enrollment Token
Transaction:
- Resolve tenant context.
- Check entitlement for max nodes and requested initial capability roles.
- Create deployment token with token hash.
- Store node source type and initial capability intent.
- Return install command with plaintext token once.
3. Edge Runtime Register
Transaction:
- Lock deployment token.
- Validate token status and expiry.
- Validate device identity payload.
- Create or reuse Node for the same device identity according to token policy.
- Create or update EdgeRuntime record.
- Create initial CapabilityBinding rows from token intent.
- Create initial RuntimeBinding rows when the intent has default runtime mapping.
- Mark token used.
- Return node_id, edge_runtime_id, runtime install profiles, and control plane URL.
4. Heartbeat
Transaction:
- Verify node-scoped Edge Runtime signature.
- Load Node and EdgeRuntime.
- Update Node last_seen_at and status.
- Update RuntimeBinding statuses.
- Update CapabilityBinding statuses.
- Store heartbeat errors as safe strings.
5. Publish Desired State
Transaction:
- Load Node.
- Load active CapabilityBindings.
- Load active RuntimeBindings.
- Load Endpoints, Domains, Certificates, Subscriptions, TrafficPolicies, QuotaEnforcements.
- Build desired state spec.
- Compile runtime configurations per RuntimeBinding.
- Store DesiredState with incremented node-scoped version.
- Store RuntimeConfiguration rows.
- Publish desired state.
6. Create Subscription
Transaction:
- Resolve tenant and user.
- Check entitlement.
- Select ready
traffic.entryendpoints. - Generate stable subscription credential.
- Store token hash.
- Create Subscription row.
- Create SubscriptionEndpoint rows.
- Publish DesiredState for affected Nodes.
- Return public subscription URL.
7. Fetch Public Subscription
Transaction:
- Hash token and find active Subscription.
- Verify tenant and user are active.
- Verify entitlement.
- Verify no blocking quota enforcement applies.
- Load ready endpoint set.
- Render requested output format.
- Update last_used_at.
- Write usage-neutral access event.
8. Rotate Subscription
Transaction:
- Lock Subscription.
- Generate new token.
- Store new token hash.
- Keep subscription ID and protocol credential stable unless explicit credential rotation is requested.
- Return new public URL.
9. Revoke Subscription
Transaction:
- Lock Subscription.
- Mark status revoked and set revoked_at.
- Publish DesiredState for affected Nodes so runtime credentials are removed.
10. Delete Subscription
Transaction:
- Allow only revoked or disabled subscriptions.
- Mark deleted_at.
- Exclude from normal list APIs.
11. Update Traffic Policy
Transaction:
- Lock TrafficPolicy.
- Validate DSL.
- Store policy and rules.
- Preview affected routes when requested.
- Determine affected Nodes through
traffic.entryruntime bindings. - Publish DesiredState for affected Nodes.
12. Report Usage
Transaction:
- Verify Edge Runtime signature.
- Validate Node ownership.
- Validate runtime_binding_id belongs to Node.
- Map principal key to Subscription.
- Insert usage samples.
- Update rollups idempotently or enqueue aggregation.
- Re-evaluate quota policies.
- Publish DesiredState when enforcement state changes.
13. Certificate Reconcile
Transaction:
- Load domains and endpoints requiring TLS.
- Create or update ACME order.
- Reconcile DNS challenge.
- Store certificate metadata and material reference.
- Update EndpointTLSBinding status.
- Publish DesiredState for affected Nodes when readiness changes.
14. Concurrency Rules
- Token use locks deployment token rows.
- Subscription rotation locks subscription rows.
- DesiredState version increments are node-scoped and serialized.
- Usage sample ingestion is append-only.
- Quota enforcement changes are idempotent per policy and period.