Skip to content

Conversation

@madhav165
Copy link
Collaborator

@madhav165 madhav165 commented Aug 13, 2025

🐛 Bug-fix PR

📌 Summary

The global passthrough headers were not being stored to the database even if the passthrough was enabled. This adds a function to store them during app initialization.

💡 Fix Description

  1. Add set_global_passthrough_headers function in passthrough_headers to store passthrough_headers to database
  2. Call the function from main.py app lifespan function

🧪 Verification

Check Command Status
Lint suite make lint pass
Unit tests make test pass
Coverage ≥ 90 % make coverage pass

✅ Checklist

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

@madhav165 madhav165 self-assigned this Aug 13, 2025
@madhav165 madhav165 added bug Something isn't working python Python / backend development (FastAPI) labels Aug 13, 2025
@madhav165 madhav165 added this to the Release 0.6.0 milestone Aug 13, 2025
@madhav165 madhav165 marked this pull request as draft August 13, 2025 14:46
@madhav165 madhav165 marked this pull request as ready for review August 13, 2025 16:14
@madhav165 madhav165 requested a review from MohanLaksh August 13, 2025 16:15
Copy link
Collaborator

@MohanLaksh MohanLaksh left a comment

Choose a reason for hiding this comment

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

PR TEST SUMMARY:

make serve - PASS

image

make test - PASS

  • Coverage 80% === 1629 passed, 10 skipped, 60 warnings in 70.13s (0:01:10) ===

make autoflake isort black flake8 - PASS

  • PASS no errors

make pylint - PASS

  • Your code has been rated at 10.00/10 (previous run: 10.00/10, +0.00)

make smoketest - PASS

  • ✅ Smoketest passed!

make doctest - FAIL - NEEDS A FIX

  • 53% Coverage - 1 failed, 468 passed, 6 skipped, 1 warning in 17.66s
  • FAILED mcpgateway/utils/passthrough_headers.py::passthrough_headers.get_passthrough_headers

@madhav165 madhav165 requested a review from MohanLaksh August 13, 2025 17:24
@madhav165
Copy link
Collaborator Author

Fixed failing doctest

Signed-off-by: Madhav Kandukuri <[email protected]>
Signed-off-by: Madhav Kandukuri <[email protected]>
Signed-off-by: Madhav Kandukuri <[email protected]>
Signed-off-by: Madhav Kandukuri <[email protected]>
Signed-off-by: Madhav Kandukuri <[email protected]>
Copy link
Member

@crivetimihai crivetimihai left a comment

Choose a reason for hiding this comment

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

PR #736 Review Complete ✅

This PR adds functionality to persist passthrough headers configuration in the database, allowing global configuration management through the admin API endpoints.

Rebase Status: Successfully rebased on main (dropped 1 duplicate commit)

Test Results:

  • ✅ Doctests: 469 passed, 6 skipped
  • ✅ Unit tests: 1646 passed, 11 skipped (80% coverage)
  • ✅ Linters:
  • flake8: Clean
  • pylint: 10.00/10
  • black/isort: No formatting issues

Key Changes:

  1. Added database persistence for global passthrough headers configuration
  2. New admin API endpoints for managing passthrough headers (GET/PUT /admin/config/passthrough-headers)
  3. Initialization of global config on app startup when header passthrough is enabled
  4. Added PassthroughHeadersError exception class for better error handling
  5. Enhanced tests for the new functionality

The PR is ready to merge - all tests pass and code quality checks are clean.

@crivetimihai crivetimihai merged commit d346cd0 into main Aug 13, 2025
37 checks passed
@crivetimihai crivetimihai deleted the fix-pt-headers branch August 13, 2025 19:05
vk-playground pushed a commit to vk-playground/mcp-context-forge that referenced this pull request Sep 14, 2025
* Store passthrough config in db
Signed-off-by: Madhav Kandukuri <[email protected]>

* Fix failing test
Signed-off-by: Madhav Kandukuri <[email protected]>

* Add tests and fix doctest
Signed-off-by: Madhav Kandukuri <[email protected]>

* Fix test
Signed-off-by: Madhav Kandukuri <[email protected]>

* Fix doctest
Signed-off-by: Madhav Kandukuri <[email protected]>
vk-playground pushed a commit to vk-playground/mcp-context-forge that referenced this pull request Sep 14, 2025
* Store passthrough config in db
Signed-off-by: Madhav Kandukuri <[email protected]>

* Fix failing test
Signed-off-by: Madhav Kandukuri <[email protected]>

* Add tests and fix doctest
Signed-off-by: Madhav Kandukuri <[email protected]>

* Fix test
Signed-off-by: Madhav Kandukuri <[email protected]>

* Fix doctest
Signed-off-by: Madhav Kandukuri <[email protected]>
vk-playground pushed a commit to vk-playground/mcp-context-forge that referenced this pull request Sep 16, 2025
* Store passthrough config in db
Signed-off-by: Madhav Kandukuri <[email protected]>

* Fix failing test
Signed-off-by: Madhav Kandukuri <[email protected]>

* Add tests and fix doctest
Signed-off-by: Madhav Kandukuri <[email protected]>

* Fix test
Signed-off-by: Madhav Kandukuri <[email protected]>

* Fix doctest
Signed-off-by: Madhav Kandukuri <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working python Python / backend development (FastAPI)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants