Skip to content

Modular logistics and supply chain operating system (LSOS)

ci(contract): run order, review-account identities and socket auth for the module contracts (#717)

Ron7b4f6b7c9374
diff --git a/.github/actions/postman-contract/action.yml b/.github/actions/postman-contract/action.yml
index b5fc74e9..e33f0c4d 100644
--- a/.github/actions/postman-contract/action.yml
+++ b/.github/actions/postman-contract/action.yml
@@ -389,6 +389,11 @@ runs:
# Update Authenticated Customer is a no-op rename rather than a surprise.
# verification_code must equal what mint-api-key.php seeded — both read the same
# action input, so they cannot drift.
+ # creation_code_identity is a THIRD identity, for Storefront's request-creation-code:
+ # it must have no account, and it cannot be new_customer_identity because the
+ # newest live code for an identity is the one that counts, and the code
+ # mint-api-key.php seeded for that identity has to stay the newest for Create a
+ # Customer. Nothing reads the code this request sends.
# driver_password_reset_code is the same seeded value, but it is a SEPARATE
# variable because it stands for a different row: DriverController::resetPassword
# matches `for=driver_password_reset`, which a driver login code does not satisfy.
@@ -424,6 +429,7 @@ runs:
' --env-var "customer_password=${CUSTOMER_PASSWORD}" \' \
' --env-var "customer_phone=${CUSTOMER_PHONE}" \' \
' --env-var "[email protected]" \' \
+ ' --env-var "[email protected]" \' \
' --env-var "verification_code=${VERIFICATION_CODE}" \' \
' --env-var "driver_identity=${DRIVER_IDENTITY}" \' \
' --env-var "driver_password=${DRIVER_PASSWORD}" \' \
diff --git a/.github/workflows/api-contract.yml b/.github/workflows/api-contract.yml
index 39d83776..4a18ed20 100644
--- a/.github/workflows/api-contract.yml
+++ b/.github/workflows/api-contract.yml
@@ -216,16 +216,36 @@ jobs:
echo "$1=$2" >> api/.env
fi
}
- # The storefront review-account bypass, pointed at the seeded customer's phone.
- # This is the same mechanism App Store review uses, and it is inert without BOTH
- # values — the code alone is not accepted for an identity that is not listed.
- # It lets phone verification be exercised without a live SMS provider.
+ # The storefront review-account bypass, pointed at the seeded customer. This is
+ # the same mechanism App Store review uses, and it is inert without BOTH values
+ # — the code alone is not accepted for an identity that is not listed. It lets
+ # verification be exercised without a live SMS provider.
+ #
+ # Both of the customer's identities are listed, because the collection verifies
+ # under whichever one the request names: Verify Phone Number sends the phone,
+ # while Verify a SMS code sends {{customer_identity}}, the email. With only the
+ # phone listed the latter answered "Invalid verification code!" every run.
set_env STOREFRONT_BYPASS_VERIFICATION_CODE 000000
- set_env STOREFRONT_REVIEW_ACCOUNTS '+15555550123'
+ set_env STOREFRONT_REVIEW_ACCOUNTS '+15555550123,[email protected]'
set_env MAIL_MAILER log
set_env MAIL_FROM_ADDRESS [email protected]
echo "Mail transport: log (from [email protected])"
+ # Socket auth on, so the socket-token endpoints are exercised rather than
+ # answering their "not configured" 404 (Storefront's Create Customer Socket
+ # Token). The installer reads SOCKETCLUSTER_AUTH_ENABLED from the PROJECT .env,
+ # the one Compose loads, keeps a value that is already there and generates the
+ # key; the socket server starts in log mode, so nothing is enforced. The API
+ # then publishes events over the socket server's signed HTTP endpoint; a
+ # published socket image without it drops them, and no request in the run
+ # depends on a delivered event.
+ if grep -q '^SOCKETCLUSTER_AUTH_ENABLED=' .env 2>/dev/null; then
+ sed -i 's|^SOCKETCLUSTER_AUTH_ENABLED=.*|SOCKETCLUSTER_AUTH_ENABLED=true|' .env
+ else
+ echo 'SOCKETCLUSTER_AUTH_ENABLED=true' >> .env
+ fi
+ echo "Socket auth: on (log mode)"
+
bash scripts/docker-install.sh --non-interactive
diff --git a/scripts/ci/order-collection-requests.py b/scripts/ci/order-collection-requests.py
index c98a13cb..1e513c9c 100755
--- a/scripts/ci/order-collection-requests.py
+++ b/scripts/ci/order-collection-requests.py
@@ -82,17 +82,15 @@ EXCLUDED = {
# what is available, then Update Order Activity to apply it — once per stop, exactly as
# navigator-app does. The collection's order carries four waypoints plus a pickup and a
# dropoff — but a stop usually takes MORE than one activity to clear (arrive, then
-# complete), so `times` is well above the stop count rather than equal to it. Six cycles
-# applied cleanly and still left "Not all waypoints completed for order."
+# complete), so `times` is well above the stop count rather than equal to it.
#
-# A surplus cycle is NOT harmless, which an earlier version of this comment got wrong:
-# once the flow is exhausted updateActivity answers "Order is already completed." with a
-# 400, and each extra pass is a counted failure. 16 passes completed the order and then
-# failed four times; 12 is what the flow actually consumes.
-#
-# So this number is tied to the order config's activity count and the collection's
-# waypoint count. If either changes, the tail of the cycle starts failing — the fix is to
-# retune this, not to treat it as an API problem.
+# A surplus cycle used to be a counted failure: once the flow is exhausted updateActivity
+# answers "Order is already completed." with a 400. The collection now ends the cycle
+# itself — Get Order Next Activity records an empty answer as `order_flow_exhausted`, and
+# both requests skip (pm.execution.skipRequest) from then on, which is neither a pass nor
+# a failure. So `times` only has to be an upper bound: a flow that needs more passes than
+# this fails at Complete an Order with "Not all waypoints completed", and the fix is to
+# raise it, not to treat it as an API problem. Six stops took eight to twelve passes.
#
# `then` runs after the cycle, which is the only way Complete an Order can see every
# waypoint COMPLETED.
@@ -102,7 +100,7 @@ CYCLES = {
'Orders/Get Order Next Activity',
'Orders/Update Order Activity',
],
- 'times': 12,
+ 'times': 16,
'then': ['Orders/Complete an Order'],
},
}
@@ -155,6 +153,20 @@ RUN_LATE = {
# creates a storefront order.
'Orders/Complete Order Pickup',
'Orders/Get Order Receipt',
+ 'Orders/Get Order Activity Flow',
+ 'Orders/Get Order Stores',
+
+ # A review needs a COMPLETED order with the store, which only exists once Complete
+ # Order Pickup has run. In folder order the Reviews requests fired before any order
+ # existed: Create a review answered its documented 403, and Retrieve a Store review
+ # was sent the literal "{{review_id}}". Check Review Eligibility now records
+ # `review_eligible`, Create a review then creates one, and the rest address it.
+ # Delete a Review is a DELETE and is deferred to the delete phase on its own.
+ 'Reviews/Query Reviews ❗',
+ 'Reviews/Check Review Eligibility',
+ 'Reviews/Create a review',
+ 'Reviews/Counts the number of ratings for a store',
+ 'Reviews/Retrieve a Store review',
# Both QPay callbacks address {{checkout_id}}, which only Before sets — in the
# Checkout folder they sort ahead of it and were sent the literal string
@@ -173,6 +185,11 @@ RUN_LATE = {
DELETE_FIRST = {
'Fleetbase API': [
'Zones/Delete a Zone', # cascades with Service Areas/Delete a Service Area
+ # Delete an Order (Orders sorts before both Tracking folders) soft-deletes the
+ # order's tracking number and every status on it, so both deletes answered
+ # "resource not found." The status goes first: it hangs off the number.
+ 'Tracking Statuses/Delete a Tracking Status',
+ 'Tracking Numbers/Delete a Tracking Number',
],
}