Skip to content

fix(cli): scope 'image search -p' to the project#486

Open
digaobarbosa wants to merge 2 commits into
mainfrom
digao/fix-image-search-project-scope
Open

fix(cli): scope 'image search -p' to the project#486
digaobarbosa wants to merge 2 commits into
mainfrom
digao/fix-image-search-project-scope

Conversation

@digaobarbosa
Copy link
Copy Markdown
Contributor

@digaobarbosa digaobarbosa commented May 25, 2026

Description

roboflow image search "<query>" -p <project> silently ignored -p and returned workspace-wide results — so IDs could come from other projects, and a follow-up image get -p <project> <id> would 404.

Root cause: _handle_search built its args with project=... but never used it — it called rfapi.workspace_search with only the raw query, so nothing scoped the result to the project.

image search Before (bug) After (fix)
"*" -p penguin-finder 117,275 (whole workspace) 26,804 (project)
"class:penguin" -p penguin-finder 646 (workspace) 515 (project)

Type of change

  • Bug fix

How has this change been tested?

  • Live: ran the commands above against staging and confirmed scoped totals.
  • Unit: strengthened test_search to assert the scoped query project:proj tag:test; added test_search_without_project_is_unscoped. Full suite passes (python -m unittest), ruff check/format clean.

Will the change affect Universe?

No.

Any specific deployment considerations

N/A (Python SDK / CLI package).

Docs

  • Docs updated? N/A

The -p/--project flag was silently ignored: _handle_search passed the
project nowhere, so every search returned workspace-wide results.

The search/v1 endpoint only honors a project filter expressed inside the
RoboQL query (project:<slug>, which the API resolves to a project id) —
body-level project/dataset params are ignored. Prepend project:<slug> to
the user's query with a leading space (implicit AND) so it stays
compatible with free-text/semantic queries; an explicit 'AND (...)'
wrapper 500s on free text.
@digaobarbosa digaobarbosa self-assigned this May 25, 2026
@digaobarbosa digaobarbosa requested a review from a team May 25, 2026 17:24
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