Skip to content

feat(qmd-mcp): embeddable HTTP server handle and acceptance gaps - #98

Merged
fjh2333 merged 1 commit into
mainfrom
feat/issue-97-p5-acceptance-gaps
Oct 29, 2026
Merged

fjh2333 merged 1 commit into
mainfrom
feat/issue-97-p5-acceptance-gaps

Conversation

@fjh2333

@fjh2333 fjh2333 commented Oct 29, 2026

Copy link
Copy Markdown
Member

Changes

  • HttpServer::bind / port() / serve(shutdown) mirror upstream's HttpServerHandle { port, stop }; HttpOptions gains allowed_origins/allowed_hosts (they override QMD_ALLOWED_*, like upstream's ??, origin-guard.ts:98-99). serve_http stays the CLI wrapper owning SIGINT/SIGTERM; CLI behavior unchanged. Embedding doctest + crate README section.
  • qmd:// decoding follows JS decodeURIComponent: malformed escapes and invalid UTF-8 return upstream's recorded -32603 "URI error" instead of passing through.
  • Golden fixture: 18 new upstream-recorded cases — encoded/double-encoded/spaced resource paths, suffix match, malformed escapes, get bare name + Did you mean suggestions, multi_get Errors:/[SKIPPED, lex edge queries, HTTP tools/call get. Churn in existing cases is limited to doc counts from the one added corpus file.
  • New crates/qmd-mcp/tests/http.rs: a request parked in reranker inference does not block /health, tools/call status or a no-rerank /query (AC5); allowlist override; port 0. Inflight-gate unit tests: idle fast path, release on panic and on error.

Related issue

Closes #97

How it was tested

  • Golden replay: 61 stdio responses + 56 HTTP cases verbatim against upstream recordings.
  • New http.rs (3), resource decoder (4) and inflight-gate (3) tests.
  • Real-model #[ignore] stdout test (AC6) passes with cached GGUFs.
  • just all green (fmt, nightly clippy -D warnings, deny, workspace tests, rustdoc incl. the new doctest, markdownlint); no new unsafe.

The P5 acceptance review found the library could not be embedded
cleanly over HTTP and several upstream test cases had no evidence.

- HttpServer::bind / port() / serve(shutdown) mirror upstream's
  HttpServerHandle {port, stop}; HttpOptions gains allowed_origins /
  allowed_hosts that override QMD_ALLOWED_* like upstream's `??`.
  serve_http stays the CLI wrapper owning SIGINT/SIGTERM.
- qmd:// decoding follows JS decodeURIComponent: malformed escapes and
  invalid UTF-8 now return upstream's recorded -32603 "URI error"
  instead of passing through.
- Golden fixture records 18 new upstream cases (encoded/double-encoded
  and spaced paths, suffix match, malformed escapes, get suggestions,
  multi_get Errors/SKIPPED, lex edge queries, HTTP tools/call get);
  existing-case churn is limited to doc counts from the new corpus file.
- New in-process HTTP tests prove a call parked in inference does not
  block other requests (AC5), plus allowlist override and port 0;
  inflight-gate tests cover the idle fast path and release on panic or
  error.

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@fjh2333 fjh2333 self-assigned this Oct 29, 2026
@fjh2333 fjh2333 added enhancement New feature or request rust Pull requests that update rust code labels Oct 29, 2026
@fjh2333
fjh2333 merged commit d544d62 into main Oct 29, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request rust Pull requests that update rust code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(qmd-mcp): embeddable HTTP server handle and acceptance gaps

1 participant