Skip to content

fix: move PROJECT_PATH from os.getenv() to ConfigProvider#666

Open
arnavp27 wants to merge 1 commit intopotpie-ai:mainfrom
arnavp27:fix/move-project-path-to-config-provider
Open

fix: move PROJECT_PATH from os.getenv() to ConfigProvider#666
arnavp27 wants to merge 1 commit intopotpie-ai:mainfrom
arnavp27:fix/move-project-path-to-config-provider

Conversation

@arnavp27
Copy link
Copy Markdown

@arnavp27 arnavp27 commented Feb 28, 2026

Summary

Fixes #638

  • Added get_project_path() static method to ConfigProvider in config_provider.py, following the existing @staticmethod pattern
  • Replaced direct os.getenv("PROJECT_PATH", ...) calls in agents_service.py and search_service.py with ConfigProvider.get_project_path()
  • Removed now-unused import os and from pathlib import Path from both service files

search_service.py had the identical issue (same raw os.getenv call) so it was fixed in the same PR.

Summary by CodeRabbit

  • Refactor
    • Centralized project path resolution logic to improve code maintainability and reduce duplication across services.

Adds ConfigProvider.get_project_path() static method following the
existing @staticmethod pattern, and replaces direct os.getenv() calls
in agents_service.py and search_service.py with the new method.

Closes potpie-ai#638
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Feb 28, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 2f38075 and 5d62fda.

📒 Files selected for processing (3)
  • app/core/config_provider.py
  • app/modules/intelligence/agents/agents_service.py
  • app/modules/search/search_service.py

Walkthrough

The PR centralizes PROJECT_PATH environment variable access by introducing a get_project_path() static method in ConfigProvider and replacing direct os.getenv() calls in AgentsService and SearchService with this centralized method, eliminating inconsistent config access patterns.

Changes

Cohort / File(s) Summary
ConfigProvider Enhancement
app/core/config_provider.py
Added static method get_project_path() that retrieves PROJECT_PATH from environment with default fallback to "projects/" and added Path import from pathlib.
Service Configuration Migration
app/modules/intelligence/agents/agents_service.py, app/modules/search/search_service.py
Replaced direct os.getenv('PROJECT_PATH', 'projects/') calls with ConfigProvider.get_project_path() to consolidate configuration access through the central provider.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐰 A config so scattered, now gathered with care,
ConfigProvider's wisdom is now everywhere!
No more os.getenv in places so far,
One source of truth—a centralized star! ⭐

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.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
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and accurately summarizes the main change: moving PROJECT_PATH configuration from direct os.getenv() calls to centralized ConfigProvider access.
Linked Issues check ✅ Passed The PR fully addresses all coding objectives from issue #638: adding get_project_path() to ConfigProvider, replacing os.getenv() calls in agents_service.py and search_service.py with ConfigProvider calls, and centralizing config management.
Out of Scope Changes check ✅ Passed All changes are directly aligned with issue #638 requirements. The PR appropriately includes fixing search_service.py which had the same pattern, and removes unused imports as cleanup.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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 and usage tips.

@sonarqubecloud
Copy link
Copy Markdown

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.

[Feature] Move PROJECT_PATH from os.getenv() to ConfigProvider

1 participant