Skip to content

ci: enforce make lint and fix the three violations it was hiding - #1769

Closed
hkad98 wants to merge 1 commit into
masterfrom
jkd/enforce-lint-in-ci
Closed

ci: enforce make lint and fix the three violations it was hiding#1769
hkad98 wants to merge 1 commit into
masterfrom
jkd/enforce-lint-in-ci

Conversation

@hkad98

@hkad98 hkad98 commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

The job named lint-and-format-check (rw-python-tests.yaml) only ever ran make format. Ruff's linter was therefore never enforced in CI — only by pre-commit, which runs on changed files. Three violations reached master as a result, and make lint fails on a clean checkout of master today:

SIM103   packages/gooddata-eval/src/gooddata_eval/core/chat/sse_client.py:92   Return the condition directly
PLC0415  packages/gooddata-eval/tests/test_agentic_runner.py:84                import should be at top-level
PLC0415  packages/gooddata-eval/tests/test_agentic_runner.py:197               import should be at top-level

This fixes all three, then adds the missing step so the job does what its name says.

The fixes

SIM103_is_retryable_exc ended with an if isinstance(...): return True / return False pair. Collapsed to returning the isinstance directly. The comment explaining why RemoteProtocolError is retryable is preserved verbatim, moved above the return.

PLC0415 ×2 — both function-level imports named symbols already imported at module top: AgenticEvalOutcome identically (from gooddata_eval.core.models import AgenticEvalOutcome, DatasetItem), and AGENTIC_TEST_KINDS from gooddata_eval.cli.agentic_runner, a module the file already imports from. So these were redundant, not deliberate deferrals for a cycle or an expensive import. Removed, with AGENTIC_TEST_KINDS added to the existing top-level import.

No behaviour change: the isinstance chain returns the same value for every input, and the moved imports resolve to the same objects.

Verification

Check Result
make lint All checks passed — first time on a clean checkout
make format 569 files, clean
make test — gooddata-eval, py314, full suite 473 passed
make test — gooddata-eval, -k 'agentic_runner or sse' 111 passed, 362 deselected
CI job simulated exactly (rm -rf .venv && uv sync --only-group lint --lockedmake formatmake lint) 1 package installed (ruff 0.15.20), both clean

The last row matters: the job installs only the lint group, and make lint invokes .venv/bin/ruff directly, so no extra dependency is needed for the new step.

Note

I deliberately targeted the two tests whose imports moved — the AGENTIC_TEST_KINDS one is a staleness guard asserting the parametrized case list covers every registered kind, so it would fail loudly if the import change had broken its resolution. It passes.

Related: #1768 (uv workspace hardening) is independent — no overlapping files — and among other things makes a bare uv sync actually install ruff, so make lint works locally without --all-groups.

Summary by CodeRabbit

  • Tests
    • Improved test setup and coverage checks for agentic evaluation scenarios.
  • Chores
    • Linting now runs as part of the automated formatting verification.
  • Refactor
    • Simplified internal retryability handling without changing retry behavior.

The job named `lint-and-format-check` only ever ran `make format`, so ruff's
linter was never enforced anywhere except pre-commit -- which runs on changed
files only. Three violations reached master as a result, and `make lint` has
been failing on a clean checkout.

Fixes all three, then adds the missing step so the job does what its name says:

- sse_client.py `_is_retryable_exc` ended with an `if isinstance(...): return
  True` / `return False` pair (SIM103). Collapsed to returning the isinstance
  directly; the comment explaining why RemoteProtocolError is retryable moves
  above the return and is unchanged.
- test_agentic_runner.py imported `AGENTIC_TEST_KINDS` and `AgenticEvalOutcome`
  inside two test bodies (PLC0415, twice). Both names were already imported at
  module top -- `AgenticEvalOutcome` identically, `AGENTIC_TEST_KINDS` from a
  module the file already imports from -- so the local imports were redundant,
  not deliberate deferrals. Removed, and AGENTIC_TEST_KINDS added to the
  existing top-level import.

No behaviour change: the isinstance chain returns the same value for every
input, and the moved imports resolve to the same objects.

jira: trivial
risk: low
@hkad98
hkad98 requested review from lupko and pcerny as code owners September 1, 2026 14:09
@coderabbitai

coderabbitai Bot commented Sep 1, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Essentials

Run ID: 22c08351-5bea-4828-9f90-84bca6374164

📥 Commits

Reviewing files that changed from the base of the PR and between 25f6f76 and f3c8ce6.

📒 Files selected for processing (3)
  • .github/workflows/rw-python-tests.yaml
  • packages/gooddata-eval/src/gooddata_eval/core/chat/sse_client.py
  • packages/gooddata-eval/tests/test_agentic_runner.py

Included review availability: 2 reviews are currently available. Your included PR review attempts over the past 7 days set your current allowance at 4 reviews per hour.


📝 Walkthrough

Walkthrough

The pull request adds lint execution to the Python test workflow, simplifies SSE retry classification without changing behavior, and moves agentic runner test imports to module scope.

Changes

Python quality maintenance

Layer / File(s) Summary
CI lint validation
.github/workflows/rw-python-tests.yaml
The lint-and-format-check job now runs make lint after the formatting check.
Retry check simplification
packages/gooddata-eval/src/gooddata_eval/core/chat/sse_client.py
The _is_retryable_exc method returns the RemoteProtocolError type check directly.
Test import cleanup
packages/gooddata-eval/tests/test_agentic_runner.py
The tests use module-level imports for AGENTIC_TEST_KINDS and AgenticEvalOutcome.

Estimated code review effort: 2 (Simple) | ~10 minutes

Merge Risk: ⚪ Minimal · up to f3c8c

This change fixes lint violations and enforces linting in CI without changing product behavior; no actionable merge-blocking risk remains beyond normal checks and review.

Suggested reviewers: lupko, pcerny, tomkess

Poem

A rabbit reads each line,
The patch grows clear beneath the moon,
Small changes hop in place,
Tests guard the garden path,
Reviews bloom before the dawn.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 75.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 4 functions across 2 files. (1 skipped: 1… Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly identifies the main change: enforcing make lint in CI and fixing the violations that lint exposed.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

Docstring coverage is 75.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 4 functions across 2 files. (1 skipped: 1 unsupported.)

  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch

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

@codecov

codecov Bot commented Sep 1, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 80.82%. Comparing base (f25f9fd) to head (f3c8ce6).
⚠️ Report is 3 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1769      +/-   ##
==========================================
- Coverage   80.83%   80.82%   -0.01%     
==========================================
  Files         272      272              
  Lines       19416    19414       -2     
==========================================
- Hits        15694    15692       -2     
  Misses       3722     3722              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@hkad98

hkad98 commented Sep 1, 2026

Copy link
Copy Markdown
Contributor Author

Folded into #1768 as a single PR — the lint gate and its three fixes are now commit 3 there. Closing this one; no work is lost.

@hkad98 hkad98 closed this Sep 1, 2026
@hkad98
hkad98 deleted the jkd/enforce-lint-in-ci branch September 1, 2026 14:19
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