This document details the testing procedures, infrastructure setup, bug fixes, and verification results for the ZeroApp prototype backend.
Date: 2025-12-03 Status: ✅ Verified Stable
Started the Restate runtime using Docker (standalone container) as docker-compose was unavailable.
docker run -d --name restate_dev --rm \
-p 8080:8080 -p 9070:9070 -p 9071:9071 \
--add-host=host.docker.internal:host-gateway \
docker.io/restatedev/restate:latestServices were registered using the register-services.sh script.
- Issue: Script initially failed due to incorrect path and permissions.
- Fix: Fixed permissions (
chmod +x) and ran from root directory. - Status: Successfully registered
ShippingService,UserSession, andOrderFulfillmentWorkflow.
During verification, the following critical issues were identified and resolved:
- Issue:
ingress.gowas configured to connect tolocalhost:9089(the service port) instead oflocalhost:8080(the Restate Runtime ingress port). - Error:
connection reset by peerwhen calling Restate services. - Fix: Updated
RESTATE_INGRESS_URLtohttp://localhost:8080.
- Issue: The
ApproveWorkflowhandler failed with "unexpected end of JSON input". - Cause: The Restate client generic type was
[bool, error], expecting a return value, but the handler returnsvoid. - Fix: Changed client definition to
restateingress.Workflow[bool, restate.Void].
- Issue: Adding items to the cart resulted in a placeholder price (5000 cents) instead of the actual product price.
- Fix: Modified
UserSession.AddItemto fetch product details from SQLite usingrestate.Run(for determinism). - Improvement: Updated logic to refresh product details (Name, SKU, Price) even if the item already exists in the cart, ensuring data consistency.
Action: Fetch product list.
curl -s http://localhost:8081/api/productsResult: ✅ Returns JSON list of products from SQLite.
Action: Add item to cart.
curl -X POST http://localhost:8081/api/cart/add \
-H "X-User-ID: alice" \
-H "Content-Type: application/json" \
-d '{"product_id": 3, "quantity": 1}'Result: ✅ Returns success. Verified price is correct (12000 cents).
Flow: Checkout -> Payment -> Admin Approval -> Shipping
-
Initiate Checkout:
curl -X POST http://localhost:8081/api/checkout \ -H "X-User-ID: alice" \ -H "Content-Type: application/json" \ -d '{"order_id": "order-test-2", "shipping_address": "123 Test St"}'
Result: Returns
202 Acceptedand creates an Awakeable. -
Resolve Payment (Simulated): Captured Awakeable ID from logs.
curl -X POST http://localhost:8081/api/payment/callback \ -H "Content-Type: application/json" \ -d '{"awakeable_id": "<ID>", "transaction_id": "txn-123", "amount": 5000, "status": "success"}'
Result: ✅ Payment accepted, Workflow launched.
-
Admin Approval:
curl -X POST http://localhost:8081/api/workflow/order-test-2/approve \ -H "Content-Type: application/json" \ -d '{"approved": true}'
Result: ✅ Workflow proceeds to shipping and completes.
- HTTP Port: 8081 (Note: User recently updated code to 8082, requires restart)
- Restate Service Port: 9089 (Note: User recently updated code to 9090, requires restart)
- Restate Runtime Ingress: 8080
- Restart backend to apply new port configuration (8082/9090).
- Update
register-services.shto match port 9090. - Begin Frontend integration testing.