Skip to content

Conversation

@ESnark
Copy link
Contributor

@ESnark ESnark commented Dec 2, 2025

🐛 Bug-fix PR

Before opening this PR please:

  1. make lint - passes ruff, mypy, pylint
  2. make test - all unit + integration tests green
  3. make coverage - ≥ 90 %
  4. make docker docker-run-ssl or make podman podman-run-ssl
  5. Update relevant documentation.
  6. Tested with sqlite and postgres + redis.
  7. Manual regression no longer fails. Ensure the UI and /version work correctly.

📌 Summary

Bootstrap script fails if DATABASE_URL contains % characters. #1533

🔁 Reproduction Steps

  1. Set DATABASE_URL with a password containing %.
  2. Run the bootstrap script or start the application:
    python3 -m mcpgateway.bootstrap_db or python3 -m mcpgateway.

🐞 Root Cause

Alembic's Config.set_main_option() uses Python's configparser, which interprets % as interpolation syntax and raises InterpolationSyntaxError for URL-encoded characters like %40.

💡 Fix Description

Escape % to %% before passing the URL to configparser.

🧪 Verification

Check Command Status
Lint suite make lint
Unit tests make test
Coverage ≥ 90 % make coverage
Manual regression no longer fails steps / screenshots

📐 MCP Compliance (if relevant)

  • Matches current MCP spec
  • No breaking change to MCP clients

✅ Checklist

  • Code formatted (make black isort pre-commit)
  • No secrets/credentials committed

@ESnark ESnark requested a review from crivetimihai as a code owner December 2, 2025 05:05
@rakdutta rakdutta self-requested a review December 8, 2025 09:10
Copy link
Collaborator

@rakdutta rakdutta left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested SQLite and PostgreSQL with % in DATABASE_URL. Issue (ValueError: invalid interpolation syntax) occurs on main but is resolved in this PR. Ready to merge.

@crivetimihai crivetimihai self-assigned this Dec 12, 2025
ESnark and others added 2 commits December 12, 2025 16:46
Signed-off-by: ESnark <31977180+ESnark@users.noreply.github.com>
Add comprehensive ignore patterns for .venv and uv.lock files
in nested directories, particularly plugins/external/opa/. Updated:
- .gitignore: Added **/.venv and **/uv.lock patterns
- .dockerignore: Added **/.venv and **/uv.lock patterns
- MANIFEST.in: Added prune rules and global-exclude patterns
- plugins/external/opa/.gitignore: Created for local ignores

Signed-off-by: Mihai Criveti <crivetimihai@gmail.com>
@crivetimihai crivetimihai force-pushed the fix/database-url-parser-error branch from 70ee97f to 70a9676 Compare December 12, 2025 17:23
@crivetimihai crivetimihai merged commit 9822650 into IBM:main Dec 12, 2025
44 of 45 checks passed
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.

3 participants