-
Notifications
You must be signed in to change notification settings - Fork 0
**Actionable comments posted: 7** #59
Description
Actionable comments posted: 7
🔭 Outside diff range comments (2)
server/python_backend/performance_monitor.py (1)
448-478:⚠️ Potential issueDecorator factory should be synchronous – current signature breaks usage
Declaring
async def track_function_performance()forces callers toawaitthe decorator itself, which is not how decorators are normally consumed (@monitor.track_function_performance("foo")).
This will raiseTypeError: object NoneType can’t be used in ‘await’ expressionor silently leave the coroutine un-awaited.- async def track_function_performance(self, func_name: str): + def track_function_performance(self, func_name: str):No other awaits exist in this factory, so making it synchronous is safe.
launch.py (1)
310-323: 🛠️ Refactor suggestion
stage_requirements_file_pathmay be referenced before assignmentIf the relevant
requirements-*.txtfile is missing, the variable is never created yet line 322 still reads it, raisingUnboundLocalError.- stage_requirements_file = None + stage_requirements_file_path: str | None = Noneand keep using that single variable afterwards.
🧰 Tools
🪛 Ruff (0.11.9)
313-313: Local variable
dev_req_pathis assigned to but never usedRemove assignment to unused variable
dev_req_path(F841)
🪛 Pylint (3.3.7)
[error] 322-322: Using variable 'stage_requirements_file_path' before assignment
(E0601)
♻️ Duplicate comments (1)
tests/test_action_item_extractor.py (1)
121-128: NameError riskLines 125/144 still instantiate
ActionItemExtractor()even though the import is commented out – this will raiseNameError. Fix automatically once the main import is restored or guard withHAS_NLTK.🧰 Tools
🪛 Ruff (0.11.9)
125-125: Undefined name
ActionItemExtractor(F821)
🪛 Pylint (3.3.7)
[error] 125-125: Undefined variable 'ActionItemExtractor'
(E0602)
🧹 Nitpick comments (5)
server/python_backend/performance_monitor.py (1)
14-16: Remove unused import and redundantdatetimere-import
fieldis not referenced anywhere and Ruff rightfully flags it.
The secondfrom datetime import datetimeimmediately shadows the first import (line 9) – dead code & noise.-from dataclasses import dataclass, field, asdict # Added dataclass and field -from datetime import datetime # Ensure datetime is directly available +from dataclasses import dataclass, asdict🧰 Tools
🪛 Ruff (0.11.9)
14-14:
dataclasses.fieldimported but unusedRemove unused import:
dataclasses.field(F401)
15-15: Redefinition of unused
datetimefrom line 9Remove definition:
datetime(F811)
extensions/example/example.py (1)
11-11: Remove unused typing imports
List,Optional, andTupleare imported but never used; Ruff already flagged them. Tiny cleanup:-from typing import Dict, Any, List, Optional, Tuple +from typing import Dict, Any🧰 Tools
🪛 Ruff (0.11.9)
11-11:
typing.Listimported but unusedRemove unused import
(F401)
11-11:
typing.Optionalimported but unusedRemove unused import
(F401)
11-11:
typing.Tupleimported but unusedRemove unused import
(F401)
deployment/models.py (1)
174-210: Consider early-validatingplaceholder_diris actually a directory
placeholder_dir.exists()may returnTruewhen a file (not dir) with that name already exists, causingmkdirto later fail and the method to silently proceed while everyfile_path.touch()raisesIsADirectoryError.
A quick guard makes the code more resilient:-if not placeholder_dir.exists(): +if placeholder_dir.exists() and not placeholder_dir.is_dir(): + logger.error(f"{placeholder_dir} exists and is not a directory.") + return False +if not placeholder_dir.exists():server/python_backend/ai_engine.py (1)
176-182: Health-check should reflect actual statusSimilarly, the health-check now hard-codes
"status": "unhealthy"while still trying to propagate fields from the mockedresult. Consider returning early with a minimal object to avoid mixed messaging and extra unused keys.launch.py (1)
359-362: Remove pointlessf-stringLine 359 is flagged by Ruff; there are no placeholders.
- logger.info(f"DEBUG: args.skip_models is False. Checking models...") + logger.info("DEBUG: args.skip_models is False. Checking models...")🧰 Tools
🪛 Ruff (0.11.9)
359-359: f-string without any placeholders
Remove extraneous
fprefix(F541)
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (6)
email_cache.dbis excluded by!**/*.dbserver/python_nlp/intent_model.pklis excluded by!**/*.pklserver/python_nlp/sentiment_model.pklis excluded by!**/*.pklserver/python_nlp/topic_model.pklis excluded by!**/*.pklserver/python_nlp/urgency_model.pklis excluded by!**/*.pklsmart_filters.dbis excluded by!**/*.db
📒 Files selected for processing (14)
=2.20.0(1 hunks)deployment/models.py(1 hunks)extensions/example/example.py(2 hunks)launch.py(1 hunks)requirements-dev.txt(1 hunks)requirements_versions.txt(1 hunks)server/python_backend/__init__.py(1 hunks)server/python_backend/ai_engine.py(4 hunks)server/python_backend/main.py(1 hunks)server/python_backend/models.py(15 hunks)server/python_backend/performance_monitor.py(1 hunks)server/python_nlp/action_item_extractor.py(1 hunks)tests/test_action_item_extractor.py(1 hunks)vite.config.ts(1 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (4)
server/python_backend/__init__.py (3)
server/python_nlp/gmail_service.py (1)
GmailAIService(32-590)server/python_backend/ai_engine.py (2)
AdvancedAIEngine(51-262)AIAnalysisResult(18-49)server/python_nlp/smart_filters.py (2)
SmartFilterManager(45-1247)EmailFilter(16-29)
server/python_backend/main.py (1)
server/python_nlp/smart_filters.py (1)
SmartFilterManager(45-1247)
launch.py (1)
deployment/models.py (3)
list_models(94-99)download_default_models(156-172)create_placeholder_nlp_models(174-210)
server/python_backend/ai_engine.py (1)
server/python_nlp/nlp_engine.py (1)
_get_fallback_analysis(840-860)
🪛 Ruff (0.11.9)
server/python_backend/performance_monitor.py
14-14: dataclasses.field imported but unused
Remove unused import: dataclasses.field
(F401)
extensions/example/example.py
11-11: typing.List imported but unused
Remove unused import
(F401)
11-11: typing.Optional imported but unused
Remove unused import
(F401)
11-11: typing.Tuple imported but unused
Remove unused import
(F401)
launch.py
359-359: f-string without any placeholders
Remove extraneous f prefix
(F541)
server/python_backend/ai_engine.py
89-89: Undefined name result_json_str
(F821)
🪛 Pylint (3.3.7)
server/python_backend/ai_engine.py
[error] 89-89: Undefined variable 'result_json_str'
(E0602)
server/python_backend/models.py
[refactor] 226-226: Too few public methods (0/2)
(R0903)
[refactor] 221-221: Too few public methods (0/2)
(R0903)
[refactor] 302-302: Too few public methods (0/2)
(R0903)
[refactor] 296-296: Too few public methods (0/2)
(R0903)
[refactor] 341-341: Too few public methods (0/2)
(R0903)
[refactor] 337-337: Too few public methods (0/2)
(R0903)
🔇 Additional comments (6)
requirements_versions.txt (1)
9-10: Consider bounding the new dependencies to avoid future breaking changesBlindly accepting any future
requests≥ 2.20 andpsutil≥ 5.8 may bite you when v3.0 (or any ABI-breaking release) lands. Pinning an upper bound (e.g.<3) – or at minimum documenting the expected major series – keeps reproducibility and supply-chain reviews simpler.-requests>=2.20.0 -psutil>=5.8.0 +requests>=2.20.0,<3.0 +psutil>=5.8.0,<6.0requirements-dev.txt (1)
7-9: Assess whetheruvicornandfastapiare runtime, not dev, dependenciesIf the application’s production entrypoint is FastAPI served by Uvicorn, these belong in
requirements_versions.txt(orrequirements.txt) so production images/installations pull them in.
Keeping them only in dev requirements risks “works on my machine” surprises during deployment.Please verify packaging intent and relocate if necessary.
server/python_backend/__init__.py (1)
16-18: 👍 Import redirection looks goodThe switch to absolute imports matches the refactor of NLP modules; nothing else to flag here.
extensions/example/example.py (1)
25-32: Great observability improvementThe extra, highly-specific log lines around
NLPEngineimport will make extension-loading issues far easier to diagnose. Nice touch.server/python_backend/models.py (2)
30-34: Switch toPattern[...]or ensure Pydantic v2 is enforced
Field(pattern=…)is only valid on Pydantic v2+.
If your runtime still ships v1 (common in many distros), this will raiseTypeError: __init__() got an unexpected keyword argument 'pattern'.Please either:
- Pin
pydantic>=2.0inrequirements*.txt, or- Revert to
regex=for v1 compatibility.🧰 Tools
🪛 Pylint (3.3.7)
[refactor] 31-31: Too few public methods (0/2)
(R0903)
127-129:validate_by_namereplacesallow_population_by_field_name– version check againSame version-compatibility concern as above. Make sure every consumer environment has Pydantic v2; otherwise parsing will fail.
🧰 Tools
🪛 Pylint (3.3.7)
[refactor] 127-127: Too few public methods (0/2)
(R0903)
Originally posted by @coderabbitai[bot] in #48 (review)