feat: add a server type that carries the smocket-only API - #188
Conversation
|
Warning Review limit reached
Next review available in: 40 minutes You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (5)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Summary
differences.mdsection B documentsserver.nextConnection(namespace)andio.adapter(factory)as public API, but annotating withServerContractdrops both, so following the documentation and following the exported types pointed in different directions.ServerContractis not widened. It is the subset real socket.io is verified against, and theEnsure<>proofs stop compiling the moment it names a member socket.io lacks.SmocketServer extends ServerContractadds the two from outside instead, and gets noEnsure<>line of its own because there is nothing on socket.io's side to prove it against.Servernow declaresimplements SmocketServer, so the interface is checked against the class rather than trusted to stay in step. Both members already existed on the class with these signatures (adapter(factory: AdapterFactory): void,nextConnection(namespace = '/')), so no runtime code moved.DelayingAdapteris left alone. It is exported as a class, so its name already works in type position, and it is an adapter rather than part of the server surface. Theexportsmap is untouched.Purely additive, so existing
ServerContractannotations keep compiling. Under 0019 that is the public type change row, a minor above 1.0.0 and a patch below it.Related issue
No tracking issue. Found while installing the package from outside and annotating a server with the types #178 exported.
Checklist
src/index.test.tsannotates a server asSmocketServerand calls both members, so the test stops compiling if either is lost. The conformance report is regenerated in its own commit.Ensure<>proofs still hold, which is what confirmsServerContractstayed a socket.io subset.