Skip to content

feat(registry): add promise HTTP adapter lifecycle - #1544

Merged
ricardo-devis-agullo merged 2 commits into
masterfrom
feat/promise-http-server-adapters
Aug 9, 2026
Merged

feat(registry): add promise HTTP adapter lifecycle#1544
ricardo-devis-agullo merged 2 commits into
masterfrom
feat/promise-http-server-adapters

Conversation

@ricardo-devis-agullo

Copy link
Copy Markdown
Collaborator

Summary

  • add promise-capable listen() and close() APIs to the Express and Fastify adapters
  • preserve callback signatures and behavior with one-time deprecation warnings
  • migrate registry start/close internals and Fastify integration setup to the promise path
  • add focused adapter tests and a patch changeset

Validation

  • npm run build in packages/oc
  • npm run build in packages/oc-fastify-server-adapter
  • npm run test-silent in packages/oc
  • npm test in packages/oc-fastify-server-adapter
  • focused Mocha and Biome checks

V1.md confirms this is additive 0.x registry-layer work; browser/component contracts are unchanged.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds promise-based HTTP adapter lifecycle APIs while retaining deprecated callback support.

Changes:

  • Adds promise overloads for Express and Fastify adapter lifecycle methods.
  • Migrates registry startup/shutdown and integration tests to promises.
  • Adds adapter tests and patch changesets.

Reviewed changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
packages/oc/test/unit/registry.js Updates lifecycle mocks for promises.
packages/oc/test/unit/registry-domain-http-server.js Tests Express lifecycle APIs.
packages/oc/src/registry/index.ts Migrates registry lifecycle internals.
packages/oc/src/registry/domain/http-server/types.ts Adds promise lifecycle contracts.
packages/oc/src/registry/domain/http-server/express-adapter.ts Implements Express promise lifecycle.
packages/oc/src/index.ts Exports listen options type.
packages/oc-fastify-server-adapter/test/registry-node.ts Migrates integration setup to promises.
packages/oc-fastify-server-adapter/test/index.test.ts Tests Fastify lifecycle behavior.
packages/oc-fastify-server-adapter/src/index.ts Implements Fastify promise lifecycle.
.changeset/modern-adapters-listen.md Records package patch releases.
Suppressed comments (1)

packages/oc/src/registry/index.ts:145

  • This also breaks callback-only custom adapters: listen(opts) returns undefined, causing Promise.race to resolve before the socket is listening. A later bind error then only reaches serverError after the race has already settled, so registry.start() incorrectly reports success. Please preserve the old adapter implementation contract through a compatibility wrapper or explicit capability detection rather than assuming every configured adapter already returns a promise.
      const listenPromise = adapter.listen({
        port: options.port,
        timeout: options.timeout,
        keepAliveTimeout: options.keepAliveTimeout
      });

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread packages/oc/src/registry/index.ts Outdated
resolve();
}
});
Promise.resolve(adapter.close()).then(resolve, reject);
@ricardo-devis-agullo
ricardo-devis-agullo merged commit 421c029 into master Aug 9, 2026
3 checks passed
@ricardo-devis-agullo
ricardo-devis-agullo deleted the feat/promise-http-server-adapters branch August 9, 2026 19:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants