Go One Layer Deeper

One ordinary line of code, expanded downward. Every layer names what it hides for you, how it fails, and where to learn it properly. Descend as far as the problem requires — and stop.

One HTTP call, all the way down
Depth
A single line that crosses a runtime, a kernel, a network stack, several routers and someone else's infrastructure — and can fail at every one of them in a different way.
1await fetch('/api/users')
  1. 1
1/9 layers · Enough to build
Why should an application engineer care?

Almost every "flaky" bug in a distributed system is one of these layers behaving exactly as designed while you assumed a different layer's guarantees. Knowing which layer holds the connection, which one retries and which one gave up turns an intermittent mystery into a specific question.

The question this ladder asks

What happens when the network is unreliable?

What are you delegating to an http client or sdk? →
Where this goes wrong in production
  1. Default retry in the HTTP client
  2. Non-idempotent endpoint
  3. Duplicate request
  4. Customer charged twice
The lesson behind it →

What are you delegating here?

What are you delegating to an http client or sdk?
API Design
You write
1const charge = await stripe.charges.create({ amount: 4990, currency: 'eur' })
The abstraction handles
  • Serialization, headers, authentication headers
  • Connection reuse and TLS
  • Typed request and response shapes
  • Default retries for the failures the vendor considers safe
  • Pagination helpers, rate-limit backoff
Still your responsibility
  • Timeouts — the default is often none, and "none" means your thread waits as long as their outage lasts
  • Idempotency — a retried POST is a second request; the key that makes it safe is yours to supply
  • Failure semantics — an exception does not tell you whether the remote side performed the action
  • Blast radius — what the API key is scoped to, where it lives, how it rotates
  • Their availability is now yours — unless you designed a fallback, their incident is your incident
Know your escape hatch

When: The SDK's retry policy, timeout or error mapping does not fit your endpoint's semantics.

Drop to: The raw HTTP contract: method, status codes, error model, Retry-After, and your own client with explicit timeouts and idempotency keys.

You do not have to stop using the SDK — most expose the underlying request options. You have to know they exist.