Skip to content

fix(ci): satisfy ruff lint and format checks on main - #241

Open
Kcodess2807 wants to merge 1 commit into
kubeflow:mainfrom
Kcodess2807:fix/ruff-lint-and-format
Open

fix(ci): satisfy ruff lint and format checks on main#241
Kcodess2807 wants to merge 1 commit into
kubeflow:mainfrom
Kcodess2807:fix/ruff-lint-and-format

Conversation

@Kcodess2807

@Kcodess2807 Kcodess2807 commented Sep 3, 2026

Copy link
Copy Markdown

Fixes #236.

What

The Lint and format job in .github/workflows/tests.yml is currently failing on main. This fixes both of its steps.

Reproducible on a clean checkout of main with the pinned ruff==0.15.9:

1. ruff check .

F811 [*] Redefinition of unused `json` from line 1
 --> docs-agent-mcp/mcp-server/server.py:5:8

server.py imports json on both line 1 and line 5. The duplicate is a no-op at runtime, so there is no user-visible impact — but F811 is the rule that catches genuine silent redefinitions (a shadowed import, or two same-named tests where the second quietly replaces the first), so it is removed rather than suppressed.

2. ruff format --check docs-agent-mcp/mcp-server tests

3 files would be reformatted, 13 files already formatted

server.py, tests/test_docs_pipeline.py, tests/test_mcp_server.py.

Scope

Formatting was applied to exactly the two directories CI checks:

ruff format docs-agent-mcp/mcp-server tests

Deliberately not ruff format .. docs-agent-mcp/pipelines/ has never been format-checked by CI, and reformatting it here would bury a small fix in a large unrelated diff and conflict with in-flight pipeline work.

ruff 0.15.9 was used to match the pin in the workflow, since 0.16 widened the default rule set (see the note in pyproject.toml).

Verification

All three CI jobs, locally:

Check Before After
ruff check . F811 All checks passed
ruff format --check docs-agent-mcp/mcp-server tests 3 files would be reformatted 16 files already formatted
compileall pass pass
pytest 137 passed, 6 skipped 137 passed, 6 skipped

Because server.py is reformatted, the MCP server was also exercised against a live Milvus + TEI stack with all three collections populated. smoke_tools.py exits 0 and every tool returns byte-identical relevance scores before and after:

search_kubeflow_docs   0.6381
search_github_issues   0.2574
search_kubeflow_code   0.2869

No behaviour change.

The lint job has been failing on main since 9a1e5ab.

"ruff check ." reported F811: server.py imported json on both line 1 and
line 5. The duplicate is a no-op at runtime, but F811 is the rule that
catches genuine silent redefinitions, so remove it rather than suppress
it.

"ruff format --check docs-agent-mcp/mcp-server tests" reported three
files. Reformatted with the pinned ruff 0.15.9, scoped to exactly the two
directories CI checks, so the never-format-checked
docs-agent-mcp/pipelines tree is left untouched.

Formatting changes only; no behaviour change. Verified locally against a
live Milvus + TEI stack: all three MCP tools return identical relevance
scores before and after, and smoke_tools.py exits 0.

Signed-off-by: Kcodess2807 <karnatakarush@gmail.com>
@google-oss-prow

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign franciscojavierarceo for approval. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@Kcodess2807

Copy link
Copy Markdown
Author

Fixes #236.

Flagging the overlap with #235, which formats tests/test_docs_pipeline.py only. That leaves the Lint and format job still failing, because:

  • ruff check . reports F811 for a duplicate import json in docs-agent-mcp/mcp-server/server.py (lines 1 and 5), which is a separate step from the format check.
  • ruff format --check docs-agent-mcp/mcp-server tests also flags tests/test_mcp_server.py and server.py, not just test_docs_pipeline.py.

This PR covers all four so the job goes green in a single pass. Formatting was scoped to exactly the two directories CI checks, so docs-agent-mcp/pipelines/ is deliberately left untouched.

Happy to close this in favour of #235 if the maintainers would rather land the fixes incrementally.

@ArshVermaGit ArshVermaGit 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.

Looks good overall. The changes are focused on fixing the Ruff lint/format checks without changing runtime behavior. The verification results also show the existing test suite remains intact. No concerns from my side.

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: PR Safety workflow failing on main — ruff format check fails for tests/test_docs_pipeline.py

2 participants