Skip to content

Fix hardcoded paths with environment variables#4

Merged
Redliana merged 1 commit into
mainfrom
fix/cmm-docs-hardcoded-path
Feb 12, 2026
Merged

Fix hardcoded paths with environment variables#4
Redliana merged 1 commit into
mainfrom
fix/cmm-docs-hardcoded-path

Conversation

@Redliana

Copy link
Copy Markdown
Owner

Summary

  • cmm-docs-mcp: Replaced hardcoded /Users/wash198/... absolute path in config.py with CMM_DOCS_DATA_ROOT env var. This was a deployment blocker — the path only worked on one machine.
  • cmm-fine-tune: Replaced brittle Path(__file__).resolve().parents[4] in constants.py with CMM_FINETUNE_DATA_ROOT env var. The parents[4] assumption was incorrect after the monorepo migration.

Both packages gracefully degrade when env vars are unset — paths resolve to empty and the existing code already checks .exists() before accessing files.

Environment variables

Variable Package Points to
CMM_DOCS_DATA_ROOT cmm-docs-mcp Directory containing OSTI_retrieval/, schemas/, USGS_Data/, etc.
CMM_FINETUNE_DATA_ROOT cmm-fine-tune Directory containing API_Scripts/ and fine_tuning/

Verification

  • ruff format: clean
  • ruff lint: clean
  • mypy: 0 errors
  • pytest: 489 passed, 0 failures

Test plan

  • All existing tests pass without env vars set
  • uv run ruff check packages/ passes
  • uv run mypy packages/ passes

🤖 Generated with Claude Code

- cmm-docs-mcp: Replace hardcoded /Users/wash198/... path with
  CMM_DOCS_DATA_ROOT env var for the directory containing OSTI_retrieval,
  schemas, USGS data, etc.
- cmm-fine-tune: Replace brittle parents[4] relative path with
  CMM_FINETUNE_DATA_ROOT env var for the directory containing
  API_Scripts and fine_tuning subdirs.

Both packages now gracefully degrade when env vars are not set (paths
resolve to empty, and code already handles missing files).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@Redliana Redliana merged commit dac65ff into main Feb 12, 2026
0 of 4 checks passed
@Redliana Redliana deleted the fix/cmm-docs-hardcoded-path branch February 12, 2026 19:16
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.

2 participants