Skip to content

Production-harden the registry HTTP service #22

Closed
11 of 11 issues completed
Closed

Description

@lmcorbalan

Objective

Take the registry HTTP service from working prototype to something safe to run as a long-lived service: typed at its boundaries, linted, validating what it accepts, observable when it fails, and able to start and stop cleanly.

Rationale

A deep review of the service found the same class of problem repeatedly: the code was correct but undefended. strict: true was defeated by pervasive any at the JSON boundary, so a field-name drift like the instrumentId versus id confusion would surface at runtime rather than at compile time. Nothing validated incoming requests, so a malformed body reached the ledger. The terminal error handler returned a clean 500 but logged nothing, leaving an operator blind to a ledger outage. None of these are bugs a test would catch, and all of them get much more expensive once the service is deployed.

Scope

In scope:

  • Typed payloads and unknown at the JSON boundary, removing any from src/
  • Lint and format tooling matching the team's reference repo
  • Runtime request validation against the vendored OpenAPI specs
  • Structured logging, 5xx logging, and clean startup and shutdown
  • Error responses tested against the specs' ErrorResponse schemas
  • A ledger readiness probe distinct from the liveness probe
  • Layering cleanup, keeping the pure mapping module free of Express

Out of scope:

  • New endpoints or any change to the API contract
  • Live-node verification, which belongs to the conformance epic
  • Authentication and rate limiting

Architecture & technical considerations

  • Biome is used for lint, format, and import organization, matching BootNodeDev/dAppBooster. Alias imports were deliberately skipped: they work there only because Vite bundles, and this package is plain tsc to dist/ under NodeNext, where an unrewritten alias throws ERR_MODULE_NOT_FOUND at runtime.
  • Request validation runs one express-openapi-validator instance per vendored spec with ignoreUndocumented: true, so the admin and health routes pass through untouched.
  • The vendored openapi/ directory stays byte-pristine and is excluded from formatting.
  • Shutdown is hand-rolled rather than delegated to a library: idle connections are released first so close() cannot hang, with an unref'd timer backstop that force-closes at a configurable deadline.
  • The undocumented 409 on standard transfer and allocation endpoints is a deliberate spec extension and is kept, documented at its single site.

Dependencies

Depends on the registry HTTP service epic. Every change is additive and self-contained within registry/.

Issue breakdown

Every task through #37 is merged into the aggregate branch, and #38 lands with #19.
The last two are deferred polish, filed after the whole-branch review.

Acceptance criteria

  • No any remains in registry/src
  • npm run lint is clean and the vendored openapi/ directory is untouched by formatting
  • Malformed requests are rejected before they reach the ledger
  • Every 5xx is logged with structure, and the process exits non-zero on a config error
  • The service drains in-flight connections on SIGTERM and SIGINT
  • Liveness and readiness are separate endpoints
  • The full vitest suite is green

Activity

  1. added
    epicLarge body of work broken into smaller issues
    on Jul 22, 2026
  2. moved this from Backlog to In review in Canton - dAppBooster (#390)on Jul 22, 2026
  3. moved this from In review to In progress in Canton - dAppBooster (#390)on Jul 24, 2026
  4. self-assigned this
    on Aug 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

epicLarge body of work broken into smaller issuespriority: mediumShould be addressed soon

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions