You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(sdk): normalize wire-vs-type drift in subdomains/faucet/usage (#164)
* fix(sdk): normalize wire-vs-type drift in subdomains/faucet/usage
Three SDK methods declared one return shape and returned another at
runtime in 1.51.0, surfaced in run402#163:
- `subdomains.list` returned the gateway envelope `{ subdomains: [...] }`
but was typed as `SubdomainSummary[]` — crashed the shipped
`list_subdomains` MCP tool with TypeError on iteration.
- `getUsage` declared `lease_expires_at: string` but the gateway omits
the field entirely. Relaxed to `?: string | null` here; gateway-side
fix filed in run402-private#143.
- `allowance.faucet` declared camelCase `transactionHash`/`amount` but
the gateway returns snake_case `transaction_hash`/`amount_usd_micros`,
so callers saw `undefined` in log lines. Now normalized at the SDK
boundary; `amountUsdMicros` added for callers wanting the raw number.
Test mocks updated to mirror the actual wire shapes so the next
regression gets caught before shipping — the previous mocks agreed with
the typed shape, not reality, which is how the drift slipped through.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* fix(test): align cli-e2e mocks with real gateway shapes
The e2e mocks for `GET /subdomains/v1` and `POST /faucet/v1` returned
the SDK's old typed shape rather than what the live gateway emits, so
they couldn't catch the drifts fixed in the previous commit. After the
SDK normalization, the subdomains mock no longer matched the unwrap
path and `subdomains list` failed in CI.
- `/subdomains/v1` GET → `{ subdomains: [...] }` (was a bare array).
- `/faucet/v1` POST → `{ transaction_hash, amount_usd_micros, ... }`
(was `{ tx_hash, amount, ... }`).
Same principle as the SDK unit-test mock updates: tests verify reality,
not what the type says.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
0 commit comments