Skip to content

Phase 0 Audit ​

A snapshot of ESI.ts at 10.2.3 (master, 2026-09-26), taken as Phase 0 of the "Road to Done" plan. It records what is hand-written, what is generated, which ESI operations the client covers, and the mutation baseline, so the later phases start from measured facts. Re-run the numbers rather than editing them by hand; the commands are listed with each table.

Code inventory ​

Line counts exclude *.generated.ts.

AreaFilesLinesOrigin
src/clients404965Hand-written: 39 domain clients plus BaseEsiClient
src/core/endpoints422501Hand-written endpoint definitions (234 path and method entries)
src/core (rest)464909Hand-written pipeline, cache, retry, rate limiter, pagination
src/schemas392571Hand-written Zod schemas, checked by npm run schema:drift
src/types401437Hand-written response types, branded IDs
src/auth91399Hand-written SSO and token handling
src/sde206379Hand-written SDE ingestion and query (separate sub-path export); refreshed 2026-09-28
src/config488Hand-written
src/testing21054Hand-written test helpers (public sub-path)

Generated from the ESI spec at compatibility date 2026-05-19 (npm run generate:types):

FileLinesHolds
src/types/generated/esi-spec.generated.ts2383Response interfaces
src/core/endpoints/esi-scopes.generated.ts218EsiScope union (72), scope per endpoint
src/core/endpoints/esi-rate-limit-groups.generated.ts168Rate-limit group per endpoint (156)
src/core/endpoints/esi-cache-ttls.generated.ts142Cache TTL per endpoint (136)

Today only types and per-route metadata are generated. Every operation is reached through a hand-written endpoint definition, client method and Zod schema, about 10,000 hand-written lines that Phase 1 would move to the generator.

Operation coverage ​

Counted by matching METHOD path between the spec and every src/core/endpoints/*Endpoints.ts definition, with path parameters normalised.

SourceOperations
Vendored spec tests/contract/snapshots/esi-openapi.snapshot.json218
of which require auth137
of which take a page or cursor parameter45
Endpoint definitions in src/core/endpoints234

Findings, re-checked on 2026-09-26 after Phase 1 re-vendored the spec at 2026-05-19 (the date the client sends) through .github/workflows/spec-refresh.yml:

  1. Resolved: the vendored spec now matches the date the client sends. It was pinned to 2025-12-16 (208 operations); scripts/spec/snapshot-openapi.ts now defaults to COMPATIBILITY_DATE. npm run spec:coverage checks the generated operations against it in CI.
  2. Every spec operation has a definition. GET /sovereignty/map and GET /sovereignty/structures, missing before, are covered at 2026-05-19.
  3. 16 definitions are not in the spec at 2026-05-19, all intentional. SKINR cosmetics (3), Paragon Hub (5) and military campaigns (6) are beta routes ESI enabled after that compatibility date (SKINR on ESI); the client supports them on purpose. /meta/openapi.json and /meta/name are meta routes outside the spec. Phase 2 has to keep these reachable even though the generator, which reads the vendored spec, does not emit them.
  4. No operation in the vendored spec is marked deprecated.

Mutation baseline ​

Per-directory floors enforced by the nightly ratchet (scripts/mutation/mutation-ratchet.ts). Stryker's global break is null; the gate is per directory. A dash means the file sets no floor for that directory.

DirectoryUnit (config/mutation/unit-thresholds.json)BDD-only (config/mutation/bdd-thresholds.json)
src—15.5
src/auth—23.4
src/clients—12.1
src/core81.828.8
src/core/cache65.322.3
src/core/circuitBreaker77.737.3
src/core/endpoints—24.5
src/core/logger55.521.7
src/core/middleware100.026.0
src/core/pagination73.912.6
src/core/rateLimiter77.911.7
src/core/requestPipeline75.238.5
src/core/util95.442.8
src/schemas—0.0
src/sde85.693.0
src/sde/ingestion98.097.0
src/sde/providers98.090.0

The plan's target is 90 on the hand-written core and 80 repo-wide. Only src/core/middleware and src/core/util meet 90 today; src/core/logger (55.5) and src/core/cache (65.3) are furthest away.

Plan gates today ​

GateStateEvidence and gap
Route coveragePartialspec:coverage checks every spec operation has a generated function; mapping them onto client scopes is Phase 2
Spec driftPartialnightly-spec-drift.yml and schema:drift exist; the vendored snapshot is at the sent date and spec-refresh.yml re-vendors it
Public APIMetetc/esi.ts.api.md committed, API Surface Check and API SemVer Gate in CI
Type safetyPartialstrict and noUncheckedIndexedAccess on; exactOptionalPropertyTypes on (11.0); isolatedDeclarations checked over the pipeline, ports, generated code, client, auth and entry points (typecheck:isolated), not the Zod schemas or endpoint maps, whose types are inferred by design (ROADMAP Phase 3); tsd type tests exist
TestsPartialUnit, BDD, contract replay, fuzz, faults and consumer tiers all run; mutation floors below the plan's 90/80
SecurityPartialProvenance on publish, CodeQL, Scorecard, zizmor, SHA-pinned actions; publishing still uses NPM_TOKEN, not trusted publishing; pino and zod are runtime deps
Package healthPartialpublint, attw, size budgets and the consumer matrix run; engines.node is >=18; no sideEffects field; no Bun, Deno or browser matrix
DocsPartialREADME and guide examples are type-checked; the VitePress site in docs-site/ is not deployed (esi-06b)
ReleasePartialrelease-please, commitlint and the SBOM script exist; the release pipeline has open P1 defects (esi-l38.5)
Live healthMetnightly-live-health.yml refreshes a maintained SSO token and calls /status and /characters/{id}/online through the real client every night, filing one issue while it fails; the three ESI_HEALTH_* secrets are the maintainer's to add, and the run says "not configured" until they exist

Transport rules from the plan ​

RuleState
Send X-Compatibility-Date on every requestDone (src/core/requestPipeline/headers.ts)
Send X-TenantMissing: no request sets it
Descriptive User-Agent, refuse to build without onePartial: X-User-Agent carries clientId, which defaults to esi-client and is never required
ETag, If-None-Match, 304 as a hitDone (spec-aware TTL cache)
X-Pages paginationDone (offset and cursor handlers); open defect esi-l38.1
Error-limit trackingDone (src/core/rateLimiter/RateLimiter.ts)
Surface Warning headersDone as warn logs; not yet a typed event

Released under the GPL-3.0-or-later license.