fix: resolve open CodeQL findings (real fixes) + add Rust desktop unit tests#192
fix: resolve open CodeQL findings (real fixes) + add Rust desktop unit tests#192Prekzursil wants to merge 1 commit into
Conversation
…ests Behavior-preserving fixes for all open code-scanning alerts plus a starter test suite for the desktop (Tauri) Rust crate. CodeQL real fixes (no dismissals): - py/test-equals-none (publish_api.py:206,227): replace `== None # noqa: E711` with the SQLAlchemy/SQLModel `.is_(None)` idiom, which compiles to SQL `IS NULL` and is not flagged. Drops the now-unneeded E711 suppression. This converts the two prior `false positive` dismissals (#1462,#1463) into a real code fix; the scanner will resolve them as fixed on the next run. - py/empty-except (api.py:1675): replace the bare `except: pass` on the best-effort Celery revoke with a `logger.warning(..., exc_info=True)` and an explanatory comment. Errors are still swallowed (run/steps are cancelled regardless), so request behavior is unchanged. - py/unused-import (check_visual_zero.py:6): remove unused `os` import. - py/unused-local-variable (test_project_collaboration.py:38): drop the unused `collaborator` binding while keeping the registration call for its side effect. Rust desktop crate: - Extract behavior-preserving pure helpers `find_compose_file_from(start)` and `compose_up_args(build)` so the compose-resolution and up-args logic are unit testable without depending on the process cwd. - Add a `#[cfg(test)]` suite (13 tests) covering `format_output` (all stdout/stderr branches incl. trailing-newline handling), `docker_compose_unsupported` (each match arm + negatives + case-insensitivity), `compose_up_args`, and `find_compose_file_from` (found + not-found). Verified: ruff check + py_compile on changed Python files; cargo fmt --check, cargo clippy (clean), and cargo test --lib (13 passed) on the desktop crate.
|
Unable to trigger custom agent "Code Reviewer". You have run out of credits 😔 |
Qodo reviews are paused for this user.Troubleshooting steps vary by plan Learn more → On a Teams plan? Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center? |
|
CodeAnt AI is reviewing your PR. Thanks for using CodeAnt! 🎉We're free for open-source projects. if you're enjoying it, help us grow by sharing. Share on X · |
|
Warning Review limit reached
More reviews will be available in 30 minutes and 39 seconds. Learn how PR review limits work. Your organization has run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the 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 include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (5)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
|
Analysis CompleteGenerated ECC bundle from 1 commits | Confidence: 50% View Pull Request #193Repository Profile
Changed Files (5)
Top hotspots
Top directories
Analysis Depth Readiness (commit-history, 7%)ECC Tools uses this to decide whether recommendations should stay at commit-history/setup guidance or expand into CI, security, harness, reference-set, AI-routing, and team backlog work.
Reference Set Readiness (0/7, 0%)
Likely Future Issues (3)
Suggested Follow-up Work (3)
Copy-ready bodies test: add regression coverage for apps/api/app/api.py + apps/api/app/publish_api.py ## Summary
- Add regression coverage for the recently touched code paths before more changes stack on top.
## Why
- Backfill regression coverage before another change set lands on the touched code paths.
## Touched paths
- `apps/api/app/api.py`
- `apps/api/app/publish_api.py`
## Validation
- Add or extend focused tests that exercise the touched paths.
- Run the affected test suite and verify the new coverage closes the gap.test: add integration coverage for apps/api/app/api.py + apps/api/app/publish_api.py ## Summary
- Add integration or end-to-end coverage for the recently changed API surface.
## Why
- Backfill integration or end-to-end coverage for the changed API surface before more contract changes land.
## Touched paths
- `apps/api/app/api.py`
- `apps/api/app/publish_api.py`
## Validation
- Add or extend integration / e2e coverage for the changed API, route, or contract surface.
- Exercise the touched endpoints or route handlers against realistic request / response flows.docs: sync API contract for apps/api/app/api.py + apps/api/app/publish_api.py ## Summary
- Update the API contract artifact that should reflect the recently changed implementation surface.
## Why
- Backfill the missing API contract or spec update before another implementation change lands on top of the same surface.
## Touched paths
- `apps/api/app/api.py`
- `apps/api/app/publish_api.py`
## Validation
- Update the relevant OpenAPI, GraphQL, or contract/spec artifact used by this repo.
- Run the contract validation, docs generation, or API verification flow that depends on that artifact.Generated Instincts (14)
After merging, import with: Files
|
Not up to standards ⛔🔴 Issues
|
| Category | Results |
|---|---|
| Security | 1 high |
🟢 Metrics 0 duplication
Metric Results Duplication ✅ 0 (≤ 0 duplication)
NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.
|
CodeAnt AI finished reviewing your PR. |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
User description
Summary
Behavior-preserving real fixes for all 3 open CodeQL/code-scanning alerts, conversion of the 2 prior
py/test-equals-nonedismissals into a real code fix, and a starter unit-test suite for the desktop (Tauri) Rust crate (which previously had zero tests). No alert was dismissed; no security state was touched.CodeQL real fixes (no dismissals)
py/test-equals-nonepublish_api.py:206,227—== None # noqa: E711→.is_(None)(SQLAlchemy/SQLModel idiom; compiles to SQLIS NULL, not flagged). The lingering# noqa: E711is removed since it would otherwise be an unused suppression. The twofalse positivedismissals become a real code fix and resolve as fixed on the next scan.py/empty-exceptapi.py:1675— bareexcept Exception: passon the best-effort Celeryrevoke→logger.warning(..., exc_info=True)+ explanatory comment. Errors are still swallowed (the run/steps are cancelled regardless), so request behavior is unchanged.py/unused-importcheck_visual_zero.py:6— remove unusedosimport.py/unused-local-variabletest_project_collaboration.py:38— drop the unusedcollaboratorbinding; keep the_register(...)call for its registration side effect.Rust desktop crate (
apps/desktop/src-tauri)find_compose_file_from(start)andcompose_up_args(build)so the logic is unit-testable without depending on the process cwd.#[cfg(test)]suite (13 tests) coveringformat_output(all stdout/stderr branches incl. trailing-newline handling),docker_compose_unsupported(each match arm + negatives + case-insensitivity),compose_up_args, andfind_compose_file_from(found / not-found). Usesstdonly — no new dependencies. The#[tauri::command]wrappers and docker-invoking paths are intentionally left uncovered (require a live Tauri context / docker daemon).Verification
ruff check(all passed) +python -m compileallon the 4 changed files.cargo fmt --check(clean),cargo clippy --lib --tests(no warnings),cargo test --lib→ 13 passed, 0 failed.Out of scope (left for other PRs)
Inspirations & Former Attempts/(directory removed frommainin PR fix: harden security workflows and sanitize media/url inputs #68; no longer present) and per-site security dismissals (path-injection/SSRF/etc.) requiring human judgment.apps/desktop/src-tauri/src/**is currently listed undersonar.coverage.exclusions, so these new tests do not yet move the Sonar coverage number — un-excluding it (adding Rust coverage to CI and hitting threshold) is a sized follow-up.Test plan
ruff checkon changed Python filescargo test --libinapps/desktop/src-tauriSummary by cubic
Fixes all open CodeQL alerts with real code changes and adds a 13-test Rust suite for the desktop crate. No behavior changes and no dismissals.
Bug Fixes
.is_(None)instead of== Nonein publish queries (SQLAlchemy/SQLModel), converting two prior dismissals into fixes.except: passonCeleryrevoke withlogger.warning(..., exc_info=True).New Features
upargs to enable testing.upargs, and compose file discovery.Written for commit 3d358d5. Summary will update on new commits.
CodeAnt-AI Description
Fix a few scan issues and add coverage for desktop compose behavior
What Changed
docker compose/docker-composefallback handling, output formatting, andcompose upcommand options.Impact
✅ Correctly hidden revoked publish connections✅ Clearer workflow cancellation failures✅ Safer desktop compose command handling💡 Usage Guide
Checking Your Pull Request
Every time you make a pull request, our system automatically looks through it. We check for security issues, mistakes in how you're setting up your infrastructure, and common code problems. We do this to make sure your changes are solid and won't cause any trouble later.
Talking to CodeAnt AI
Got a question or need a hand with something in your pull request? You can easily get in touch with CodeAnt AI right here. Just type the following in a comment on your pull request, and replace "Your question here" with whatever you want to ask:
This lets you have a chat with CodeAnt AI about your pull request, making it easier to understand and improve your code.
Example
Preserve Org Learnings with CodeAnt
You can record team preferences so CodeAnt AI applies them in future reviews. Reply directly to the specific CodeAnt AI suggestion (in the same thread) and replace "Your feedback here" with your input:
This helps CodeAnt AI learn and adapt to your team's coding style and standards.
Example
Retrigger review
Ask CodeAnt AI to review the PR again, by typing:
Check Your Repository Health
To analyze the health of your code repository, visit our dashboard at https://app.codeant.ai. This tool helps you identify potential issues and areas for improvement in your codebase, ensuring your repository maintains high standards of code health.