Skip to content

fix: SonarCloud findings on main, 123 fixed and 41 refuted - #459

Merged
HardMax71 merged 3 commits into
mainfrom
max/sonar-fixes
Oct 23, 2026
Merged

HardMax71 merged 3 commits into
mainfrom
max/sonar-fixes

Conversation

@HardMax71

@HardMax71 HardMax71 commented Oct 23, 2026 •

Copy link
Copy Markdown
Owner

Summary

SonarCloud lists 164 open issues on main (issues); this fixes 123 and refutes 41.

Changes

Backend: BaseEvent revalidates its dataclass fields. The cancel route drops a reason body nothing stored since #428, and the spec and client are regenerated. 45 routes drop a response_model equal to their return annotation, and the spec stays byte-identical. The queue registers its Lua scripts once, six needless async methods become plain, unused parameters and two getattr calls go.

Frontend: the editor CSS loses !important copies of its CodeMirror theme, plus small TypeScript cleanups.

Docs: Material draws Mermaid in a closed shadow root, so the 30 overrides never applied (diagrams pixel-identical). extra.css never loaded in the Swagger iframes, so the filter box now hides through extra_css.

Not changed: 26 duplicated literals are span names, MongoDB operators and log event names; 7 functions are async for Starlette, APScheduler or an awaited dispatch table; 4 !important are the reduced-motion reset; 2 nestings are Tailwind's @utility; the email regex is linear (1.7 MB in 46 ms); RedactingFilter.filter returns True by contract.

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update
  • Refactoring (no functional changes)
  • CI/CD or tooling changes

Test Plan

  • Backend unit tests pass (cd backend && uv run pytest tests/unit)
  • Frontend unit tests pass (cd frontend && npm run test)
  • Backend E2E tests pass (docker compose exec -T backend sh -c 'uv sync --group test --no-dev --frozen --no-install-project --no-build && pytest tests/e2e')
  • Frontend E2E tests pass (cd frontend && npm run test:e2e)
  • API spec and client regenerated if routes or schemas changed (uv run python -m scripts.export_openapi in backend/, then npm run generate:api in frontend/), never edited by hand
  • Manual testing performed

Validation: ruff, strict mypy, grimp, 552 unit and 3 contract tests and every frontend gate pass. The old and new entrypoint.sh give identical output.

Checklist

  • My code follows the project's style guidelines
  • I have run pre-commit run --all-files and all checks pass
  • I have added tests that prove my fix/feature works
  • I have updated documentation if needed
  • My changes don't introduce new warnings

Summary by cubic

Fixes 123 of the 164 SonarCloud findings on main and documents why the other 41 are acceptable. Only two changes affect behavior: events built in code now validate like events read from Kafka, and the cancel endpoint stops accepting a request body that nothing has stored since #428.

Behavioral changes

  • BaseEvent sets revalidate_instances="always", so metadata and resource usage built in code get the same validation as events read from Kafka.
  • The cancel route drops its reason body; FastAPI ignores undeclared bodies, so existing clients still work. The OpenAPI spec, generated client, and documentation are regenerated to match.

Cleanups and refuted findings

  • 45 routes drop a response_model identical to their return annotation; the spec stays byte-identical.
  • Redis Lua scripts register once, six methods that awaited nothing are now plain, and unused parameters and getattr calls go. The shell entrypoint names its positional parameters.
  • The editor loses its !important copies of the CodeMirror height rules; TypeScript cleanups use a Set for active statuses, a Record for failure messages, Number.isNaN, and String.raw selectors.
  • Docs: 30 Mermaid overrides never applied because Material draws diagrams in a shadow root (pixel-identical before/after); extra.css never loaded in Swagger iframes, so the filter box is now hidden via a fresh swagger.css.
  • The 41 refuted findings: 26 duplicated literals are span names, Mongo operators, and log event names; 7 async functions serve Starlette/APScheduler; the remaining !importants are the reduced-motion reset; the email regex is linear; and RedactingFilter.filter returns True by contract.

Written for commit dc85401. Summary will update on new commits.

View guided diff Turn on auto-fix

…, the cancel route drops its unused reason, and routes stop repeating their response model

BaseEvent sets revalidate_instances=always, so an event built in code checks its metadata and resource usage the way one read from Kafka does. The cancel route accepted a reason nothing stored since #428; the request body goes, and the spec and client are regenerated. 45 routes drop a response_model equal to their return annotation (the spec is byte-identical), and six parameters use Annotated. The queue registers its Lua scripts once instead of through async getters typed Any; four async methods that awaited nothing are plain; unused parameters go; getattr calls and a nested conditional in the pod event mapper are plain attribute access; entrypoint.sh names its positional parameters.
…eir !important copies of its theme, and small TypeScript cleanups

CodeMirrorEditor's EditorView.theme already sets the editor's height, max-height and the scroller's overflow; the !important CSS copies go. Failure messages come from a Record keyed by event type instead of a nested ternary, active statuses are a Set, the CSRF cookie is read with RegExp.exec, and the ESLint selectors use String.raw.
…agger filter box for real

Material for MkDocs draws each diagram in a closed shadow root, so the 30 !important rules in extra.css never reached a diagram; the screenshots before and after are pixel-identical. extra.css never loaded inside the Swagger UI iframes either, so the filter box showed on every filtered page; it now comes from swagger.css through the plugin's extra_css.
@HardMax71
HardMax71 enabled auto-merge (squash) October 23, 2026 19:58
@coderabbitai

coderabbitai Bot commented Oct 23, 2026

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: d08ea2ae-7004-4a90-b012-5ec264692ee9
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

@github-actions github-actions Bot added documentation Improvements or additions to documentation area: frontend Svelte UI and the generated API client area: api FastAPI routes, auth, rate limiting, settings area: execution Queue, scheduler, k8s worker, pod monitor, result processor, executor pods, runtimes area: events Kafka consumers and middlewares, producer, idempotency, DLQ, replay area: realtime SSE streams and notifications labels Oct 23, 2026
@sonarqubecloud

Copy link
Copy Markdown

@codecov-commenter

codecov-commenter commented Oct 23, 2026 •

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

❌ Patch coverage is 96.55172% with 2 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
backend/app/domain/replay/models.py 0.00% 1 Missing ⚠️
backend/app/services/pod_monitor/event_mapper.py 83.33% 1 Missing ⚠️
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.
Flag Coverage Δ
backend-e2e 82.04% <78.26%> (-0.01%) ⬇️
backend-unit 77.82% <89.13%> (-0.05%) ⬇️
frontend-unit 92.25% <100.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
backend/app/api/routes/admin/events.py 100.00% <100.00%> (ø)
backend/app/api/routes/admin/executions.py 100.00% <ø> (ø)
backend/app/api/routes/admin/rate_limits.py 93.10% <100.00%> (ø)
backend/app/api/routes/admin/settings.py 100.00% <ø> (ø)
backend/app/api/routes/admin/users.py 96.29% <100.00%> (ø)
backend/app/api/routes/auth.py 100.00% <100.00%> (ø)
backend/app/api/routes/execution.py 100.00% <100.00%> (ø)
backend/app/api/routes/health.py 100.00% <100.00%> (ø)
backend/app/api/routes/notifications.py 100.00% <100.00%> (ø)
backend/app/api/routes/saved_scripts.py 100.00% <100.00%> (ø)
... and 15 more
Components Coverage Δ
Backend 94.73% <95.65%> (+<0.01%) ⬆️
Frontend 92.25% <100.00%> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@HardMax71
HardMax71 merged commit 8e58246 into main Oct 23, 2026
23 checks passed
@HardMax71
HardMax71 deleted the max/sonar-fixes branch October 23, 2026 20:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: api FastAPI routes, auth, rate limiting, settings area: events Kafka consumers and middlewares, producer, idempotency, DLQ, replay area: execution Queue, scheduler, k8s worker, pod monitor, result processor, executor pods, runtimes area: frontend Svelte UI and the generated API client area: realtime SSE streams and notifications documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants