feat(server): add secure Streamable HTTP transport - #71
Conversation
|
Warning Review limit reachedYou’ve reached a temporary PR review limit under our Fair Usage Limits Policy. Next review available in: 17 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. 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: Organization UI Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (6)
📝 WalkthroughWalkthroughThe PR adds loopback-first Streamable HTTP serving, session-scoped runtimes, HTTP configuration validation, bearer authentication, session lifecycle management, CLI transport selection, documentation, and comprehensive HTTP integration tests. ChangesStreamable HTTP serving
Estimated code review effort: 4 (Complex) | ~60 minutes Possibly related PRs
Poem
Caution Pre-merge checks failedPlease resolve all errors before merging. Addressing warnings is optional.
❌ Failed checks (1 error)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
|
@coderabbitai review |
✅ Action performedReview finished.
|
There was a problem hiding this comment.
Actionable comments posted: 6
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/cli/main.ts`:
- Line 22: Update the HTTP startup output in the CLI entrypoint to write the
successful “Miftah HTTP server listening…” status to stdout instead of stderr,
preserving the existing message and ensuring stderr remains empty on successful
startup as documented.
In `@src/config/schema.ts`:
- Around line 649-655: Consolidate the duplicated host-canonicalization logic by
extracting the shared HTTP host and literal loopback validation helpers from
schema.ts and miftah-http-server.ts into a common utility. Update
isCanonicalHttpHost, isLiteralLoopbackBindHost, isCanonicalHost, and
isLiteralLoopbackHost to reuse the shared implementation, preserving their
current validation behavior and interfaces.
In `@src/http/miftah-http-server.ts`:
- Line 3: Remove the duplicated host-canonicalization helpers hostPattern,
isCanonicalHost, and isLiteralLoopbackHost from the HTTP server implementation,
and reuse the corresponding shared helpers httpHostPattern, isCanonicalHttpHost,
and isLiteralLoopbackBindHost from src/config/schema.ts. Update the affected
validation paths and imports while preserving their existing behavior.
- Line 500: Update the createServer configuration in the bounded-capacity HTTP
server to explicitly set requestTimeout and headersTimeout values aligned with
the existing maxSessions, sessionIdleTimeoutMs, and maxRequestBytes limits.
Choose appropriately tighter connection-level bounds so slow clients cannot hold
admission slots for the default multi-minute duration.
- Line 100: Hoist the regular expressions used by the request-handling functions
in miftah-http-server.ts—including the bracketed host/port matcher and the digit
validators—into module-scope constants. Update the code around the affected
parsing logic to reuse those constants while preserving the existing matching
behavior and flags.
- Around line 500-515: Update the server startup promise handling around
createServer and server.listen so the catch preserves the original listen
failure as the cause of the startup error. Keep the generic “Unable to start the
Miftah HTTP server” context while attaching or propagating the caught error
details, including failures such as EADDRINUSE and EACCES.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: d0c4be18-0c98-4cd6-bc7f-da7028c2d035
📒 Files selected for processing (26)
README.mddocs/architecture.mddocs/cli.mddocs/config.mddocs/library-api.mddocs/security.mdpackage.jsonsrc/cli/main.tssrc/cli/parse.tssrc/config/schema.tssrc/config/types.tssrc/http/miftah-http-server.tssrc/index.tssrc/runtime/create-miftah-runtime.tssrc/runtime/create-runtime.tssrc/runtime/resolve-runtime-config.tssrc/secrets/secret-provider-availability.tssrc/secrets/secret-resolver.tstests/cli-parse.test.tstests/config-public-contract.test.tstests/config-runtime-parity.test.tstests/config-schema-contract.test.tstests/http-server.test.tstests/public-api.test.tstests/runtime-config-resolution.test.tstests/secret-provider-availability.test.ts
|
@coderabbitai review |
✅ Action performedReview finished.
|
Summary
miftah serve --transport httpwith a localhost-first Streamable HTTP hostserver.httpconfiguration and contract coverageValidation
npm run test:corenpm run test:coverage(68 files, 928 passed, 11 platform skips)npm run lintnpm run typechecknpm run buildnpm run smoke:clinpm run check:packnpm run test:packagenpm testwas also retried on the shared local host. Its moving failures were unrelated fake-upstream startup timeouts; the complete coverage run passed on the same commit. Required CI remains the merge gate.Closes #33
Summary by CodeRabbit
New Features
servecommand.Documentation
Tests