Skip to content

Add grammar-aware filter fuzzing - #958

Open
strickvl wants to merge 13 commits into
developfrom
feat/filter-fuzzing
Open

Add grammar-aware filter fuzzing#958
strickvl wants to merge 13 commits into
developfrom
feat/filter-fuzzing

Conversation

@strickvl

@strickvl strickvl commented Sep 2, 2026

Copy link
Copy Markdown
Collaborator

Summary

Recursive list filters now get their own nightly property run. It exercises filter JSON through the Agent list boundary and PostgreSQL SQL compilation, so the recursive grammar cannot silently drift outside the schema-based API fuzzer's coverage.

Related: #907
Related: #932

Reviewer Notes

The valid cases are deliberately limited to the API's accepted depth and condition caps. They cover every boolean node and Agent filter operator without a live database. A separate hostile-shape property permits normal Pydantic validation failures but rejects crashes such as RecursionError.

Reproduction

just fuzz-filters

The nightly profile ran 2,000 examples for each property in 4.16 seconds. just check also passed.

Exploratory harness for #923: runs the real app (lifespan, Alembic
migrations, disposable Postgres database, real bearer-token login)
under uvicorn in a background thread and fuzzes all 141 operations
from openapi/openapi.json with Schemathesis 4.x.

Spike-only code, not wired into CI. Requires 'uv pip install
schemathesis' (deliberately not added to pyproject.toml yet) and
'docker compose up -d db'.
Deep exploratory runs want fresh inputs, so KITARU_FUZZ_RANDOM=1 turns
off derandomize; the default stays derandomized for reproducibility.
The exception capture path was hardcoded to an absolute scratch path.
Generates requests from openapi/openapi.json in both schema-conformant
and schema-violating modes and sends them to the real app on a
disposable PostgreSQL database, asserting only that the server never
answers 5xx.

One session-scoped database is shared across the run, which makes
"was this rejected?" depend on run order while leaving "did it
crash?" well-posed, so negative_data_rejection is not run. Response
schema conformance is gated behind an env var until #930 lands.

The four defects this found are listed in KNOWN_FAILURES and skip, so
a filed crash does not mask the rest of its operation.
#927, #928, #929 and #931 landed on develop, so all 141 operations
are covered again with nothing skipped.
#930 fixed the 422 response schemas, so the KITARU_FUZZ_SCHEMA_CONFORMANCE
gate on test_response_matches_schema no longer has a reason to exist. The
full suite now passes with the check on: 282 passed, 0 skipped.
tests/server/test_fuzz_api.py imports schemathesis, which lives in the
fuzz dependency group. Without it, ty cannot resolve the import and the
job fails with four unresolved-import diagnostics.
The module-level skipif only applies after the module imports, and the
regular test matrix does not install the fuzz group, so pytest crashed
during collection with ModuleNotFoundError. importorskip before the
schemathesis imports skips the whole module instead, matching test_otel.
The nightly workflow caches .hypothesis/examples and uploads it as the
replay artifact named in the auto-filed issue. database=None left that
artifact empty for the api surface, so a randomized failure could not be
replayed as the issue instructs.

@greptile-apps greptile-apps Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your trial has ended. Reactivate Greptile to resume code reviews.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 2, 2026

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review Completed 2026-09-02T18:43:47.631244Z c06ef88 New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@strickvl strickvl added the enhancement New feature or request label Sep 2, 2026
Base automatically changed from spike/api-fuzzing to develop September 2, 2026 18:35
@strickvl strickvl linked an issue Sep 2, 2026 that may be closed by this pull request
@strickvl strickvl added tests and removed enhancement New feature or request labels Sep 2, 2026
@strickvl strickvl self-assigned this Sep 2, 2026
@strickvl strickvl moved this from Backlog to In review in Kitaru Roadmap Sep 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

Status: In review

Development

Successfully merging this pull request may close these issues.

Add grammar-aware fuzzing for recursive list filters

1 participant