Skip to content

fix(deepsource): reconcile repository-wide findings - #197

Merged
YaoYinYing merged 15 commits into
mainfrom
codex/deepsource-core-fixes
Jul 30, 2026
Merged

fix(deepsource): reconcile repository-wide findings#197
YaoYinYing merged 15 commits into
mainfrom
codex/deepsource-core-fixes

Conversation

@YaoYinYing

@YaoYinYing YaoYinYing commented Jul 29, 2026

Copy link
Copy Markdown
Owner

Scope

Repository-wide DeepSource reconciliation for:

  • Bug Risk
  • Anti-pattern
  • Security
  • Performance

The cleanup covers server, desktop, tools, and development scripts. Every
finding is checked against current code; still-valid findings are fixed,
intentional patterns receive narrow documented suppressions, and stale findings
are not changed.

Inventory model

Captured default-branch inventory at
fac8eec56efd2604b72e394182f8e67675e5650b:

  • Bug Risk: 49 occurrences
  • Anti-pattern: 459 occurrences
  • Security: 27 occurrences
  • Performance: 60 occurrences
  • Reconciliation: 595 dashboard occurrences = 595 exported occurrence IDs =
    595 unique occurrence IDs

The export uses the public frontend GraphQL endpoint with a fresh anonymous
CSRF cookie and paginates both issue and occurrence connections. A PR analysis
run remains a changeset regression gate; the default-branch backlog can only be
proved cleared by re-exporting after merge.

Notable fixes

  • remove raw email addresses from admin notification-failure logs
  • validate GREMLIN residue labels and numeric position suffixes independently
  • clear repository-wide PYL-R1705 and PYL-R1724
  • harden package-manager temporary-file access against symlink replacement
  • preserve lazy logging output in standalone package-manager mode
  • stream A3M filtering with a lowercase translation table and one combined file
    context manager
  • fix socket message validation, lifecycle attributes, unused work, eager
    formatting, and other validated DeepSource patterns
  • document the correct public-cookie API and repository/run data model

Local validation

  • server suite excluding Docker integration: 281 passed
  • focused affected repository suite: 137 passed
  • complete fast test phase: 770 passed, 59 skipped
  • repository-wide Pylint R1705,R1724: 10.00/10
  • compileall and git diff --check: passed
  • targeted security and style checks: passed

The serial test phase reaches a pre-existing Qt NSApplication event-loop
stall during duplicate bootstrap; the same scenarios pass in the complete fast
phase.

Remote acceptance

The terminal DeepSource run for 4d438372 reports 16 occurrences, all outside
this PR's requested scope (Style: one PYL-C0202 and fifteen PYL-R1710):

  • Bug Risk: 0
  • Anti-pattern: 0
  • Security: 0
  • Performance: 0
  • DeepSource changeset result: 712 resolved, 16 out-of-scope Style remaining

All CodeRabbit review threads are resolved. After merge, rerun the complete
595-ID default-branch export to close the repository-level invariant on the
default branch.

@coderabbitai

coderabbitai Bot commented Jul 29, 2026

Copy link
Copy Markdown

Review Change Stack

Important

Review skipped

Too many files!

This PR contains 111 files, which is 11 over the limit of 100.

To get a review, narrow the scope:
• coderabbit review --committed # exclude uncommitted changes
• coderabbit review --dir # limit to a subdirectory
• coderabbit review --base # compare against a closer base

Upgrade to a paid plan to raise the limit.

This review couldn't start because sufficient usage credits or metered capacity aren't available. Add credits or update usage-based reviews in the billing tab, then retry.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 680ae0a5-d4fa-462b-aabc-e4c47459f086

📥 Commits

Reviewing files that changed from the base of the PR and between 232111a and ea8a99f.

📒 Files selected for processing (111)
  • .gitignore
  • CHANGELOG.md
  • dev/tools/check_qt_binding_imports.py
  • dev/tools/generate_ui_typing.py
  • docs/dev-guide/codex-deepsource.md
  • docs/dev-guide/testing.md
  • pyproject.toml
  • server/pssm_gremlin_server/config.py
  • server/pssm_gremlin_server/maintenance/tasks/database_backup.py
  • server/pssm_gremlin_server/maintenance/tasks/log_rotation.py
  • server/pssm_gremlin_server/maintenance/tasks/result_cleanup.py
  • server/pssm_gremlin_server/migrate_auth_db.py
  • server/pssm_gremlin_server/ratelimit.py
  • server/pssm_gremlin_server/routes.py
  • server/pssm_gremlin_server/task_runtime.py
  • server/scripts/GREMLIN_TFv1.py
  • server/scripts/fasta_lower_char_rm.py
  • server/scripts/gremlin_labels.py
  • server/scripts/make_paired_MSA_simple.py
  • server/tests/test_admin.py
  • server/tests/test_auth.py
  • server/tests/test_database_backup.py
  • server/tests/test_fasta_lower_char_rm.py
  • server/tests/test_gremlin_labels.py
  • server/tests/test_log_rotation.py
  • server/tests/test_maintenance_manager.py
  • server/tests/test_process_isolation.py
  • server/tests/test_tasks.py
  • src/REvoDesign/Qt/qt_wrapper.py
  • src/REvoDesign/REvoDesign.py
  • src/REvoDesign/__init__.py
  • src/REvoDesign/application/font/font_manager.py
  • src/REvoDesign/application/launching.py
  • src/REvoDesign/application/menu.py
  • src/REvoDesign/basic/abc_singleton.py
  • src/REvoDesign/basic/extensions.py
  • src/REvoDesign/basic/server_monitor.py
  • src/REvoDesign/bootstrap/set_config.py
  • src/REvoDesign/citations/citation_manager.py
  • src/REvoDesign/clients/QtSocketConnector.py
  • src/REvoDesign/clusters/cluster_runner.py
  • src/REvoDesign/clusters/cluster_sequence.py
  • src/REvoDesign/clusters/combine_positions.py
  • src/REvoDesign/clusters/methods/evo.py
  • src/REvoDesign/clusters/score_clusters.py
  • src/REvoDesign/common/multi_mutant_designer.py
  • src/REvoDesign/common/mutant_tree.py
  • src/REvoDesign/common/mutant_visualise.py
  • src/REvoDesign/driver/environ_register.py
  • src/REvoDesign/driver/file_dialog.py
  • src/REvoDesign/driver/group_register.py
  • src/REvoDesign/driver/ui_driver.py
  • src/REvoDesign/editor/monaco/config.py
  • src/REvoDesign/editor/monaco/monaco.py
  • src/REvoDesign/editor/monaco/server.py
  • src/REvoDesign/evaluate/evaluator.py
  • src/REvoDesign/logger/logger.py
  • src/REvoDesign/magician/__init__.py
  • src/REvoDesign/magician/designers/cart_ddg.py
  • src/REvoDesign/magician/designers/colabdesign.py
  • src/REvoDesign/magician/designers/openkinetics/_client.py
  • src/REvoDesign/magician/designers/openkinetics/_scorers.py
  • src/REvoDesign/phylogenetics/evo_mutator.py
  • src/REvoDesign/phylogenetics/gremlin_pytorch.py
  • src/REvoDesign/phylogenetics/gremlin_tools.py
  • src/REvoDesign/phylogenetics/revo_designer.py
  • src/REvoDesign/shortcuts/dialog_hooks.py
  • src/REvoDesign/shortcuts/registry/exports.yaml
  • src/REvoDesign/shortcuts/tools/evolution.py
  • src/REvoDesign/shortcuts/tools/exports.py
  • src/REvoDesign/shortcuts/tools/ligand_converters.py
  • src/REvoDesign/shortcuts/tools/openmm_utils.py
  • src/REvoDesign/shortcuts/tools/represents.py
  • src/REvoDesign/shortcuts/tools/rfdiffusion_tasks.py
  • src/REvoDesign/shortcuts/tools/vina_tools.py
  • src/REvoDesign/shortcuts/utils.py
  • src/REvoDesign/sidechain/mutate_runner/DLPacker.py
  • src/REvoDesign/sidechain/mutate_runner/DLPackerPytorch.py
  • src/REvoDesign/sidechain/mutate_runner/DiffPack.py
  • src/REvoDesign/sidechain/mutate_runner/PIPPack.py
  • src/REvoDesign/sidechain/sidechain_solver.py
  • src/REvoDesign/structure/PocketSearcher.py
  • src/REvoDesign/tools/cgo_utils.py
  • src/REvoDesign/tools/customized_widgets.py
  • src/REvoDesign/tools/download_registry.py
  • src/REvoDesign/tools/measure_utils.py
  • src/REvoDesign/tools/mutant_tools.py
  • src/REvoDesign/tools/package_manager.py
  • src/REvoDesign/tools/pymol_utils.py
  • src/REvoDesign/tools/rfdiffusion_tools.py
  • src/REvoDesign/tools/rosetta_utils.py
  • src/REvoDesign/tools/safe_pickle.py
  • src/REvoDesign/tools/ssl_certificates.py
  • src/REvoDesign/tools/system_tools.py
  • src/REvoDesign/tools/utils.py
  • tests/basic/test_server_monitor.py
  • tests/basic/test_socket_broadcaster.py
  • tests/cases/tabs/test_config.py
  • tests/cases/tabs/test_run_ui.py
  • tests/clusters/test_cluster_methods.py
  • tests/clusters/test_cluster_sequence.py
  • tests/conftest.py
  • tests/dev_tools/test_qt_compat_tools.py
  • tests/driver/test_environ_register.py
  • tests/editor/test_editor_server.py
  • tests/magician/test_openkinetics_scorer.py
  • tests/menu/shortcuts/test_exports.py
  • tests/menu/test_window_pops.py
  • tests/tools/customized_widgets/test_dialog_wrapper_registry.py
  • tests/tools/test_package_manager.py
  • tests/tools/test_package_manager_bootstrap.py

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

📝 Walkthrough

Walkthrough

The PR refactors GREMLIN upload, dashboard, deletion, and admin routes; adds public task-runtime compatibility aliases; adds temporary-path and input validation; simplifies repository control flow; and expands DeepSource workflow documentation, changelog entries, and related tests.

Changes

GREMLIN server cleanup

Layer / File(s) Summary
Task runtime compatibility exports
server/pssm_gremlin_server/task_runtime.py, server/pssm_gremlin_server/pssm_gremlin.py
Adds stable task-runtime aliases and updates compatibility exports to reference them, alongside import and formatting cleanup.
Upload, dashboard, and task deletion flows
server/pssm_gremlin_server/routes.py
Extracts FASTA upload preparation, dashboard status calculation, archive validation, and shared soft deletion into helpers used by the corresponding routes.
Admin user and authentication handling
server/pssm_gremlin_server/routes.py, server/pssm_gremlin_server/auth.py, server/run/restart_pssm_flask.sh, server/tests/test_admin.py
Separates admin update validation and notifications, simplifies authentication and bootstrap checks, and tests failure logging by user ID.
Temporary-path and input validation
src/REvoDesign/tools/package_manager.py, server/scripts/GREMLIN_TFv1.py, tests/tools/test_package_manager.py
Restricts bootstrap-related files to the temporary directory, validates amino-acid labels, and adds rejection tests for unsafe paths.
Repository cleanup and DeepSource workflow
docs/dev-guide/codex-deepsource.md, CHANGELOG.md, server/scripts/*, src/REvoDesign/*
Documents DeepSource data and audit procedures, updates completion tracking, records cleanup findings, and applies control-flow and checker-annotation cleanup across supporting modules.

Estimated code review effort: 4 (Complex) | ~45 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 30.00% 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
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.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title is concise and accurately summarizes the repository-wide DeepSource cleanup effort.
✨ Finishing Touches 💡 2
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🛠️ Fix failing CI checks 💡
  • Fix failing CI checks
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/deepsource-core-fixes

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.

@codacy-production

codacy-production Bot commented Jul 29, 2026

Copy link
Copy Markdown

Not up to standards ⛔

🔴 Issues 5 high · 31 medium · 1 minor

Alerts:
⚠ 37 issues (≤ 0 issues of at least minor severity)

Results:
37 new issues

Category Results
Documentation 1 minor
ErrorProne 5 high
Complexity 31 medium

View in Codacy

🟢 Metrics 54 complexity · -4 duplication

Metric Results
Complexity 54
Duplication -4

View in Codacy

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.

@deepsource-io

deepsource-io Bot commented Jul 29, 2026

Copy link
Copy Markdown

DeepSource Code Review

We reviewed changes in fac8eec...ea8a99f on this pull request. Below is the summary for the review, and you can see the individual issues we found as inline review comments.

See full review on DeepSource ↗

PR Report Card

Overall Grade   Security  

Reliability  

Complexity  

Hygiene  

Code Review Summary

Analyzer Status Updated (UTC) Details
Python Jul 30, 2026 2:28a.m. Review ↗

Important

AI Review is run only on demand for your team. We're only showing results of static analysis review right now. To trigger AI Review, comment @deepsourcebot review on this thread.

@coderabbitai coderabbitai Bot 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.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@server/pssm_gremlin_server/routes.py`:
- Around line 1323-1334: Update _notify_admin_user_update so
notification-failure warnings log the user_id instead of approved_user["email"]
or user["email"], for both approval and rejection paths. Preserve the existing
warning messages and failure conditions while removing raw email addresses from
application logs.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: d710ba47-bb66-4693-97b3-648f5d7b987d

📥 Commits

Reviewing files that changed from the base of the PR and between fac8eec and f45fb1f.

📒 Files selected for processing (7)
  • CHANGELOG.md
  • docs/dev-guide/codex-deepsource.md
  • server/pssm_gremlin_server/auth.py
  • server/pssm_gremlin_server/pssm_gremlin.py
  • server/pssm_gremlin_server/routes.py
  • server/pssm_gremlin_server/task_runtime.py
  • server/run/restart_pssm_flask.sh

Comment thread server/pssm_gremlin_server/routes.py Outdated
@YaoYinYing
YaoYinYing marked this pull request as draft July 29, 2026 08:24
@codecov

codecov Bot commented Jul 29, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 76.20192% with 99 lines in your changes missing coverage. Please review.
✅ Project coverage is 74.03%. Comparing base (fac8eec) to head (ea8a99f).

Files with missing lines Patch % Lines
src/REvoDesign/tools/package_manager.py 66.32% 33 Missing ⚠️
src/REvoDesign/REvoDesign.py 68.00% 8 Missing ⚠️
src/REvoDesign/common/multi_mutant_designer.py 0.00% 7 Missing ⚠️
src/REvoDesign/tools/customized_widgets.py 70.83% 7 Missing ⚠️
src/REvoDesign/clusters/combine_positions.py 44.44% 5 Missing ⚠️
src/REvoDesign/logger/logger.py 25.00% 3 Missing ⚠️
src/REvoDesign/tools/pymol_utils.py 40.00% 3 Missing ⚠️
src/REvoDesign/__init__.py 81.81% 2 Missing ⚠️
src/REvoDesign/application/font/font_manager.py 81.81% 2 Missing ⚠️
src/REvoDesign/driver/ui_driver.py 84.61% 2 Missing ⚠️
... and 22 more
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #197      +/-   ##
==========================================
- Coverage   74.17%   74.03%   -0.14%     
==========================================
  Files         122      122              
  Lines       15592    15675      +83     
==========================================
+ Hits        11565    11605      +40     
- Misses       4027     4070      +43     
Files with missing lines Coverage Δ
src/REvoDesign/Qt/qt_wrapper.py 95.65% <100.00%> (ø)
src/REvoDesign/application/launching.py 95.65% <100.00%> (+0.41%) ⬆️
src/REvoDesign/application/menu.py 96.77% <100.00%> (ø)
src/REvoDesign/basic/abc_singleton.py 100.00% <100.00%> (ø)
src/REvoDesign/bootstrap/set_config.py 83.90% <100.00%> (-2.95%) ⬇️
src/REvoDesign/citations/citation_manager.py 93.82% <100.00%> (ø)
src/REvoDesign/clusters/cluster_runner.py 87.09% <100.00%> (+0.08%) ⬆️
src/REvoDesign/clusters/methods/evo.py 48.29% <100.00%> (+0.25%) ⬆️
src/REvoDesign/driver/environ_register.py 96.42% <100.00%> (ø)
src/REvoDesign/driver/group_register.py 96.72% <100.00%> (ø)
... and 55 more
🚀 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.

@YaoYinYing
YaoYinYing marked this pull request as ready for review July 29, 2026 13:09

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 232111a7e4

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread server/scripts/GREMLIN_TFv1.py Outdated

@coderabbitai coderabbitai Bot 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.

Actionable comments posted: 4

🧹 Nitpick comments (1)
server/scripts/fasta_lower_char_rm.py (1)

20-22: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Avoid shadowing the builtin input.

Rename the parameter and local references to text (or another descriptive name). This removes Ruff A001 and avoids mutating a parameter named after a builtin.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@server/scripts/fasta_lower_char_rm.py` around lines 20 - 22, Rename the
parameter and all local references in the affected function from input to text
(or another descriptive name), while preserving the existing character-removal
behavior and return value.

Source: Linters/SAST tools

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@docs/dev-guide/codex-deepsource.md`:
- Around line 69-92: Update the audit artifact setup around
deepsource_cookie_jar so every temporary file, including the issues HTML,
inventory payload, and inventory JSON, is created inside one private temporary
directory. Replace the fixed /tmp paths with variables derived from that
directory and ensure the directory is cleaned up after the audit completes.

In `@src/REvoDesign/tools/package_manager.py`:
- Around line 518-523: Make temporary bootstrap-file validation and access
atomic: update _resolve_temporary_path and the dependent read/write sites at
src/REvoDesign/tools/package_manager.py lines 518-523, 541-546, and 647-648 to
use directory-relative, file-descriptor-based operations that prevent symlink
replacement between validation and access, or ensure bootstrap files are created
in a private temporary directory unavailable to attackers.

In `@tests/tools/test_package_manager.py`:
- Around line 1081-1087: Move the HMAC-related tests, including
test_pm_compute_hmac_rejects_non_temporary_path and its companion tests, from
test_package_manager.py into a separate concern-specific test module; retain
their existing assertions and setup, and leave test_package_manager.py below the
1000-line limit.
- Around line 97-104: Make both rejected-path tests independent of the checkout
location by monkeypatching the configured temporary root to a deterministic
temporary directory and constructing a sibling destination outside that root.
Update tests/tools/test_package_manager.py lines 97-104 in
test_pm_fetch_gist_file_rejects_non_temporary_destination and lines 1081-1085 in
the HMAC rejection test with the same controlled-root setup; preserve their
existing rejection assertions.

---

Nitpick comments:
In `@server/scripts/fasta_lower_char_rm.py`:
- Around line 20-22: Rename the parameter and all local references in the
affected function from input to text (or another descriptive name), while
preserving the existing character-removal behavior and return value.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 32b392fd-3f19-4e96-8fae-3e67496c24dc

📥 Commits

Reviewing files that changed from the base of the PR and between f45fb1f and 232111a.

📒 Files selected for processing (18)
  • CHANGELOG.md
  • docs/dev-guide/codex-deepsource.md
  • server/pssm_gremlin_server/pssm_gremlin.py
  • server/pssm_gremlin_server/routes.py
  • server/scripts/GREMLIN_TFv1.py
  • server/scripts/fasta_lower_char_rm.py
  • server/tests/test_admin.py
  • src/REvoDesign/clusters/cluster_sequence.py
  • src/REvoDesign/clusters/combine_positions.py
  • src/REvoDesign/logger/logger.py
  • src/REvoDesign/phylogenetics/gremlin_pytorch.py
  • src/REvoDesign/shortcuts/tools/evolution.py
  • src/REvoDesign/shortcuts/tools/ligand_converters.py
  • src/REvoDesign/shortcuts/utils.py
  • src/REvoDesign/tools/customized_widgets.py
  • src/REvoDesign/tools/mutant_tools.py
  • src/REvoDesign/tools/package_manager.py
  • tests/tools/test_package_manager.py
🚧 Files skipped from review as they are similar to previous changes (2)
  • server/pssm_gremlin_server/pssm_gremlin.py
  • server/pssm_gremlin_server/routes.py

Comment thread docs/dev-guide/codex-deepsource.md Outdated
Comment thread src/REvoDesign/tools/package_manager.py
Comment thread tests/tools/test_package_manager.py Outdated
Comment thread tests/tools/test_package_manager.py Outdated
@YaoYinYing YaoYinYing changed the title fix(deepsource): resolve current server findings fix(deepsource): reconcile repository-wide findings Jul 29, 2026
@YaoYinYing
YaoYinYing merged commit acacb95 into main Jul 30, 2026
14 of 15 checks passed
@YaoYinYing
YaoYinYing deleted the codex/deepsource-core-fixes branch July 30, 2026 03:06
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