Skip to content

fix(flows): replace GET /flows/exists with POST to support URI-unsaflow names#264

Open
Jayant-kernel wants to merge 4 commits intoopenml:mainfrom
Jayant-kernel:main
Open

fix(flows): replace GET /flows/exists with POST to support URI-unsaflow names#264
Jayant-kernel wants to merge 4 commits intoopenml:mainfrom
Jayant-kernel:main

Conversation

@Jayant-kernel
Copy link

Description:

Summary

  • Removes GET /flows/exists/{name}/{external_version} endpoint
  • Adds POST /flows/exists accepting {"name", "external_version"} in the request body
  • Fixes support for flows with URI-unsafe characters in names (e.g. sklearn flows like sklearn.ensemble.AdaBoostClassifier(base_estimator=sklearn.tree.DecisionTreeClassifier)) that were previously broken with the GET approach

Closes #166

Test plan

  • Updated unit tests to call POST /flows/exists with JSON body
  • Updated migration tests — py_api uses POST, php_api keeps GET (legacy)
  • Flow not found still returns 404 with correct detail message
  • Found flow correctly returns flow_id

Jayant Kernel and others added 2 commits March 7, 2026 22:57
… flow names

The GET /flows/exists/{name}/{external_version} endpoint broke for flows
with URI-unsafe characters in their names (e.g. sklearn flows with
parentheses). Replaced with POST /flows/exists accepting name and
external_version in the request body, resolving issue openml#166.

Closes openml#166
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 7, 2026

Warning

Rate limit exceeded

@Jayant-kernel has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 13 minutes and 19 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 3fdffd5f-347e-408a-b482-e9a747443bbc

📥 Commits

Reviewing files that changed from the base of the PR and between 3ff845f and a771b69.

📒 Files selected for processing (3)
  • src/routers/openml/flows.py
  • src/schemas/flows.py
  • tests/routers/openml/flows_test.py

Walkthrough

The flow existence check endpoint was changed from a GET with path parameters to a POST with a JSON body. A new Pydantic model FlowExistsBody (fields name and external_version) was added. The route changed from @router.get("/exists/{name}/{external_version}") to @router.post("/exists"), and flow_exists now accepts FlowExistsBody. Tests were updated to use the POST body; behavior (return flow ID or 404) is unchanged.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 12.50% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and specifically describes the main change: replacing GET /flows/exists with POST to support URI-unsafe flow names.
Description check ✅ Passed The description is directly related to the changeset, explaining the endpoint change, the motivation for supporting URI-unsafe characters, and the testing approach.
Linked Issues check ✅ Passed The pull request directly addresses issue #166 by removing the GET endpoint and implementing POST-only support with JSON body, exactly as proposed in the linked issue.
Out of Scope Changes check ✅ Passed All changes are scoped to the /flows/exists endpoint refactoring and related test updates, with no unrelated modifications detected.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey - I've left some high level feedback:

  • Removing the GET /flows/exists/{name}/{external_version} route entirely may break existing Python API consumers that construct URLs directly; consider keeping the GET route as a thin wrapper around the new POST handler for a deprecation period.
  • Since the request model is just a simple name/version pair, you might want to reuse or place FlowExistsBody in a shared schemas module so it can be consistently referenced by any future endpoints that need the same shape.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- Removing the `GET /flows/exists/{name}/{external_version}` route entirely may break existing Python API consumers that construct URLs directly; consider keeping the GET route as a thin wrapper around the new POST handler for a deprecation period.
- Since the request model is just a simple name/version pair, you might want to reuse or place `FlowExistsBody` in a shared schemas module so it can be consistently referenced by any future endpoints that need the same shape.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@Jayant-kernel
Copy link
Author

@PGijsbers
the GET endpoint broke for flows with URI-unsafe characters (e.g. sklearn flows with parentheses in names). Switching to POST with a JSON body handles all flow names safely.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/routers/openml/flows.py (1)

5-18: ⚠️ Potential issue | 🟡 Minor

Reject empty strings in the new request body.

The old path route could not match empty name or external_version, but FlowExistsBody accepts "" for both fields via plain Pydantic str type. This widens the contract and turns requests with empty strings into a DB lookup that returns no match, resulting in a 404 instead of early validation.

Suggested fix
-from pydantic import BaseModel
+from pydantic import BaseModel, Field
...
 class FlowExistsBody(BaseModel):
-    name: str
-    external_version: str
+    name: str = Field(min_length=1)
+    external_version: str = Field(min_length=1)
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/routers/openml/flows.py` around lines 5 - 18, FlowExistsBody currently
allows empty strings for name and external_version because both are plain str;
change the model to reject empty values by specifying non-empty constraints
(e.g., use pydantic.constr(min_length=1) or Field(..., min_length=1)) for the
name and external_version fields in the FlowExistsBody class so validation fails
early instead of passing empty strings to the DB lookup in database.flows.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Outside diff comments:
In `@src/routers/openml/flows.py`:
- Around line 5-18: FlowExistsBody currently allows empty strings for name and
external_version because both are plain str; change the model to reject empty
values by specifying non-empty constraints (e.g., use
pydantic.constr(min_length=1) or Field(..., min_length=1)) for the name and
external_version fields in the FlowExistsBody class so validation fails early
instead of passing empty strings to the DB lookup in database.flows.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 21fd2185-be28-4cb4-ab90-ec25fd991100

📥 Commits

Reviewing files that changed from the base of the PR and between 2f60ac4 and 3ff845f.

📒 Files selected for processing (1)
  • src/routers/openml/flows.py

…cated wrapper

- Move FlowExistsBody to schemas/flows.py for reusability
- Keep GET /flows/exists/{name}/{version} as a deprecated thin wrapper
  around POST /flows/exists for backward compatibility
- Update test imports accordingly
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.

On flow names, external versions and URI-safe characters

1 participant