Skip to content

fix(registry): use adapter-neutral server errors - #1547

Merged
ricardo-devis-agullo merged 2 commits into
masterfrom
feat/adapter-neutral-registry-errors
Aug 9, 2026
Merged

fix(registry): use adapter-neutral server errors#1547
ricardo-devis-agullo merged 2 commits into
masterfrom
feat/adapter-neutral-registry-errors

Conversation

@ricardo-devis-agullo

Copy link
Copy Markdown
Collaborator

Summary

  • Replace the transport-specific EXPRESS_ERROR registry event code with SERVER_ERROR.
  • Preserve the { code, message } event shape, original error messages, callback behavior, and promise rejection behavior.
  • Export and document RegistryErrorEvent, with focused Express/Fastify/future-adapter coverage.

Validation

  • npm run lint
  • npm run build
  • npm test -- --concurrency=1 (990 passing)
  • npx mocha test/unit/registry.js (29 passing)
  • npm test --workspace=oc-fastify-server-adapter (unit and integration tests)
  • npx tsc --project packages/oc/tsconfig.types.json --noEmit

No changeset or version bump included, per repository contribution guidance.

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

Updates the registry’s emitted error event code to be adapter-neutral, so server-adapter failures no longer leak transport-specific details (Express) into registry event consumers, while keeping the existing error event payload shape and lifecycle behavior intact.

Changes:

  • Replace legacy EXPRESS_ERROR with adapter-neutral SERVER_ERROR for server adapter failures.
  • Export and document the stable RegistryErrorEvent { code, message } payload type.
  • Update unit + TypeScript type tests and migration documentation to reflect the new error code.

Reviewed changes

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

Show a summary per file
File Description
V1.md Marks the adapter-neutral error code migration item (R17) as completed and updates rollout notes.
packages/oc/test/unit/registry.js Updates expected emitted error code and adds coverage around server adapter error emission behavior.
packages/oc/test/types/registry-events.ts Adds a TS type-level check that registry.on('error', ...) receives RegistryErrorEvent.
packages/oc/src/types.ts Introduces exported RegistryErrorEvent type with documented { code, message } shape.
packages/oc/src/registry/index.ts Emits SERVER_ERROR for adapter onServerError and preserves error message + rejection behavior.
packages/oc/src/registry/domain/events-handler.ts Types the error event payload as RegistryErrorEvent.
packages/oc/src/index.ts Re-exports RegistryErrorEvent from the package public API.
packages/oc/README.md Documents registry error event payload and the adapter-neutral SERVER_ERROR code.

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

Comment thread packages/oc/test/unit/registry.js Outdated
Comment on lines +348 to +352
describe('when the configured HTTP server adapter emits an error', () => {
for (const adapterName of ['express', 'fastify', 'future']) {
it(`should emit the same error event for ${adapterName}`, async () => {
deps['./domain/plugins-initialiser'].init.resolves('ok');
repositoryInitStub.resolves('ok');

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.

Collapsed the loop into a single test that asserts SERVER_ERROR is emitted for adapter errors. Commit: Collapse misleading parametrized adapter test to a single test.

@ricardo-devis-agullo
ricardo-devis-agullo merged commit a4766f1 into master Aug 9, 2026
3 checks passed
@ricardo-devis-agullo
ricardo-devis-agullo deleted the feat/adapter-neutral-registry-errors branch August 9, 2026 21:19
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.

3 participants