Skip to content

test: add unit tests for Response Store filter and config#236

Open
leseb wants to merge 3 commits into
praxis-proxy:mainfrom
leseb:leseb/fix-issue-230
Open

test: add unit tests for Response Store filter and config#236
leseb wants to merge 3 commits into
praxis-proxy:mainfrom
leseb:leseb/fix-issue-230

Conversation

@leseb

@leseb leseb commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Add 47 new tests covering previously untested code paths in the Response Store module (filter.rs, config.rs, input_items.rs)
  • Direct list_input_items unit tests for pagination edge cases (scalar/null/empty input, limit clamping, cursor logic, ordering)
  • Filter lifecycle tests for message assembly edge cases (null/missing output, non-array output, object/null input, custom tenant)
  • Config validation tests for SSRF prevention edge cases (IPv6 unique-local/link-local, revalidate_postgres_host, URL fragment parsing, TLS alias path traversal)

Closes #230

Test plan

  • All 192 store module tests pass (cargo test -p praxis-ai-apis --lib openai::responses::store::tests)
  • Clippy clean (cargo clippy -p praxis-ai-apis --tests)

@leseb leseb requested review from a team and franciscojavierarceo July 2, 2026 07:46
@leseb leseb requested a review from shaneutt as a code owner July 2, 2026 07:46
@praxis-bot-app

praxis-bot-app Bot commented Jul 2, 2026

Copy link
Copy Markdown

Missing Signed-off-by: 308ec5c. All commits require sign-off (via git commit --signoff).

@praxis-bot-app

praxis-bot-app Bot commented Jul 2, 2026

Copy link
Copy Markdown

PR too large: 972 lines added (limit: 750, excludes Cargo files, tests, docs, examples, and benchmarks). Please split into smaller PRs. Add skip/pr-conventions label to override.

Add 47 new tests covering previously untested code paths in the
Response Store module:

- Direct list_input_items unit tests (16 tests): scalar/null/empty
  input wrapping, ascending/descending order, limit clamping (0→1,
  >MAX→MAX), ID-based and numeric cursor pagination, next_cursor
  computation with and without item IDs

- Filter lifecycle edge cases (10 tests): on_request_body non-EOS
  and non-POST paths, message assembly with null/missing output,
  non-array output, object/null/missing input, custom tenant_id
  persistence

- GET input_items edge cases (5 tests): trailing slash handling,
  scalar input wrapping, default descending order, empty input,
  tenant isolation

- Config validation edge cases (16 tests): sqlite memory URL
  variants, revalidate_postgres_host direct tests, IPv6 unique-local/
  unspecified/link-local SSRF rejection, IPv4-mapped loopback in
  authority, hostaddr with invalid IP, URL fragment vs query
  separation, ssl-cert/ssl-key/ssl-ca alias path traversal

Closes praxis-proxy#230

Signed-off-by: Sébastien Han <seb@redhat.com>
String input is now returned as a user message item matching the
OpenAI ItemResource schema, and null input yields an empty list
instead of [null]. This aligns list_input_items with the existing
append_stored_input_items normalization used for message assembly.

Signed-off-by: Sébastien Han <seb@redhat.com>
@leseb leseb force-pushed the leseb/fix-issue-230 branch from d57f20d to a2515e6 Compare July 2, 2026 09:52
Update input_items_from_string_input to expect a message item
instead of a raw string, matching the normalize_input_items fix.

Signed-off-by: Sébastien Han <seb@redhat.com>
@leseb leseb force-pushed the leseb/fix-issue-230 branch from a2515e6 to 8eb5d7d Compare July 2, 2026 09:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

test: add unit tests for Response Store filter and config

1 participant