Add request logging to verify blocked requests never reach the server

Đang mở
#14 2 bình luận 0 reaction 0 người được giao Xem trên GitHub

@VISHNU0906 đang làm issue này rồi.

Từ ngày 9/11/2026.

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
38/100
Loại issue
Tính năng
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
go
Lĩnh vực
backend, observability, testing

Hướng nghiên cứu

Start with server.go, the provider handlers such as openai.go, and cmd/mockllm/main.go to map request handling, startup health checks, and CLI configuration. Define how a recorder or callback will capture every LLM request and expose a fresh test baseline, then document the gateway rejection workflow with a positive control. Done means tests show successful, unmatched, malformed, and streaming requests are recorded with timestamp, method, path, and status, while health checks can be distinguished or filtered.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

Use case

During security testing, a gateway or policy should reject certain requests before they reach the upstream LLM. When mockllm is that upstream, I need server-side evidence that it received zero LLM requests during the test. A client-side rejection alone does not establish this.

Current behavior

Reviewed main at 35792a0:

  • server.go registers handlers without access-log middleware and exposes no received-request history or count. Its health response reports configured mock counts.
  • The provider handlers do not record every received request. For example, openai.go includes an unmatched request in the HTTP error response to the client; this is not a server-side request log.
  • The CLI has no request-logging option.

Requested capability

Add request logging usable from both the standalone server and embedded Go tests:

  • Record every received LLM API request, including successful, unmatched, and malformed requests, across all supported providers and streaming modes.
  • Include timestamp, method, path, and response status in structured entries. Request bodies and credential headers are unnecessary for the zero-request assertion.
  • Provide a test-friendly way to inspect or count received requests within a defined test window, such as a recorder/callback with a reset or baseline.
  • Make health checks distinguishable or filterable, including the server's own startup /health probe.

Expected validation

A positive-control request produces a visible entry/count. After establishing a fresh baseline, a request rejected by the gateway leaves the upstream LLM request count at zero for the test window. Document this workflow with an example.

Ngôn ngữ chính
Go
Star
6
Fork
6
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Chuẩn bị môi trường

Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue tương tự

Thêm issue về Go

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.