Skip to content

Encode object detection class filters in inference URLs - #568

Draft
Kayvan-Zahiri wants to merge 1 commit into
roboflow:mainfrom
Kayvan-Zahiri:codex/encode-inference-class-filters
Draft

Kayvan-Zahiri wants to merge 1 commit into
roboflow:mainfrom
Kayvan-Zahiri:codex/encode-inference-class-filters

Conversation

@Kayvan-Zahiri

Copy link
Copy Markdown

What does this PR do?

URL-encode the object detection classes query value before concatenating it into the inference URL. A filter such as fish&chips previously became multiple parameters, c++ became spaces, part#1 became a URL fragment (also losing the hosted image parameter), and class%2Bname was decoded before reaching the server. Encoding once preserves the caller's literal value, including the existing comma-separated filter syntax.

Related Issue(s): No matching existing issue found.

Type of Change

  • Bug fix (non-breaking change that fixes an issue)

Testing

  • I have tested this change locally
  • I have added/updated tests for this change

Test details: A public ObjectDetectionModel.predict() regression makes intercepted HTTP requests using six class filters, supplied either at construction or per call (12 subcases). Eight special-character subcases fail before the fix; the ordinary and comma-separated controls pass. All pass afterward, and the complete parsed request parameters are checked to catch truncation or unintended parameters.

  • Required full python -m unittest: 1,269 tests run, OK, one skipped.
  • Required make style: 79 source files already formatted; Ruff passes.
  • Required make check_code_quality: format/lint pass; mypy reports no issues in 79 source files.
  • Changed test Ruff lint/format and git diff --check: pass.

Python 3.12.12 on macOS, prescribed editable [dev] dependencies and repository-pinned Ruff 0.15.10. Initial sandbox run could not bind local test servers and one existing test needed network access; rerunning the full unchanged suite with the necessary access passes. New regression HTTP calls are intercepted by responses. No real API key, hosted model deployment or credentialed inference was used. The Python/OS matrix and optional model/HEIC extras were not exercised. Existing suite emits resource warnings.

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code where necessary, particularly in hard-to-understand areas
  • My changes generate no new warnings or errors
  • I have updated the documentation accordingly (if applicable) — no API or usage change

Additional Context

Developed with Codex assistance and reproduced locally.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant