async await diagnostics claim parallelism benefits for serialized or synchronous work

Author: thomasorgevalCreated Sep 26, 2026Updated Sep 26, 2026

server-sequential-independent-await and async-await-in-loop infer unnecessary latency from await syntax even when visible callees serialize work on the same queue or perform synchronous work behind a Promise-returning interface.

The immediate request is evidence-appropriate wording and guidance, not blanket suppression based on method names or a claim that arbitrary callees can be proven safe by the detector.

Reproduction environment

React Doctor 0.9.14, Node 24.18.0, macOS. The full CLI scan succeeds with schemaVersion: 3, ok: true, complete: true, and no skipped checks.

Create package.json:

json
{"name":"react-doctor-await-repros","private":true,"version":"1.0.0","type":"module","dependencies":{"react":"19.3.0"}}

Create src/App.tsx so the fixture explicitly contains a React entry point:

typescript
import { createElement } from 'react'
export const App = () => createElement('div', null, 'Rule reproductions')

Add the TypeScript file below and run from that directory:

bash
npx --yes [email protected] . --scope full --json --blocking none --yes --no-score

Minimal source

src/serialized-queue.ts:

typescript
export class Repository {
  private tail: Promise<void> = Promise.resolve()
  readonly writes: string[] = []

  private serialize<T>(operation: () => Promise<T>): Promise<T> {
    const result = this.tail.then(operation, operation)
    this.tail = result.then(() => undefined, () => undefined)
    return result
  }

  runAsync(id: string): Promise<void> {
    return this.serialize(async () => {
      this.writes.push(id)
    })
  }

  private runSqliteRead(kind: string): Promise<string[]> {
    return this.serialize(async () => [kind])
  }

  async readSnapshot(): Promise<string[]> {
    const collectionRows = await this.runSqliteRead('collection')
    const binderRows = await this.runSqliteRead('binders')
    return [...collectionRows, ...binderRows]
  }
}

export async function writeBatch(repository: Repository, ids: string[]): Promise<void> {
  for (const id of ids) {
    await repository.runAsync(id)
  }
}

const files = new Set(['a', 'b'])
const cache = { exists: async (path: string) => files.has(path) }

export async function readExisting(paths: string[]): Promise<string[]> {
  const found: string[] = []
  for (const path of paths) {
    if (!(await cache.exists(path))) continue
    found.push(path)
  }
  return found
}

Actual

The full scan reports:

  • server-sequential-independent-await at line 23, claiming users wait twice as long and recommending Promise.all for the two reads.
  • async-await-in-loop at line 30, recommending concurrent calls for writes routed through the same queue.
  • async-await-in-loop at line 40, recommending concurrent calls for an async facade around the synchronous Set.has operation.

Both reads and all writes are queued through Repository.serialize; starting callers together does not make operations execute in parallel. The existence lookup also has no independent asynchronous I/O to overlap. This fixture mirrors a native SQLite per-handle queue and a synchronous filesystem getter behind an async adapter without requiring either native dependency.

Expected

Describe these as potential opportunities requiring independent asynchronous work, not demonstrated latency defects. Preserve resource limits, transaction ordering, and failure/cancellation semantics. A visible shared queue or synchronous body may allow a narrow exemption, but unknown methods should not be exempted by name alone. An inter-file opaque adapter may need contextual triage rather than an attempt at whole-program proof.

The fixture's reads, writes, and lookups were executed under Node 24.18.0 and returned the expected data and order. No device slowdown or general performance improvement is claimed. This report concerns the applicability of the advice.

Existing-report search

No exact report found among open/closed issues and PRs searched for the rule IDs, SQLite, transactions, serialized queues, and synchronous work on 2026-09-26. Related work covers different cases:

  • #1810: ordered HTTP mutations, with a proposed patch; it does not cover shared queues or sync facades.
  • #1521: ordered CRDT replay with specific before/after receiver observations.
  • #1827: repeated reads of shared cached promises, rather than distinct work serialized on one queue.

The canonical validation prompts already require this independence assessment; the categorical CLI messages should reflect that requirement too.