# Stack quick checks

Verified 2026-09. The idiom rows below catch most real bugs per stack. They are deliberately short:
the stack's own development skill owns the full idiom set, this file only lists what a *reviewer*
should look for when the diff is in a stack they do not work in daily.

Use these after the stack-neutral checks in `review-checklist.md`, not instead of them.

## .NET

| Look for | Why it is a bug |
|---|---|
| `.Result`, `.Wait()`, `GetAwaiter().GetResult()` on a hot path | Blocks a thread-pool thread; under load the pool starves and p99 collapses while CPU stays low. |
| `async void` on anything but an event handler | The exception cannot be caught by the caller; it crashes the process. |
| A `CancellationToken` parameter that is accepted but never passed down | Cancellation stops at that frame; work continues after the client disconnects. |
| `HttpClient` constructed with `new` | Socket exhaustion and stale DNS; use `IHttpClientFactory` / a typed client. |
| A scoped service injected into a singleton (`BackgroundService`, cache, hosted service) | Captive dependency: the scoped instance, and its `DbContext`, outlives its scope. |
| EF: a `foreach` issuing a query per row; a tracked entity read for display | N+1; use a projection and `AsNoTracking` for read paths. |

## Node.js / TypeScript

| Look for | Why it is a bug |
|---|---|
| A promise not `await`ed and not `.catch()`ed | Unhandled rejection; on Node 15+ the default is to terminate the process. |
| CPU-bound work (crypto, big `JSON.parse`, image work, sync `fs`) in a request handler | One event loop serves every request; a 200 ms block is 200 ms added to *all* in-flight requests. |
| `try`/`catch` around an async callback that does not return the promise | The catch never fires; the error escapes. |
| A stream piped without backpressure or error handling | Memory grows until the pod is OOM-killed; `pipeline()` handles both. |
| An unbounded in-process `Map`/object used as a cache | Grows without limit; it is a leak, not a cache. |

## Java / Spring

| Look for | Why it is a bug |
|---|---|
| `@Transactional` on a method called from within the same class | Proxy-based AOP only intercepts calls from outside; self-invocation runs with no transaction. Non-public methods are not reliably intercepted either. |
| `@Transactional` spanning a remote call | The database transaction is held open for the duration of the HTTP call; connections run out. |
| A checked exception thrown inside `@Transactional` | Rollback is triggered by unchecked exceptions by default; a checked one commits unless `rollbackFor` says otherwise. |
| A JPA entity returned straight from a controller | Lazy-loading outside the session, and every schema field becomes public API. |

## Python

| Look for | Why it is a bug |
|---|---|
| A blocking call (`requests`, `time.sleep`, driver without async support, heavy CPU) inside `async def` | It blocks the whole event loop; wrap in `asyncio.to_thread` or use an async client. |
| A mutable default argument (`def f(x=[])`) | The default is created once and shared across calls. |
| A bare `except:` or `except Exception` that continues | Swallows `KeyboardInterrupt`/`SystemExit` and hides real failures. |
| `pickle`, `yaml.load` without `SafeLoader`, or `eval` on input that crossed a trust boundary | Deserialization of untrusted data is remote code execution. |

## Go

| Look for | Why it is a bug |
|---|---|
| A function doing I/O without a `context.Context` first parameter, or one that ignores it | Nothing can cancel or time-bound the call; a slow dependency pins goroutines. |
| `context.WithCancel`/`WithTimeout` without `defer cancel()` | Leaks the context's goroutine and timer. |
| A goroutine started per request with no bound and no way to stop it | Unbounded concurrency against a downstream that has limits. |
| A captured loop variable in a goroutine (pre-1.22 semantics) or shared map without a mutex | Data race; run the review against `go test -race` output if there is any doubt. |
| An error assigned and not checked, or wrapped without `%w` | Lost failures, and `errors.Is`/`errors.As` stop working up the stack. |

## GraphQL resolvers

- **N+1 by construction**: a field resolver that queries per parent is executed once per item in the
  list above it. Require a DataLoader (or equivalent batching) for every resolver that touches a
  datastore, and check the batch key actually dedupes.
- **Depth and complexity limits**: without them a single nested query is a denial-of-service. Check
  for a depth limit, a cost/complexity budget and a cap on list `first`/`last` arguments.
- **Authorization per field, not per query**: the entry point being authorized says nothing about a
  nested `user { email }`. Look for field- or type-level checks on anything sensitive.
- **Introspection and error detail in production**: schema introspection and stack traces in the
  `errors` array both leak internals.
- **Mutations**: same idempotency and input-validation rules as any other write endpoint.

## Queue and event consumers

- **Delivery is at-least-once**: the handler must be idempotent on the message id or a business key.
  A handler that inserts, charges or emails without a dedupe key will do it twice — it is a question
  of when, not whether.
- **Visibility timeout vs processing time**: if the handler can run longer than the broker's
  visibility/lock window, the message is redelivered while the first attempt is still running, and
  now two workers process it concurrently. Check the ratio, and whether the handler extends the lock.
- **Ack semantics**: acking before the work completes loses messages on crash; acking after a partial
  write without a transaction or outbox loses the tail. Check what is acked, and when.
- **Poison messages**: a retry loop with no attempt cap and no dead-letter queue blocks the partition
  or spins forever. Check the DLQ exists and that someone can see it.
- **Ordering**: if the code assumes order, check the broker actually guarantees it for that key —
  most guarantee it only per partition/group, and any retry breaks it.
- **Backpressure**: prefetch/batch size bounded, and failure of a downstream slows consumption
  instead of building an unbounded in-memory queue.
