Address phase 6 review: fix packaging, types, and Fastify behavior#1513
Conversation
Adds packages/oc-fastify-server-adapter implementing the HttpServerAdapter
interface against Fastify: body parsing with qs urlencoded semantics,
cookies, multipart uploads normalized to the OC upload file shape, request
timing, logging, local error handling, strong ETag/304 support, and
HEAD/OPTIONS parity with Express.
Re-exports the neutral HTTP adapter types from the oc package root so the
external adapter can compile against the public package surface.
Includes adapter-level parity tests (ETag/304, OPTIONS, urlencoded qs,
cookies, wildcard params, connect middleware, streaming, multipart) and
registry-level opt-in smoke/parity tests exercising the adapter through
Registry({ server: { adapter } }).
Generated with [Devin](https://devin.ai)
Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Fixes blocking issues and should-fix items from the phase 6 review: - Package: fix broken entry points (tsconfig rootDir, files exclude dist/test) - Deps: move oc to peerDependency (>=0.50.56) and devDependency - Types: replace Express/Multer type aliases with neutral CookieOptions/UploadedFile - Cookies: translate Express maxAge (ms→s) and default Path=/; fail on signed - Listen: default host to 0.0.0.0, accept host option, catch invalid ports via callback - Body: add gzip/deflate/brotli inflation via preParsing, set receivedEncodedLength - Logging: guard skip against missing res.conf in adapter and core middleware - Multipart: throw LIMIT_FIELD_VALUE on field truncation (match multer) - OPTIONS: scope Allow header to matching routes when possible - Fallthrough: 404 only on empty handler arrays; document send requirement - Response: track hasSent immediately to avoid false fallthroughs; remove default end() content-type - Tests: add adapter tests for cookie semantics, compressed JSON, listen host, invalid port, scoped Allow, empty-handler 404 - Integration: add non-local publish/auth/static/batch smoke tests with temp file storage - Docs: add README documenting opt-in contract and Fastify differences Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Keep compile-time HTTP server adapter types self-contained so the package can build before oc emits dist/index.d.ts in workspace CI. Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
This pull request adds a new Fastify-based HttpServerAdapter implementation for the OC registry and updates OC’s neutral HTTP types and packaging so adapters can depend on OC without pulling in Express-specific types.
Changes:
- Introduces
oc-fastify-server-adapterwith Fastify routing, body parsing (qs urlencoded), cookies, multipart uploads, ETag/304 handling, and OPTIONS/HEAD parity. - Replaces Express/Multer type aliases in OC with structural
CookieOptionsandUploadedFile, and re-exports neutral adapter types from theocpackage root. - Adds adapter-focused tests (unit + registry integration) and updates repo tooling/config to include the new package.
Reviewed changes
Copilot reviewed 13 out of 15 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/oc/src/registry/middleware/index.ts | Guards logging skip function when res.conf is absent. |
| packages/oc/src/registry/domain/validators/uploaded-package.ts | Switches validator typing from Multer to neutral UploadedFile. |
| packages/oc/src/registry/domain/http-server/types.ts | Introduces structural CookieOptions/UploadedFile and keeps neutral HTTP adapter interfaces centralized. |
| packages/oc/src/registry/domain/extract-package.ts | Updates extract-package typing to neutral UploadedFile. |
| packages/oc/src/index.ts | Re-exports neutral HTTP adapter types from the OC package root. |
| packages/oc-fastify-server-adapter/tsconfig.test.json | Adds a dedicated TS config to emit integration test code to dist/test. |
| packages/oc-fastify-server-adapter/tsconfig.json | Adds TypeScript build configuration for the new adapter package. |
| packages/oc-fastify-server-adapter/test/registry-node.ts | Adds integration tests that run an OC registry using the Fastify adapter. |
| packages/oc-fastify-server-adapter/test/index.test.ts | Adds adapter unit tests for ETags, OPTIONS/Allow, cookies, urlencoded parsing, streaming, multipart, and listen behavior. |
| packages/oc-fastify-server-adapter/src/index.ts | Implements the Fastify HttpServerAdapter (routing, middleware bridging, cookie/body/multipart support). |
| packages/oc-fastify-server-adapter/README.md | Documents adapter usage and behavioral differences vs Express. |
| packages/oc-fastify-server-adapter/package.json | Defines adapter package metadata, build/lint/test scripts, and dependencies/peerDependencies. |
| package-lock.json | Locks new dependencies introduced by the adapter package. |
| biome.json | Includes the new adapter package in Biome’s formatting/linting scope. |
| .gitignore | Ignores the adapter’s dist/ output. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
The adapter now uses self-contained structural types and does not need oc for package builds. Keep oc only as a peer dependency to document the supported host package range. Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
The adapter has no compile-time or runtime dependency on oc and is consumed structurally by the host package. Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
|
@copilot build failed. check why and try to fix |
The CI failure was in Fixed in commit
All 9 tests now pass locally and the build is clean. |
Adapter implementation:
Package & dependencies:
Neutral types:
Behavior fixes:
Tests:
Docs: