test(e2e): read delivery_mode from register response, not GET

Step 5b assertion failed against staging:

  register response: {"delivery_mode":"poll","platform_inbound_secret":"...","status":"registered"}
  HTTP_CODE=200
   Expected delivery_mode=poll, got — register UPDATE not honoring payload.delivery_mode

The register call succeeded (200, status:registered, delivery_mode:poll).
The assertion was reading the field from the workspace GET response — but
GET /workspaces/:id (workspace.go:587 Get handler) doesn't fetch
delivery_mode at all. The SELECT column list on line 597 pre-dates the
delivery_mode column from #2339 PR 1, so empty is the only thing GET can
return for it.

Fix: read delivery_mode from the register response body. That's the
canonical source — register is what writes the column, and its handler
already echoes the resolved value back. The check is now meaningful
("the handler honored the explicit poll we sent") instead of testing
GET's serialization gap.

Surfacing delivery_mode in GET is a separate fix; not gating this test
on it keeps the test focused on the awaiting_agent transitions it was
written for. Filed mentally as a follow-up — registry_test.go already
covers the resolveDeliveryMode logic directly, which is what users
actually hit through the handler.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Hongming Wang 2026-04-30 10:35:21 -07:00
parent 201f39a6d0
commit 17a0f49140

View File

@ -292,16 +292,18 @@ ONLINE_STATUS=$(echo "$GET_RESP" | python3 -c "import json,sys; print(json.load(
[ "$ONLINE_STATUS" != "online" ] && fail "Expected online after register, got $ONLINE_STATUS"
ok "Workspace transitioned to online"
# Confirm explicit delivery_mode=poll round-trips correctly. We now pass
# poll explicitly above (see REGISTER_BODY) rather than rely on the
# runtime=external→poll default, so this is a round-trip smoke check, not
# a default-resolution check. The default is exercised by integration
# tests in workspace-server/internal/handlers/registry_test.go.
DELIVERY_MODE=$(echo "$GET_RESP" | python3 -c "import json,sys; print(json.load(sys.stdin).get('delivery_mode',''))")
if [ "$DELIVERY_MODE" = "poll" ]; then
ok "delivery_mode=poll (explicit-poll round-trip)"
# Confirm the register handler echoed back delivery_mode=poll. We read
# this from the register RESPONSE, not the workspace GET response, because
# the GET handler's SELECT (workspace.go:597) doesn't fetch delivery_mode
# — its column list pre-dates the delivery_mode column from #2339 PR 1.
# Surfacing delivery_mode in GET is tracked separately; not gating on it
# here keeps this test focused on the awaiting_agent transitions.
REGISTER_BODY_JSON=$(echo "$REGISTER_RESP" | head -n 1)
REGISTER_DELIVERY_MODE=$(echo "$REGISTER_BODY_JSON" | python3 -c "import json,sys; print(json.load(sys.stdin).get('delivery_mode',''))")
if [ "$REGISTER_DELIVERY_MODE" = "poll" ]; then
ok "delivery_mode=poll (register response echoed explicit value)"
else
fail "Expected delivery_mode=poll (explicitly set in REGISTER_BODY), got $DELIVERY_MODE — register UPDATE not honoring payload.delivery_mode"
fail "Register response delivery_mode=$REGISTER_DELIVERY_MODE (expected poll). Body: $REGISTER_BODY_JSON"
fi
# ─── 6. Stop heartbeating; wait past REMOTE_LIVENESS_STALE_AFTER ────────